/* PrimeGrid — кабинет оператора (lk.prg01.ru).
 *
 * The owner panel's look, not its stylesheet: the same dark tokens, and on a computer the
 * same frame — the menu down the left, the page's title across the top, the same sign-in
 * screen (owner, 07.10). The rules for those are copied from owner.css rather than shared:
 * owner.css is the panel's, with its own page sections and the test that keeps them apart,
 * and the cabinet takes from it only what it shows. Change a colour there, change it here.
 *
 * On a phone (up to 720px) the left column gives way to a bar at the top and the menu at
 * the bottom of the screen, under the thumb. Up to 1180px the tables are drawn as cards:
 * beside the menu, the sessions table needs about 1150px of window.
 */
:root {
  --bg: #070a11;
  --bg-sidebar: #0a0f18;
  --panel: #0e1522;
  --panel-head: #111a29;
  --panel-hover: #141d2e;
  --border: #1b2434;
  --border-soft: #16202e;

  --text: #e7edf7;
  --text-muted: #8a97ab;
  --text-dim: #5b6879;

  --accent: #3b82f6;
  --accent-soft: rgba(59, 130, 246, 0.14);
  --accent-line: rgba(59, 130, 246, 0.45);
  --green: #22c55e;
  --green-soft: rgba(34, 197, 94, 0.14);
  --red: #ef4444;
  --red-soft: rgba(239, 68, 68, 0.14);
  --amber: #f59e0b;
  --amber-soft: rgba(245, 158, 11, 0.14);
  --brand: #7dd93f;
  --on-accent: #06101f;
  --shadow-strong: #000;

  --radius: 14px;
  --radius-sm: 8px;
  --radius-pill: 999px;
  --gap-xs: 6px;
  --gap-sm: 10px;
  --gap: 16px;
  --gap-lg: 24px;

  --sidebar-w: 268px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
  --fs-sm: 0.78rem;
  --fs-base: 0.875rem;
  --fs-lg: 1.05rem;
  --nav-h: 62px;

  color-scheme: dark;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
ul { list-style: none; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: var(--radius-pill);
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); background-clip: content-box; }

.muted { color: var(--text-muted); }
.small { font-size: var(--fs-sm); }
.nowrap { white-space: nowrap; }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.amount-in { color: var(--green); font-weight: 600; font-variant-numeric: tabular-nums; }
.big { font-size: 1.25rem; }

/* ------------------------------------------------------------ controls */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--gap-xs);
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel-head);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
.btn:hover { border-color: var(--accent-line); }
.btn-ghost { background: transparent; }
.btn:focus-visible, .nav-item:focus-visible, .tabs a:focus-visible, .who-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

input[type="text"], input[type="password"] {
  background: var(--panel-head);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  padding: 7px 10px;
}
input:focus { outline: 1px solid var(--accent-line); }

/* A saved sign-in the browser filled in is repainted by the browser in a pale box; it is
   flooded back from the inside, as in the panel. */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px var(--panel-head) inset;
  box-shadow: 0 0 0 1000px var(--panel-head) inset;
  caret-color: var(--text);
  transition: background-color 9999s ease-out 0s;
}

/* ---------------------------------------------------------------- frame */

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

/* The panel's left column: pinned, so the menu does not scroll away on a long page. */
.sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  padding: var(--gap-lg) var(--gap);
  display: flex;
  flex-direction: column;
  gap: var(--gap-lg);
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 var(--gap-xs);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.01em;
}
.brand-mark { height: 27px; height: 1.15cap; width: auto; flex: none; }
.brand-prime { color: var(--text); }
.brand-grid { color: var(--brand); }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
  padding: var(--gap-sm);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  border: 1px solid transparent;
}
.nav-item:hover { background: var(--panel-hover); color: var(--text); }
.nav-item.is-active { background: var(--accent-soft); border-color: var(--accent-line); color: var(--text); }
.nav-item svg { flex: none; opacity: 0.85; }
.nav-label { flex: 1; }

.sidebar-foot { margin-top: auto; }
.system-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  padding: var(--gap);
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
}
.system-title { font-weight: 600; }
.system-note { color: var(--text-muted); font-size: var(--fs-sm); }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--text-dim); }
.dot-ok { background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }

