/* ---------- Токены ---------- */
:root {
    --font-ui: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
    --font-mono: "Cascadia Code", "Cascadia Mono", Consolas, "SFMono-Regular", ui-monospace, Menlo, monospace;

    --gray-950: #1a1a1c;
    --gray-900: #2c2c2e;
    --gray-800: #3a3a3d;
    --gray-700: #48484b;
    --gray-600: #58585a;
    --gray-500: #6f6f72;
    --gray-300: #b0b0b3;
    --gray-100: #efeff0;

    --bg: var(--gray-900);
    --surface: var(--gray-600);
    --surface-2: var(--gray-700);
    --border: var(--gray-500);
    --text: var(--gray-100);
    --muted: var(--gray-300);

    --accent: #86b6dd;
    --accent-hover: #6ba0cb;
    --accent-soft: rgba(134, 182, 221, .18);
    --accent-ink: #14181c;

    --success: #4ecb84;
    --error: #ff6f61;
    --missing: var(--gray-300);
    --unclear: #ffbf5e;

    --radius: 8px;

    --login-bg-1: var(--gray-950);
    --login-bg-2: var(--gray-900);
    --login-bg-3: var(--gray-800);
    --login-card-bg: var(--gray-800);
    --login-card-border: rgba(255, 255, 255, 0.14);
    --login-text: var(--gray-100);
    --login-muted: var(--gray-300);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font-ui);
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.5;
}

h2 {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin: 0 0 16px;
}
h3 {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 12px;
}

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

.dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent);
    margin-right: 9px;
    flex: none;
}

/* ---------- Верхняя панель приложения ---------- */
.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 28px;
    background: linear-gradient(135deg, var(--gray-950) 0%, var(--gray-900) 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-wrap: wrap;
    gap: 10px;
}
.nav-brand {
    display: flex;
    align-items: center;
    font-family: var(--font-mono);
    font-size: 14.5px;
    color: var(--gray-100);
}
.nav-links a {
    margin-left: 18px;
    text-decoration: none;
    color: var(--gray-300);
    font-size: 13.5px;
    transition: color .15s ease;
}
.nav-links a:hover { color: var(--gray-100); }

.container {
    max-width: none;
    margin: 32px 0;
    padding: 0 1cm;
}

/* ---------- Таблицы ---------- */
.table-scroll {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}
.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--surface);
}
.table th {
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .02em;
    color: var(--muted);
    background: var(--surface-2);
    padding: 10px 16px;
    white-space: nowrap;
    border-bottom: 1px solid var(--border);
}
.table td {
    padding: 11px 16px;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    white-space: nowrap;
}
.table td.wrap { white-space: normal; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: var(--surface-2); }

.mono { font-family: var(--font-mono); font-size: 13px; }

.status-success .status-cell,
.status-new .status-cell { color: var(--success); font-weight: 600; }
.status-error .status-cell,
.status-deleted .status-cell { color: var(--error); font-weight: 600; }
.status-missing .status-cell { color: var(--missing); font-weight: 600; }
.status-unclear .status-cell { color: var(--unclear); font-weight: 600; }
.status-pending .status-cell { color: var(--muted); }

