/* Дизайн-код кабинета — docs/design_code.md.
   Стиль: светлые карточки со скруглениями и мягкими тенями, пилюли-кнопки,
   шрифт Golos Text. Все цвета — только через переменные из base.html
   (вычисляются из базового оттенка Иттена). Новых цветов здесь не вводить. */

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Golos Text", "Segoe UI", system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.5;
}

h1 { font-size: 26px; font-weight: 700; margin: 0 0 20px; letter-spacing: -0.3px; }

/* --- Сайдбар-полоса: иконки всегда, надписи при наведении --- */
body { padding-left: var(--rail); }

.rail {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--rail);
    background: #fff;
    box-shadow: 2px 0 14px var(--shadow);
    z-index: 40;
    overflow: hidden;
    transition: width 0.22s ease, box-shadow 0.22s ease;
    display: flex;
    flex-direction: column;
}
.rail:hover {
    width: var(--rail-open);
    box-shadow: 8px 0 28px var(--shadow-hover);
}
.rail-brand {
    font-size: 24px;
    padding: 18px 0 14px;
    text-align: center;
    flex-shrink: 0;
}
.rail:hover .rail-brand { text-align: left; padding-left: 20px; }
.rail-nav { display: flex; flex-direction: column; gap: 4px; padding: 0 10px 16px; flex: 1; }
.rail-spacer { flex: 1; }
.rail-nav a, .rail-soon {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 11px 10px;
    border-radius: var(--radius-input);
    text-decoration: none;
    white-space: nowrap;
}
.rail-nav a { color: var(--text); }
.rail-nav a:hover { background: var(--hover); }
.rail-nav a.active { background: var(--tint); color: var(--primary); }
.rail-soon { color: var(--text-muted); opacity: 0.55; font-size: 14px; }
.rail-nav .ico { font-size: 20px; width: 24px; text-align: center; flex-shrink: 0; }
.rail-nav .lbl {
    font-size: 14.5px;
    font-weight: 500;
    opacity: 0;
    transform: translateX(6px);
    transition: opacity 0.18s ease 0.05s, transform 0.18s ease 0.05s;
}
.rail:hover .lbl { opacity: 1; transform: none; }

/* --- Плавающая шапка --- */
.topbar {
    background: #fff;
    border-radius: var(--radius-card);
    box-shadow: 0 4px 18px var(--shadow);
    display: flex;
    align-items: center;
    gap: 20px;
    max-width: 1140px;
    margin: 20px auto 0;
    padding: 14px 24px;
}
.brand { font-weight: 700; font-size: 17px; white-space: nowrap; display: flex; align-items: center; gap: 8px; flex: 1; }
.brand-mark { font-size: 20px; }
.user { font-size: 14px; display: flex; align-items: center; gap: 12px; }
.user-name { color: var(--text-muted); font-weight: 500; }
.user a { color: var(--primary); text-decoration: none; font-weight: 500; }
.user a:hover { text-decoration: underline; }

main { max-width: 1140px; margin: 28px auto 48px; padding: 0 20px; }

/* --- Карточки --- */
.card {
    background: #fff;
    border-radius: var(--radius-card);
    box-shadow: 0 4px 18px var(--shadow);
    padding: 22px 26px;
    margin-bottom: 20px;
}

/* --- Кнопки-пилюли --- */
.btn {
    display: inline-block;
    background: var(--primary);
    color: var(--on-primary);
    border: 1.5px solid transparent;
    border-radius: var(--radius-pill);
    padding: 10px 22px;
    cursor: pointer;
    font-size: 14.5px;
    font-weight: 600;
    font-family: inherit;
    text-decoration: none;
    transition: filter 0.15s, box-shadow 0.15s;
}
.btn:hover { filter: brightness(1.1); box-shadow: 0 4px 14px var(--shadow-hover); }
.btn-light {
    background: #fff;
    color: var(--primary);
    border-color: var(--primary);
}
.btn-light:hover { background: var(--tint); box-shadow: 0 4px 14px var(--shadow); }
.btn-danger { background: var(--danger); border-color: var(--danger); }
.btn-danger:hover { filter: brightness(1.1); box-shadow: 0 4px 14px var(--shadow); }
.btn[disabled] { opacity: 0.5; cursor: default; box-shadow: none; }

/* --- Формы --- */
label { display: block; font-size: 13px; font-weight: 500; color: var(--text-muted); margin: 10px 0 5px; }
input[type="text"], input[type="password"], input[type="number"], input[type="date"] {
    width: 100%;
    max-width: 320px;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-input);
    font-size: 14.5px;
    font-family: inherit;
    color: var(--text);
    background: #fff;
    transition: border-color 0.15s;
}
input:focus { outline: none; border-color: var(--focus); }

.btn-sm { padding: 6px 14px; font-size: 13px; }
.inline-form { display: flex; align-items: center; gap: 8px; margin: 0; }
.inline-form input[type="date"] { max-width: 160px; padding: 6px 10px; font-size: 13.5px; }

/* Прогресс фоновых заданий */
.progress {
    height: 8px;
    background: var(--surface-alt);
    border-radius: var(--radius-pill);
    overflow: hidden;
    margin: 6px 0 12px;
}
.progress > div {
    height: 100%;
    background: var(--primary);
    border-radius: var(--radius-pill);
    transition: width 0.4s;
}
.event-log { font-size: 14px; color: var(--text); }

