/* tasks.vismirnov.ru — mobile-first, без внешних CDN. */

:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --ink: #14181f;
  --muted: #5d6874;
  --line: #e2e6ea;
  --accent: #1c5fd6;
  --danger: #c8232c;
  --danger-bg: #fdeceb;
  --warn: #a35d00;
  --warn-bg: #fdf3e2;
  --ok: #1c7a4a;
  --ok-bg: #e8f5ee;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171c;
    --surface: #1c2027;
    --ink: #e8ebef;
    --muted: #9aa5b1;
    --line: #2b313a;
    --accent: #6ea3ff;
    --danger: #ff8b8b;
    --danger-bg: #35211f;
    --warn: #f0b565;
    --warn-bg: #33281a;
    --ok: #6bd39b;
    --ok-bg: #172b21;
    --shadow: none;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
}

a { color: var(--accent); }

.wrap { max-width: 960px; margin: 0 auto; padding: 0 12px 88px; }

/* --- шапка --- */
header.top {
  position: sticky; top: 0; z-index: 10;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
}
.top-row { display: flex; align-items: baseline; gap: 10px;
           max-width: 960px; margin: 0 auto; }
.top h1 { font-size: 18px; margin: 0; letter-spacing: -.01em; }
.sync { margin-left: auto; font-size: 12px; color: var(--muted); }
.sync.bad { color: var(--danger); font-weight: 600; }

/* --- навигация --- */
nav.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  display: flex; background: var(--surface);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
nav.tabs a {
  flex: 1; text-align: center; padding: 10px 2px 12px;
  font-size: 11px; color: var(--muted); text-decoration: none;
}
nav.tabs a.active { color: var(--accent); font-weight: 600; }
nav.tabs .ic { display: block; font-size: 18px; line-height: 1.2; }
nav.tabs .badge {
  display: inline-block; min-width: 16px; padding: 0 4px;
  background: var(--danger); color: #fff; border-radius: 8px;
  font-size: 10px; font-weight: 700; vertical-align: top;
}

@media (min-width: 720px) {
  nav.tabs { position: static; border-top: none; border-bottom: 1px solid var(--line);
             justify-content: center; gap: 4px; }
  nav.tabs a { flex: 0 0 auto; padding: 12px 16px; font-size: 14px; }
  nav.tabs .ic { display: none; }
  .wrap { padding-bottom: 40px; }
}

/* --- дата --- */
.date-line {
  font-size: 13px; color: var(--muted); font-weight: 600;
  padding: 12px 2px 0; text-transform: lowercase;
}

/* --- вердикт за пять секунд --- */
.verdict {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 14px; margin: 8px 0 4px;
  border-radius: var(--radius); text-decoration: none;
  border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); font-size: 15px; font-weight: 600;
}
.verdict.alarm { background: var(--danger-bg); border-color: transparent;
                 color: var(--danger); }
.verdict.calm  { background: var(--ok-bg); border-color: transparent;
                 color: var(--ok); }
.verdict .v-ic { font-size: 17px; line-height: 1; }
.verdict .v-text { flex: 1; }
.verdict .v-more { font-size: 12px; font-weight: 600; opacity: .75;
                   white-space: nowrap; }

/* --- карточки --- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 13px; margin: 10px 0;
  box-shadow: var(--shadow);
}
.card h2 { font-size: 15px; margin: 0 0 8px; letter-spacing: -.01em; }
.card h2 .count { color: var(--muted); font-weight: 400; }

/* Блок, который ждёт действия, отделяем от справочных. */
.card.need-action { border-left: 3px solid var(--danger); }

.card.as-details > summary {
  cursor: pointer; list-style: none;
}
.card.as-details > summary::-webkit-details-marker { display: none; }
.card.as-details > summary h2 { margin: 0; }

/* Порядковый номер в тройке главных дел. */
.rank {
  display: inline-block; min-width: 18px; height: 18px; line-height: 18px;
  margin-right: 7px; text-align: center; border-radius: 5px;
  background: var(--bg); color: var(--muted);
  font-size: 11px; font-weight: 700; vertical-align: 1px;
}

/* Свёрнутый индекс: одна строка вместо половины экрана. */
.compact-index {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--ink);
}
.compact-index .ci-label { flex: 1; font-size: 14px; }
.compact-index .ci-value {
  font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}
.compact-index .ci-value.nodata { font-size: 13px; font-weight: 500;
                                  color: var(--muted); }
.compact-index .ci-more { font-size: 12px; color: var(--accent); }

.logout { margin-top: 20px; }

.section-title {
  font-size: 12px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); margin: 22px 0 6px; font-weight: 600;
}

/* --- задача --- */
.task { padding: 11px 0; border-bottom: 1px solid var(--line); }
.task:last-child { border-bottom: none; }
.task-head { display: flex; gap: 8px; align-items: flex-start; }
.task-title { font-weight: 600; flex: 1; }
.task-meta { font-size: 13px; color: var(--muted); margin-top: 3px; }
.task-meta .sep { opacity: .5; padding: 0 5px; }
.task.overdue .task-title { color: var(--danger); }