/* ---------- Кнопки ---------- */
.btn, button {
    display: inline-block;
    background: var(--accent);
    color: var(--accent-ink);
    border: none;
    padding: 9px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    text-decoration: none;
    transition: background .15s ease;
}
.btn:hover, button:hover { background: var(--accent-hover); }
.btn-small { padding: 5px 11px; font-size: 12.5px; border-radius: 5px; }
.btn-danger { background: var(--error); color: #fff; }
.btn-danger:hover { background: #e35b4e; }
.btn-outline {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
    font-weight: 500;
}
.btn-outline:hover { background: var(--surface-2); }

/* ---------- Формы ---------- */
form { display: flex; flex-direction: column; gap: 8px; max-width: 440px; margin-top: 14px; }
/* точечные кнопки-формы (проверить сейчас/всё, удалить) не должны растягиваться на всю
   ширину контейнера — form{display:flex;flex-direction:column} выше стягивает по умолчанию */
.inline-form { display: inline-block; width: auto; max-width: none; margin: 0; }
label { font-size: 13px; color: var(--muted); margin-top: 8px; font-weight: 500; }
input[type=text], input[type=password], input[type=time], input[type=number] {
    padding: 9px 11px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    background: var(--gray-700);
    color: var(--text);
}
input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.hint { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

a:focus-visible, button:focus-visible, input:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ---------- Разное ---------- */
.banner { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; font-size: 14px; border: 1px solid transparent; }
.banner.warn { background: rgba(255, 191, 94, .15); color: var(--unclear); border-color: rgba(255, 191, 94, .35); }
.banner.error-banner { background: rgba(255, 111, 97, .15); color: #ff9a90; border-color: rgba(255, 111, 97, .35); }
.banner.ok-banner { background: rgba(78, 203, 132, .15); color: var(--success); border-color: rgba(78, 203, 132, .35); }
.error { color: var(--error); font-size: 14px; }
.ok { color: var(--success); }
.warn { color: var(--unclear); }
.settings-block { background: var(--surface); padding: 20px; border-radius: var(--radius); margin-bottom: 20px; border: 1px solid var(--border); }

/* ---------- Страница входа ---------- */
body.auth-shell {
    background-image:
        radial-gradient(1000px 720px at 50% 76%, #c6c6c8 0%, #97979a 30%, #5c5c5f 58%, #2c2c2e 100%),
        radial-gradient(760px 560px at 88% 6%, rgba(0, 0, 0, .55), transparent 62%),
        radial-gradient(640px 500px at 8% 12%, rgba(255, 255, 255, .07), transparent 55%);
    background-repeat: no-repeat;
    background-size: 140% 140%, 200% 200%, 200% 200%;
    background-position: 50% 60%, 0% 0%, 0% 0%;
    animation: shimmer 30s ease-in-out infinite;
    color: var(--login-text);
    position: relative;
}
@keyframes shimmer {
    0%, 100% { background-position: 50% 60%, 0% 0%, 0% 0%; }
    50% { background-position: 46% 66%, 20% 15%, 15% 10%; }
}
@media (prefers-reduced-motion: reduce) {
    body.auth-shell { animation: none; }
}

body.auth-shell .container {
    max-width: none;
    margin: 0;
    padding: 24px;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-box {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 360px;
    background: var(--login-card-bg);
    border: 1px solid var(--login-card-border);
    border-radius: 12px;
    padding: 36px 32px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .4);
}
.login-brand {
    display: flex;
    align-items: center;
    font-family: var(--font-mono);
    font-size: 17px;
    color: var(--login-text);
}
.login-sub {
    color: var(--login-muted);
    font-size: 13px;
    margin: 6px 0 24px;
}
.login-box label { color: var(--login-muted); }
.login-box input {
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(255, 255, 255, .16);
    color: var(--login-text);
}
.login-box input::placeholder { color: rgba(255, 255, 255, .35); }
.login-box input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.login-box button {
    width: 100%;
    margin-top: 10px;
    background: var(--accent);
    color: var(--accent-ink);
}
.login-box button:hover { background: var(--accent-hover); }

/* ---------- Бегунок-переключатель ---------- */
.switch-row { display: flex; flex-direction: column; gap: 14px; }
.switch-form { display: flex; flex-direction: row; align-items: center; gap: 12px; margin: 0; max-width: none; }
.switch-label { font-size: 14px; color: var(--text); }
.switch {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 24px;
    flex: none;
    cursor: pointer;
}
.switch input {
    position: absolute;
    inset: 0;
    opacity: 0;
    margin: 0;
    cursor: pointer;
    z-index: 1;
}
.switch-track {
    position: absolute;
    inset: 0;
    background: var(--gray-500);
    border-radius: 999px;
    transition: background .18s ease;
}
.switch-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .35);
    transition: transform .18s ease;
}
.switch input:checked + .switch-track { background: var(--success); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Мобильные экраны ---------- */
@media (max-width: 640px) {
    .container { padding: 0 14px; margin: 20px 0; }
    .nav { padding: 12px 16px; }
    .table th, .table td { padding: 9px 12px; font-size: 13.5px; }
}