.content {
  min-width: 0;
  padding: var(--gap-lg);
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--gap); }
.page-title { font-size: 1.55rem; font-weight: 700; }
.page-subtitle { color: var(--text-muted); font-size: var(--fs-sm); margin-top: 2px; }

.who { text-align: right; line-height: 1.25; }
.who-name { font-weight: 600; }
.who-form { display: inline; }
.who-link {
  color: var(--text-muted);
  font-size: var(--fs-sm);
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  line-height: inherit;
  text-align: inherit;
  cursor: pointer;
}
.who-link:hover { color: var(--accent); }

/* A phone's frame, put away on a computer. */
.mobile-top, .tabs { display: none; }

/* -------------------------------------------------------------- blocks */

.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); }
.tile {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--gap) 18px;
  min-width: 0;
}
.tile-label { color: var(--text-muted); font-size: var(--fs-sm); }
.tile-value { font-size: 1.9rem; font-weight: 700; line-height: 1.25; font-variant-numeric: tabular-nums; }
.tile-value.is-money { color: var(--green); }
.tile-note { color: var(--text-dim); font-size: var(--fs-sm); margin-top: 2px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  min-width: 0;
}
.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 12px var(--gap);
  background: var(--panel-head);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}
.panel-head a { color: var(--accent); font-weight: 400; }
.panel-head a:hover { text-decoration: underline; }
.panel-head .small { font-weight: 400; }

.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px var(--gap);
  border-bottom: 1px solid var(--border-soft);
}
.list-row:last-child { border-bottom: none; }
.list-main { min-width: 0; overflow-wrap: anywhere; }
.list-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }

.empty { padding: 18px var(--gap); color: var(--text-muted); }

table.rows { width: 100%; border-collapse: collapse; }
table.rows th {
  text-align: left;
  padding: var(--gap-sm) 12px;
  color: var(--text-dim);
  font-size: var(--fs-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  border-bottom: 1px solid var(--border-soft);
}
table.rows th.num { text-align: right; }
table.rows td { padding: 11px 12px; border-bottom: 1px solid var(--border-soft); vertical-align: top; }
table.rows tbody tr:last-child td { border-bottom: none; }
table.rows tbody tr:hover td { background: var(--panel-hover); }
tr.is-void td { color: var(--text-dim); }
tr.is-void .num > span { text-decoration: line-through; }
.table-scroll { overflow-x: auto; }

.note { color: var(--text-dim); font-size: var(--fs-sm); margin-top: 3px; max-width: 260px; }

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-sm);
  white-space: nowrap;
}
.tone-ok { background: var(--green-soft); color: var(--green); }
.tone-wait { background: var(--amber-soft); color: var(--amber); }
.tone-live { background: var(--accent-soft); color: var(--accent); }
.tone-off { background: var(--panel-hover); color: var(--text-muted); }
.tone-bad { background: var(--red-soft); color: var(--red); }

