/* OOVY Console. Light, white + cobalt like the store. Status colours are semantic only:
   blue = to deliver, red = not working, yellow = renew soon, green = active, grey = ended.
   System font on purpose: native on every phone, zero download, tabular numbers for money and dates. */
:root {
  --ink: #0A1B3A; --ink-2: #4F5E7B; --ink-3: #7B88A3;
  --paper: #FFFFFF; --mist: #F4F7FC; --line: #DDE4F0; --line-2: #EAF0F8;
  --cobalt: #2345D3; --cobalt-600: #1A37B0; --cobalt-soft: #ECF0FD; --aqua: #22C0EA;
  --deliver: #2345D3; --deliver-bg: #ECF0FD;
  --problem: #C42B2B; --problem-bg: #FDECEC;
  --renew: #A86200; --renew-bg: #FFF4D6; --renew-dot: #F2A900;
  --active: #0E7C5A; --active-bg: #E3F6EE; --active-dot: #17B26A;
  --expired: #6B7A99; --expired-bg: #F0F3F8;
  --r-lg: 22px; --r-md: 16px; --r-sm: 12px; --r-pill: 999px;
  --shadow-1: 0 1px 2px rgba(10, 27, 58, .05), 0 1px 1px rgba(10, 27, 58, .03);
  --shadow-2: 0 12px 32px -14px rgba(35, 69, 211, .28), 0 2px 6px rgba(10, 27, 58, .05);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --nav-h: 68px;
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--mist); color: var(--ink); font: 16px/1.45 var(--font); -webkit-text-size-adjust: 100%; }
body { min-height: 100dvh; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--cobalt); }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-2); }
.small { font-size: 14px; }
.tiny { font-size: 12.5px; color: var(--ink-3); }
.hidden { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- shell ---------- */
.app { max-width: 760px; margin: 0 auto; padding: 0 16px calc(var(--nav-h) + 28px + env(safe-area-inset-bottom)); }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; margin: 0 -16px; padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  background: rgba(244, 247, 252, .86); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); }
.topbar h1 { flex: 1; margin: 0; font-size: 22px; letter-spacing: -.02em; line-height: 1.15; }
.topbar .sub { display: block; font-size: 13px; font-weight: 500; color: var(--ink-3); letter-spacing: 0; }
.logo { width: 34px; height: 34px; flex: none; border-radius: 10px; box-shadow: var(--shadow-1); }
.icon-btn { display: grid; place-items: center; width: 44px; height: 44px; flex: none; border: 1px solid var(--line); border-radius: 50%; background: var(--paper); cursor: pointer; box-shadow: var(--shadow-1); }
.icon-btn:active { transform: scale(.95); }
.icon-btn svg { width: 20px; height: 20px; }

.nav { position: fixed; inset: auto 0 0 0; z-index: 10; display: flex; justify-content: center; padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, .94); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top: 1px solid var(--line-2); }
.nav__in { display: grid; grid-template-columns: repeat(4, 1fr); width: 100%; max-width: 520px; }
.nav a { position: relative; display: grid; justify-items: center; gap: 3px; padding: 6px 4px; border-radius: var(--r-sm); color: var(--ink-3); font-size: 12px; font-weight: 600; text-decoration: none; }
.nav a svg { width: 24px; height: 24px; }
.nav a[aria-current="page"] { color: var(--cobalt); }
.nav a[aria-current="page"]::before { content: ""; position: absolute; top: -9px; width: 26px; height: 3px; border-radius: 0 0 3px 3px; background: var(--cobalt); }
.nav .badge { position: absolute; top: 2px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--r-pill); background: var(--problem); color: #fff; font-size: 11px; line-height: 18px; text-align: center; }

