:root {
    --bg: #f5f5f7;
    --card: rgba(255, 255, 255, 0.88);
    --card-border: rgba(15, 23, 42, 0.08);
    --text: #111827;
    --muted: #6b7280;
    --accent: #111111;
    --accent-soft: #f0f2f5;
    --success: #0f766e;
    --danger: #b91c1c;
    --shadow: 0 20px 60px rgba(15, 23, 42, 0.08);
    --radius: 24px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "SF Pro Display", "Helvetica Neue", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(214, 219, 255, 0.7), transparent 30%),
        radial-gradient(circle at bottom right, rgba(226, 239, 255, 0.8), transparent 30%),
        var(--bg);
}

a {
    color: inherit;
}

.shell {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: 32px 0 64px;
}

.hero {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 28px;
}

.brand {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

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

.panel, .card {
    background: var(--card);
    backdrop-filter: blur(18px);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.panel {
    padding: 32px;
}

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

.grid.two {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.grid.three {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

form {
    display: grid;
    gap: 14px;
}

label {
    display: grid;
    gap: 8px;
    font-size: 0.95rem;
}

.option-list {
    display: grid;
    gap: 10px;
}

.option-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.72);
}

.option-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    flex: 0 0 auto;
}

.option-row span {
    font-size: 0.95rem;
}

input, textarea, select {
    width: 100%;
    border: 1px solid rgba(15, 23, 42, 0.1);
    border-radius: 18px;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.85);
    font: inherit;
    color: var(--text);
}

input:disabled,
textarea:disabled,
select:disabled {
    color: #9ca3af;
    background: rgba(15, 23, 42, 0.04);
    border-color: rgba(15, 23, 42, 0.06);
    cursor: not-allowed;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.02);
}

input:disabled::placeholder,
textarea:disabled::placeholder {
    color: #9ca3af;
}

.field-hint {
    display: block;
    font-size: 0.82rem;
    line-height: 1.4;
    color: var(--muted);
}

textarea {
    min-height: 120px;
    resize: vertical;
}

.button, button {
    border: 0;
    border-radius: 999px;
    padding: 13px 20px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.18s ease, opacity 0.18s ease;
}

.button:hover, button:hover {
    transform: translateY(-1px);
}

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

.button.secondary {
    background: var(--accent-soft);
    text-decoration: none;
}

.stack {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.message {
    border-radius: 18px;
    padding: 14px 16px;
}

.message.error {
    background: rgba(185, 28, 28, 0.08);
    color: var(--danger);
}

.message.success {
    background: rgba(15, 118, 110, 0.08);
    color: var(--success);
}

.kpi {
    padding: 22px;
}

.kpi strong {
    display: block;
    font-size: 1.8rem;
    margin-top: 10px;
}

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

th, td {
    text-align: left;
    padding: 12px 0;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    vertical-align: top;
}

.nav {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.nav a {
    text-decoration: none;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(15, 23, 42, 0.06);
}

.oauth-card {
    max-width: 720px;
}

.button.danger,
button.danger {
    background: rgba(185, 28, 28, 0.1);
    color: var(--danger);
}

.compact-grid {
    gap: 16px;
}

.internal-screen {
    min-height: 100vh;
    background: var(--bg);
}

.app-shell {
    width: min(1440px, calc(100% - 24px));
    margin: 0 auto;
    padding: 16px 0 24px;
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.app-sidebar {
    position: sticky;
    top: 16px;
    display: grid;
    gap: 20px;
    min-height: calc(100vh - 32px);
    padding: 22px 18px;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 28px;
    backdrop-filter: blur(18px);
    box-shadow: var(--shadow);
}

.sidebar-branding {
    display: grid;
    gap: 8px;
}

.sidebar-brand {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    text-decoration: none;
}

.sidebar-copy {
    margin: 0;
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.5;
}

.sidebar-nav {
    display: grid;
    gap: 6px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    padding: 10px 12px;
    border-radius: 14px;
    text-decoration: none;
    color: #374151;
    transition: background 0.18s ease, color 0.18s ease;
}

.sidebar-link:hover {
    background: rgba(15, 23, 42, 0.05);
}

.sidebar-link.is-active {
    background: #111827;
    color: #fff;
}

.sidebar-link-mark {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: rgba(107, 114, 128, 0.35);
    flex: 0 0 auto;
}

.sidebar-link.is-active .sidebar-link-mark {
    background: #93c5fd;
}

.sidebar-link-label {
    font-weight: 600;
    font-size: 0.96rem;
}

.sidebar-footer {
    margin-top: auto;
    display: grid;
    gap: 16px;
}

.sidebar-user {
    display: grid;
    gap: 4px;
    padding: 14px;
    border-radius: 18px;
    background: rgba(15, 23, 42, 0.04);
}

.sidebar-user strong,
.topbar-user strong {
    font-size: 0.95rem;
}

.sidebar-user span,
.topbar-user span {
    color: var(--muted);
    font-size: 0.85rem;
}

.sidebar-role {
    text-transform: capitalize;
}

.sidebar-logout {
    gap: 0;
}

.sidebar-logout .button {
    width: 100%;
    justify-content: center;
}

.app-main {
    min-width: 0;
    display: grid;
    gap: 18px;
}

.app-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 22px;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 24px;
    backdrop-filter: blur(18px);
    box-shadow: var(--shadow);
}

.page-heading {
    min-width: 0;
    display: grid;
    gap: 6px;
}

.page-heading h1,
.section-head h2,
.panel h2 {
    margin: 0;
    letter-spacing: -0.03em;
}

.page-heading h1 {
    font-size: 1.8rem;
}

.page-heading p,
.section-head p {
    margin: 0;
    color: var(--muted);
}

.topbar-user {
    display: grid;
    justify-items: end;
    gap: 2px;
    text-align: right;
}

.sidebar-toggle {
    display: none;
    width: 44px;
    height: 44px;
    padding: 10px;
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.04);
}

.sidebar-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    margin: 3px auto;
    background: #111827;
    border-radius: 999px;
}

