/* Дизайн в стиле консоли «Смена» (test.s4.skin): тёмный фон, лаймовый акцент, плоские карточки */
:root {
  --bg: #101410;
  --panel: #181d19;
  --raised: #222922;
  --line: #2e382f;
  --text: #e7eee6;
  --muted: #8d9a8c;
  --accent: #d6f25c;
  --accent-fg: #14180c;
  --danger: #e07a6a;
  --warn: #e2b657;
  --ok: #8dcea8;
  --ok-bg: rgba(141, 206, 168, 0.14);
  --warn-bg: rgba(226, 182, 87, 0.14);
  --danger-bg: rgba(224, 122, 106, 0.14);
  --radius: 14px;
  --radius-sm: 8px;
  --font: "Manrope", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button, input, select { font-family: inherit; }

.shell { display: grid; grid-template-columns: 224px minmax(0, 1fr); min-height: 100vh; width: 100%; }
.side {
  background: var(--bg);
  border-right: 1px solid var(--line);
  padding: 24px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: block; margin-bottom: 28px; }
.logo { display: none; }
.brand strong {
  display: block;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
}
.brand small { display: block; color: var(--muted); font-size: 14px; margin-top: 4px; }
.nav a {
  display: block; padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--muted); margin-bottom: 4px; font-size: 14px; font-weight: 500;
}
.nav a:hover { background: var(--raised); color: var(--text); }
.nav a.active { background: var(--accent); color: var(--accent-fg); }
.side-foot { position: absolute; bottom: 24px; left: 16px; right: 16px; color: var(--muted); font-size: 12px; }

.main {
  padding: 28px 32px 56px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  max-width: 100%;
}
.main > * { min-width: 0; max-width: 100%; }
.grid, .card, .top, .split, .plist { min-width: 0; max-width: 100%; }

.top {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px; margin-bottom: 0;
  padding-bottom: 16px; border-bottom: 1px solid var(--line);
}
.top h1::before {
  content: "Парк устройств";
  display: block;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 2px;
}
h1 { margin: 0 0 4px; font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.sub { color: var(--muted); margin: 0; font-size: 14px; }
.badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 999px; background: var(--raised);
  border: 1px solid var(--line); font-size: 13px;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.dot.on { background: var(--ok); box-shadow: 0 0 0 4px rgba(141, 206, 168, 0.15); }
.dot.off { background: var(--danger); }

.grid { display: grid; gap: 12px; }
.stats { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 0; }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.card h2 {
  margin: 0 0 12px; font-size: 12px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.025em; color: var(--muted);
}
.stats .card { display: flex; flex-direction: column-reverse; justify-content: flex-end; }
.stat-value { font-family: var(--mono); font-size: 24px; font-weight: 500; margin-top: 8px; }
.stat-label {
  color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.025em;
}

.split { grid-template-columns: 1.4fr 1fr; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left; color: var(--muted); font-weight: 500; padding: 8px 10px;
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.025em;
}
td { padding: 10px; border-top: 1px solid var(--line); }
tr:hover td { background: rgba(255, 255, 255, 0.02); }
.muted { color: var(--muted); }
.ok { color: var(--ok); }
.warn { color: var(--warn); }
.danger { color: var(--danger); }
.pill {
  display: inline-block; padding: 3px 8px; border-radius: 999px;
  background: var(--raised); font-size: 12px;
}

.form-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; max-width: 100%; }
.stack { display: grid; gap: 10px; width: 100%; max-width: 100%; }
.stack > * { width: 100%; max-width: 100%; min-width: 0; box-sizing: border-box; }
input, select {
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 10px 12px; min-width: 0;
}
input:focus, select:focus { outline: none; border-color: var(--accent); }
button, .btn {
  background: var(--accent); color: var(--accent-fg); border: 0; border-radius: var(--radius-sm);
  padding: 10px 14px; font-weight: 600; cursor: pointer;
}
button:hover, .btn:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.ghost:hover { background: var(--raised); filter: none; }
.btn.danger { background: var(--danger-bg); color: var(--danger); }
.flash {
  background: rgba(214, 242, 92, 0.1); border: 1px solid rgba(214, 242, 92, 0.3); color: var(--text);
  padding: 12px 14px; border-radius: var(--radius-sm); margin-bottom: 0;
}

.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
}
.login-card { width: min(420px, 100%); }
.login-card h1 { margin-bottom: 8px; font-size: 22px; }
.login-card h1::before { content: none; }
.login-card form { display: grid; gap: 10px; margin-top: 18px; }
.login-card input, .login-card button { width: 100%; }

.hint {
  background: var(--bg); border: 1px dashed var(--line);
  padding: 14px; border-radius: var(--radius-sm); color: var(--muted); font-size: 14px; line-height: 1.5;
}
code { color: var(--accent); font-family: var(--mono); }

