:root {
  --bg: #f4f5f7; --card: #fff; --ink: #1b1d21; --muted: #6b7280; --line: #e3e5e9;
  --brand: #b8321f; --brand-soft: #fbe9e5; --ok: #1e7a46; --ok-soft: #e3f4ea; --warn: #9a6200; --warn-soft: #fdf1d9;
  --blue: #2563eb;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 15px; color: var(--ink); background: var(--bg); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--blue); }
.layout { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
@media (max-width: 800px) { .layout { grid-template-columns: 1fr; } .side { position: static !important; height: auto !important; } }
.side { background: #1b1d21; color: #e8eaed; padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow: auto; }
.side h1 { font-size: 18px; margin: 4px 8px 18px; }
.side .r { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 10px; border-radius: 8px; color: inherit; }
.side .r.active, .side .r:hover { background: #2d3036; }
.side .r small { display: block; color: #9aa0a8; }
.side .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #2fc46b; margin-right: 6px; }
.side .dot.off { background: #e5484d; }
.side hr { border: 0; border-top: 1px solid #2d3036; margin: 14px 0; }
.main { padding: 22px 28px 60px; max-width: 1150px; min-width: 0; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.head h2 { margin: 0; font-size: 24px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; flex-wrap: wrap; }
.tabs button { background: none; border: 0; padding: 10px 14px; border-bottom: 3px solid transparent; font-weight: 600; color: var(--muted); }
.tabs button.active { color: var(--ink); border-color: var(--brand); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px; margin-bottom: 16px; }
.card h3 { margin: 0 0 12px; font-size: 17px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 16px; }
.f label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.f .hint { color: var(--muted); font-size: 12px; margin-top: 3px; }
input[type=text], input[type=number], input[type=password], input[type=date], input[type=time], select, textarea {
  width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff;
}
textarea { resize: vertical; }
.input { padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.chk { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.chk input { width: 17px; height: 17px; accent-color: var(--brand); }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px; border-radius: 8px; border: 1px solid var(--line); background: #fff; font-weight: 600; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.danger { color: var(--brand); border-color: #f0c4bc; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; margin-top: 12px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; color: var(--muted); letter-spacing: .04em; }
td.num, th.num { text-align: right; white-space: nowrap; }
.table-wrap { overflow-x: auto; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--line); color: var(--muted); white-space: nowrap; }
.pill.green { background: var(--ok-soft); color: var(--ok); }
.pill.red { background: var(--brand-soft); color: var(--brand); }
.pill.yellow { background: var(--warn-soft); color: var(--warn); }
.muted { color: var(--muted); }
.alert { padding: 12px 14px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); margin-bottom: 14px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.stat .k { color: var(--muted); font-size: 13px; }
.stat .v { font-size: 22px; font-weight: 800; }
.cat-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cat-head h3 { margin: 0; }
.sizes-table td { padding: 4px; border: 0; }
.hours-grid { display: grid; grid-template-columns: 100px 1fr; gap: 8px 12px; align-items: center; }
.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: grid; place-items: center; padding: 16px; z-index: 20; }
.modal { background: #fff; border-radius: 14px; padding: 20px; width: min(760px, 100%); max-height: calc(100vh - 32px); overflow: auto; }
.modal h3 { margin-top: 0; }
.login { min-height: 100vh; display: grid; place-items: center; }
.login form { width: min(360px, 92vw); }
code { background: #eef0f3; padding: 1px 5px; border-radius: 5px; font-size: 13px; overflow-wrap: anywhere; }
#toasts { position: fixed; bottom: 16px; right: 16px; z-index: 50; display: grid; gap: 8px; width: min(92vw, 380px); }
.toast { background: var(--ink); color: #fff; padding: 12px 14px; border-radius: 10px; }
.toast-error { background: var(--brand); }
