/* Расстановки — строгая аналитика.
   Монохром, один акцент, волосяные разделители вместо рамок и теней.
   Числа везде табличными цифрами, чтобы столбцы не плясали. */

:root {
    --bg: #fafafb;
    --surface: #ffffff;
    --ink: #14161a;
    --ink-2: #565d6b;
    --ink-3: #878d9b;
    --line: #e8eaee;
    --line-2: #d7dbe2;
    --accent: #2f5bea;
    --accent-ink: #ffffff;
    --danger: #b42318;
    --danger-bg: #fef4f2;
    --danger-line: #f4c7c1;
    --warn: #8a5a05;
    --warn-bg: #fffaeb;
    --warn-line: #f2dda6;
    --ok: #066f46;
    --ok-bg: #edfcf4;
    --ok-line: #b6e6cd;
    --radius: 10px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ------------------------------------------------------------------ шапка */
header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: saturate(160%) blur(8px);
    border-bottom: 1px solid var(--line);
}

header .bar {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 28px;
    height: 56px;
    display: flex;
    align-items: center;
    gap: 28px;
}

.brand {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--ink);
}
.brand:hover { text-decoration: none; }

header nav { display: flex; gap: 22px; }

header nav a {
    font-size: 14px;
    color: var(--ink-2);
    padding: 18px 0;
    border-bottom: 2px solid transparent;
}
header nav a:hover { color: var(--ink); text-decoration: none; }
header nav a.active {
    color: var(--ink);
    font-weight: 500;
    border-bottom-color: var(--ink);
}

main {
    max-width: 1240px;
    margin: 0 auto;
    padding: 32px 28px 64px;
}

/* ------------------------------------------------------- заголовок экрана */
.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

h1 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.page-head .sub {
    margin: 4px 0 0;
    color: var(--ink-3);
    font-size: 14px;
}

.subtitle { color: var(--ink-2); margin: 0 0 24px; }

/* -------------------------------------------------------------- кнопки */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 36px;
    padding: 0 14px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: var(--ink);
    color: #fff;
    font-size: 14px;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
}
.btn:hover { background: #000; text-decoration: none; color: #fff; }

.btn-secondary {
    background: var(--surface);
    color: var(--ink);
    border-color: var(--line-2);
}
.btn-secondary:hover { background: #f4f5f7; color: var(--ink); }

/* ---------------------------------------------------------- панель даты */
.date-bar {
    display: flex;
    align-items: center;
    gap: 8px;
}

.date-bar label { font-size: 13px; color: var(--ink-3); }

.date-bar input[type="date"] {
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--line-2);
    border-radius: 8px;
    background: var(--surface);
    font-family: inherit;
    font-size: 14px;
    color: var(--ink);
}

/* ------------------------------------------------------------- метрики */
.metrics {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 20px;
}

.metric {
    padding: 18px 20px 14px;
    border-left: 1px solid var(--line);
    min-width: 0;
}
.metric:first-child { border-left: 0; }

.metric .label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--ink-3);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.metric .value {
    margin-top: 6px;
    font-size: 32px;
    line-height: 1.1;
    font-weight: 600;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
}

.metric .delta {
    margin-top: 2px;
    font-size: 12px;
    color: var(--ink-3);
    font-variant-numeric: tabular-nums;
    height: 18px;
}
.metric .delta.up { color: var(--ink-2); }
.metric .delta.down { color: var(--ink-2); }

.spark { display: block; margin-top: 10px; height: 32px; width: 100%; }
.spark .area { fill: rgba(47, 91, 234, 0.10); }
.spark .line { fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.spark .dot { fill: var(--accent); }
.spark-empty { height: 32px; margin-top: 10px; }

/* -------------------------------------------------------------- панели */
.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    margin-bottom: 20px;
    overflow: hidden;
}

.panel > h2 {
    margin: 0;
    padding: 16px 20px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--ink);
    border-bottom: 1px solid var(--line);
}

.panel > p, .panel > ul { padding: 0 20px; }
.panel > p:first-of-type { margin-top: 16px; }
.panel > p:last-child { margin-bottom: 18px; }

.muted { color: var(--ink-2); font-size: 14px; }
.empty-note { color: var(--ink-3); font-size: 14px; }

/* -------------------------------------------------------------- таблица */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

thead th {
    padding: 10px 20px;
    text-align: left;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-3);
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

tbody td {
    padding: 11px 20px;
    border-bottom: 1px solid var(--line);
    color: var(--ink);
}

tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fafafc; }

th.num, td.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

td.dim { color: var(--ink-3); }

tr.total td {
    border-top: 1px solid var(--line-2);
    border-bottom: 0;
    font-weight: 600;
    background: #fbfbfd;
}
tr.total:hover td { background: #fbfbfd; }

.tag {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    background: #f1f2f5;
    color: var(--ink-2);
}

/* ------------------------------------------------------------ сообщения */
.message {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 14px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: var(--surface);
    margin-bottom: 20px;
    font-size: 14px;
}

.message .ico {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    margin-top: 1px;
}

.message-success { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok); }
.message-success a { color: var(--ok); text-decoration: underline; }
.message-error { background: var(--danger-bg); border-color: var(--danger-line); color: var(--danger); }
.message-error a { color: var(--danger); text-decoration: underline; }