/* ---------- HUD ---------- */
.hero { position: relative; overflow: hidden; margin-top: 4px; padding: 20px 20px 18px; border-radius: var(--r-lg); background: var(--cobalt); color: #fff; box-shadow: var(--shadow-2); }
.hero::after { content: ""; position: absolute; right: -40px; top: -60px; width: 220px; height: 220px; border: 26px solid rgba(255, 255, 255, .08); border-radius: 50%; }
.hero__label { font-size: 13px; font-weight: 600; letter-spacing: .02em; opacity: .8; }
.hero__big { margin: 2px 0 10px; font-size: 40px; font-weight: 750; letter-spacing: -.03em; line-height: 1.05; }
.hero__row { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 14px; }
.hero__row b { font-weight: 700; }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 16px 0 6px; }
.tile { position: relative; display: block; min-height: 108px; padding: 14px 14px 12px; border: 1px solid var(--line-2); border-radius: var(--r-md); background: var(--paper); color: var(--ink); text-decoration: none; box-shadow: var(--shadow-1); transition: transform .18s var(--ease), box-shadow .18s; }
.tile:active { transform: scale(.98); }
.tile__n { display: block; margin-top: 8px; font-size: 38px; font-weight: 750; letter-spacing: -.03em; line-height: 1; }
.tile__t { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 650; }
.tile__h { display: block; margin-top: 6px; font-size: 12.5px; color: var(--ink-3); }
.tile--deliver .tile__n { color: var(--deliver); } .tile--problem .tile__n { color: var(--problem); }
.tile--renew .tile__n { color: var(--renew); } .tile--active .tile__n { color: var(--active); }
.tile.is-hot { border-color: transparent; }
.tile--problem.is-hot { background: var(--problem-bg); } .tile--deliver.is-hot { background: var(--deliver-bg); } .tile--renew.is-hot { background: var(--renew-bg); }

/* ---------- status ---------- */
.dot { width: 10px; height: 10px; flex: none; border-radius: 50%; background: var(--expired); }
.dot--deliver { background: var(--deliver); box-shadow: 0 0 0 4px var(--deliver-bg); }
.dot--problem { background: var(--problem); box-shadow: 0 0 0 4px var(--problem-bg); animation: pulse 1.6s ease-in-out infinite; }
.dot--renew { background: var(--renew-dot); box-shadow: 0 0 0 4px var(--renew-bg); }
.dot--active { background: var(--active-dot); box-shadow: 0 0 0 4px var(--active-bg); }
.dot--expired { background: #A9B4C8; }
.tile .dot--problem { animation: none; } /* only pulse on a real customer card, not on the counter */
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(196, 43, 43, .12); } }
.pill { display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 11px 0 9px; border-radius: var(--r-pill); font-size: 13px; font-weight: 700; white-space: nowrap; }
.pill--deliver { background: var(--deliver-bg); color: var(--deliver); } .pill--problem { background: var(--problem-bg); color: var(--problem); }
.pill--renew { background: var(--renew-bg); color: var(--renew); } .pill--active { background: var(--active-bg); color: var(--active); }
.pill--expired { background: var(--expired-bg); color: var(--expired); }

/* ---------- lists ---------- */
.section-t { display: flex; align-items: baseline; justify-content: space-between; margin: 24px 2px 10px; font-size: 17px; font-weight: 750; letter-spacing: -.01em; }
.section-t a { font-size: 14px; font-weight: 600; text-decoration: none; }
.cards { display: grid; gap: 10px; }
.card { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 4px 12px; padding: 14px; border: 1px solid var(--line-2); border-radius: var(--r-md);
  background: var(--paper); color: var(--ink); text-decoration: none; box-shadow: var(--shadow-1); transition: transform .15s var(--ease); }
