/* gofindit — дежурный пульт обращений. Токены: холодный серый ground, «государственный синий» бренд,
   красный только для срока/аварии; статусы — штампы журнала; Onest для текста, IBM Plex Mono для времени и номеров. */
@import url("/static/fonts/fonts.css");

:root {
  --ground: #F2F4F7; --surface: #FFFFFF; --surface-2: #E9ECF1; --surface-3: #DFE3EA;
  --ink: #14181F; --ink-2: #2B3240; --muted: #5D6675; --line: #D3D8E0; --line-2: #BFC6D1;
  --brand: #2247B8; --brand-ink: #1A3790; --brand-soft: #E4EAF9; --brand-soft-2: #C9D5F5;
  --alarm: #C0392B; --alarm-soft: #F9E3E0;
  --amber: #B7791F; --amber-soft: #FBEFD9;
  --violet: #5A3E9E; --violet-soft: #ECE6F8;
  --teal: #1F6A8B; --teal-soft: #E1EEF5;
  --green: #1B7F4C; --green-soft: #DDF2E6;
  --grey: #6B7482; --grey-soft: #ECEEF2;
  --radius: 8px; --radius-s: 5px;
  --font: "Onest", "Segoe UI", Roboto, system-ui, -apple-system, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;
  --side-w: 236px;
}

* { box-sizing: border-box; }
html { font-size: 14.5px; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font-family: var(--font); line-height: 1.45; font-feature-settings: "tnum" 1; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 3px; }
h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -.01em; margin: 0; line-height: 1.2; }
h2 { font-size: 1.05rem; font-weight: 700; margin: 26px 0 10px; letter-spacing: -.005em; }
h3 { font-size: .92rem; font-weight: 700; margin: 0 0 10px; }
code { font-family: var(--mono); font-size: .9em; background: var(--surface-2); padding: 1px 5px; border-radius: 3px; }

