/* =========================================================
   WASHVERA OWNER DASHBOARD (app.washvera.com) — phone first
   ========================================================= */
:root {
    --navy: #0b2a4a; --teal: #1f9e8a; --teal-2: #17806f;
    --bg: #f2f5f8; --card: #ffffff; --ink: #14212e; --muted: #5f7183; --line: #dde5ec;
    --good: #1f9e8a; --warn: #c98a00; --bad: #d1435b; --chip: #e8eef3;
    --shadow: 0 1px 2px rgba(11, 42, 74, .06), 0 4px 14px rgba(11, 42, 74, .05);
}
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #071726; --card: #0d2236; --ink: #e8f1f8; --muted: #8fa6ba; --line: #1d3a55;
        --chip: #15324d; --shadow: none;
    }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
    background: var(--bg); color: var(--ink);
    font: 15px/1.45 "Segoe UI", system-ui, -apple-system, "Noto Sans SC", "Microsoft YaHei", sans-serif;
    -webkit-text-size-adjust: 100%;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--bad); font-weight: 600; min-height: 1.2em; margin: 6px 0; }
.error:empty { min-height: 0; margin: 0; }

.brand { font-weight: 800; font-size: 20px; letter-spacing: -.3px; }
.brand.big { font-size: 34px; }
.brand .w { color: var(--navy); } .brand .v { color: var(--teal); }
@media (prefers-color-scheme: dark) { .brand .w { color: #fff; } }

button {
    font: inherit; border: 0; border-radius: 10px; padding: 10px 14px; cursor: pointer;
    background: var(--chip); color: var(--ink); font-weight: 600; min-height: 42px;
}
button.primary { background: var(--teal); color: #fff; }
button.primary:hover { background: var(--teal-2); }
button.ghost { background: transparent; color: var(--muted); padding: 8px 10px; min-height: 36px; }
button.wide { width: 100%; margin-top: 6px; min-height: 48px; font-size: 16px; }
button:disabled { opacity: .55; cursor: default; }

label { display: block; margin: 12px 0 0; font-size: 13px; font-weight: 600; color: var(--muted); }
input {
    display: block; width: 100%; margin-top: 4px; padding: 11px 12px; font: inherit; font-size: 16px;
    border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink);
}
input:focus { outline: 2px solid var(--teal); outline-offset: 0; border-color: transparent; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; box-shadow: var(--shadow); }
.card h2 { margin: 0 0 12px; font-size: 16px; }
.center { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px 16px; }
.narrow { width: 100%; max-width: 400px; }
.narrow h2 { margin: 14px 0 4px; font-size: 20px; }

/* language chips */
.langs { display: flex; gap: 6px; margin: 14px 0 4px; }
.langs button { min-height: 34px; padding: 6px 12px; font-size: 14px; }
.langs button.on { background: var(--navy); color: #fff; }
@media (prefers-color-scheme: dark) { .langs button.on { background: var(--teal); } }
.langs.small { margin: 0; }
.langs.small button { min-height: 30px; padding: 4px 9px; font-size: 13px; }

/* header */
.top {
    position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 10px;
    padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
    background: var(--card); border-bottom: 1px solid var(--line);
}
.top-left { min-width: 0; }
.shop { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-right { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }

.page { max-width: 1180px; margin: 0 auto; padding: 14px 16px 40px; }
.notice { border-radius: 12px; padding: 10px 14px; margin-bottom: 12px; font-weight: 600; background: #fff4d6; color: #7a5300; }
.notice.bad { background: #fde7eb; color: #8c1d31; }
@media (prefers-color-scheme: dark) {
    .notice { background: #3a2d05; color: #ffd98a; }
    .notice.bad { background: #44151f; color: #ff9aa8; }
}

/* period + branch chips */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 8px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips button { flex: 0 0 auto; border-radius: 999px; padding: 8px 14px; min-height: 38px; }
.chips button.on { background: var(--navy); color: #fff; }
@media (prefers-color-scheme: dark) { .chips button.on { background: var(--teal); } }
.dates { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; margin: 0 0 8px; }
.dates label { margin: 0; flex: 1 1 140px; }
.dates button { flex: 0 0 auto; min-height: 46px; }

.period-title { font-size: 22px; margin: 10px 0 4px; letter-spacing: -.3px; }

/* totals */
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 10px 0 14px; }
@media (min-width: 720px) { .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow); min-width: 0; }
.kpi span { display: block; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.kpi strong { display: block; font-size: clamp(16px, 4.9vw, 22px); letter-spacing: -.3px; margin-top: 2px; overflow-wrap: anywhere; }
.kpi small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.kpi.main { border-color: var(--teal); }
.kpi.main strong { color: var(--teal); }

.grid2 { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 900px) { .grid2 { grid-template-columns: 1.6fr 1fr; } }

/* chart */
.chart { width: 100%; overflow: hidden; }
.chart svg { display: block; width: 100%; height: auto; }
.chart .axis { stroke: var(--line); stroke-width: 1; }
.chart text { fill: var(--muted); font-size: 11px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: 13px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.chart-tip { font-size: 13px; color: var(--muted); min-height: 1.4em; margin-top: 4px; }

/* payment methods */
.mrow { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.mrow:last-child { border-bottom: 0; }
.mrow b { white-space: nowrap; }
.mrow small { color: var(--muted); }
.mrow.total { font-weight: 700; }

/* branches */
.section { font-size: 18px; margin: 20px 0 10px; }
.branches { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 720px) { .branches { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .branches { grid-template-columns: repeat(3, 1fr); } }
.bhead { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.bhead h3 { margin: 0; font-size: 17px; }
.bhead .code { display: inline-block; font-size: 12px; font-weight: 800; color: #fff; background: var(--navy); border-radius: 6px; padding: 1px 7px; margin-right: 6px; vertical-align: 1px; }
@media (prefers-color-scheme: dark) { .bhead .code { background: var(--teal); } }
.fresh { font-size: 12px; color: var(--muted); white-space: nowrap; text-align: right; }
.fresh i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; background: var(--muted); }
.fresh.good i { background: var(--good); } .fresh.warn i { background: var(--warn); } .fresh.bad i { background: var(--bad); }
.bgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 10px; }
.bgrid div span { display: block; font-size: 12px; color: var(--muted); }
.bgrid div b { display: block; font-size: clamp(13px, 3.7vw, 16px); overflow-wrap: anywhere; }
.cashbox { margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: var(--bg); font-size: 13.5px; }
.cashbox b { font-size: 15px; }
.cashbox .over { color: var(--good); } .cashbox .short { color: var(--bad); }

.foot { margin-top: 24px; text-align: center; font-size: 13px; color: var(--muted); }
.foot p { margin: 6px 0 0; }

dialog { border: 0; padding: 0; background: transparent; width: min(420px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(4, 14, 26, .55); }
.row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }

.toast {
    position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%);
    background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 10px; font-weight: 600; z-index: 20;
    max-width: calc(100vw - 32px);
}
.toast.bad { background: var(--bad); }
.skeleton { opacity: .45; }
