/* Kassa cabinet — Registon majolica: lapis shell, glazed-white work surfaces,
   turquoise for what just happened, saffron for attention, brick for money owed. */
@font-face { font-family: Onest; font-weight: 400; font-display: swap; src: url(../fonts/Onest-400.woff2) format("woff2"); }
@font-face { font-family: Onest; font-weight: 500; font-display: swap; src: url(../fonts/Onest-500.woff2) format("woff2"); }
@font-face { font-family: Onest; font-weight: 600 700; font-display: swap; src: url(../fonts/Onest-600.woff2) format("woff2"); }
@font-face { font-family: Unbounded; font-weight: 600; font-display: swap; src: url(../fonts/Unbounded-600.woff2) format("woff2"); }

:root {
  --lapis: #22408f; --lapis-deep: #172e6b; --lapis-mist: #dce4f7; --on-lapis-muted: #c9d5f2;
  --firuza: #1fa3a1; --firuza-deep: #0f7c7a; --firuza-soft: #ddf3f2;
  --saffron: #e0a526; --saffron-ink: #8a5d00; --saffron-soft: #fbefd2;
  --brick: #a9552f; --brick-soft: #f6e3d9;
  --ground: #f7f8fb; --surface: #ffffff; --surface-2: #f2f4f9; --surface-3: #e6eaf3;
  --ink: #14213d; --ink-2: #55617c; --line: #e3e7f0; --line-2: #cfd6e4;
  --danger: #b3261e; --danger-soft: #f9dedc;
  --radius: 14px; --radius-lg: 20px;
  --shadow: 0 1px 2px rgb(11 21 48 / .06), 0 8px 24px -12px rgb(11 21 48 / .18);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --lapis-mist: #22408f; --on-lapis-muted: #c9d5f2;
    --firuza-deep: #5fd0cd; --firuza-soft: #113b3e;
    --saffron-ink: #f2c14e; --saffron-soft: #3a2e10;
    --brick: #e59b75; --brick-soft: #3a2219;
    --ground: #0d1428; --surface: #121a31; --surface-2: #162039; --surface-3: #1b2642;
    --ink: #e6eaf5; --ink-2: #a9b3cc; --line: #26304a; --line-2: #34405e;
    --danger: #f2b8b5; --danger-soft: #601410;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 8px 24px -12px rgb(0 0 0 / .6);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--ground); color: var(--ink);
  font: 400 15px/1.45 Onest, system-ui, sans-serif; font-feature-settings: "tnum" 1;
}
::selection { background: var(--saffron); color: #14213d; }
a { color: inherit; text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--saffron); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 26px; font-weight: 600; letter-spacing: -.01em; }
h2 { font-size: 18px; font-weight: 600; }
.muted { color: var(--ink-2); }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.sum::after { content: " so‘m"; font-size: .72em; font-weight: 500; color: var(--ink-2); }
html[lang="ru"] .sum::after { content: " сум"; }

