:root {
    --bg: #f4f6f8;
    --surface: #ffffff;
    --text: #17202a;
    --muted: #65717e;
    --line: #dfe4e8;
    --primary: #1f4c5c;
    --primary-dark: #153844;
    --success: #1c6b48;
    --danger: #9e2f2f;
    --info: #285c85;
    --radius: 14px;
    --shadow: 0 10px 30px rgba(25, 42, 52, 0.08);
}

* { box-sizing: border-box; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}
a { color: inherit; }
.topbar {
    min-height: 66px;
    padding: 0 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    position: sticky;
    top: 0;
    z-index: 10;
}
.brand { font-weight: 800; text-decoration: none; letter-spacing: -0.02em; }
.nav { display: flex; align-items: center; gap: 18px; }
.nav a, .link-button {
    border: 0;
    background: transparent;
    padding: 0;
    color: var(--muted);
    font: inherit;
    text-decoration: none;
    cursor: pointer;
}
.nav a:hover, .link-button:hover { color: var(--text); }
.container { width: min(1180px, calc(100% - 32px)); margin: 34px auto; }
.auth-card {
    width: min(440px, 100%);
    margin: 70px auto;
    padding: 32px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
h1, h2 { margin-top: 0; letter-spacing: -0.03em; }
h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin-bottom: 10px; }
h2 { font-size: 1.25rem; }
.muted { color: var(--muted); }
.eyebrow { margin: 0 0 6px; color: var(--primary); font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; }
label { display: block; margin: 16px 0 7px; font-weight: 700; font-size: .92rem; }
input, select {
    width: 100%;
    min-height: 46px;
    padding: 10px 12px;
    border: 1px solid #cbd3d9;
    border-radius: 9px;
    background: #fff;
    color: var(--text);
    font: inherit;
}
input:focus, select:focus { outline: 3px solid rgba(31, 76, 92, .14); border-color: var(--primary); }
.help { margin: 7px 0 0; color: var(--muted); font-size: .82rem; }
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 18px;
    border: 0;
    border-radius: 9px;
    font: inherit;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
}
.button-primary { color: #fff; background: var(--primary); }
.button-primary:hover { background: var(--primary-dark); }
.button-full { width: 100%; margin-top: 22px; }
.alert { margin: 0 0 18px; padding: 12px 14px; border-radius: 9px; border: 1px solid transparent; }
.alert-success { color: #145337; background: #e8f6ef; border-color: #b9e2cd; }
.alert-error { color: #7e2525; background: #fff0f0; border-color: #efcaca; }
.alert-info { color: #214d70; background: #edf6fc; border-color: #c9e0ef; }
.page-heading { display: flex; justify-content: space-between; align-items: end; margin-bottom: 26px; }
.grid-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 22px; }
.card, .panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.card { padding: 22px; }
.card strong { display: block; margin-top: 4px; font-size: 1.35rem; }
.card-label { color: var(--muted); font-size: .83rem; font-weight: 700; }
.card-accent { border-top: 4px solid var(--primary); }
.panel { padding: 24px; }
.panel > :last-child { margin-bottom: 0; }
.two-column { display: grid; grid-template-columns: minmax(280px, .75fr) minmax(480px, 1.4fr); gap: 18px; align-items: start; }
.table-panel { overflow: hidden; }
.table-wrap { overflow-x: auto; }
.table-scroll-float {
    position: fixed;
    bottom: 0;
    z-index: 40;
    overflow-x: auto;
    overflow-y: hidden;
    height: 26px;
    background: rgba(255, 255, 255, .92);
    border-top: 1px solid var(--line);
    box-shadow: 0 -3px 10px rgba(20, 43, 54, .07);
    scrollbar-width: auto;
    scrollbar-color: #7d939b transparent;
    opacity: 0;
    visibility: hidden;
    transition: opacity .12s;
}
.table-scroll-float.is-visible { opacity: 1; visibility: visible; }
.table-scroll-float-inner { height: 1px; }
.table-scroll-float::-webkit-scrollbar { height: 20px; }
.table-scroll-float::-webkit-scrollbar-thumb {
    background: #7d939b;
    border: 4px solid transparent;
    background-clip: padding-box;
    border-radius: 999px;
}
.table-scroll-float::-webkit-scrollbar-track { background: transparent; }
@media print {
    .table-scroll-float { display: none !important; }
}
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; }
.badge { display: inline-block; padding: 4px 9px; border-radius: 999px; font-size: .78rem; font-weight: 800; }
.badge-ok { color: #145337; background: #e8f6ef; }
.badge-off { color: #5d6670; background: #eceff2; }

@media (max-width: 820px) {
    .topbar { padding: 0 16px; }
    .container { width: min(100% - 22px, 1180px); margin-top: 22px; }
    .grid-cards, .two-column { grid-template-columns: 1fr; }
    .auth-card { margin: 30px auto; padding: 24px; }
    .nav { gap: 12px; font-size: .9rem; }
}
