:root {
  --brand: #0f766e;
  --brand-dark: #115e59;
  --brand-light: #ccfbf1;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f1f5f9;
  --card: #ffffff;
  --danger: #dc2626;
  --warn: #d97706;
  --ok: #16a34a;
  --radius: 12px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.loading-screen {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px; color: var(--muted);
}

/* ---------- Shell + tabbar ---------- */
.shell { min-height: 100vh; padding-bottom: 72px; }
.topbar {
  display: flex; align-items: center; gap: 10px;
  background: var(--brand); color: #fff;
  padding: calc(env(safe-area-inset-top) + 14px) 16px 14px;
  position: sticky; top: 0; z-index: 20;
}
.topbar .title { font-size: 18px; font-weight: 700; }
.topbar .sub { font-size: 12.5px; opacity: .85; }
.topbar .back { background: rgba(255,255,255,.18); border: 0; color: #fff; font-size: 20px;
  width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center; }

.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  display: flex; background: #fff; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  flex: 1; text-align: center; padding: 8px 4px 10px; text-decoration: none;
  color: var(--muted); font-size: 11px; display: flex; flex-direction: column; gap: 2px;
}
.tabbar a.active { color: var(--brand); font-weight: 700; }
.tabbar .ico { font-size: 21px; }

.wrap { padding: 14px 16px 24px; }

/* ---------- Cards ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; margin-bottom: 12px;
}
.card.tap { cursor: pointer; transition: transform .05s; }
.card.tap:active { transform: scale(.99); }

.acct { display: flex; align-items: center; gap: 12px; }
.acct .body { flex: 1; min-width: 0; }
.acct .name { font-weight: 700; font-size: 15.5px; }
.acct .meta { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.acct .amt { text-align: right; }
.acct .amt .big { font-weight: 700; font-size: 15px; }
.acct .amt .lbl { font-size: 11px; color: var(--muted); }

.pill { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.pill.late { background: #fee2e2; color: #b91c1c; }
.pill.warn { background: #fef3c7; color: #92400e; }
.pill.ok { background: #dcfce7; color: #166534; }
.pill.legal { background: #ede9fe; color: #6d28d9; }

.summary { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.summary .box { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.summary .box .num { font-size: 22px; font-weight: 800; color: var(--brand-dark); }
.summary .box .cap { font-size: 12px; color: var(--muted); }

/* ---------- Buttons + inputs ---------- */
.btn {
  display: block; width: 100%; background: var(--brand); color: #fff; border: 0;
  padding: 13px; border-radius: 10px; font-size: 15px; font-weight: 700; cursor: pointer;
}
.btn:active { background: var(--brand-dark); }
.btn.secondary { background: #fff; color: var(--brand); border: 1.5px solid var(--brand); }
.btn.ghost { background: #eef2f5; color: var(--ink); }
.btn.small { width: auto; padding: 9px 14px; font-size: 13.5px; display: inline-block; }
.btn:disabled { opacity: .55; }

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 16px; background: #fff; color: var(--ink);
}
.search { width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; font-size: 16px; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 24px; background: linear-gradient(160deg, var(--brand) 0%, var(--brand-dark) 100%); }
.login .box { background: #fff; border-radius: 16px; padding: 26px 22px; box-shadow: 0 20px 40px rgba(0,0,0,.2); }
.login h1 { margin: 0 0 3px; font-size: 21px; }
.login .tag { color: var(--muted); font-size: 13px; margin-bottom: 18px; }
.login .logo { text-align: center; margin-bottom: 18px; }
.login .logo img { max-width: 150px; }
.error-msg { background: #fee2e2; color: #b91c1c; padding: 10px 12px; border-radius: 9px; font-size: 13.5px; margin-top: 12px; }

/* ---------- Detail rows ---------- */
.kv { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--muted); }
.kv .v { font-weight: 600; text-align: right; }

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }
.actions a { text-decoration: none; }

.muted { color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 40px 20px; }
.section-title { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 18px 0 8px; }

/* ---------- Modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(15,23,42,.55); z-index: 100; display: flex; align-items: flex-end; }
.modal {
  background: #fff; width: 100%; border-radius: 18px 18px 0 0; padding: 20px 18px calc(env(safe-area-inset-bottom) + 20px);
  max-height: 92vh; overflow-y: auto;
}
.modal h3 { margin: 0 0 4px; }
.method-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.method-btn { padding: 11px 6px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; font-size: 12.5px; font-weight: 600; text-align: center; }
.method-btn.active { border-color: var(--brand); background: var(--brand-light); color: var(--brand-dark); }
.suggest-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.suggest { background: #eef2f5; border: 0; padding: 8px 12px; border-radius: 8px; font-size: 13px; font-weight: 600; }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); background: #0f172a; color: #fff;
  padding: 11px 18px; border-radius: 10px; font-size: 14px; z-index: 200; max-width: 90%; text-align: center; }
.toast.ok { background: #15803d; }
.toast.bad { background: #b91c1c; }

/* ---- Shared UI polish (2026-09-14) — gentle, additive ---- */
* { -webkit-tap-highlight-color: transparent; }
body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
.btn, button { transition: transform .08s ease, filter .15s ease; }
.btn:active, button:active { filter: brightness(.97); transform: scale(.98); }
.list-row, .card, .ticket, .kpi { transition: box-shadow .15s ease, transform .08s ease; }
.list-row:active, .card:active, .ticket:active { transform: scale(.995); }
.list-row, .card, .ticket { box-shadow: 0 1px 3px rgba(15,23,42,.05); }
.kpi { box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.badge, .pill, .tag { letter-spacing: .01em; }
input:focus, select:focus, textarea:focus { outline: none; box-shadow: 0 0 0 3px rgba(37,99,235,.15); border-color: #93c5fd; }
.topbar { box-shadow: 0 1px 0 rgba(15,23,42,.05); }
.showmore-btn { width:100%; margin-top:8px; padding:11px; background:#f1f5f9; color:#334155; border:0; border-radius:10px; font-size:13px; font-weight:700; cursor:pointer; }
