/* ===== Фирменный стиль ЗЗД (взят с new.zzd23.ru / fgv-помощника) =====
   --navy #011b4a, --bronze #cc9a6e, Montserrat. Карточки r=12px, мягкие navy-тени. */
:root {
  --navy: #011b4a; --navy-2: #0f223d; --blue: #1e3a8a; --link: #1f6feb;
  --bronze: #cc9a6e; --bronze-d: #b9875b;
  --sky: #dce9f6; --sky-2: #eef3ff; --sky-3: #f5f8ff;
  --green: #10b981; --green-bg: #ecfdf5; --green-line: #a7f3d0;
  --red: #ef4444; --red-bg: #fff1f2; --red-line: #fecaca;
  --amber: #f59e0b; --amber-bg: #fff7d1;
  --bg: #f8f9fa; --surface: #fff; --line: #e5e7eb; --line-2: #e2e8f0;
  --ink: #0f223d; --muted: #64748b;
  --radius: 12px; --radius-sm: 8px;
  --shadow: 0 8px 32px rgba(1,27,74,.08);
  --shadow-sm: 0 4px 20px rgba(1,27,74,.06);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; color: var(--ink); background: var(--bg); font-size: 15px;
  font-family: "Montserrat", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  overflow-x: hidden;
}
a { color: var(--link); }
h1 { font-size: 1.5rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.02rem; }
h1, h2, h3, .brand { font-weight: 700; letter-spacing: -.01em; }
.muted { color: var(--muted); }

/* ===== Раскладка: боковая панель ZZD + контент ===== */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 250px; flex: 0 0 250px; position: sticky; top: 0; height: 100vh;
  background: linear-gradient(160deg, var(--navy) 0%, var(--navy-2) 100%); color: #fff;
  display: flex; flex-direction: column; padding: 1.1rem .9rem; border-right: 3px solid var(--bronze); }
.sidebar .brand { display: block; color: #fff; text-decoration: none; font-weight: 700; font-size: 1.5rem;
  padding: .2rem .5rem .8rem; border-bottom: 1px solid rgba(255,255,255,.12); }
