:root {
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #202b35;
    background: #f4f6f8;
    font-synthesis: none;
    --navy: #172b3a;
    --muted: #71808c;
    --border: #e3e8ec;
    --green: #327b68;
    --green-dark: #276653;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }

[hidden] { display: none !important; }

.login-screen {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: #f1f4f5;
}

.login-card {
    width: min(100%, 430px);
    padding: 42px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 15px 50px #172b3a0d;
}

.brand-mark {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    background: var(--navy);
    color: white;
    border-radius: 10px;
    font-weight: 700;
}

.eyebrow {
    margin: 0 0 9px;
    color: var(--green);
    font-size: 10px;
    font-weight: 750;
    letter-spacing: 1.5px;
}

.login-card .eyebrow { margin-top: 28px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 10px; font-size: 27px; letter-spacing: -.7px; }
h2 { margin-bottom: 8px; font-size: 20px; letter-spacing: -.3px; }
h3 { font-size: 16px; }
.muted { color: var(--muted); line-height: 1.6; font-size: 13px; }

label {
    display: block;
    margin: 18px 0 7px;
    font-size: 12px;
    font-weight: 650;
}

input, textarea {
    width: 100%;
    padding: 11px 12px;
    color: var(--navy);
    background: white;
    border: 1px solid #d9e0e5;
    border-radius: 6px;
    outline: none;
}

input:focus, textarea:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 3px #327b6818;
}

textarea { resize: vertical; font-family: ui-monospace, monospace; font-size: 12px; }

.primary-button, .secondary-button {
    padding: 10px 15px;
    border: 0;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 650;
}

.primary-button { color: white; background: var(--green); }
.primary-button:hover { background: var(--green-dark); }
.secondary-button { color: var(--navy); background: #edf1f3; }
.login-card .primary-button { width: 100%; margin-top: 23px; }

.message { min-height: 18px; margin: 12px 0 0; font-size: 12px; color: #b34c42; }

#app { min-height: 100vh; }
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 2;
    width: 238px;
    display: flex;
    flex-direction: column;
    padding: 25px 17px 17px;
    color: white;
    background: var(--navy);
}

.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 35px; }
.sidebar-brand .brand-mark { color: var(--navy); background: white; }
.sidebar-brand strong, .sidebar-brand span { display: block; }
.sidebar-brand strong { font-size: 13px; }
.sidebar-brand span { margin-top: 4px; color: #aab8c2; font-size: 11px; }

.nav-label { padding: 0 10px 12px; color: #8295a2; font-size: 9px; letter-spacing: 1.5px; }
nav { display: grid; gap: 5px; }
.nav-item {
    width: 100%;
    padding: 11px 12px;
    text-align: left;
    color: #c5d0d7;
    background: transparent;
    border: 0;
    border-radius: 6px;
    font-size: 12px;
}
.nav-item:hover, .nav-item.active { color: white; background: #ffffff16; }
.nav-item.active { box-shadow: inset 3px 0 #77b9a4; }

.sidebar-footer { margin-top: auto; padding: 15px 10px 5px; border-top: 1px solid #ffffff20; font-size: 12px; }
.logout-button { display: block; margin-top: 12px; padding: 0; color: #aab8c2; background: none; border: 0; font-size: 11px; }

.main { min-height: 100vh; margin-left: 238px; padding: 0 38px 50px; }
.topbar {
    min-height: 112px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
}
.topbar .eyebrow { margin-bottom: 7px; }
.topbar h1 { margin: 0; font-size: 23px; }
.connection-status { color: var(--muted); font-size: 11px; }
.status-dot { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: #4b9b79; }

.view { max-width: 1250px; margin: 32px auto; }
.welcome { display: flex; align-items: center; justify-content: space-between; margin-bottom: 27px; }
.welcome h2 { font-size: 24px; }
.welcome p { margin-bottom: 0; }

.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 17px; margin-bottom: 24px; }
.stat-card, .panel {
    padding: 23px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 9px;
}
.stat-card span, .stat-card small { display: block; color: var(--muted); font-size: 11px; }
.stat-card strong { display: block; margin: 15px 0 5px; font-size: 30px; font-weight: 650; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.panel-heading h2 { margin: 0; }
.panel-heading .eyebrow { margin-bottom: 6px; }
.text-button { padding: 8px 0; color: var(--green); background: none; border: 0; font-size: 12px; font-weight: 650; }

.tabs { display: flex; gap: 22px; margin: 22px 0; border-bottom: 1px solid var(--border); }
.tab { padding: 12px 3px; color: var(--muted); background: none; border: 0; border-bottom: 2px solid transparent; font-size: 12px; }
.tab.active { color: var(--green); border-color: var(--green); font-weight: 700; }

.table-container { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th { padding: 11px 12px; color: var(--muted); background: #f7f9fa; font-size: 10px; font-weight: 700; }
td { padding: 13px 12px; border-bottom: 1px solid #edf0f2; font-size: 12px; }
tr:last-child td { border-bottom: 0; }
.badge { display: inline-block; padding: 4px 8px; color: #327b68; background: #eaf4ef; border-radius: 20px; font-size: 10px; }
.badge.inactive { color: #8b6c3d; background: #f8f0df; }
.row-button { padding: 5px 9px; color: var(--green); background: #edf5f1; border: 0; border-radius: 5px; font-size: 10px; }

.editor { max-width: 720px; margin-top: 20px; }
.editor h2 { margin-bottom: 20px; }
.checkbox-label { display: flex; align-items: center; gap: 9px; }
.checkbox-label input { width: auto; }
.form-actions { display: flex; gap: 10px; margin-top: 22px; }
.global-message { position: fixed; right: 25px; bottom: 20px; color: var(--green); font-size: 12px; }

@media (max-width: 850px) {
    .sidebar { width: 190px; }
    .main { margin-left: 190px; padding: 0 22px 40px; }
    .stats-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
    .sidebar { position: static; width: 100%; min-height: auto; }
    .sidebar-brand { padding-bottom: 18px; }
    nav { grid-template-columns: repeat(2, 1fr); }
    .sidebar-footer { margin-top: 20px; }
    .main { margin-left: 0; padding: 0 15px 35px; }
    .topbar { min-height: 90px; }
    .connection-status { display: none; }
    .welcome { align-items: flex-start; flex-direction: column; gap: 17px; }
    .login-card { padding: 28px; }
}