/* ---------- каркас: боковая колонка + рабочее поле ---------- */
.shell { display: grid; grid-template-columns: var(--side-w) 1fr; min-height: 100vh; }
.side { background: var(--surface); border-right: 1px solid var(--line); padding: 18px 14px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 18px; }
.brand { display: block; padding: 4px 8px; color: var(--ink); }
.brand b { font-size: 1.25rem; font-weight: 700; letter-spacing: -.02em; display: block; }
.brand small { display: block; color: var(--muted); font-size: .8rem; margin-top: 2px; }
.brand:hover { text-decoration: none; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--radius-s); color: var(--ink-2); font-weight: 500; }
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a.active { background: var(--brand-soft); color: var(--brand-ink); }
.nav .cnt { margin-left: auto; font-family: var(--mono); font-size: .75rem; padding: 1px 7px; border-radius: 10px; background: var(--surface-2); color: var(--muted); }
.nav .cnt.alarm { background: var(--alarm); color: #fff; }
.nav .cnt.amber { background: var(--amber-soft); color: var(--amber); }
.side .foot { margin-top: auto; padding: 10px 8px; border-top: 1px solid var(--line); font-size: .82rem; color: var(--muted); display: flex; flex-direction: column; gap: 6px; }
.side .foot b { color: var(--ink); font-weight: 600; }
.led { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--grey); margin-right: 6px; vertical-align: 1px; }
.led.ok { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.led.bad { background: var(--alarm); box-shadow: 0 0 0 3px var(--alarm-soft); }
.led.warn { background: var(--amber); box-shadow: 0 0 0 3px var(--amber-soft); }
.main { padding: 22px 28px 64px; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head .sub { color: var(--muted); font-size: .88rem; margin-top: 4px; }
.clock { font-family: var(--mono); color: var(--muted); font-size: .85rem; }
.flash { background: var(--brand-soft); border: 1px solid var(--brand-soft-2); color: var(--brand-ink); padding: 9px 13px; border-radius: var(--radius-s); margin-bottom: 14px; font-size: .92rem; }

/* ---------- строка «Сейчас» ---------- */
.now { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 18px; }
.now > div { background: var(--surface); padding: 14px 18px; }
.now .k { font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.now .v { font-size: 1.7rem; font-weight: 700; letter-spacing: -.02em; margin-top: 2px; line-height: 1.15; }
.now .v small { font-size: .95rem; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.now .v.alarm { color: var(--alarm); }
.now .s { font-size: .82rem; color: var(--muted); margin-top: 4px; }

/* ---------- карточки, сетки, показатели ---------- */
.grid { display: grid; gap: 12px; }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; min-width: 0; }
.card .k { font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.card .v { font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; margin-top: 4px; }
.card .s { font-size: .82rem; color: var(--muted); margin-top: 4px; }
.two { display: grid; grid-template-columns: 1.45fr 1fr; gap: 14px; align-items: start; }

/* ---------- таблицы ---------- */
.tbl-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th { position: sticky; top: 0; background: var(--surface-2); text-align: left; font-size: .7rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; z-index: 1; }
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td, .tbl tr.row:hover td { background: #FAFBFD; }
.tbl tr.urgent td:first-child { box-shadow: inset 3px 0 0 var(--alarm); }
.tbl td.num, .mono { font-family: var(--mono); font-size: .84rem; white-space: nowrap; }
.tbl .sub { color: var(--muted); font-size: .8rem; }
.card > .tbl, .card .tbl { border: 0; }
.card .tbl th { position: static; }
.clip { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 560px; }
.tbl td.wide { min-width: 340px; }
.clip-3 { -webkit-line-clamp: 3; }
.text { white-space: pre-wrap; word-break: break-word; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; font-size: .9rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* ---------- штампы статусов ---------- */
.stamp { display: inline-block; font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 3px 7px; border: 1.5px solid currentColor; border-radius: 3px; line-height: 1.2; white-space: nowrap; color: var(--grey); background: transparent; }
.stamp.new { color: var(--alarm); background: var(--alarm-soft); }
.stamp.candidate { color: var(--amber); background: var(--amber-soft); border-style: dashed; }
.stamp.in_work { color: var(--brand-ink); background: var(--brand-soft); }
.stamp.sent { color: var(--violet); background: var(--violet-soft); }
.stamp.answer_received { color: var(--teal); background: var(--teal-soft); }
.stamp.answered { color: var(--green); background: var(--green-soft); }
.stamp.closed { color: var(--grey); background: var(--grey-soft); }
.stamp.rejected { color: var(--grey); background: var(--grey-soft); text-decoration: line-through; }
.stamp.big { font-size: .8rem; padding: 5px 10px; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: .76rem; white-space: nowrap; background: var(--surface-2); color: var(--ink-2); }
.pill.ok { background: var(--green-soft); color: var(--green); }
.pill.bad { background: var(--alarm-soft); color: var(--alarm); }
.pill.warn { background: var(--amber-soft); color: var(--amber); }
.pill.closed, .pill.rejected { background: var(--grey-soft); color: var(--grey); }
.pill.new { background: var(--alarm-soft); color: var(--alarm); }
.pill.candidate { background: var(--amber-soft); color: var(--amber); }
.pill.in_work { background: var(--brand-soft); color: var(--brand-ink); }
.pill.sent { background: var(--violet-soft); color: var(--violet); }
.pill.answer_received { background: var(--teal-soft); color: var(--teal); }
.pill.answered { background: var(--green-soft); color: var(--green); }

/* ---------- таймер срока: подпись пульта ---------- */
.timer { display: inline-flex; align-items: baseline; gap: 6px; font-family: var(--mono); font-size: .86rem; padding: 3px 8px; border-radius: var(--radius-s); background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.timer b { font-weight: 500; font-size: 1rem; }
.timer .lbl { font-family: var(--font); font-size: .74rem; color: var(--muted); }
.timer.soon { background: var(--amber-soft); color: var(--amber); }
.timer.over { background: var(--alarm); color: #fff; }
.timer.over .lbl { color: #fff; opacity: .85; }
.timer.done { background: var(--green-soft); color: var(--green); }
.timer.late { background: var(--alarm-soft); color: var(--alarm); }
@media (prefers-reduced-motion: no-preference) {
  .timer.soon b { animation: tick 1s steps(2, jump-none) infinite; }
  @keyframes tick { 50% { opacity: .55; } }
}

/* ---------- кнопки и формы ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); padding: 6px 12px; border-radius: var(--radius-s); font: inherit; font-size: .88rem; font-weight: 500; cursor: pointer; line-height: 1.2; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-ink); }
.btn.go { background: var(--green); border-color: var(--green); color: #fff; }
.btn.go:hover { filter: brightness(.94); }
.btn.danger { color: var(--alarm); border-color: #E8B4AE; }
.btn.danger:hover { background: var(--alarm-soft); }
.btn.sm { padding: 3px 8px; font-size: .78rem; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--brand); }
form.inline { display: inline; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 12px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; margin-bottom: 12px; }
.filters label { display: flex; flex-direction: column; gap: 3px; font-size: .74rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
input[type=text], input[type=date], input[type=number], input[type=password], input[type=email], select, textarea {
  font: inherit; font-size: .9rem; padding: 6px 9px; border: 1px solid var(--line-2); border-radius: var(--radius-s); background: var(--surface); color: var(--ink); min-width: 0;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); outline: 2px solid var(--brand-soft-2); outline-offset: 0; }
textarea { width: 100%; min-height: 76px; resize: vertical; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; font-size: .8rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.field > input, .field > select, .field > textarea, .field .text { text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--ink); font-size: .92rem; }
.field .small, .field span.small { text-transform: none; letter-spacing: 0; font-weight: 400; }
.tabs { display: flex; gap: 2px; flex-wrap: wrap; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.tabs a { padding: 8px 12px; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.active { color: var(--brand-ink); border-bottom-color: var(--brand); }
.tabs .n { font-family: var(--mono); font-size: .76rem; color: var(--muted); margin-left: 5px; }
details { border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface); padding: 8px 12px; margin-bottom: 8px; }
details summary { cursor: pointer; font-weight: 600; font-size: .9rem; }
details[open] summary { margin-bottom: 8px; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.score { font-family: var(--mono); font-size: .76rem; color: var(--muted); }
.score b { color: var(--ink-2); font-weight: 500; }
.bar { height: 5px; background: var(--surface-2); border-radius: 3px; overflow: hidden; margin: 4px 0; }
.bar i { display: block; height: 100%; background: var(--brand); }
.series { border-left: 3px solid var(--brand-soft-2); padding-left: 10px; margin: 8px 0; }
.log { list-style: none; padding: 0; margin: 0; font-size: .86rem; }
.log li { padding: 6px 0; border-bottom: 1px dashed var(--line); }
.log li:last-child { border-bottom: 0; }
.log .t { font-family: var(--mono); font-size: .78rem; color: var(--muted); margin-right: 8px; }
.pager { margin-top: 10px; display: flex; gap: 12px; align-items: center; color: var(--muted); font-size: .86rem; }

/* ---------- жизненный цикл обращения ---------- */
.stepper { display: grid; grid-template-columns: repeat(7, 1fr); gap: 0; margin: 4px 0 4px; }
.step { position: relative; padding: 10px 8px 0 0; font-size: .78rem; color: var(--muted); }
.step::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--surface-3); }
.step.done::before { background: var(--brand); }
.step.current::before { background: var(--alarm); }
.step b { display: block; color: var(--ink); font-weight: 600; font-size: .8rem; white-space: nowrap; }
.step .t { font-family: var(--mono); color: var(--ink-2); font-size: .8rem; }
.step.pending b { color: var(--muted); font-weight: 500; }

/* ---------- вход ---------- */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-side { background: var(--brand-ink); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.login-side .wm { font-size: 2.4rem; font-weight: 700; letter-spacing: -.03em; }
.login-side .wm small { display: block; font-size: 1rem; font-weight: 500; opacity: .8; letter-spacing: 0; margin-top: 4px; }
.login-side ul { list-style: none; padding: 0; margin: 30px 0 0; font-size: 1rem; opacity: .92; }
.login-side li { padding: 8px 0; border-top: 1px solid rgba(255,255,255,.18); }
.login-side .foot { font-family: var(--mono); font-size: .8rem; opacity: .7; }
.login-form { display: flex; align-items: center; justify-content: center; padding: 40px; }
.login-form form { width: min(360px, 100%); }
.login-form h1 { margin-bottom: 18px; }
.err { background: var(--alarm-soft); color: var(--alarm); padding: 9px 12px; border-radius: var(--radius-s); margin-bottom: 12px; font-size: .9rem; }

/* ---------- отзывчивость ---------- */
@media (max-width: 1100px) { .now, .grid.cols-4 { grid-template-columns: 1fr 1fr; } .grid.cols-3 { grid-template-columns: 1fr 1fr; } .stepper { grid-template-columns: repeat(4, 1fr); row-gap: 10px; } }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 8px; padding: 10px 14px; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .side .foot { margin: 0; border: 0; padding: 0; margin-left: auto; }
  .main { padding: 16px 14px 48px; }
  .two { grid-template-columns: 1fr; }
  .login-wrap { grid-template-columns: 1fr; } .login-side { padding: 28px; }
}
@media (max-width: 600px) { .now, .grid.cols-4, .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr; } .stepper { grid-template-columns: 1fr 1fr; } }