/* --- Shell --------------------------------------------------------------------------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.rail {
  background: var(--lapis-deep); color: #fff; padding: 20px 14px; position: sticky; top: 0; height: 100vh; align-self: start;
  display: flex; flex-direction: column; gap: 4px;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 20px; }
.brand-mark { width: 40px; height: 40px; border-radius: 12px; background: var(--lapis); display: grid; place-items: center; }
.brand-mark svg { width: 22px; height: 22px; }
.brand b { display: block; font-size: 16px; }
.brand small { color: var(--on-lapis-muted); font-size: 12.5px; }
.rail a.nav {
  display: flex; align-items: center; gap: 12px; padding: 0 12px; min-height: 46px; border-radius: 12px;
  color: #c9d5f2; text-decoration: none; font-weight: 500;
}
.rail a.nav svg { width: 20px; height: 20px; flex: none; }
.rail a.nav:hover { background: rgb(255 255 255 / .07); color: #fff; }
.rail a.nav[aria-current="page"] { background: rgb(255 255 255 / .14); color: #fff; font-weight: 600; }
.rail .spacer { flex: 1; }
.rail form button {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 0 12px; min-height: 46px; border-radius: 12px;
  background: none; border: 0; color: #c9d5f2; font: inherit; cursor: pointer;
}
.rail form button:hover { background: rgb(255 255 255 / .07); color: #fff; }
.rail form button svg { width: 20px; height: 20px; flex: none; }
.lang { display: flex; gap: 4px; padding: 8px 8px 12px; }
.lang a { flex: 1; text-align: center; padding: 6px 0; border-radius: 8px; color: #c9d5f2; text-decoration: none; font-weight: 600; font-size: 13px; }
.lang a[aria-current="true"] { background: rgb(255 255 255 / .16); color: #fff; }

main { padding: 28px clamp(16px, 3vw, 40px) 64px; max-width: 1240px; width: 100%; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 12px; gap: 2px; }
  .brand { padding: 0 8px 0 0; }
  .brand small, .rail .spacer, .rail .lang { display: none; }
  .rail a.nav { min-height: 40px; padding: 0 10px; font-size: 14px; }
  .rail a.nav span { display: none; }
  .rail a.nav[aria-current="page"] span { display: inline; }
  .rail form { margin-left: auto; }
  .rail form button span { display: none; }
}

/* --- Surfaces ------------------------------------------------------------------------ */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.panel-pad { padding: 20px; }
.panel h2 { margin-bottom: 14px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.stack > * + * { margin-top: 16px; }

/* The one reversed plate per screen, crowned by the tile rule. */
.band { background: var(--lapis); color: #fff; border-radius: var(--radius-lg); overflow: hidden; }
.tile-rule {
  height: 4px; margin: 0 22px;
  background: repeating-linear-gradient(90deg, var(--saffron) 0 12px, transparent 12px 16px, var(--firuza) 16px 28px, transparent 28px 32px);
}
.band-body { padding: 18px 22px 22px; display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr)); gap: 20px; align-items: end; }
.band .label { font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--on-lapis-muted); font-weight: 600; }
.band .big { font: 600 clamp(28px, 4vw, 40px)/1.1 Unbounded, Onest, sans-serif; margin-top: 4px; letter-spacing: -.01em; }
.band .big small { font: 500 15px Onest, sans-serif; color: var(--on-lapis-muted); margin-left: 6px; }
.band .stat b { display: block; font-size: 18px; font-weight: 600; margin-top: 2px; }
.band .stat .note { color: var(--saffron); font-size: 12.5px; }
.band .stat { border-left: 1px solid rgb(255 255 255 / .18); padding-left: 16px; }
@media (max-width: 860px) { .band-body { grid-template-columns: 1fr 1fr; } .band-body > :first-child { grid-column: 1 / -1; } }