.pill {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.pill.due { background: var(--danger-bg); color: var(--danger); }
.pill.wait { background: var(--warn-bg); color: var(--warn); }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.flat { background: var(--bg); color: var(--muted); }

/* --- метрики --- */
.metrics { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 720px) { .metrics { grid-template-columns: repeat(4, 1fr); } }

.metric {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px;
}
.metric .label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); font-weight: 600;
}
.metric .value {
  font-size: 20px; font-weight: 700; margin-top: 5px;
  letter-spacing: -.02em; font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.metric .hint { font-size: 11px; color: var(--muted); margin-top: 3px; }

/* --- индекс --- */
.index-big {
  font-size: 34px; font-weight: 700; letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
}
.index-big.nodata { font-size: 17px; color: var(--muted); font-weight: 500; }

.comp { margin: 9px 0; }
.comp-row { display: flex; font-size: 13px; gap: 8px; align-items: baseline; }
.comp-row .name { flex: 1; }
.comp-row .w { color: var(--muted); font-size: 11px; }
.comp-row .v { font-weight: 600; font-variant-numeric: tabular-nums; }
.comp-row .v.nodata { color: var(--muted); font-weight: 400; font-size: 12px; }
.bar { height: 5px; background: var(--line); border-radius: 3px; margin-top: 4px; }
.bar > i { display: block; height: 100%; border-radius: 3px; background: var(--muted); }
/* Цвет — сигнал, а не украшение: подсвечиваем только провал. */
.bar > i.low { background: var(--danger); }
.bar.nodata { opacity: .35; }

.index-head { display: flex; align-items: baseline; gap: 10px;
              flex-wrap: wrap; margin-bottom: 10px; }
.index-head .note { margin: 0; }

/* Ширина и высота задаются классами, а не инлайновым style: CSP
   (style-src 'self') инлайн блокирует, и полосы залипали на 100%. */
.w0   { width: 0 }      .w5   { width: 5% }    .w10  { width: 10% }
.w15  { width: 15% }    .w20  { width: 20% }   .w25  { width: 25% }
.w30  { width: 30% }    .w35  { width: 35% }   .w40  { width: 40% }
.w45  { width: 45% }    .w50  { width: 50% }   .w55  { width: 55% }
.w60  { width: 60% }    .w65  { width: 65% }   .w70  { width: 70% }
.w75  { width: 75% }    .w80  { width: 80% }   .w85  { width: 85% }
.w90  { width: 90% }    .w95  { width: 95% }   .w100 { width: 100% }

.h0   { height: 2px }   .h5   { height: 5% }   .h10  { height: 10% }
.h15  { height: 15% }   .h20  { height: 20% }  .h25  { height: 25% }
.h30  { height: 30% }   .h35  { height: 35% }  .h40  { height: 40% }
.h45  { height: 45% }   .h50  { height: 50% }  .h55  { height: 55% }
.h60  { height: 60% }   .h65  { height: 65% }  .h70  { height: 70% }
.h75  { height: 75% }   .h80  { height: 80% }  .h85  { height: 85% }
.h90  { height: 90% }   .h95  { height: 95% }  .h100 { height: 100% }

/* --- таблица --- */
.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
     color: var(--muted); font-weight: 600; white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums;
                 white-space: nowrap; }

/* --- формы и кнопки --- */
button, .btn {
  font: inherit; font-size: 14px; padding: 8px 13px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  cursor: pointer; text-decoration: none; display: inline-block;
}
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.small { padding: 5px 10px; font-size: 13px; }
button.danger { color: var(--danger); border-color: var(--danger); }
button:hover { filter: brightness(.97); }

input[type=text], input[type=password], input[type=datetime-local],
input[type=date], textarea, select {
  font: inherit; font-size: 16px; width: 100%; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: 9px;
  background: var(--surface); color: var(--ink);
}
label { display: block; font-size: 13px; color: var(--muted);
        margin: 9px 0 4px; font-weight: 500; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions { display: flex; gap: 6px; margin-top: 9px; flex-wrap: wrap; }

details.inline > summary {
  cursor: pointer; font-size: 13px; color: var(--accent);
  list-style: none; padding: 4px 0;
}
details.inline > summary::-webkit-details-marker { display: none; }
details.inline > div { padding: 8px 0 4px; }

.empty { color: var(--muted); font-size: 14px; padding: 8px 0; }
.note { font-size: 12px; color: var(--muted); margin-top: 6px; }

.banner {
  padding: 10px 12px; border-radius: 9px; font-size: 14px; margin: 12px 0;
}
.banner.danger { background: var(--danger-bg); color: var(--danger); }
.banner.warn { background: var(--warn-bg); color: var(--warn); }

/* --- вход --- */
.login-wrap { max-width: 360px; margin: 14vh auto; padding: 0 16px; }
.login-wrap h1 { font-size: 21px; margin: 0 0 4px; }
.login-wrap .sub { color: var(--muted); font-size: 14px; margin-bottom: 18px; }

/* --- kanban --- */
.kanban { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 8px; }
.kanban .col { flex: 0 0 210px; }
.kanban .col h3 {
  font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); margin: 0 0 7px;
}
.kanban .mini {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 9px; padding: 9px; margin-bottom: 7px; font-size: 13px;
}

/* --- тренд --- */
.trend { display: flex; align-items: flex-end; gap: 5px; height: 56px; margin-top: 8px; }
.trend .b { flex: 1; background: var(--accent); border-radius: 3px 3px 0 0;
            min-height: 2px; opacity: .8; }
.trend .b.nodata { background: var(--line); }
.trend-labels { display: flex; gap: 5px; margin-top: 4px; }
.trend-labels span { flex: 1; font-size: 9px; color: var(--muted);
                     text-align: center; overflow: hidden; }
