:root {
  --ink: #072b47;
  --ink-soft: #35526a;
  --page: #f4f8fa;
  --white: #ffffff;
  --teal: #103f3a;
  --teal-2: #0d5a4e;
  --lime: #dce843;
  --lime-soft: #f3f7dc;
  --success: #11b981;
  --success-soft: #e9fbf4;
  --success-line: #8be5c2;
  --warning: #f4b51d;
  --warning-soft: #fff8df;
  --warning-line: #f6d56d;
  --danger: #f45b72;
  --danger-soft: #fff0f3;
  --danger-line: #ff9bad;
  --neutral: #cfd8e1;
  --line: #d9e4eb;
  --shadow: 0 2px 8px rgba(26, 59, 74, 0.08);
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  font-family: Inter, "Segoe UI", Arial, Helvetica, sans-serif;
  background: var(--page);
  color: var(--ink);
}

button, input { font: inherit; }

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 75% -15%, rgba(220,232,67,.12), transparent 26%),
    var(--page);
}

.topbar {
  min-height: 82px;
  padding: 12px 18px;
  background: var(--teal);
  color: white;
  display: grid;
  grid-template-columns: 135px minmax(0,1fr) auto;
  align-items: center;
  gap: 22px;
  box-shadow: 0 2px 7px rgba(0,0,0,.12);
}

.brand-block {
  height: 56px;
  border: 1px solid rgba(220,232,67,.5);
  border-radius: 8px;
  padding: 6px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.02;
  white-space: nowrap;
  color: #eef4d1;
}

.brand-block span { font-size: 8px; font-weight: 700; letter-spacing: .04em; }
.brand-block strong { color: var(--lime); font-size: 15px; line-height: 1.1; }