.card:active { transform: scale(.985); background: #FBFCFF; }
.card__flag { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: var(--mist); font-size: 24px; grid-row: span 2; }
.card__name { overflow: hidden; font-weight: 700; white-space: nowrap; text-overflow: ellipsis; }
.card__meta { overflow: hidden; color: var(--ink-2); font-size: 13.5px; white-space: nowrap; text-overflow: ellipsis; }
.card__side { display: grid; justify-items: end; gap: 4px; grid-row: span 2; }
.card--problem { border-left: 4px solid var(--problem); } .card--deliver { border-left: 4px solid var(--deliver); }
.card--renew { border-left: 4px solid var(--renew-dot); } .card--active { border-left: 4px solid var(--active-dot); } .card--expired { border-left: 4px solid #C9D2E1; opacity: .8; }
.empty { padding: 28px 18px; border: 1px dashed var(--line); border-radius: var(--r-md); background: var(--paper); color: var(--ink-2); text-align: center; }

.search { position: relative; margin: 6px 0 10px; }
.search input { width: 100%; height: 50px; padding: 0 16px 0 46px; border: 1px solid var(--line); border-radius: var(--r-pill); background: var(--paper); font-size: 16px; box-shadow: var(--shadow-1); }
.search svg { position: absolute; left: 16px; top: 15px; width: 20px; height: 20px; color: var(--ink-3); }
.chips { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 12px; padding: 2px 16px 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; text-decoration: none; color: var(--ink); display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--r-pill); background: var(--paper); font-size: 14px; font-weight: 650; cursor: pointer; }
.chip[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: #fff; }
.chip .n { color: var(--ink-3); font-weight: 600; } .chip[aria-pressed="true"] .n { color: rgba(255, 255, 255, .7); }

/* ---------- detail ---------- */
.head { display: grid; gap: 10px; margin: 8px 0 16px; padding: 18px; border-radius: var(--r-lg); background: var(--paper); box-shadow: var(--shadow-2); }
.head__top { display: flex; align-items: center; gap: 12px; }
.head__flag { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 16px; background: var(--mist); font-size: 30px; }
.head__name { margin: 0; font-size: 21px; letter-spacing: -.02em; line-height: 1.2; }
.head__hint { color: var(--ink-2); font-size: 14px; }
.meter { position: relative; height: 8px; overflow: hidden; border-radius: 8px; background: var(--line-2); }
.meter i { position: absolute; inset: 0; border-radius: 8px; background: var(--active-dot); transform-origin: left; }
.meter--renew i { background: var(--renew-dot); } .meter--problem i { background: var(--problem); } .meter--expired i { background: #A9B4C8; }

.panel { margin: 0 0 14px; padding: 16px; border: 1px solid var(--line-2); border-radius: var(--r-md); background: var(--paper); box-shadow: var(--shadow-1); }
.panel h2 { display: flex; align-items: center; justify-content: space-between; margin: 0 0 12px; font-size: 15px; font-weight: 750; letter-spacing: .01em; }
.kv { display: grid; grid-template-columns: minmax(96px, 34%) 1fr; gap: 10px 12px; margin: 0; }
.kv dt { color: var(--ink-3); font-size: 14px; }
.kv dd { margin: 0; overflow-wrap: anywhere; font-weight: 600; }
.cred { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 6px 6px 6px 14px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--mist); }
.cred + .cred { margin-top: 8px; }
.cred__k { width: 76px; flex: none; color: var(--ink-3); font-size: 13px; }
.cred__v { flex: 1; min-width: 0; overflow: hidden; font: 600 15px/1.3 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; text-overflow: ellipsis; white-space: nowrap; }
.copy { flex: none; height: 36px; padding: 0 12px; border: 0; border-radius: 10px; background: var(--paper); color: var(--cobalt); font-size: 13px; font-weight: 700; cursor: pointer; box-shadow: var(--shadow-1); }
.check { display: flex; gap: 10px; align-items: flex-start; margin-top: 12px; padding: 12px; border-radius: var(--r-sm); font-size: 14px; }
.check--ok { background: var(--active-bg); color: var(--active); } .check--bad { background: var(--problem-bg); color: var(--problem); } .check--none { background: var(--mist); color: var(--ink-2); }

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 0 14px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 0 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper);
  color: var(--ink); font-size: 15px; font-weight: 700; text-decoration: none; cursor: pointer; box-shadow: var(--shadow-1); transition: transform .12s, background .15s; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: progress; }