.drops { display: grid; gap: 6px; }
.drop { display: flex; align-items: center; gap: 8px; min-width: 0; }
.drop-pics { display: inline-flex; gap: 2px; flex: none; }
.drop-pics img { height: 30px; width: auto; }
.drop-names { font-size: var(--fs-sm); max-width: 280px; overflow-wrap: anywhere; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* The cards a table becomes where it has no room: one a row, saying only what it has. */
.card { display: grid; gap: 5px; padding: 12px var(--gap); border-bottom: 1px solid var(--border-soft); min-width: 0; }
.card:last-child { border-bottom: none; }
.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.card-top .row-title { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.card-top .badge, .card-top .num { flex: none; }
.card-money { display: flex; justify-content: space-between; gap: 10px; }
.card .note { max-width: none; margin-top: 0; }
.card.is-void .row-title, .card.is-void .num { color: var(--text-dim); }
.card.is-void .num { text-decoration: line-through; }

.only-narrow { display: none; }

@media (max-width: 1180px) {
  .only-wide { display: none; }
  .only-narrow { display: block; }
}

/* ------------------------------------------------------------- sign-in */

/* The panel's sign-in screen: its own background, a pattern faded into the corners. */
.login-screen {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--gap-lg);
  background: var(--bg);
}

.login-screen::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  opacity: 0.18;
  background-image:
    radial-gradient(circle, var(--accent) 1px, transparent 1px),
    repeating-linear-gradient(-45deg, var(--accent) 0 1px, transparent 1px 28px),
    radial-gradient(circle, var(--brand) 1px, transparent 1px),
    repeating-linear-gradient(45deg, var(--brand) 0 1px, transparent 1px 28px);
  background-size: 28px 28px, auto, 28px 28px, auto;
  background-position: left top, left top, right bottom, right bottom;
  background-repeat: repeat;
  mask-image: radial-gradient(ellipse 60% 60% at 50% 50%, transparent 25%, #000 90%);
  -webkit-mask-image: radial-gradient(ellipse 60% 60% at 50% 50%, transparent 25%, #000 90%);
}

.login-card {
  position: relative;
  z-index: 1;
  width: min(440px, 100%);
  padding: var(--gap-lg);
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  border: 1px solid transparent;
  border-radius: 20px;
  background-image:
    linear-gradient(var(--panel), var(--panel)),
    linear-gradient(160deg, var(--accent), var(--brand));
  background-origin: border-box;
  background-clip: padding-box, border-box;
  box-shadow: 0 0 60px -12px var(--accent-line), 0 24px 60px -30px var(--shadow-strong);
}

.login-brand { justify-content: center; gap: var(--gap-sm); font-size: 1.9rem; letter-spacing: 0.02em; }

.login-rule {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
  color: var(--text-muted);
  font-size: var(--fs-sm);
}
.login-rule::before, .login-rule::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.login-rule > span { display: inline-flex; align-items: center; gap: var(--gap-xs); }
.login-foot { margin-top: var(--gap-xs); }

.login-form { display: flex; flex-direction: column; gap: var(--gap); }
.filter { display: flex; flex-direction: column; gap: 4px; }
.filter > span, .filter > label { color: var(--text-muted); font-size: var(--fs-sm); }

.field { position: relative; display: flex; align-items: center; }
.field-icon { position: absolute; left: 12px; display: flex; color: var(--text-dim); pointer-events: none; }
.field input { width: 100%; padding: 10px 12px 10px 38px; font-size: 1rem; }
.field input.has-eye { padding-right: 42px; }
.field-eye {
  position: absolute;
  right: 8px;
  display: grid;
  place-items: center;
  padding: 4px;
  border: none;
  background: none;
  color: var(--text-dim);
  cursor: pointer;
}
.field-eye:hover { color: var(--text); }

.login-submit {
  padding: 12px;
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--on-accent);
  border-color: transparent;
  background: linear-gradient(90deg, var(--accent), var(--brand));
}
.login-submit:hover { filter: brightness(1.08); border-color: transparent; }

.banner {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--amber-soft);
  color: var(--amber);
}

/* ---------------------------------------------------------------- phone */

@media (max-width: 720px) {
  .shell { display: block; padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px)); }
  .sidebar, .topbar { display: none; }

  .mobile-top {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 16px;
    padding-top: calc(10px + env(safe-area-inset-top, 0px));
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border);
  }
  .mobile-top .brand { font-size: 1.3rem; padding: 0; }
  .who-inline { display: flex; align-items: center; gap: 8px; }
  .who-inline .who-name { font-weight: 400; color: var(--text-muted); font-size: var(--fs-sm); }

  /* The menu goes to the bottom of the screen, under the thumb. */
  .tabs {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--bg-sidebar);
    border-top: 1px solid var(--border);
  }
  .tabs a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    height: var(--nav-h);
    color: var(--text-muted);
    font-size: 0.75rem;
  }
  .tabs a.on { color: var(--accent); }

  .content { padding: 12px 16px 20px; gap: 12px; }

  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .tiles:not(.tiles-week) .tile:first-child { grid-column: 1 / -1; }
  .tiles-week { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tile { padding: 10px 12px; }
  .tile-value { font-size: 1.35rem; }
  .tiles:not(.tiles-week) .tile:first-child .tile-value { font-size: 1.8rem; }
  .tiles-week .tile-value { font-size: 1.15rem; }
  .tiles-week .tile-label { font-size: 0.72rem; }

  .drop-names { max-width: none; }

  .login-screen { padding: var(--gap); }
}