.app-content {
    display: grid;
    gap: 18px;
}

.content-split {
    display: grid;
    grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
    gap: 18px;
}

.content-split-wide {
    grid-template-columns: minmax(320px, 390px) minmax(0, 1fr);
}

.content-single {
    display: grid;
    gap: 18px;
}

.panel-compact {
    padding: 22px;
}

.panel-muted {
    background: rgba(255, 255, 255, 0.65);
}

.page-section {
    display: grid;
    gap: 14px;
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.form-compact {
    gap: 12px;
}

.form-grid-two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
}

.form-grid-two button,
.form-grid-two .option-list,
.form-grid-two label:last-of-type {
    grid-column: 1 / -1;
}

.form-compact label {
    gap: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #374151;
}

.form-compact input,
.form-compact select,
.form-compact textarea {
    min-height: 44px;
    padding: 10px 12px;
    border-radius: 14px;
}

.form-compact textarea {
    min-height: 96px;
}

.form-compact .option-row {
    min-height: 44px;
    padding: 10px 12px;
    border-radius: 14px;
}

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

.data-table {
    min-width: 640px;
}

.data-table th,
.data-table td {
    padding: 10px 0;
    font-size: 0.92rem;
}

.inline-action {
    display: inline-flex;
    gap: 0;
}

.action-row {
    display: inline-flex;
    flex-wrap: nowrap;
    gap: 6px;
    align-items: center;
}

.table-actions {
    text-align: right;
}

.data-table td.table-actions {
    width: 1%;
    white-space: nowrap;
}

.data-table td.table-actions .action-row,
.data-table td.table-actions .inline-action {
    justify-content: flex-end;
}

.data-table td.table-actions .button,
.data-table td.table-actions button {
    min-height: 34px;
    padding: 7px 11px;
    border-radius: 12px;
    font-size: 0.84rem;
    line-height: 1.1;
}

.table-empty {
    padding: 18px 0;
    color: var(--muted);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.06);
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: capitalize;
}

.system-card p {
    margin-bottom: 0;
    color: var(--muted);
    line-height: 1.6;
}

.app-backdrop {
    display: none;
}

@media (max-width: 720px) {
    .hero {
        flex-direction: column;
        align-items: flex-start;
    }

    .panel {
        padding: 22px;
    }
}

@media (max-width: 1080px) {
    .content-split,
    .content-split-wide,
    .form-grid-two {
        grid-template-columns: 1fr;
    }

    .data-table {
        min-width: 560px;
    }

    .action-row {
        flex-wrap: wrap;
    }
}

@media (max-width: 940px) {
    .app-shell {
        width: min(100%, calc(100% - 16px));
        grid-template-columns: 1fr;
        padding: 12px 0 24px;
    }

    .app-sidebar {
        position: fixed;
        top: 8px;
        left: 8px;
        bottom: 8px;
        z-index: 30;
        width: min(300px, calc(100vw - 32px));
        min-height: auto;
        transform: translateX(-112%);
        transition: transform 0.22s ease;
    }

    .internal-screen.sidebar-open .app-sidebar {
        transform: translateX(0);
    }

    .app-topbar {
        padding: 16px 18px;
    }

    .sidebar-toggle {
        display: inline-block;
    }

    .topbar-user {
        display: none;
    }

    .app-backdrop {
        position: fixed;
        inset: 0;
        z-index: 20;
        border: 0;
        background: rgba(15, 23, 42, 0.24);
    }

    .internal-screen.sidebar-open .app-backdrop {
        display: block;
    }
}