.page-title {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.title-icon {
  flex: 0 0 42px;
  height: 42px;
  border-radius: 9px;
  background: rgba(220,232,67,.18);
  display: grid;
  place-items: center;
}

.title-icon svg { width: 27px; fill: var(--lime); }

.page-title h1 {
  margin: 0;
  color: white;
  font-size: clamp(21px, 2.4vw, 31px);
  line-height: .98;
  letter-spacing: -0.045em;
}

.page-title p {
  margin: 7px 0 0 16px;
  font-size: 12px;
  color: var(--lime);
  font-weight: 800;
  letter-spacing: .02em;
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: flex-end;
}

.region-pill,
.online-pill {
  height: 34px;
  border-radius: 9px;
  border: 1px solid rgba(255,255,255,.12);
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 700;
  background: rgba(0,0,0,.13);
  white-space: nowrap;
}

.region-pill svg { width: 16px; fill: var(--lime); }
.online-pill { color: #2ee39f; border-color: rgba(46,227,159,.38); background: rgba(7,96,72,.35); }
.online-dot { width: 7px; height: 7px; border-radius: 50%; background: #2ee39f; box-shadow: 0 0 0 3px rgba(46,227,159,.08); }

.content {
  position: relative;
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 28px 28px 34px;
  flex: 1;
}

.summary-panel {
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: white;
  border: 1px solid #d8e1e7;
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 16px 20px;
}

.summary-title { display: flex; align-items: center; gap: 13px; min-width: 0; }
.summary-mark { width: 11px; height: 39px; border-radius: 7px; background: var(--teal-2); flex: 0 0 auto; }
.summary-title h2 { margin: 0; font-size: clamp(16px, 1.5vw, 21px); letter-spacing: -.035em; }
.summary-title p { margin: 3px 0 0; color: #657d91; font-size: 11px; }

.legend { display: flex; gap: 13px; flex-wrap: wrap; justify-content: flex-end; }
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 12px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}
.legend-item i { width: 10px; height: 10px; border-radius: 50%; }
.legend-success { color: #058a61; background: var(--success-soft); border: 1px solid var(--success-line); }
.legend-success i { background: var(--success); }
.legend-warning { color: #c47900; background: var(--warning-soft); border: 1px solid var(--warning-line); }
.legend-warning i { background: var(--warning); }
.legend-danger { color: #d92b4d; background: var(--danger-soft); border: 1px solid var(--danger-line); }
.legend-danger i { background: var(--danger); }

.save-banner {
  margin: 12px 4px -2px auto;
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  color: #1b7960;
  font-size: 11px;
  font-weight: 750;
  transition: color .2s ease;
}
.save-banner.saving { color: #ba7800; }
.save-banner.error { color: #d12b49; }
.save-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.save-banner.saving .save-dot { animation: pulse 1s infinite; }
@keyframes pulse { 50% { transform: scale(1.45); opacity: .4; } }

.cards-grid {
  margin-top: 17px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 18px;
}

.indicator-card {
  min-width: 0;
  background: white;
  border: 1.5px solid var(--success-line);
  border-radius: 14px;
  box-shadow: 0 2px 6px rgba(24,61,73,.035);
  padding: 17px 18px 14px;
  transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}

.indicator-card.warning { border-color: var(--warning-line); }
.indicator-card.danger { border-color: var(--danger-line); }
.indicator-card.pending { border-color: var(--warning-line); }
.indicator-card.saving { box-shadow: 0 0 0 3px rgba(244,181,29,.08); }

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  min-height: 48px;
}

.card-heading-wrap { display: flex; gap: 12px; min-width: 0; align-items: flex-start; }
.card-number {
  flex: 0 0 41px;
  height: 37px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--lime-soft);
  color: #173b42;
  font-size: 14px;
  font-weight: 900;
}
.indicator-card.danger .card-number { background: #ffe9ee; color: #c82b48; }
.indicator-card.pending .card-number { background: #fff7dc; color: #9e7100; }

.card-heading { min-width: 0; padding-top: 4px; }
.card-heading h3 { margin: 0; font-size: 17px; line-height: 1.05; letter-spacing: -.025em; }
.card-heading p { margin: 4px 0 0; color: #8a9bab; font-size: 8.5px; line-height: 1.15; }

.status-icon {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--success);
  position: relative;
}
.status-icon::before {
  content: "";
  width: 13px;
  height: 7px;
  border-left: 3px solid white;
  border-bottom: 3px solid white;
  transform: rotate(-45deg);
  position: absolute;
  left: 10px;
  top: 11px;
}
.indicator-card.pending .status-icon { background: var(--warning); }
.indicator-card.pending .status-icon::before { width: 12px; height: 12px; border: 2px solid #7d5700; border-radius: 50%; left: 10px; top: 10px; transform: none; }
.indicator-card.pending .status-icon::after { content: ""; position: absolute; left: 17px; top: 13px; width: 2px; height: 7px; background: #7d5700; box-shadow: 3px 6px 0 -0.5px #7d5700; transform-origin: bottom; }
.indicator-card.danger .status-icon { background: var(--danger); }
.indicator-card.danger .status-icon::before { width: 13px; height: 13px; border: 2px solid white; border-radius: 50%; left: 9px; top: 9px; transform: none; }
.indicator-card.danger .status-icon::after { content: "!"; color: white; position: absolute; font-size: 13px; font-weight: 900; left: 15px; top: 8px; }

.metric-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.metric-box {
  min-width: 0;
  min-height: 70px;
  border-radius: 9px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 10px;
}
.metric-target { background: #f6f8dc; border: 1px solid #d8dd89; }
.metric-current { background: var(--success-soft); border: 1px solid var(--success-line); cursor: text; }
.indicator-card.pending .metric-current { background: var(--warning-soft); border-color: var(--warning-line); }
.indicator-card.danger .metric-current { background: var(--danger-soft); border-color: var(--danger-line); }
.metric-label { font-size: 9px; font-weight: 800; color: #4f6d70; letter-spacing: .01em; }
.metric-target strong { margin-top: 4px; font-size: 22px; color: #052b39; }

.current-input-wrap { display: flex; align-items: baseline; justify-content: center; width: 100%; margin-top: 2px; }
.current-input {
  min-width: 0;
  width: 76px;
  padding: 0;
  text-align: right;
  border: 0;
  outline: 0;
  background: transparent;
  color: #00906b;
  font-size: 23px;
  font-weight: 900;
  line-height: 1.1;
}
.current-input:focus-visible { box-shadow: 0 2px 0 0 currentColor; }
.indicator-card.pending .current-input { color: #9a7000; }
.indicator-card.danger .current-input { color: #ef3152; }
.current-input::placeholder { color: #9ba7b4; opacity: 1; }
.unit-suffix { font-size: 21px; line-height: 1; font-weight: 900; color: inherit; }
.indicator-card .unit-suffix { color: #00906b; }
.indicator-card.pending .unit-suffix { color: #9a7000; }
.indicator-card.danger .unit-suffix { color: #ef3152; }

.progress-track { height: 12px; margin-top: 15px; background: #e2e8ed; border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--success); border-radius: inherit; transition: width .45s ease; }
.indicator-card.pending .progress-fill { background: var(--warning); }
.indicator-card.danger .progress-fill { background: var(--danger); }

.card-bottom { margin-top: 8px; display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 22px; }
.difference-text { min-width: 0; color: #0a9470; font-size: 10px; font-weight: 800; }
.indicator-card.pending .difference-text { color: #c27a00; }
.indicator-card.danger .difference-text { color: #e23250; }
.status-chip { flex: 0 0 auto; border-radius: 999px; padding: 4px 8px; background: var(--success-soft); color: #079467; font-size: 8px; font-weight: 900; text-transform: uppercase; }
.indicator-card.pending .status-chip { background: #fff0bd; color: #a76a00; }
.indicator-card.danger .status-chip { background: #ffe5eb; color: #de2e4c; }

.footer {
  min-height: 50px;
  background: white;
  border-top: 1px solid #dfe8ed;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 18px;
  color: #678094;
  font-size: 10px;
}
.footer strong { color: var(--ink); }
.footer-right { display: flex; align-items: center; gap: 12px; }
.sep { margin: 0 8px; color: #a8b6c0; }
.sync { color: #0d9a70; font-weight: 800; }
.sync i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--success); margin-right: 5px; }

body.view-mode .metric-current { cursor: default; }
body.view-mode .current-input { pointer-events: none; }
body.view-mode .save-banner { display: none; }

@media (max-width: 1300px) {
  .cards-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
}

@media (max-width: 1050px) {
  .topbar { grid-template-columns: 110px minmax(0,1fr); }
  .topbar-meta { grid-column: 1 / -1; justify-content: flex-end; margin-top: -4px; }
  .cards-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .summary-panel { align-items: flex-start; flex-direction: column; }
  .legend { justify-content: flex-start; }
}

@media (max-width: 680px) {
  .topbar { display: flex; align-items: flex-start; flex-wrap: wrap; padding: 12px; gap: 13px; }
  .brand-block { display: none; }
  .page-title { flex: 1 1 100%; }
  .page-title p { margin-left: 0; }
  .topbar-meta { width: 100%; justify-content: flex-start; flex-wrap: wrap; }
  .content { padding: 16px 12px 24px; }
  .summary-panel { min-height: auto; padding: 14px; }
  .legend { gap: 7px; }
  .legend-item { height: 27px; font-size: 9px; padding: 0 9px; }
  .cards-grid { grid-template-columns: 1fr; gap: 14px; }
  .indicator-card { padding: 14px; }
  .metric-row { gap: 9px; }
  .footer { align-items: flex-start; flex-direction: column; padding: 12px; }
  .footer-right { flex-wrap: wrap; }
}