.cal th, .cal td { text-align: center; padding: 6px 4px; font-size: 11px; min-width: 28px; }
.cal td:first-child { text-align: left; min-width: 160px; }
.cell.ok { background: var(--ok-bg); color: var(--ok); }
.cell.late { background: var(--warn-bg); color: var(--warn); }
.cell.absent { background: var(--danger-bg); color: var(--danger); }
.cell.off { color: #4b5a4c; }
.cell.future { color: #343f35; }

.month { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.month-head { text-align: center; color: var(--muted); font-size: 12px; padding: 4px; }
.day { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px; min-height: 118px; }
.day.empty { background: transparent; border: none; min-height: 0; }
.day.ok { border-color: rgba(141, 206, 168, 0.5); }
.day.late { border-color: var(--warn); }
.day.early { border-color: #d8a15a; }
.day.off { opacity: .7; }
.day.sel { outline: 2px solid var(--accent); }
button.day { width: 100%; text-align: left; color: inherit; cursor: pointer; font: inherit; }
.day-num { font-weight: 700; font-family: var(--mono); }
.day-meta { color: var(--muted); font-size: 11px; }
.day-form { display: grid; gap: 4px; margin-top: 6px; }
.day-form input[type="time"] { width: 100%; min-height: 32px; font-size: 12px; }
.day-form button { min-height: 32px; padding: 4px 8px; }

button, .btn { min-height: 42px; }
input, select { min-height: 42px; font-size: 16px; }
input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-width: 16px;
  min-height: 16px;
  margin: 0;
  accent-color: var(--accent);
}
.checks { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  color: var(--text);
  font-size: 14px;
}
.card { margin-bottom: 0; }
.month { margin-top: 8px; }

.mobile-bar { display: none; }
.nav-mask { display: none; }
.hide-desk { display: none; }
.plist { display: grid; gap: 12px; }
.pitem {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
}
.pitem-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.meta-line { margin-top: 6px; font-size: 13px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.actions form { margin: 0; }
.tag { display:inline-block; padding:4px 10px; border-radius:999px; font-size:12px; font-weight:600; white-space:nowrap; }
.tag.in { background:var(--ok-bg); color:var(--ok); }
.tag.late { background:var(--warn-bg); color:var(--warn); }
.tag.wait { background:var(--raised); color:var(--muted); }
.tag.absent { background:var(--danger-bg); color:var(--danger); }
.tag.early { background:var(--warn-bg); color:var(--warn); }
.tag.soft { background:rgba(214, 242, 92, 0.1); color:#d6c98a; }
.tag.done { background:var(--ok-bg); color:var(--muted); }
.day.soft { border-color:#8a7d4a; }
.cell.soft { background:rgba(214, 242, 92, 0.1); color:#d6c98a; }

@media (max-width: 1100px) {
  html, body { overflow-x: hidden; max-width: 100%; }
  .shell { display: flex; flex-direction: column; }
  .mobile-bar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 30;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }
  .mobile-bar-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    padding-top: max(8px, env(safe-area-inset-top));
    min-width: 0;
  }
  .mobile-bar strong {
    flex: 1;
    min-width: 0;
    font-size: 15px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .menu-btn {
    width: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
    height: 44px;
    min-height: 44px;
    padding: 0 !important;
    flex: 0 0 44px;
    background: transparent;
    border: 1px solid var(--line);
    color: var(--text);
  }
  .hide-phone { display: none !important; }
  .hide-desk { display: grid; }
  .side {
    position: fixed !important;
    left: 0; top: 0;
    height: 100% !important;
    width: min(300px, 86vw);
    z-index: 40;
    transform: translateX(-105%);
    transition: transform .2s ease;
  }
  .side.open { transform: none; }
  .nav-mask.show {
    display: block; position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 35;
  }
  .side-foot { position: static; margin-top: 24px; }
  .stats, .split { grid-template-columns: 1fr; }
  .top { flex-direction: column; align-items: stretch; width: 100%; }
  .form-row, .stack { flex-direction: column; width: 100%; }
  .form-row > *:not(.menu-btn),
  .stack > *,
  .card form input,
  .card form select,
  .card form button,
  .card form .btn {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }
  .main { padding: 12px; overflow-x: hidden; }
  .month { gap: 6px; }
  .day { min-height: 72px; padding: 6px; }
}

@media (max-width: 640px) {
  .stat-value { font-size: 22px; }
}

.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap table { min-width: 560px; }
@media (min-width: 1101px) {
  .hide-desk { display: none !important; }
}

.side { overflow-x: hidden; overflow-y: auto; padding-bottom: 28px; }
.side-foot { position: static; margin-top: 18px; }
.company-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; min-width: 0; max-width: 100%; }
.company-chips form { margin: 0; width: auto; flex: 0 1 auto; min-width: 0; }
.chip {
  background: var(--raised);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  min-height: 36px;
  width: auto;
  max-width: 100%;
  font-weight: 600;
  font-size: 13px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chip.on { background: var(--accent); color: var(--accent-fg); border-color: transparent; }
.mobile-chips { display: none; }
.card.hide-phone, .table-wrap { overflow-x: auto; max-width: 100%; }
.cal { width: max-content; min-width: 100%; }
@media (max-width: 1100px) {
  .side-chips { display: none !important; }
  .mobile-bar .mobile-chips {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 8px;
    margin: 0;
    padding: 0 12px 10px;
    background: transparent;
    border: 0;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
  }
  .mobile-chips .chip { flex: 0 0 auto; width: auto !important; max-width: 220px; }
  .mobile-chips form { width: auto !important; flex: 0 0 auto; }
}

/* Переключатель ресторана */
.rest-switch { margin: 0 0 16px; }
.rest-switch select { width: 100%; font-weight: 600; }
.side-rest small {
  display: block; color: var(--muted); font-size: 12px; margin-bottom: 6px;
  text-transform: uppercase; letter-spacing: 0.025em;
}
.mobile-bar .rest-switch { margin: 0; padding: 0 12px 10px; }
@media (max-width: 1100px) { .side-rest { display: none; } }

/* Общая статистика */
.net-table th.num, .net-table td.num { text-align: right; white-space: nowrap; font-family: var(--mono); }
.net-table th.num { font-family: var(--font); }
.net-table tr.net-total td { font-weight: 600; border-top: 2px solid var(--line); }
.net-table .form-inline { display: inline; margin: 0; }
.net-table .linkbtn { background: none; color: var(--accent); padding: 0; min-height: 0; font-weight: 600; text-align: left; }

.nav details.more { margin: 0 0 4px; }
.nav details.more > summary {
  display: block;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  list-style: none;
}
.nav details.more > summary::-webkit-details-marker { display: none; }
.nav details.more > summary::marker { content: ""; }
.nav details.more > summary:hover,
.nav details.more[open] > summary { background: var(--raised); color: var(--text); }
.nav details.more a { padding-left: 22px; }

/* Парк устройств */
.tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.tabs a {
  padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line);
  color: var(--muted); font-size: 14px; font-weight: 600;
}
.tabs a:hover { background: var(--raised); color: var(--text); }
.tabs a.on { background: var(--accent); color: var(--accent-fg); border-color: transparent; }
.tabs small { font-family: var(--mono); margin-left: 4px; opacity: .8; }

.dev {
  display: grid; gap: 10px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; border-left: 4px solid var(--line);
}
.dev.s-ok { border-left-color: var(--ok); }
.dev.s-warn { border-left-color: var(--warn); }
.dev.s-bad { border-left-color: var(--danger); }
.dev.s-off { border-left-color: #566056; opacity: .8; }
.dev.s-new { border-left-color: var(--accent); }
.dev-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.dev-head a { font-weight: 700; font-size: 16px; }
.dev-head a:hover { color: var(--accent); }
.dev-sub { color: var(--muted); font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.st {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: var(--raised); color: var(--muted); white-space: nowrap;
}
.st b { font-weight: 500; opacity: .75; }
.st-ok { background: var(--ok-bg); color: var(--ok); }
.st-warn { background: var(--warn-bg); color: var(--warn); }
.st-bad { background: var(--danger-bg); color: var(--danger); }
.st-new { background: rgba(214, 242, 92, 0.12); color: var(--accent); }
.st-off, .st-none, .st-unknown { background: var(--raised); color: var(--muted); }
.kv { display: grid; grid-template-columns: minmax(140px, 220px) 1fr; gap: 6px 16px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.sec-title { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.sec-title h2 { margin: 0; }
.mono { font-family: var(--mono); }
pre.raw {
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px; overflow: auto; max-height: 420px; font-family: var(--mono); font-size: 12px;
}
details.fold > summary { cursor: pointer; color: var(--muted); font-size: 14px; }
.pager { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.copy-box {
  display: flex; gap: 8px; align-items: center; background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 8px 12px; font-family: var(--mono); font-size: 13px; word-break: break-all;
}
@media (max-width: 640px) { .kv { grid-template-columns: 1fr; } .kv dt { margin-top: 6px; } }

.avatar { width: 56px; height: 56px; object-fit: cover; border-radius: var(--radius-sm); display: block; margin-bottom: 8px; }
.avatar.lg { width: 96px; height: 96px; border-radius: var(--radius); }