/* --------------------------------------------------- панели ошибок */
.panel.is-error { border-color: var(--danger-line); }
.panel.is-error > h2 { background: var(--danger-bg); color: var(--danger); border-bottom-color: var(--danger-line); }

.panel.is-warn { border-color: var(--warn-line); }
.panel.is-warn > h2 { background: var(--warn-bg); color: var(--warn); border-bottom-color: var(--warn-line); }

.rowno {
    display: inline-block;
    min-width: 30px;
    padding: 1px 7px;
    border-radius: 6px;
    background: #f1f2f5;
    color: var(--ink);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    text-align: center;
}

.col-letter {
    color: var(--ink-3);
    font-size: 13px;
}

/* --------------------------------------------------------- зона загрузки */
.upload-form { margin: 0 0 20px; }

.dropzone {
    display: block;            /* это <label>: без block рамка рвётся на строки */
    background: var(--surface);
    border: 1.5px dashed var(--line-2);
    border-radius: 12px;
    padding: 36px 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}
.dropzone.hover { border-color: var(--accent); background: #f7f9ff; }

.dropzone .big {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 4px;
}

.dropzone .hint { color: var(--ink-3); font-size: 13px; margin-bottom: 18px; }

.dropzone input[type="file"] { display: none; }

.file-name {
    margin-top: 14px;
    font-size: 13px;
    color: var(--ink-2);
    min-height: 18px;
    font-variant-numeric: tabular-nums;
}

.dz-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

.steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    background: var(--line);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 20px;
}

.step { background: var(--surface); padding: 16px 18px; }

.step .n {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--ink);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 8px;
}

.step .t { font-size: 14px; font-weight: 500; margin-bottom: 2px; }
.step .d { font-size: 13px; color: var(--ink-3); }

.missing-list { list-style: none; margin: 16px 0 18px; padding: 0 20px; }
.missing-list li {
    display: inline-block;
    margin: 0 8px 8px 0;
    padding: 4px 10px;
    border-radius: 20px;
    background: var(--warn-bg);
    border: 1px solid var(--warn-line);
    color: var(--warn);
    font-size: 13px;
}

/* ------------------------------------------------------------- адаптив */
@media (max-width: 1080px) {
    .metrics { grid-template-columns: repeat(3, 1fr); }
    .metric:nth-child(4) { border-left: 0; }
    .metric:nth-child(n+4) { border-top: 1px solid var(--line); }
}

@media (max-width: 720px) {
    main { padding: 24px 16px 48px; }
    header .bar { padding: 0 16px; gap: 16px; }
    .metrics { grid-template-columns: repeat(2, 1fr); }
    .metric { border-left: 1px solid var(--line); }
    .metric:nth-child(odd) { border-left: 0; }
    .metric:nth-child(n+3) { border-top: 1px solid var(--line); }
    .steps { grid-template-columns: 1fr; }
    .table-wrap { overflow-x: auto; }
}

.table-wrap { overflow-x: auto; }

/* ------------------------------------------------------------------- вход */
.login-wrap {
    width: 100%;                 /* иначе 380px + поля страницы шире телефона */
    max-width: 380px;
    margin: 56px auto 0;
}

.login-wrap h1 { margin-bottom: 4px; }
.login-wrap .sub { color: var(--ink-3); font-size: 14px; margin: 0 0 24px; }

.login-panel { padding: 24px; }

.field { margin-bottom: 16px; }

.field label {
    display: block;
    font-size: 13px;
    color: var(--ink-2);
    margin-bottom: 6px;
}

.field input {
    display: block;
    width: 100%;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--line-2);
    border-radius: 8px;
    background: var(--surface);
    font-family: inherit;
    font-size: 15px;
    color: var(--ink);
}

.field input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(47, 91, 234, 0.12);
}

.btn-wide { width: 100%; justify-content: center; height: 40px; }

.login-note {
    margin-top: 16px;
    font-size: 13px;
    color: var(--ink-3);
    text-align: center;
}

/* --------------------------------------------------- баннер открытого режима */
.message-warn {
    background: var(--warn-bg);
    border-color: var(--warn-line);
    color: var(--warn);
}

/* ------------------------------------------------------------ кто вошёл */
.whoami {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: var(--ink-3);
}
.whoami .role {
    padding: 2px 8px;
    border-radius: 20px;
    background: #f1f2f5;
    color: var(--ink-2);
}

.nowrap { white-space: nowrap; }

.tag-ok { background: var(--ok-bg); color: var(--ok); }
.tag-bad { background: var(--danger-bg); color: var(--danger); }

.nodata { color: var(--ink-3); font-weight: 400; }
