:root {
    color-scheme: light;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --blue: #176b87;
    --blue-dark: #11536a;
    --blue-soft: #e9f5f9;
    --line: #d8e2e6;
    --muted: #64747b;
    --text: #18262c;
    --background: #f4f7f8;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--background); color: var(--text); }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }

.panel-shell { display: flex; min-height: 100vh; }
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    display: flex;
    width: 260px;
    flex-direction: column;
    border-right: 1px solid var(--line);
    background: #fff;
}
.brand {
    display: flex;
    min-height: 68px;
    align-items: center;
    padding: 0 24px;
    border-bottom: 1px solid var(--line);
    color: var(--blue-dark);
    font-size: 19px;
    font-weight: 700;
}
.main-menu { padding: 34px 12px; }
.main-menu a {
    display: block;
    padding: 12px 14px;
    border-radius: 7px;
    color: var(--blue-dark);
    font-size: 14px;
}
.main-menu a:hover, .main-menu a.active { background: var(--blue-soft); font-weight: 650; }
.sidebar-bottom { display: grid; gap: 12px; margin-top: auto; padding: 12px; border-top: 1px solid var(--line); }
.django-admin-link { display: grid; gap: 3px; padding: 12px; border-radius: 7px; background: var(--blue-soft); color: var(--blue-dark); }
.django-admin-link span { font-size: 14px; font-weight: 650; }
.django-admin-link small, .signed-in-user { color: var(--muted); font-size: 11px; }
.signed-in-user { padding: 0 12px 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.workspace { width: calc(100% - 260px); min-height: 100vh; margin-left: 260px; }
.topbar { display: flex; min-height: 68px; align-items: center; justify-content: space-between; padding: 0 32px; border-bottom: 1px solid var(--line); background: #fff; }
.topbar h1 { margin: 0; font-size: 20px; font-weight: 650; }
.topbar form { margin: 0; }
.content { padding: 32px; }
.actions { display: flex; justify-content: flex-end; margin-bottom: 16px; }

.primary-button, .quiet-button {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: 7px;
    cursor: pointer;
    font-weight: 650;
}
.primary-button { background: var(--blue); color: #fff; }
.primary-button:hover { background: var(--blue-dark); }
.quiet-button { border-color: var(--line); background: #fff; color: var(--text); }

.table-card, .form-card { overflow: hidden; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px 16px; border-bottom: 1px solid #e8eef0; text-align: left; }
th { background: #f8fafb; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
td { font-size: 14px; }
tbody tr:last-child td { border-bottom: 0; }
.row-action { width: 1%; text-align: right; white-space: nowrap; }
.row-action a { color: var(--blue); font-weight: 650; }
.empty { padding: 36px; color: var(--muted); text-align: center; }
.status { display: inline-block; padding: 4px 8px; border-radius: 999px; background: #edf0f1; color: var(--muted); font-size: 11px; }
.status.active { background: #e3f3e8; color: #267244; }

.form-card { max-width: 680px; padding: 24px; }
.form-row { display: grid; gap: 7px; margin-bottom: 18px; }
.form-row label { color: var(--muted); font-size: 12px; font-weight: 650; }
.form-row input:not([type="checkbox"]) { width: 100%; min-height: 42px; padding: 9px 11px; border: 1px solid #bccbd1; border-radius: 6px; outline: none; }
.form-row input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(23, 107, 135, .12); }
.form-row small { color: var(--muted); font-size: 11px; line-height: 1.45; }
.form-row small ul { margin: 4px 0 0; padding-left: 18px; }
.checkbox-row { grid-template-columns: auto 1fr; align-items: center; }
.checkbox-row label { grid-column: 2; grid-row: 1; }
.checkbox-row input { grid-column: 1; grid-row: 1; width: 18px; height: 18px; }
.form-errors { color: #a12e2e; font-size: 12px; }
.form-errors ul { margin: 0; padding-left: 18px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 26px; }
.message { margin-bottom: 16px; padding: 12px 14px; border: 1px solid #b8ddc4; border-radius: 7px; background: #edf8f0; color: #23663b; font-size: 13px; }

.auth-page {
    min-height: 100vh;
    background:
        radial-gradient(circle at 12% 15%, rgba(230, 64, 145, .08), transparent 28%),
        radial-gradient(circle at 88% 82%, rgba(52, 127, 185, .08), transparent 30%),
        #f5f6f7;
    color: #252326;
}
.auth-shell {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 28px;
}
.auth-card {
    position: relative;
    width: min(430px, 100%);
    overflow: hidden;
    border: 1px solid #e2e1e3;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(34, 31, 36, .12);
}
.auth-card::before {
    position: absolute;
    inset: 0 0 auto;
    height: 4px;
    background: linear-gradient(90deg, #e64091 0 25%, #f4a000 25% 50%, #f15a2a 50% 75%, #347fb9 75%);
    content: "";
}
.auth-brand {
    display: flex;
    justify-content: center;
    padding: 36px 36px 25px;
    border-bottom: 1px solid #efedef;
}
.auth-brand img { display: block; width: 68px; height: 83px; }
.auth-content { padding: 30px 36px 36px; }
.auth-content h1 {
    margin: 0 0 25px;
    color: #242124;
    font-size: 25px;
    font-weight: 700;
    letter-spacing: -.025em;
    text-align: center;
}
.auth-field { display: grid; gap: 8px; margin-bottom: 18px; }
.auth-field label {
    color: #605c62;
    font-size: 12px;
    font-weight: 700;
}
.auth-field input {
    display: block;
    width: 100%;
    height: 48px;
    padding: 11px 13px;
    border: 1px solid #cbc8cc;
    border-radius: 8px;
    background: #fff;
    color: #252326;
    font: inherit;
    font-size: 15px;
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.auth-field input::placeholder { color: #aaa6ab; }
.auth-field input:focus {
    border-color: #347fb9;
    box-shadow: 0 0 0 3px rgba(52, 127, 185, .13);
}
.auth-content button {
    display: block;
    width: 100%;
    height: 48px;
    margin-top: 25px;
    border: 0;
    border-radius: 8px;
    background: #252326;
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-size: 15px;
    font-weight: 700;
    transition: background .15s ease, transform .15s ease;
}
.auth-content button:hover { background: #347fb9; }
.auth-content button:active { transform: translateY(1px); }
.auth-content button:focus-visible { outline: 3px solid rgba(52, 127, 185, .25); outline-offset: 2px; }
.auth-error {
    margin: 0 0 20px;
    padding: 11px 13px;
    border: 1px solid #efc5cb;
    border-radius: 8px;
    background: #fff2f4;
    color: #9b2939;
    font-size: 13px;
}

@media (max-width: 760px) {
    .sidebar { position: static; width: 100%; min-height: auto; }
    .panel-shell { display: block; }
    .main-menu { padding: 12px; }
    .sidebar-bottom { margin-top: 0; }
    .workspace { width: 100%; margin-left: 0; }
    .content, .topbar { padding-left: 18px; padding-right: 18px; }
    .table-card { overflow-x: auto; }
    .auth-shell { padding: 16px; }
    .auth-brand { padding: 30px 24px 22px; }
    .auth-content { padding: 26px 24px 28px; }
}
