* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: #17202a;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #f5f7fb;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

.auth-page {
    background: linear-gradient(135deg, #12598e, #142a42 54%, #233d4d);
}

.login-shell {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 24px;
}

.login-panel {
    width: min(100%, 430px);
    padding: 34px;
    border: 1px solid rgba(255, 255, 255, 0.36);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 24px 70px rgba(11, 31, 52, 0.28);
}

.eyebrow {
    margin: 0 0 8px;
    color: #1f6f8f;
    font-size: 0.77rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 10px;
    font-size: clamp(2rem, 5vw, 2.75rem);
    line-height: 1.05;
}

.muted,
.credential-hint,
.auth-switch {
    color: #647080;
}

.login-form {
    display: grid;
    gap: 10px;
    margin-top: 28px;
}

.login-form label {
    color: #2b3541;
    font-size: 0.92rem;
    font-weight: 700;
}

.login-form input[type="email"],
.login-form input[type="password"] {
    width: 100%;
    min-height: 48px;
    padding: 12px 14px;
    border: 1px solid #cfd8e3;
    border-radius: 7px;
    background: #ffffff;
    outline: none;
}

.login-form input:focus {
    border-color: #1f6f8f;
    box-shadow: 0 0 0 4px rgba(31, 111, 143, 0.14);
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 0 4px;
}

.login-form button,
.ghost-button {
    min-height: 46px;
    border: 0;
    border-radius: 7px;
    cursor: pointer;
    font-weight: 800;
}

.login-form button {
    color: #ffffff;
    background: #1f6f8f;
}

.alert {
    margin-top: 22px;
    padding: 12px 14px;
    border: 1px solid #f2b8b5;
    border-radius: 7px;
    color: #8c1d18;
    background: #fff1f0;
}

.credential-hint {
    margin: 18px 0 0;
    font-size: 0.9rem;
}

.auth-switch {
    margin: 10px 0 0;
    font-size: 0.94rem;
    text-align: center;
}

.auth-switch a {
    color: #1f6f8f;
    font-weight: 800;
}

.dashboard-page {
    display: flex;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 250px;
    padding: 24px 18px;
    color: #ffffff;
    background: #162536;
    transition: transform 0.22s ease;
    z-index: 20;
}

.brand {
    display: block;
    margin-bottom: 32px;
    font-size: 1.2rem;
    font-weight: 900;
}

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

.side-nav a {
    padding: 12px 14px;
    border-radius: 7px;
    color: #c6d3e1;
    font-weight: 700;
}

.side-nav a.active,
.side-nav a:hover {
    color: #ffffff;
    background: #1f6f8f;
}

.dashboard-main {
    width: 100%;
    min-height: 100vh;
    margin-left: 250px;
    transition: margin-left 0.22s ease;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 28px 34px;
    border-bottom: 1px solid #dfe6ee;
    background: #ffffff;
}

.topbar-title {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}

.topbar h1 {
    margin: 0;
    font-size: clamp(1.7rem, 4vw, 2.4rem);
}

.sidebar-toggle {
    display: inline-flex;
    flex: 0 0 44px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 7px;
    background: #e9eef5;
    cursor: pointer;
}

.sidebar-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    border-radius: 999px;
    background: #162536;
}

.sidebar-collapsed .sidebar {
    transform: translateX(-100%);
}

.sidebar-collapsed .dashboard-main {
    margin-left: 0;
}

.ghost-button {
    padding: 0 18px;
    color: #162536;
    background: #e9eef5;
}

.content-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    padding: 28px 34px;
}

.page-content {
    padding: 28px 34px;
}

.metric-card,
.activity-panel {
    border: 1px solid #dfe6ee;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 12px 30px rgba(34, 48, 70, 0.06);
}

.metric-card {
    display: grid;
    gap: 8px;
    padding: 22px;
}

.metric-card span,
.section-heading span {
    color: #647080;
    font-size: 0.9rem;
    font-weight: 700;
}

.metric-card strong {
    font-size: 2.1rem;
}

.metric-card small {
    color: #1f6f8f;
    font-weight: 700;
}

