/* xsiter mobile admin app — shared by the iOS/Android shells and /app. */

:root {
  --brand: #0a84ff;
  --accent-light: #0a84ff;
  --accent-dark: #0a84ff;
  --accent: var(--accent-light);
  --bg: #f2f2f7;
  --card: #ffffff;
  --ink: #111114;
  --ink-2: #5d5d66;
  --ink-3: #8e8e96;
  --line: rgba(60, 60, 67, 0.14);
  --fill: rgba(118, 118, 128, 0.12);
  --bar: rgba(249, 249, 251, 0.86);
  --ok: #1f9d55;
  --ok-bg: rgba(52, 199, 89, 0.14);
  --warn: #b25e00;
  --warn-bg: rgba(255, 159, 10, 0.16);
  --bad: #d70015;
  --bad-bg: rgba(255, 59, 48, 0.12);
  --info: #0063cc;
  --info-bg: rgba(10, 132, 255, 0.12);
  --mute-bg: rgba(118, 118, 128, 0.12);
  --r: 14px;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --accent: var(--accent-dark);
    --bg: #000000;
    --card: #1c1c1e;
    --ink: #f5f5f7;
    --ink-2: #aeaeb5;
    --ink-3: #7c7c84;
    --line: rgba(84, 84, 88, 0.55);
    --fill: rgba(118, 118, 128, 0.24);
    --bar: rgba(22, 22, 24, 0.86);
    --ok: #32d74b;
    --warn: #ffb340;
    --bad: #ff6961;
    --info: #64b5ff;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); }
body {
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
#app { height: 100%; }

/* ── Screen frame ──────────────────────────────────────────────────── */
.screen { position: fixed; inset: 0; display: flex; flex-direction: column; }
.bar {
  flex: none;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  min-height: calc(48px + var(--sat)); padding: var(--sat) calc(6px + var(--sar)) 0 calc(6px + var(--sal));
  background: var(--bar); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid var(--line); z-index: 5;
}
.bar-t { margin: 0; font-size: 17px; font-weight: 600; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60vw; }
.bar-large:not(.bar-scrolled) { border-bottom-color: transparent; }
.bar-large:not(.bar-scrolled) .bar-t { opacity: 0; }
.bar-t { transition: opacity .2s; }
.bar-l { justify-self: start; display: flex; }
.bar-r { justify-self: end; display: flex; gap: 2px; align-items: center; }
.large-t { font-size: 32px; font-weight: 700; letter-spacing: -0.02em; padding: 4px 16px 8px; }
.ib {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  min-width: 42px; height: 42px; padding: 0 8px; border: 0; background: none; color: var(--accent); font-size: 19px; border-radius: 10px;
}
.ib:active { background: var(--fill); }
.back { font-size: 17px; padding-left: 4px; }
.back .fa-chevron-left { font-size: 20px; }
.back-t { max-width: 28vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scroll {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-y: contain;
  padding: 8px calc(0px + var(--sar)) calc(24px + var(--sab)) calc(0px + var(--sal));
}
.has-tabs .scroll { padding-bottom: calc(92px + var(--sab)); }
.scroll.has-actbar { padding-bottom: calc(110px + var(--sab)); }
.has-tabs .scroll.has-actbar { padding-bottom: calc(170px + var(--sab)); }

/* ── Tab bar ───────────────────────────────────────────────────────── */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  display: flex; padding: 6px calc(4px + var(--sar)) calc(4px + var(--sab)) calc(4px + var(--sal));
  background: var(--bar); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-top: 0.5px solid var(--line);
}
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0; color: var(--ink-3); font-size: 10.5px; font-weight: 500; }
.tab.on { color: var(--accent); }
.tab-i { position: relative; font-size: 21px; line-height: 26px; }
.tab-l { white-space: nowrap; max-width: 20vw; overflow: hidden; text-overflow: ellipsis; }
.dot-n {
  position: absolute; top: -3px; right: -12px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: #ff3b30; color: #fff; font: 600 11px/18px -apple-system, system-ui, sans-serif; text-align: center;
}
.ib .dot-n { top: 2px; right: 0; }

/* ── Cards, rows ───────────────────────────────────────────────────── */
.card, .rows { background: var(--card); border-radius: var(--r); margin: 0 16px 14px; overflow: hidden; }
.rows-flush { margin-top: 4px; }
.card { padding: 14px 16px; }
.card.tap:active { opacity: .8; }
.card-t { display: flex; align-items: center; justify-content: space-between; margin: 0 0 8px; font-size: 13px; font-weight: 600; color: var(--ink-2); text-transform: uppercase; letter-spacing: .03em; }
.card-more { font-size: 14px; text-transform: none; letter-spacing: 0; font-weight: 500; }
.card .rows { margin: 0 -16px -14px; border-radius: 0; background: transparent; }
.group-t { margin: 22px 32px 6px; font-size: 13px; font-weight: 500; color: var(--ink-2); text-transform: uppercase; letter-spacing: .03em; }
.row {
  position: relative; display: flex; align-items: center; gap: 12px; width: 100%;
  min-height: 54px; padding: 10px 16px; border: 0; background: none; text-align: left;
}
.row + .row::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: 0.5px solid var(--line); }
.row.tap:active { background: var(--fill); }
.row.tap:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.row-m { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.row-t { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-s { font-size: 13.5px; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.row-r { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; max-width: 42%; }
.row-amt { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.row-meta { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; }
.row-go { color: var(--ink-3); font-size: 12px; opacity: .6; }
.row.unread .row-t { font-weight: 600; }
.row.unread::after { content: ""; position: absolute; left: 5px; top: 50%; width: 7px; height: 7px; margin-top: -3.5px; border-radius: 50%; background: var(--accent); }

.av { flex: none; width: 38px; height: 38px; border-radius: 50%; object-fit: cover; background: var(--fill); }
.av-s { width: 28px; height: 28px; }
.av-l { width: 76px; height: 76px; font-size: 28px; }
.av-txt { display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: 14px; color: #fff; background: hsl(var(--hue, 210), 45%, 52%); }
.av-l.av-txt { font-size: 28px; }
.av-ico { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: #fff; font-size: 14px; }

.chip { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.tone-ok.chip { background: var(--ok-bg); color: var(--ok); }
.tone-warn.chip { background: var(--warn-bg); color: var(--warn); }
.tone-bad.chip { background: var(--bad-bg); color: var(--bad); }
.tone-info.chip { background: var(--info-bg); color: var(--info); }
.tone-mute.chip { background: var(--mute-bg); color: var(--ink-2); }

/* ── Home ──────────────────────────────────────────────────────────── */
.hello { padding: 6px 20px 12px; }
.hello h2 { margin: 0; font-size: 28px; letter-spacing: -0.02em; }
.hello p { margin: 2px 0 0; color: var(--ink-2); }
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.card .kpis { margin: 0; }
.kpi {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0;
  padding: 12px; border: 0; border-radius: 12px; background: var(--fill); text-align: left;
}
.kpi:active { transform: scale(.98); }
.kpi-l { font-size: 12.5px; color: var(--ink-2); font-weight: 500; }
.kpi-v { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.kpi-s { font-size: 12px; color: var(--ink-3); }
.kpi.tone-ok .kpi-v { color: var(--ok); }
.kpi.tone-bad .kpi-v { color: var(--bad); }
.kpi.tone-warn .kpi-v { color: var(--warn); }
.kpi.tone-info .kpi-v { color: var(--info); }
.chart-w { margin-top: 2px; }
.chart-now { margin: 0 0 6px; color: var(--ink-2); font-size: 14px; }
.chart-now strong { color: var(--ink); font-size: 22px; margin-right: 4px; }
.chart { width: 100%; height: auto; display: block; }
.chart .bar-past { fill: var(--accent); opacity: .28; }
.chart .bar-now { fill: var(--accent); }
.chart text { fill: var(--ink-3); font-size: 10px; }
.notice {
  display: flex; flex-direction: column; gap: 2px; width: calc(100% - 32px); margin: 0 16px 14px; padding: 12px 14px;
  border: 0; border-radius: var(--r); text-align: left; font-size: 14px;
}
.notice strong { font-size: 15px; }
.notice.tone-warn { background: var(--warn-bg); color: var(--warn); }
.notice.tone-bad { background: var(--bad-bg); color: var(--bad); }
.notice.tone-ok { background: var(--ok-bg); color: var(--ok); }
.notice.tone-info { background: var(--info-bg); color: var(--info); }

/* ── Lists ─────────────────────────────────────────────────────────── */
.search { display: flex; align-items: center; gap: 8px; margin: 0 16px 10px; padding: 0 12px; height: 38px; border-radius: 11px; background: var(--fill); color: var(--ink-3); }
.search-btn { width: calc(100% - 32px); border: 0; text-align: left; font-size: 16px; }
.search-in { flex: 1; min-width: 0; height: 100%; border: 0; background: none; outline: 0; font-size: 16px; color: var(--ink); }
.search-in::-webkit-search-cancel-button { opacity: .5; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 0 16px 12px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.fchip { flex: none; padding: 6px 14px; border: 0; border-radius: 999px; background: var(--card); color: var(--ink); font-size: 14px; font-weight: 500; }
.fchip.on { background: var(--accent); color: #fff; }
.more-s { height: 1px; }
.fab {
  position: fixed; right: calc(18px + var(--sar)); bottom: calc(84px + var(--sab)); z-index: 7;
  width: 56px; height: 56px; border: 0; border-radius: 50%; background: var(--accent); color: #fff; font-size: 22px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .22);
}
.fab:active { transform: scale(.94); }
.check {
  flex: none; display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px;
  border: 2px solid var(--ink-3); border-radius: 50%; background: none; color: transparent; font-size: 12px; padding: 0;
}
.check.on { background: var(--ok); border-color: var(--ok); color: #fff; }
.switch { flex: none; position: relative; width: 51px; height: 31px; border: 0; border-radius: 16px; background: var(--fill); transition: background .2s; padding: 0; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, .2); transition: transform .2s; }
.switch.on { background: #34c759; }
.switch.on::after { transform: translateX(20px); }
.switch[disabled] { opacity: .45; }
.ptr { height: 0; overflow: hidden; display: flex; align-items: center; justify-content: center; color: var(--ink-3); transition: height .2s; }
.ptr.ready i { transform: rotate(180deg); color: var(--accent); }
.ptr i { transition: transform .2s; }
.ptr.busy { height: 44px !important; }
.ptr.busy i { animation: spin 1s linear infinite; }

/* ── Item ──────────────────────────────────────────────────────────── */
.item-top { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 20px 18px; text-align: center; }
.item-top h2 { margin: 4px 0 0; font-size: 22px; letter-spacing: -0.01em; }
.item-top p { margin: 0; color: var(--ink-2); font-size: 14.5px; }
.hero { display: flex; flex-direction: column; align-items: center; margin-top: 6px; }
.hero strong { font-size: 34px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.hero span { color: var(--ink-2); font-size: 13.5px; }
.quick { display: flex; gap: 10px; margin-top: 10px; }
.qk { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 64px; padding: 8px 10px; border: 0; border-radius: 12px; background: var(--card); color: var(--accent); font-size: 12px; font-weight: 500; }
.qk-i { font-size: 18px; }
.fields { margin: 0; }
.f { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; }
.f + .f { border-top: 0.5px solid var(--line); }
.f dt { color: var(--ink-2); font-size: 14.5px; flex: none; max-width: 45%; }
.f dd { margin: 0; text-align: right; font-size: 15px; word-break: break-word; }
.f-long { flex-direction: column; gap: 2px; }
.f-long dd { text-align: left; white-space: pre-wrap; }
.f-money dd { font-variant-numeric: tabular-nums; }
.f-strong dt, .f-strong dd { font-weight: 700; color: var(--ink); }
.txt { margin: 0; white-space: pre-wrap; word-break: break-word; font-size: 15px; }
.tl { list-style: none; margin: 0; padding: 0; }
.tl li { position: relative; display: flex; gap: 12px; padding: 0 0 14px; }
.tl li:not(:last-child)::before { content: ""; position: absolute; left: 4px; top: 12px; bottom: 0; border-left: 2px solid var(--line); }
.tl-d { flex: none; width: 10px; height: 10px; margin-top: 5px; border-radius: 50%; background: var(--accent); }
.tl p { margin: 0; font-size: 14.5px; }
.tl-m { font-size: 12.5px; color: var(--ink-3); }
.actbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: flex; flex-wrap: wrap; gap: 8px;
  padding: 10px calc(16px + var(--sar)) calc(10px + var(--sab)) calc(16px + var(--sal));
  background: var(--bar); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-top: 0.5px solid var(--line);
}
.actbar .btn { flex: 1 1 40%; }
.has-tabs .actbar { bottom: calc(56px + var(--sab)); }

/* ── Buttons, forms ────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px;
  border: 0; border-radius: 12px; background: var(--fill); color: var(--accent); font-size: 16px; font-weight: 600;
}
.btn:active { opacity: .75; }
.btn[disabled] { opacity: .5; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-danger { background: #ff3b30; color: #fff; }
.btn-danger-soft { background: var(--bad-bg); color: var(--bad); }
.btn-block { width: 100%; }
.btn-sm { min-height: 36px; font-size: 14px; padding: 0 14px; }
.btns { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.pad { padding: 0 16px; }
.lnk { border: 0; background: none; color: var(--accent); font-size: 15px; padding: 8px; }
.lbl { display: block; margin: 12px 2px 6px; font-size: 13.5px; font-weight: 500; color: var(--ink-2); }
.in {
  display: block; width: 100%; min-height: 46px; padding: 11px 14px; border: 1px solid transparent; border-radius: 12px;
  background: var(--card); font-size: 16px; outline: 0; -webkit-appearance: none; appearance: none;
}
.in:focus { border-color: var(--accent); }
.in-bad { border-color: var(--bad) !important; }
textarea.in { resize: vertical; min-height: 100px; }
select.in { background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
.sheet .in, .form-card .in { background: var(--fill); }
.in-code { text-align: center; font-size: 26px; letter-spacing: .18em; font-variant-numeric: tabular-nums; }
.in-w { position: relative; }
.in-scan { position: absolute; right: 2px; top: 2px; }
.fld-tgl { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; font-size: 15px; }
.tgl { width: 24px; height: 24px; accent-color: var(--accent); }
.form-err { min-height: 1.2em; margin: 8px 2px 0; color: var(--bad); font-size: 14px; }
.form-card { padding: 4px 16px 16px; }
.form-card .btn { margin-top: 12px; }
.hint { color: var(--ink-3); font-size: 13.5px; text-align: center; margin: 8px 0 0; }
.hint.pad { text-align: left; margin: 0 32px 8px; }
.foot { text-align: center; color: var(--ink-3); font-size: 12px; margin: 26px 0 8px; }

/* ── Sign-in screens ───────────────────────────────────────────────── */
.auth { display: flex; }
.auth-w { width: 100%; max-width: 420px; margin: 0 auto; padding: 18px 22px 24px; }
.auth-hero { text-align: center; margin: 18px 0 20px; }
.auth-hero h1 { margin: 12px 0 6px; font-size: 30px; letter-spacing: -0.02em; }
.auth-hero p { margin: 0; color: var(--ink-2); font-size: 15px; }
.app-mark { display: inline-flex; align-items: center; justify-content: center; width: 72px; height: 72px; border-radius: 18px; background: var(--accent); color: #fff; font-size: 32px; box-shadow: 0 8px 24px rgba(0, 0, 0, .15); }
.auth-f .in + .in { margin-top: 10px; }
.auth-f .btn { margin-top: 14px; }
.auth-alt { margin-top: 18px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.auth .group-t { margin-left: 16px; }
.auth .rows { margin: 0; }
.brand { text-align: center; margin: 10px 0 18px; }
.brand-logo { width: 72px; height: 72px; border-radius: 18px; object-fit: contain; background: var(--card); padding: 8px; }
.brand-mono { display: inline-flex; align-items: center; justify-content: center; font-size: 30px; font-weight: 700; color: var(--accent); }
.brand h2 { margin: 12px 0 2px; font-size: 22px; }
.brand p { margin: 0; color: var(--ink-3); font-size: 14px; }
.auth .notice { width: 100%; margin: 0 0 12px; }

/* ── Sheets, toasts, states ────────────────────────────────────────── */
.scrim { position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, .35); opacity: 0; transition: opacity .25s; }
.scrim.in { opacity: 1; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 21; max-height: 88vh; display: flex; flex-direction: column;
  padding: 0 calc(16px + var(--sar)) calc(16px + var(--sab)) calc(16px + var(--sal));
  background: var(--card); border-radius: 16px 16px 0 0; transform: translateY(100%); transition: transform .28s cubic-bezier(.2, .8, .2, 1);
}
@media (min-width: 640px) { .sheet { left: 50%; right: auto; width: 520px; margin-left: -260px; } }
.sheet.in { transform: none; }
.sheet-grip { width: 38px; height: 5px; border-radius: 3px; background: var(--fill); margin: 8px auto 2px; }
.sheet-h { display: flex; align-items: center; justify-content: space-between; padding: 4px 0 6px; }
.sheet-h strong { font-size: 17px; }
.sheet-b { overflow-y: auto; padding-bottom: 6px; }
.sheet-b .rows { margin: 0 -16px; border-radius: 0; background: transparent; }
.sheet-p { margin: 4px 0 0; font-size: 15px; color: var(--ink-2); }
.sheet-f .btn { margin-top: 16px; }
.toast {
  position: fixed; left: 50%; bottom: calc(100px + var(--sab)); z-index: 30; max-width: calc(100% - 40px);
  transform: translate(-50%, 20px); opacity: 0; transition: all .25s;
  padding: 11px 16px; border-radius: 12px; background: rgba(28, 28, 30, .94); color: #fff; font-size: 14.5px; box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
}
.toast.in { transform: translate(-50%, 0); opacity: 1; }
.toast.tone-ok { background: rgba(26, 127, 55, .96); }
.toast.tone-bad { background: rgba(200, 30, 30, .96); }
.spin { display: flex; justify-content: center; padding: 40px 0; }
.spin i { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--fill); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 50px 30px; color: var(--ink-3); text-align: center; }
.empty .fas { font-size: 34px; opacity: .5; }
.empty p { margin: 0; font-size: 15px; }
.scan { display: flex; flex-direction: column; gap: 8px; }
.scan-v { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; background: #000; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
