:root {
  --paper: #f3f6f4; --panel: #ffffff; --ink: #17242b; --soft: #5b6b70; --line: #d5ddd9;
  --jade: #0e6b5c; --jade-dark: #0a5247; --jade-tint: #e3f1ed; --amber: #b87400; --amber-tint: #fbefd6;
  --red: #b3372b; --red-tint: #f9e4e1; --radius: 6px;
  --font: "Segoe UI", "Noto Sans", "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { font-size: 15px; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font); line-height: 1.45; }
h1 { font-size: 1.6rem; font-weight: 650; margin: 0 0 4px; letter-spacing: -0.01em; }
h2 { font-size: 1.07rem; font-weight: 650; margin: 0 0 12px; }
p { margin: 0 0 10px; max-width: 70ch; }
a { color: var(--jade); }
.muted { color: var(--soft); }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
:focus-visible { outline: 2px solid var(--jade); outline-offset: 2px; }

/* Қаңқа: сол жақта мәзір, оң жақта бет */
.shell { display: grid; grid-template-columns: 216px 1fr; min-height: 100vh; }
.side { background: var(--ink); color: #dfe7e4; padding: 18px 10px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; height: 100vh; }
.brand { font-size: 1.25rem; font-weight: 700; color: #fff; padding: 2px 10px 16px; letter-spacing: -0.01em; }
.brand small { display: block; font-size: 0.78rem; font-weight: 400; color: #9fb1ad; }
.side button { all: unset; cursor: pointer; padding: 8px 10px; border-radius: var(--radius); color: inherit; }
.side button:hover { background: #24343c; }
.side button[aria-current="page"] { background: var(--jade); color: #fff; }
.side .spacer { flex: 1; }
main { padding: 26px 30px 60px; max-width: 1080px; width: 100%; }
.lead { color: var(--soft); margin-bottom: 20px; }

/* Желі тақтасы: оператор желісі мен әр менеджердің шамы */
.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 22px; }
.tile { background: var(--panel); padding: 12px 14px; min-height: 76px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-bottom: -1px; }
.tile.line-tile { background: var(--ink); color: #fff; }
.tile .big { font-size: 1.35rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.tile .who { font-size: 0.9rem; color: var(--soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile.line-tile .who { color: #a9bab6; }
.lamp { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #b9c4c0; margin-right: 6px; vertical-align: 1px; }
.lamp.on { background: #2fb37a; box-shadow: 0 0 0 3px rgba(47, 179, 122, .22); }
.lamp.warn { background: #e2a11c; }
.lamp.off { background: #d2594c; }

.stats { display: flex; flex-wrap: wrap; gap: 26px; margin-bottom: 24px; }
.stat b { display: block; font-size: 1.7rem; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat span { color: var(--soft); font-size: 0.9rem; }
.stat.missed b { color: var(--amber); }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; }
.note { background: var(--amber-tint); border-left: 3px solid var(--amber); padding: 10px 14px; border-radius: 0 var(--radius) var(--radius) 0; margin-bottom: 16px; max-width: 78ch; }
.note.ok { background: var(--jade-tint); border-color: var(--jade); }
.note.bad { background: var(--red-tint); border-color: var(--red); }

table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-weight: 600; font-size: 0.87rem; color: var(--soft); background: #f8faf9; }
tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 0.85rem; background: var(--jade-tint); color: var(--jade-dark); white-space: nowrap; }
.tag.missed { background: var(--amber-tint); color: #7d4e00; }
.tag.bad { background: var(--red-tint); color: var(--red); }
.tag.plain { background: #edf1ef; color: var(--soft); }
audio { height: 30px; width: 210px; }

label { display: block; font-weight: 600; font-size: 0.92rem; margin: 12px 0 4px; }
label > input, label > select { display: block; margin-top: 4px; font-weight: 400; }
label.check > input { display: inline-block; }
label.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; font-size: 1rem; margin: 9px 0; cursor: pointer; }
label.check input { margin-top: 4px; }
.hint { font-size: 0.87rem; color: var(--soft); margin: 3px 0 0; max-width: 68ch; }
input[type=text], input[type=password], input[type=number], input[type=time], select, textarea {
  font: inherit; color: inherit; padding: 7px 9px; border: 1px solid #b7c3be; border-radius: var(--radius); background: #fff; width: 100%; max-width: 420px; }
input[type=number], input[type=time] { max-width: 130px; }
.row { display: flex; flex-wrap: wrap; gap: 4px 22px; align-items: flex-start; }
.row > button.btn { margin-top: 35px; }
.row > div { min-width: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; align-items: center; }
button.btn { font: inherit; cursor: pointer; padding: 7px 14px; border-radius: var(--radius); border: 1px solid var(--jade); background: var(--jade); color: #fff; font-weight: 600; }
button.btn:hover { background: var(--jade-dark); }
button.btn.ghost { background: transparent; color: var(--jade); }
button.btn.ghost:hover { background: var(--jade-tint); }
button.btn.danger { background: transparent; color: var(--red); border-color: var(--red); }
button.btn.small { padding: 3px 9px; font-size: 0.87rem; font-weight: 500; }
button.btn:disabled { opacity: .55; cursor: default; }
code, .mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 0.92em; background: #edf1ef; padding: 1px 5px; border-radius: 4px; word-break: break-all; }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
dl.kv dt { color: var(--soft); }
dl.kv dd { margin: 0; }
ol.steps { padding-left: 20px; margin: 0; max-width: 74ch; }
ol.steps li { margin-bottom: 7px; }
.days { display: grid; grid-template-columns: max-content max-content max-content max-content; gap: 6px 12px; align-items: center; }

.login { max-width: 340px; margin: 14vh auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; }
#toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 9px 16px; border-radius: var(--radius); opacity: 0; pointer-events: none; transition: opacity .15s; max-width: 90vw; }
#toast.show { opacity: 1; }
#toast.err { background: var(--red); }
dialog { border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; max-width: 520px; width: calc(100vw - 32px); color: var(--ink); }
dialog::backdrop { background: rgba(23, 36, 43, .45); }

@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; padding: 10px; }
  .brand { width: 100%; padding-bottom: 6px; }
  .side .spacer { display: none; }
  main { padding: 18px 14px 50px; }
}
@media (prefers-reduced-motion: reduce) { #toast { transition: none; } }