.activity-panel {
    grid-column: 1 / -1;
    padding: 24px;
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.section-heading h2 {
    margin: 0;
}

.activity-list {
    display: grid;
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.activity-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 14px 0;
    border-top: 1px solid #edf1f6;
}

.activity-list span {
    color: #647080;
}

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

.primary-button,
.secondary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 16px;
    border: 0;
    border-radius: 7px;
    cursor: pointer;
    font-weight: 800;
}

.primary-button {
    color: #ffffff;
    background: #1f6f8f;
}

.secondary-button {
    color: #162536;
    background: #e9eef5;
}

.notice {
    margin-bottom: 18px;
    padding: 12px 14px;
    border: 1px solid #adddc6;
    border-radius: 7px;
    color: #185c3b;
    background: #effaf4;
}

.table-panel,
.form-panel,
.detail-panel {
    overflow: hidden;
    border: 1px solid #dfe6ee;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 12px 30px rgba(34, 48, 70, 0.06);
}

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

th,
td {
    padding: 15px 18px;
    border-bottom: 1px solid #edf1f6;
    text-align: left;
    vertical-align: middle;
}

th {
    color: #647080;
    font-size: 0.82rem;
    text-transform: uppercase;
}

.actions-cell {
    width: 240px;
    text-align: right;
}

.actions-cell a,
.actions-cell button {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    margin-left: 8px;
    padding: 0 10px;
    border: 0;
    border-radius: 6px;
    color: #1f6f8f;
    background: #eef7fb;
    cursor: pointer;
    font-weight: 800;
}

.actions-cell form {
    display: inline;
}

.actions-cell button {
    color: #8c1d18;
    background: #fff1f0;
}

.empty-cell {
    color: #647080;
    text-align: center;
}

.form-panel,
.detail-panel {
    padding: 24px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.form-grid.single-column {
    grid-template-columns: 1fr;
}

.form-grid label {
    display: grid;
    gap: 8px;
    color: #2b3541;
    font-weight: 800;
}

.form-grid input,
.form-grid select,
.form-grid textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #cfd8e3;
    border-radius: 7px;
    color: #17202a;
    background: #ffffff;
    outline: none;
}

.form-grid textarea {
    resize: vertical;
}

.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus {
    border-color: #1f6f8f;
    box-shadow: 0 0 0 4px rgba(31, 111, 143, 0.14);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

.detail-panel dl {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin: 0;
}

.detail-panel dt {
    color: #647080;
    font-size: 0.82rem;
    font-weight: 800;
    text-transform: uppercase;
}

.detail-panel dd {
    margin: 6px 0 0;
    font-size: 1.05rem;
    font-weight: 700;
}

.post-body {
    margin-top: 24px;
    padding-top: 22px;
    border-top: 1px solid #edf1f6;
    color: #2b3541;
    line-height: 1.7;
    white-space: pre-wrap;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    color: #185c3b;
    background: #effaf4;
    font-size: 0.85rem;
    font-weight: 800;
}

.permission-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.permission-group {
    margin: 0;
    padding: 18px;
    border: 1px solid #dfe6ee;
    border-radius: 8px;
}

.permission-group legend {
    padding: 0 8px;
    color: #162536;
    font-weight: 900;
}

.permission-option {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 38px;
    color: #2b3541;
    font-weight: 700;
}

.permission-option input {
    width: 18px;
    height: 18px;
}

nav[role="navigation"] {
    margin-top: 18px;
}

@media (max-width: 800px) {
    .dashboard-page {
        display: block;
    }

    .sidebar {
        width: 250px;
        box-shadow: 18px 0 40px rgba(11, 31, 52, 0.18);
    }

    .side-nav {
        grid-template-columns: 1fr;
    }

    .dashboard-main {
        margin-left: 0;
    }

    .sidebar-collapsed .sidebar {
        transform: translateX(-100%);
    }

    html:not(.sidebar-collapsed) .sidebar {
        transform: translateX(0);
    }

    .topbar,
    .activity-list li {
        align-items: flex-start;
        flex-direction: column;
    }

    .topbar-title {
        align-items: flex-start;
    }

    .content-grid {
        grid-template-columns: 1fr;
        padding: 20px;
    }

    .page-content {
        padding: 20px;
    }

    .toolbar,
    .form-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .form-grid,
    .detail-panel dl,
    .permission-grid {
        grid-template-columns: 1fr;
    }

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

    th,
    td {
        white-space: nowrap;
    }
}