.btn svg { width: 19px; height: 19px; flex: none; }
.btn--primary { border-color: transparent; background: var(--cobalt); color: #fff; box-shadow: 0 10px 22px -10px rgba(35, 69, 211, .7); }
.btn--danger { color: var(--problem); }
.btn--wide { grid-column: 1 / -1; width: 100%; }
.btn--ghost { border-color: transparent; background: transparent; box-shadow: none; color: var(--cobalt); }
a.btn--wide, button.btn--wide { width: 100%; }

.timeline { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.timeline li { position: relative; padding: 0 0 14px 22px; font-size: 14px; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--cobalt); }
.timeline li::after { content: ""; position: absolute; left: 7.5px; top: 18px; bottom: 2px; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline .t-when { display: block; color: var(--ink-3); font-size: 12.5px; }
.timeline .t-bad::before { background: var(--problem); } .timeline .t-good::before { background: var(--active-dot); } .timeline .t-money::before { background: var(--renew-dot); }
.pay { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 10px 0; border-top: 1px solid var(--line-2); }
.pay:first-of-type { border-top: 0; padding-top: 0; }
.pay b { font-size: 16px; }

/* ---------- forms + sheets ---------- */
.field { display: grid; gap: 6px; margin-bottom: 12px; }
.field label { font-size: 14px; font-weight: 650; }
.field input, .field select, .field textarea { width: 100%; min-height: 50px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--paper); font-size: 16px; }
.field textarea { min-height: 96px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .search input:focus { outline: none; border-color: var(--cobalt); box-shadow: 0 0 0 4px var(--cobalt-soft); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: var(--r-sm); background: var(--line-2); }
.seg button { height: 42px; border: 0; border-radius: 9px; background: transparent; font-weight: 700; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--paper); box-shadow: var(--shadow-1); color: var(--cobalt); }

.sheet-bg { position: fixed; inset: 0; z-index: 30; background: rgba(10, 27, 58, .4); animation: fade .2s ease; }
.sheet { position: fixed; inset: auto 0 0 0; z-index: 31; max-height: 88dvh; overflow-y: auto; margin: 0 auto; max-width: 620px; padding: 10px 18px calc(22px + env(safe-area-inset-bottom));
  border-radius: 24px 24px 0 0; background: var(--paper); box-shadow: 0 -20px 50px -20px rgba(10, 27, 58, .35); animation: up .32s var(--ease); }
.sheet::before { content: ""; display: block; width: 44px; height: 5px; margin: 0 auto 14px; border-radius: 5px; background: var(--line); }
.sheet h3 { margin: 0 0 6px; font-size: 20px; letter-spacing: -.01em; }
.sheet p { margin: 0 0 14px; color: var(--ink-2); }
.choice { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; width: 100%; margin-bottom: 10px; padding: 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--paper); text-align: left; cursor: pointer; }
.choice:active { background: var(--mist); }
.choice svg { width: 26px; height: 26px; color: var(--cobalt); grid-row: span 2; }
.choice b { font-size: 16px; } .choice span { color: var(--ink-2); font-size: 14px; }
@keyframes up { from { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }

#toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 22px + env(safe-area-inset-bottom)); z-index: 40; max-width: min(92vw, 460px); padding: 12px 18px; border-radius: 14px;
  background: var(--ink); color: #fff; font-size: 15px; font-weight: 600; box-shadow: var(--shadow-2); opacity: 0; transform: translate(-50%, 12px); pointer-events: none; transition: opacity .2s, transform .25s var(--ease); }
#toast.on { opacity: 1; transform: translate(-50%, 0); }
#toast.bad { background: var(--problem); }

.center { display: grid; place-items: center; min-height: 100dvh; padding: 24px 16px; }
.login { width: 100%; max-width: 420px; padding: 28px 22px; border-radius: var(--r-lg); background: var(--paper); box-shadow: var(--shadow-2); text-align: center; }
.login .logo { width: 56px; height: 56px; border-radius: 16px; margin-bottom: 14px; }
.login h1 { margin: 0 0 8px; font-size: 24px; letter-spacing: -.02em; }
.login p { margin: 0 0 18px; color: var(--ink-2); }
.login .field { text-align: left; }

.member { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line-2); }
.member:first-of-type { border-top: 0; }
.avatar { display: grid; place-items: center; width: 42px; height: 42px; flex: none; border-radius: 50%; background: var(--cobalt-soft); color: var(--cobalt); font-weight: 800; }
.status-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line-2); }
.status-row:first-of-type { border-top: 0; padding-top: 0; }
.status-row div { flex: 1; }
.skeleton { height: 76px; border-radius: var(--r-md); background: var(--line-2); animation: breathe 1.2s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .45; } }

:focus-visible { outline: 3px solid var(--aqua); outline-offset: 2px; }
@media (min-width: 720px) {
  .tiles { grid-template-columns: repeat(4, 1fr); }
  .actions { grid-template-columns: repeat(3, 1fr); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
