:root {
    --bg: #f5f7fb;
    --panel: #ffffff;
    --border: #e7ebf3;
    --text: #18202f;
    --muted: #6c778c;
    --accent: #3147ff;
    --accent-soft: #eef1ff;
    --success: #11835b;
    --success-soft: #e7f7f1;
    --danger: #c53737;
    --danger-soft: #fdecec;
    --shadow: 0 20px 45px rgba(24, 32, 47, 0.08);
    --radius: 22px;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background: var(--bg);
}
a { color: inherit; text-decoration: none; }

.shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 280px 1fr;
}

.sidebar {
    background: #0f1727;
    color: #f4f7fb;
    padding: 28px 22px;
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand.center {
    justify-content: center;
    margin-bottom: 24px;
}

.brand-mark {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    font-size: 24px;
    font-weight: 800;
    background: linear-gradient(135deg, #3147ff, #6c7eff);
    color: white;
    box-shadow: var(--shadow);
}

.brand-title {
    font-size: 1.1rem;
    font-weight: 700;
}

.brand-subtitle {
    font-size: 0.9rem;
    color: #aeb8c8;
}

.nav {
    display: grid;
    gap: 8px;
}

.nav a {
    padding: 12px 14px;
    border-radius: 14px;
    color: #dce4f0;
    transition: 0.2s ease;
}

.nav a:hover {
    background: rgba(255,255,255,0.08);
    color: white;
}

.content {
    padding: 34px;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

h1, h2, h3 { margin: 0 0 10px 0; }
h1 { font-size: 2rem; }
h2 { font-size: 1.15rem; }

.muted {
    color: var(--muted);
}

.grid {
    display: grid;
    gap: 20px;
}

.cards-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 20px;
}

.two-col {
    grid-template-columns: 1.2fr 1fr;
    margin-bottom: 20px;
}

.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px;
}

.card.narrow {
    max-width: 640px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.stat-label {
    color: var(--muted);
    font-size: 0.95rem;
    margin-bottom: 10px;
}
.stat-value {
    font-size: 2rem;
    font-weight: 800;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    text-align: left;
    color: var(--muted);
    font-weight: 600;
    font-size: 0.92rem;
    border-bottom: 1px solid var(--border);
    padding: 0 0 12px 0;
}

tbody td {
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

.input {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 13px 15px;
    font: inherit;
    margin: 7px 0 16px 0;
    background: #fff;
}

textarea.input {
    resize: vertical;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    padding: 11px 16px;
    border: 1px solid transparent;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s ease;
    background: white;
}

.button.primary {
    background: var(--accent);
    color: white;
}

.button.primary:hover { filter: brightness(1.05); }

.button.ghost {
    border-color: var(--border);
    color: var(--text);
    background: white;
}

.button.full {
    width: 100%;
}

.actions {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.pill {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 700;
}

.pill.success {
    background: var(--success-soft);
    color: var(--success);
}

.pill.danger {
    background: var(--danger-soft);
    color: var(--danger);
}

.pill.muted-pill {
    background: #eef2f7;
    color: #67758a;
}

.alert {
    padding: 14px 16px;
    border-radius: 14px;
    margin-bottom: 18px;
}

.alert.success {
    background: var(--success-soft);
    color: var(--success);
}

.validation {
    background: #fff2f2;
    color: #a22b2b;
    border: 1px solid #ffd6d6;
    border-radius: 14px;
    padding: 12px 14px;
    margin-bottom: 14px;
}


.validation.field-validation-valid,
.validation.validation-summary-valid,
.field-validation-valid,
.validation-summary-valid {
    display: none !important;
}

.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at top left, #dfe6ff 0, transparent 32%),
        radial-gradient(circle at bottom right, #e9fff5 0, transparent 26%),
        var(--bg);
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--panel);
    border-radius: 28px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: 28px;
}

.logout-form {
    margin-top: auto;
}

.meta-list {
    display: grid;
    gap: 8px;
}

.truncate {
    max-width: 320px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 1100px) {
    .shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        gap: 18px;
    }

    .cards-4,
    .two-col {
        grid-template-columns: 1fr;
    }
}

.alert.danger {
    background: var(--danger-soft);
    color: var(--danger);
}

.create-layout {
    align-items: start;
}

.mini-stats {
    display: grid;
    gap: 10px;
}

.log-ref {
    max-width: 520px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.selection-section {
    margin: 16px 0;
}

.checkbox-list {
    display: grid;
    gap: 8px;
    margin-top: 8px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fff;
}

.checkbox-item input {
    width: 16px;
    height: 16px;
}


.inline-form {
    margin: 0;
}

.searchable-select {
    min-height: 280px;
}

.helper-text {
    margin-top: -8px;
    margin-bottom: 12px;
    font-size: 0.92rem;
}

.stale-layout {
    grid-template-columns: 1fr 1.1fr;
    margin-bottom: 20px;
}

.filter-grid {
    display: grid;
    grid-template-columns: 1.4fr 220px 220px auto;
    gap: 14px;
    align-items: end;
}

.checkbox-inline {
    display: flex;
    align-items: center;
}

.checkbox-item.compact {
    padding: 8px 10px;
}

.compact-actions {
    align-self: end;
}

.three-col {
    grid-template-columns: 1fr 1fr 1fr;
    align-items: center;
}

.inline-note {
    padding-bottom: 12px;
}

.toggle-row {
    margin-bottom: 12px;
}

.compact-list {
    max-height: 180px;
    overflow: auto;
}

@media (max-width: 1100px) {
    .stale-layout,
    .filter-grid,
    .three-col {
        grid-template-columns: 1fr;
    }
}
