:root {
  --navy: #0b1630;
  --navy-2: #13213f;
  --orange: #f59e0b;
  --orange-deep: #e8890b;
  --green: #2f6b55;
  --green-soft: #e3efe8;
  --red: #c0392b;
  --red-soft: #fde4e1;
  --bg: #f2f5f8;
  --card: #ffffff;
  --line: #e2e8ef;
  --ink: #0f172a;
  --muted: #64748b;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 6px 18px rgba(15, 23, 42, .05);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(110px + var(--safe-b));
}
h1, h2 { margin: 2px 0 10px; font-weight: 500; letter-spacing: -.01em; }
h1 { font-size: 22px; }
h2 { font-size: 19px; }
p { margin: 6px 0; }
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* top bar */
.topbar {
  background: var(--navy);
  color: #fff;
  border-bottom: 4px solid var(--orange);
  padding-top: env(safe-area-inset-top, 0px);
}
.topbar-inner {
  max-width: 960px; margin: 0 auto; padding: 14px 16px;
  display: flex; align-items: center; gap: 12px;
}
.brand-logo { width: 34px; height: 36px; }
.brand { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.brand-title { font-size: 19px; font-weight: 500; }
.version-pill {
  background: var(--navy-2); color: var(--orange); font-weight: 700; font-size: 11px;
  padding: 4px 9px; border-radius: 999px; border: 1px solid #22335a;
}

.eyebrow { display: block; font-size: 10.5px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: var(--green); }
.eyebrow.light { color: #cbd5e1; }
.eyebrow.orange { color: var(--orange); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }

.wrap { max-width: 960px; margin: 0 auto; padding: 16px; }
.view { display: flex; flex-direction: column; gap: 14px; }

.update-bar {
  background: var(--orange); color: var(--navy); font-weight: 600;
  display: flex; justify-content: center; align-items: center; gap: 12px; padding: 8px 16px; font-size: 14px;
}

/* hero */
.hero {
  background: linear-gradient(120deg, #2f6b55, #22513f);
  color: #fff; border-radius: var(--radius); padding: 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  box-shadow: var(--shadow);
}
.hero h1 { margin: 2px 0 0; font-size: 20px; }

/* buttons */
.btn {
  border: 0; border-radius: 12px; padding: 12px 16px; font-weight: 700; font-size: 14px;
  cursor: pointer; min-height: 44px; transition: transform .08s ease, opacity .15s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: progress; }
.btn.dark { background: var(--navy); color: #fff; }
.btn.light { background: #fff; color: var(--navy); }
.btn.outline { background: #fff; color: var(--green); border: 1.5px solid var(--green); }
.btn.ghost { background: transparent; color: var(--green); padding: 8px 10px; min-height: 0; }
.btn.small { padding: 7px 12px; min-height: 0; font-size: 13px; }
.btn.edit { background: var(--green-soft); color: var(--green); }
.btn.del { background: var(--red-soft); color: var(--red); }
.btn.grow { flex: 1; }

.actions-row { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.actions-row .btn { min-width: 150px; }
.stack { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }

/* fields */
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.label { font-size: 10.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #475569; }
input[type=text], input[type=url], input[type=password], input[type=number], input[type=date], input[type=search], select {
  width: 100%; min-height: 46px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 12px; background: #fff; outline: none;
  -webkit-appearance: none; appearance: none;
}
select {
  background-image: linear-gradient(45deg, transparent 50%, #334155 50%), linear-gradient(135deg, #334155 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; font-weight: 600;
}
input:focus, select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(47, 107, 85, .15); }
.search { border-radius: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

.city-manual { display: flex; gap: 8px; align-items: center; }
.city-manual input { flex: 1; }
.hint { color: var(--muted); font-size: 12.5px; min-height: 0; }
.hint.new { color: var(--green); font-weight: 600; }
.hint.match { color: var(--orange-deep); font-weight: 600; }
.form-error { background: var(--red-soft); color: var(--red); padding: 10px 12px; border-radius: 10px; font-weight: 600; }
.invalid { border-color: var(--red) !important; }

/* cards */
.card {
  background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow);
}
.form { display: flex; flex-direction: column; gap: 14px; }
.dark-card { background: var(--navy); color: #fff; }
.dark-card ol { margin: 8px 0 0; padding-left: 18px; color: #cbd5e1; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.legend { display: flex; gap: 10px; font-size: 11.5px; color: var(--muted); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }
.dot.green { background: var(--green); }
.dot.orange { background: var(--orange); }

/* kpis */
.kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.kpi {
  background: #fff; border-radius: 16px; padding: 12px 14px; box-shadow: var(--shadow);
  border-top: 3px solid var(--green); display: flex; flex-direction: column; gap: 4px; min-width: 0;
}
.kpi.accent { border-top-color: var(--orange); }
.kpi strong { font-size: 28px; font-weight: 800; line-height: 1.1; }
.kpi .kpi-text { font-size: 19px; overflow-wrap: anywhere; }
.kpi .kpi-money { font-size: 17px; }
.kpi small { color: var(--muted); font-size: 11.5px; }

/* chart */
.chart {
  display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; align-items: end;
  height: 190px; padding-top: 10px; border-bottom: 1px solid var(--line);
}
.month { display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; gap: 4px; }
.bars { display: flex; gap: 2px; align-items: flex-end; height: calc(100% - 18px); width: 100%; justify-content: center; }
.bar { width: 45%; max-width: 30px; border-radius: 3px 3px 0 0; min-height: 2px; position: relative; }
.bar.a { background: var(--green); }
.bar.p { background: var(--orange); }
.month span { font-size: 10px; color: var(--muted); }

/* ranking */
.rank { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.rank li { display: flex; align-items: center; gap: 12px; background: #f1f4f8; border-radius: 12px; padding: 10px 12px; font-weight: 700; }
.rank .n { width: 24px; height: 24px; border-radius: 7px; background: var(--navy); color: #fff; display: grid; place-items: center; font-size: 12px; }
.rank .c { flex: 1; }
.rank .v { color: var(--green); }

/* schedule cards */
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sched {
  background: #fff; border-radius: 16px; padding: 14px; box-shadow: var(--shadow);
  border-left: 4px solid var(--green); display: flex; flex-direction: column; gap: 4px;
}
.sched.st-cancelled, .sched.st-reschedule { border-left-color: #94a3b8; }
.sched.st-hold, .sched.st-inquiry { border-left-color: var(--orange); }
.sched-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.sched-date { font-size: 12px; font-weight: 800; color: var(--green); }
.badges { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.badge { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; padding: 3px 8px; border-radius: 999px; background: #eef2f6; color: #475569; }
.badge.ok { background: var(--green-soft); color: var(--green); }
.badge.warn { background: #fff1d6; color: #9a5b00; }
.sched h3 { margin: 4px 0 2px; font-size: 17px; font-weight: 500; }
.sched .meta { font-size: 12.5px; color: var(--muted); }
.sched .band { font-weight: 700; font-size: 13px; }
.sched .row-actions { display: flex; gap: 8px; margin-top: 8px; }
.sched .row-actions .btn { flex: 1; min-height: 38px; padding: 8px; }
.sched .row-actions .btn.del { flex: 0 0 34%; }
.empty { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 30px 10px; background: #fff; border-radius: 16px; }

/* tab bar */
.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(14px + var(--safe-b));
  background: var(--navy); border-radius: 18px; padding: 6px; display: flex; gap: 4px;
  box-shadow: 0 10px 30px rgba(11, 22, 48, .35); width: min(520px, calc(100% - 24px)); z-index: 20;
}
.tabbar button {
  flex: 1; border: 0; background: transparent; color: #cbd5e1; border-radius: 13px; padding: 8px 4px;
  display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 700; cursor: pointer;
}
.tabbar button span { font-size: 15px; line-height: 1; }
.tabbar button.active { background: #fff; color: var(--navy); }

/* toast */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(96px + var(--safe-b));
  background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 12px; font-weight: 600; font-size: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .25); z-index: 30; max-width: calc(100% - 32px);
}
.toast.error { background: var(--red); }

.changelog summary { cursor: pointer; color: var(--green); font-weight: 700; margin-top: 6px; }

@media (max-width: 760px) {
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpis .kpi:last-child { grid-column: 1 / -1; }
  .cards { grid-template-columns: 1fr; }
  .chart { gap: 3px; height: 160px; }
  .month span { font-size: 9px; }
  .actions-row .btn { flex: 1; min-width: 0; }
}
@media (max-width: 420px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-3 .field:last-child { grid-column: 1 / -1; }
  .hero { flex-direction: column; align-items: flex-start; }
}

/* print / PDF */
.print-only { display: none; }
@media print {
  @page { size: A4 portrait; margin: 14mm; }
  body { background: #fff; padding: 0; font-size: 11px; }
  .topbar, .wrap, .tabbar, .toast, .update-bar { display: none !important; }
  .print-only { display: block !important; }
  .print-head { display: flex; align-items: center; gap: 10px; border-bottom: 3px solid var(--orange); padding-bottom: 8px; margin-bottom: 10px; }
  .print-head img { width: 26px; height: 28px; }
  .print-head h1 { font-size: 16px; margin: 0; }
  .print-head p { margin: 0; color: #475569; }
  .print-table { width: 100%; border-collapse: collapse; }
  .print-table th { background: var(--navy) !important; color: #fff !important; text-align: left; padding: 6px; font-size: 10px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .print-table td { border-bottom: 1px solid #e2e8f0; padding: 5px 6px; vertical-align: top; }
  .print-table tr { break-inside: avoid; }
  .print-foot { margin-top: 10px; color: #64748b; font-size: 9.5px; }
}

/* total manggung (v1.0.3) */
.total-big { text-align: right; line-height: 1; }
.total-big strong { display: block; font-size: 40px; font-weight: 800; color: var(--navy); }
.total-big small { color: var(--muted); font-size: 12px; font-weight: 700; }
.status-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 12px; }
.stat { background: #f1f4f8; border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.stat .s-label { font-size: 11px; font-weight: 800; color: #475569; text-transform: uppercase; letter-spacing: .04em; }
.stat .s-val { font-size: 22px; font-weight: 800; }
.stat .s-pct { font-size: 11px; color: var(--muted); }
.stat .meter { height: 5px; background: #e2e8f0; border-radius: 99px; overflow: hidden; }
.stat .meter i { display: block; height: 100%; border-radius: 99px; }
.eyebrow.sub { margin-top: 14px; }
.band-list { list-style: none; padding: 0; margin: 6px 0 4px; display: flex; flex-direction: column; gap: 6px; }
.band-list li { display: flex; justify-content: space-between; background: #f1f4f8; border-radius: 10px; padding: 8px 12px; font-weight: 700; font-size: 14px; }
.band-list li span:last-child { color: var(--green); }
@media (max-width: 760px) {
  .status-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 420px) {
  .status-grid { grid-template-columns: 1fr 1fr; }
  .total-big strong { font-size: 34px; }
}
@media print { .print-summary { margin: 0 0 8px; font-weight: 600; } }