/* Выпадающие списки и спойлеры */
select {
    width: 100%;
    max-width: 420px;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-input);
    font-size: 14.5px;
    font-family: inherit;
    color: var(--text);
    background: #fff;
}
details { margin-top: 10px; }
summary {
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--primary);
    margin-bottom: 6px;
}
.cluster-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 22px;
    max-width: 640px;
}
.upload-form input[type="file"] {
    font-size: 13px;
    margin: 8px 0;
    max-width: none;
}

/* --- Блок проверки ключей --- */
.key-check { display: flex; align-items: center; flex-wrap: wrap; font-size: 15px; }
.key-check .msg-err { flex-basis: 100%; margin: 12px 0 0; }
.key-dot {
    width: 12px; height: 12px;
    border-radius: 50%;
    background: var(--border);
    display: inline-block;
    margin-right: 10px;
    flex-shrink: 0;
}
.key-dot.ok { background: var(--success); box-shadow: 0 0 0 4px var(--success-bg); }
.key-dot.fail { background: var(--danger); box-shadow: 0 0 0 4px var(--danger-bg); }
.keys-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-left: 22px; }
.keys-status { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.keys-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.exp { color: var(--text-muted); }
.exp-warn { color: var(--danger); font-weight: 600; }
.keys-form { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; margin-top: 12px; flex-basis: 100%; }
.keys-form input { max-width: 260px; margin: 0; }
.keys-form .btn { margin-top: 0; }
.btn-trash {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 17px;
    line-height: 1;
    padding: 4px 6px;
}
.btn-trash:hover { transform: scale(1.15); }

/* Строки синхронизаций на «Складе» */
.sync-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 9px 0;
    font-size: 14.5px;
}
.sync-row .exp { margin-left: 2px; }
.line-sep { border-top: 1px solid var(--surface-alt); }
.report-h { font-size: 19px; margin: 26px 0 14px; }
.actions-cell { white-space: nowrap; }
.actions-cell .btn { margin-right: 6px; }
.pill {
    display: inline-block;
    background: var(--tint);
    color: var(--primary);
    border-radius: var(--radius-pill);
    font-size: 11.5px;
    font-weight: 600;
    padding: 2px 10px;
    margin-left: 6px;
}

.form-inline { display: flex; align-items: flex-end; gap: 20px; flex-wrap: wrap; }
.form-inline .field { min-width: 140px; }
.form-inline .btn { margin-top: 10px; }
.checkline { display: flex; align-items: center; gap: 8px; margin: 10px 0 0; white-space: nowrap; font-size: 14px; color: var(--text); }
.checkline input { width: auto; accent-color: var(--primary); }

/* --- Дашборд: плитки разделов --- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
.cards .card { margin-bottom: 0; }
.card-link {
    text-decoration: none;
    color: inherit;
    transition: transform 0.15s, box-shadow 0.15s;
}
.card-link:hover { transform: translateY(-3px); box-shadow: 0 8px 26px var(--shadow-hover); }
.card-soon { opacity: 0.55; }
.card-icon {
    width: 46px; height: 46px;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px;
    background: var(--tint);
    border-radius: 12px;
    margin-bottom: 12px;
}
.card-title { font-weight: 600; font-size: 15.5px; margin-bottom: 4px; }
.card-text { font-size: 13px; color: var(--text-muted); line-height: 1.45; }

/* --- Таблица отчёта: светлая шапка, карточка, скругления --- */
.table-wrap {
    overflow-x: auto;
    background: #fff;
    border-radius: var(--radius-card);
    box-shadow: 0 4px 18px var(--shadow);
}
table.report { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.report th {
    background: var(--surface-alt);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 12.5px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    padding: 11px 14px;
    text-align: center;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}
table.report td { padding: 10px 14px; border-bottom: 1px solid var(--surface-alt); text-align: center; }
table.report tbody tr:last-child td { border-bottom: none; }
table.report td:first-child { text-align: left; font-weight: 500; }
table.report tbody tr:hover td { box-shadow: inset 0 0 0 999px rgba(47,111,219,.07); }
table.report .xh-col, table.report .xh-row { box-shadow: inset 0 0 0 999px rgba(47,111,219,.07); }
table.report .xh-row.xh-col, table.report td.xh-core { box-shadow: inset 0 0 0 999px rgba(47,111,219,.16); }
.d-red { background: #fde3e3; }
.d-yellow { background: #fff4cf; }
table.report tr.total td {
    background: var(--tint);
    color: var(--primary);
    font-weight: 700;
    border-top: 2px solid var(--primary);
}
table.report tr.total td:first-child { text-align: left; }

/* --- Сообщения (семантика фиксирована) --- */
.msg-ok {
    background: var(--success-bg); border: 1px solid var(--success-border); color: var(--success);
    padding: 12px 16px; border-radius: var(--radius-input); margin-bottom: 18px;
}
.msg-err {
    background: var(--danger-bg); border: 1px solid var(--danger-border); color: var(--danger);
    padding: 12px 16px; border-radius: var(--radius-input); margin-bottom: 18px;
}
.hint { font-size: 13px; color: var(--text-muted); margin: 8px 0 16px; }
.tot { font-size: 15px; margin-bottom: 4px; }

/* --- Вход / регистрация --- */
.auth { max-width: 400px; margin: 56px auto 0; }
.auth h1 { text-align: center; }
.auth .card { padding: 28px 32px; }
.auth .btn { margin-top: 18px; width: 100%; }