.sidebar .brand .zzd { color: var(--bronze); }
.sidebar .brand small { display: block; font-weight: 400; font-size: .72rem; opacity: .75; margin-top: .25rem; line-height: 1.35; }
.nav { display: flex; flex-direction: column; gap: 3px; margin-top: 1rem; flex: 1; overflow-y: auto; }
.nav-item { display: flex; align-items: center; gap: .5rem; padding: .6rem .7rem; border-radius: var(--radius-sm);
  color: #cdd9ee; text-decoration: none; font-weight: 600; font-size: .92rem; }
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: rgba(204,154,110,.18); color: #fff; box-shadow: inset 3px 0 0 var(--bronze); }
.nav-item.small { font-weight: 500; font-size: .85rem; color: #aebfd8; padding: .45rem .7rem; }
.sidebar-foot { border-top: 1px solid rgba(255,255,255,.12); padding-top: .7rem; margin-top: .5rem; }
.sidebar-foot .user-name { font-size: .9rem; font-weight: 600; color: #fff; padding: 0 .7rem; }
.sidebar-foot .user-role { font-size: .76rem; color: var(--bronze); padding: 0 .7rem; margin-bottom: .35rem; }

.topbar { display: none; }
.hamburger { background: transparent; border: 1px solid rgba(255,255,255,.3); color: #fff; border-radius: 8px;
  font-size: 18px; line-height: 1; padding: 5px 11px; cursor: pointer; }
.sidebar-backdrop { display: none; }

.content { flex: 1; min-width: 0; padding: 1.4rem 1.7rem; max-width: 1220px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .8rem; flex-wrap: wrap; }
.page-head h1 { margin: .2rem 0; }
.page-head p { margin: .1rem 0 0; }
.page-head > div { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.page-head > div:first-child { flex-direction: column; align-items: flex-start; gap: .1rem; }

/* ===== Кнопки ===== */
.btn {
  display: inline-flex; align-items: center; gap: .35rem; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); padding: .5rem 1rem; border-radius: 999px;
  text-decoration: none; cursor: pointer; font-size: .92rem; font-weight: 600;
  font-family: inherit; transition: .15s; line-height: 1.2;
}
.btn:hover { background: #f0f3f8; }
.btn-primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-primary:hover { background: #06245e; }
.btn-success { background: var(--green); border-color: var(--green); color: #fff; }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { filter: brightness(1.05); }
.btn-ghost { background: transparent; }
.btn-sm { padding: .3rem .75rem; font-size: .85rem; }

/* ===== Flash ===== */
.flash { padding: .7rem 1rem; border-radius: var(--radius-sm); margin: .7rem 0; border: 1px solid var(--line); }
.flash-ok { background: var(--green-bg); border-color: var(--green-line); }
.flash-error { background: var(--red-bg); border-color: var(--red-line); }

/* ===== Login ===== */
.login-wrap { min-height: 70vh; display: grid; place-items: center; }
.login-card { width: 380px; max-width: 92vw; background: var(--surface); padding: 2rem 1.8rem;
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.login-card .login-logo { text-align: center; font-weight: 700; font-size: 1.6rem; color: var(--navy); margin-bottom: .2rem; }
.login-card .login-logo .zzd { color: var(--bronze); }
.login-card .login-sub { text-align: center; color: var(--muted); margin-bottom: 1.4rem; font-size: .9rem; }
.login-card label { display: block; margin-bottom: .9rem; font-size: .88rem; font-weight: 600; color: var(--muted); }
.login-card input { width: 100%; margin-top: .3rem; }
.login-card .btn { width: 100%; justify-content: center; }
.hint { color: var(--muted); font-size: .82rem; text-align: center; margin-top: 1rem; }

/* ===== Поля ===== */
input[type=text], input:not([type]), input[type=date], input[type=number],
input[type=password], textarea, select {
  padding: .5rem .6rem; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-size: .95rem; font-family: inherit; background: #fff; color: var(--ink); transition: .12s;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--bronze); box-shadow: 0 0 0 3px rgba(204,154,110,.18);
}

/* ===== Таблицы-списки ===== */
.card-table { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; margin: .9rem 0; }
table.grid { width: 100%; border-collapse: collapse; }
table.grid th, table.grid td { padding: .6rem .8rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
table.grid thead th { background: var(--sky-2); color: var(--navy); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
table.grid tbody tr:hover { background: var(--sky-3); }
table.grid tbody tr:last-child td { border-bottom: none; }
.row-actions a { color: var(--link); text-decoration: none; font-weight: 700; font-size: 1.05rem; }

/* ===== Бейджи статусов ===== */
.badge { display: inline-block; padding: .18rem .65rem; border-radius: 999px; font-size: .78rem; font-weight: 600; border: 1px solid var(--line); white-space: nowrap; }
.st-worked  { background: var(--green-bg); border-color: var(--green-line); color: #047857; }
.st-failed  { background: var(--red-bg); border-color: var(--red-line); color: #b91c1c; }
.st-testing { background: var(--amber-bg); border-color: #fde68a; color: #92400e; }
.st-backlog { background: #f1f5f9; color: var(--muted); }

/* ===== Плитки-счётчики ===== */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .7rem; margin: .3rem 0 1rem; }
.stat-tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: .7rem .9rem; }
.stat-num { font-size: 1.5rem; font-weight: 700; color: var(--navy); line-height: 1.1; }
.stat-lbl { font-size: .8rem; color: var(--muted); font-weight: 600; }
.st-tile-worked { border-left: 4px solid var(--green); }
.st-tile-failed { border-left: 4px solid var(--red); }
.st-tile-testing { border-left: 4px solid var(--amber); }
.st-tile-backlog { border-left: 4px solid var(--line-2); }
.metric-tiles .stat-num { font-size: 1.35rem; }

/* ===== Таблица гипотез ===== */
.hyp-grid .col-rank { width: 2.2rem; color: var(--muted); font-weight: 700; text-align: center; }
.hyp-grid .hyp-title { color: var(--navy); font-weight: 700; text-decoration: none; }
.hyp-grid .hyp-title:hover { text-decoration: underline; }
.cat-chip { display: inline-block; background: var(--sky); color: var(--navy); font-size: .72rem; font-weight: 600;
  border-radius: 999px; padding: .05rem .55rem; margin-left: .4rem; vertical-align: middle; }
.hyp-desc { color: var(--muted); font-size: .82rem; margin-top: .25rem; max-width: 40ch;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.col-metric { max-width: 15rem; }
.mt-name { font-size: .85rem; }
.mt-vals { font-size: .82rem; color: var(--muted); margin-top: .15rem; }
.col-term { white-space: nowrap; font-size: .85rem; }
.col-ice { text-align: center; width: 4.5rem; }
.ice-mini { font-size: .72rem; color: var(--muted); margin-top: .2rem; }
.status-quick { margin: 0; }
.st-select { padding: .3rem .5rem; font-size: .82rem; font-weight: 600; border-radius: 999px; cursor: pointer; }
.st-select.st-worked  { background: var(--green-bg); color: #047857; border-color: var(--green-line); }
.st-select.st-failed  { background: var(--red-bg); color: #b91c1c; border-color: var(--red-line); }
.st-select.st-testing { background: var(--amber-bg); color: #92400e; border-color: #fde68a; }
.st-select.st-backlog { background: #f1f5f9; color: var(--muted); }

/* ===== ICE-бейдж ===== */
.ice-badge { display: inline-block; min-width: 2.1rem; text-align: center; font-weight: 700; font-size: .95rem;
  border-radius: 999px; padding: .12rem .5rem; border: 1px solid var(--line); background: #f1f5f9; color: var(--muted); }
.ice-high { background: var(--green-bg); color: #047857; border-color: var(--green-line); }
.ice-mid  { background: var(--amber-bg); color: #92400e; border-color: #fde68a; }
.ice-low  { background: var(--red-bg); color: #b91c1c; border-color: var(--red-line); }
.ice-none { background: #f1f5f9; color: #94a3b8; }

/* ===== Карточки / колонки ===== */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; margin: 1rem 0; box-shadow: var(--shadow-sm); }
.card h3 { color: var(--navy); margin-top: 0; }
.cols { display: grid; grid-template-columns: 1fr 320px; gap: 1.1rem; align-items: start; }
.col-side .card { margin-top: 0; }
table.kv { border-collapse: collapse; width: 100%; }
table.kv th { text-align: left; width: 190px; vertical-align: top; padding: .4rem .6rem; color: var(--muted); font-weight: 600; }
table.kv td { padding: .4rem .6rem; border-bottom: 1px solid #eef1f5; }
table.kv tr:last-child td, table.kv tr:last-child th { border-bottom: none; }
.kv-tight th { width: 62%; } .kv-tight th, .kv-tight td { padding: .3rem .5rem; font-size: .88rem; }

.ice-card { text-align: center; border-color: var(--bronze); }
.ice-big { font-size: 2.6rem; font-weight: 700; border-radius: var(--radius); padding: .4rem; margin: .2rem 0 .6rem; }
.ice-card table.kv th { width: auto; text-align: left; }
.ice-card table.kv td { text-align: right; }

.decision-box { border-color: var(--bronze); background: linear-gradient(135deg, #fff 0%, var(--sky-3) 100%); }

/* ===== Формы ===== */
.hyp-form fieldset { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin: 1rem 0; padding: 1.1rem 1.2rem; box-shadow: var(--shadow-sm); }
.hyp-form legend { font-weight: 700; padding: 0 .5rem; color: var(--navy); font-size: 1.02rem; }
.hyp-form .row { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: .7rem; }
.hyp-form label { display: flex; flex-direction: column; font-size: .85rem; gap: .28rem; color: var(--muted); font-weight: 600; margin-bottom: .7rem; }
.hyp-form label b { color: var(--navy); font-weight: 700; }
.hyp-form label.full { display: block; }
.hyp-form label.full > input, .hyp-form label.full > textarea { width: 100%; }
.hyp-form .col2 { flex: 1 1 240px; }
.hyp-form .col-narrow { flex: 0 1 200px; }
.hyp-form input, .hyp-form textarea, .hyp-form select { font-weight: 400; color: var(--ink); }
.form-actions { display: flex; gap: .8rem; margin: 1.2rem 0 .3rem; }

/* ===== ICE-слайдеры ===== */
.score-hint { margin: 0 0 .8rem; }
.score-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.score-axis { background: var(--sky-3); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .7rem .8rem; }
.score-axis-head { display: flex; justify-content: space-between; align-items: baseline; }
.score-axis-head b { color: var(--navy); }
.score-val { font-size: 1.3rem; font-weight: 700; color: var(--bronze-d); }
.score-axis-desc { font-size: .78rem; margin-bottom: .5rem; }
.score-range { width: 100%; accent-color: var(--navy); }
.ice-result { margin-top: 1rem; font-weight: 600; color: var(--navy); display: flex; align-items: center; gap: .5rem; }
.ice-result .ice-badge { font-size: 1.2rem; min-width: 3rem; }

/* ===== Спринт ===== */
.goal-card { border-color: var(--bronze); }
.goal-label { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.goal-text { font-size: 1.3rem; font-weight: 700; color: var(--navy); margin: .3rem 0 1.1rem; }
.progress-head { display: flex; justify-content: space-between; font-size: .85rem; color: var(--muted); margin-bottom: .35rem; }
.progress-head b { color: var(--navy); font-size: 1rem; }
.progress-bar { height: 16px; background: var(--sky); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--bronze), var(--navy)); border-radius: 999px; transition: width .4s; }
.golden-card { background: linear-gradient(135deg, #fff 0%, #fff7ec 100%); border-color: var(--bronze); }
.golden-card h3 { color: var(--bronze-d); }

/* ===== Дашборд ===== */
.year-nav { display: flex; align-items: center; gap: .5rem; }
.year-cur { font-weight: 700; font-size: 1.1rem; color: var(--navy); }
.legend { display: flex; flex-wrap: wrap; gap: .4rem 1rem; margin: .3rem 0 .9rem; font-size: .8rem; color: var(--muted); }
.legend-item { display: inline-flex; align-items: center; gap: .35rem; }
.legend-item i { width: 14px; height: 14px; border-radius: 3px; display: inline-block; }
.dash-scroll table.dash-grid { min-width: 780px; }
.dash-grid th, .dash-grid td { text-align: center; padding: .45rem .35rem; border: 1px solid var(--line); }
.dash-grid .dash-metric { text-align: left; white-space: nowrap; font-weight: 600; color: var(--navy); background: var(--sky-3); position: sticky; left: 0; }
.dash-unit { color: var(--muted); font-weight: 400; font-size: .75rem; margin-left: .3rem; }
.dash-mo { font-size: .74rem; }
.dash-cell { font-size: .8rem; }
.cell-fact { font-weight: 700; }
.cell-plan { color: var(--muted); font-size: .72rem; }
.dash-year { font-weight: 700; background: var(--sky-2); }
.dash-hint { font-size: .8rem; margin: .3rem 0 1rem; }
.dash-edit { display: flex; flex-wrap: wrap; gap: .8rem; align-items: flex-end; }
.dash-edit label { display: flex; flex-direction: column; font-size: .8rem; font-weight: 600; color: var(--muted); gap: .25rem; }

/* ===== Фильтры списка ===== */
.filters { display: flex; flex-wrap: wrap; gap: .5rem; margin: .2rem 0 1rem; align-items: center; }
.filters select { font-size: .88rem; }

/* ===== Чипы отдел/направление ===== */
.chip-row { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .25rem; }
.dep-chip, .dir-chip { font-size: .72rem; font-weight: 600; border-radius: 999px; padding: .05rem .5rem; border: 1px solid var(--line); }
.dep-chip { background: var(--sky-2); color: var(--navy); }
.dir-chip { background: #fff3e6; color: var(--bronze-d); border-color: #f0d9bf; }

/* ===== Админка справочников ===== */
.cols-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; align-items: start; }
.dict-list { list-style: none; margin: .4rem 0; padding: 0; }
.dict-list li { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; padding: .3rem 0; border-bottom: 1px dashed var(--line); }
.dict-list li.off { opacity: .5; }
.dict-list .inline-form { margin: 0; }
.dict-list .inline-form input[type=text] { width: 11rem; }
.add-form { margin-top: .6rem !important; }

.empty-box { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); padding: 2rem; text-align: center; color: var(--muted); }
.empty-box .btn { margin-top: .5rem; }

.inline-form { display: inline-flex; gap: .3rem; align-items: center; margin: .15rem .3rem .15rem 0; }
.inline-form input { padding: .25rem .4rem; font-size: .82rem; }
.page-foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 1.5rem 0 .5rem; }

/* ===== Адаптив ===== */
@media (max-width: 980px) { .cols { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  .card-table { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .card-table table.hyp-grid { min-width: 680px; }
}
@media (max-width: 899px) {
  .layout { display: block; }
  .topbar { display: flex; align-items: center; gap: .8rem; position: sticky; top: 0; z-index: 30;
    background: linear-gradient(135deg, var(--navy), var(--navy-2)); color: #fff;
    padding: .55rem .9rem; border-bottom: 2px solid var(--bronze); }
  .topbar .brand { color: #fff; text-decoration: none; font-weight: 700; font-size: 1.15rem; }
  .topbar .brand .zzd { color: var(--bronze); }
  .sidebar { position: fixed; top: 0; left: 0; height: 100vh; width: 250px; z-index: 40;
    transform: translateX(-100%); transition: transform .25s ease; box-shadow: 2px 0 28px rgba(0,0,0,.45); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(0,0,0,.5); }
  .content { padding: 1rem .9rem; max-width: none; }
}
@media (max-width: 600px) {
  h1 { font-size: 1.22rem; }
  .hyp-form .col2, .hyp-form .col-narrow { flex: 1 1 100%; }
  input[type=text], input:not([type]), input[type=date], input[type=number],
  input[type=password], textarea, select { font-size: 16px; }
  .form-actions { flex-wrap: wrap; }
  .form-actions .btn { flex: 1 1 auto; justify-content: center; }
}