/* --- Controls ------------------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px;
  border-radius: var(--radius); border: 1.5px solid var(--line-2); background: var(--surface); color: var(--ink);
  font: 600 14.5px Onest, sans-serif; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .1s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--lapis); border-color: var(--lapis); color: #fff; }
.btn-primary:hover { background: var(--lapis-deep); border-color: var(--lapis-deep); }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-small { min-height: 38px; padding: 0 12px; font-size: 13.5px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

label.field { display: block; }
label.field > span { display: block; font-weight: 600; font-size: 13.5px; margin-bottom: 6px; }
label.field > small { display: block; color: var(--ink-2); margin-top: 6px; font-size: 12.5px; }
input[type=text], input[type=tel], input[type=password], input[type=number], input[type=search], input[type=date], select, textarea {
  width: 100%; min-height: 48px; padding: 0 14px; border-radius: var(--radius);
  border: 1.5px solid var(--line-2); background: var(--surface); color: var(--ink); font: 400 15.5px Onest, sans-serif;
}
textarea { padding: 12px 14px; min-height: 90px; }
input::placeholder { color: var(--ink-2); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--lapis); box-shadow: 0 0 0 3px color-mix(in srgb, var(--lapis) 18%, transparent); }
.form-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.form-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }
.error-text { color: var(--danger); font-size: 13px; margin-top: 6px; }

.tabs { display: inline-flex; background: var(--surface-2); border-radius: 12px; padding: 4px; gap: 2px; flex-wrap: wrap; }
.tabs a { padding: 8px 14px; border-radius: 9px; text-decoration: none; font-weight: 600; font-size: 13.5px; color: var(--ink-2); }
.tabs a[aria-current="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { padding: 7px 12px; border-radius: 10px; border: 1.5px solid var(--line-2); text-decoration: none; font-weight: 600; font-size: 13px; color: var(--ink-2); }
.chip[aria-current="true"] { background: var(--lapis); border-color: var(--lapis); color: #fff; }

/* --- Tables -------------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; }
table.data th { text-align: left; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data .r { text-align: right; }
table.data a.row-link { text-decoration: none; font-weight: 600; }
table.data a.row-link:hover { text-decoration: underline; }
.barcode { color: var(--ink-2); font-size: 12.5px; }

.pill { display: inline-block; padding: 3px 9px; border-radius: 8px; font-size: 12.5px; font-weight: 600; background: var(--surface-3); color: var(--ink-2); }
.pill-low { background: var(--saffron-soft); color: var(--saffron-ink); }
.pill-out, .pill-debt { background: var(--brick-soft); color: var(--brick); }
.pill-ok { background: var(--firuza-soft); color: var(--firuza-deep); }

.flash { padding: 12px 16px; border-radius: var(--radius); background: var(--firuza-soft); color: var(--firuza-deep); font-weight: 600; margin-bottom: 16px; }
.flash-error { background: var(--danger-soft); color: var(--danger); }

/* --- Lists & bars -------------------------------------------------------------------- */
.rows { list-style: none; margin: 0; padding: 0; }
.rows li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.rows li:last-child { border-bottom: 0; }
.rows .grow { flex: 1; min-width: 0; }
.rows a { text-decoration: none; }
.rows a:hover { text-decoration: underline; color: var(--lapis); }
.rows .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.split { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--surface-3); }
.split i { display: block; height: 100%; }
.legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px 16px; margin-top: 14px; }
.legend div { display: flex; align-items: center; gap: 8px; }
.legend .dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend b { margin-left: auto; }

.chart { display: flex; align-items: flex-end; gap: 6px; height: 180px; padding-top: 8px; }
.chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; height: 100%; justify-content: flex-end; }
.chart .bar { width: 100%; max-width: 36px; border-radius: 6px 6px 2px 2px; background: var(--lapis); min-height: 2px; position: relative; }
.chart .bar.today { background: var(--firuza); }
.chart .col small { font-size: 11px; color: var(--ink-2); }
.chart .bar:hover::after {
  content: attr(data-v); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--surface); padding: 4px 8px; border-radius: 6px; font-size: 12px; white-space: nowrap;
}

.empty { text-align: center; padding: 40px 16px; color: var(--ink-2); }

/* --- Login --------------------------------------------------------------------------- */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.login-art { background: var(--lapis); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.login-art .tile-rule { margin: 0; width: 160px; }
.login-art h1 { font: 600 clamp(30px, 3.4vw, 46px)/1.1 Unbounded, Onest, sans-serif; max-width: 12ch; }
.login-art p { color: var(--on-lapis-muted); max-width: 40ch; }
.login-form { display: grid; place-items: center; padding: 32px 20px; }
.login-form form { width: min(400px, 100%); }
.phone-row { display: flex; gap: 8px; }
.phone-row .prefix { display: grid; place-items: center; padding: 0 14px; border-radius: var(--radius); background: var(--surface-2); font-weight: 600; min-height: 48px; }
@media (max-width: 860px) { .login { grid-template-columns: 1fr; } .login-art { padding: 28px 20px; gap: 24px; } }

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