:root {
    color-scheme: light;
    --bg: #eef6fb;
    --surface: rgba(255, 255, 255, 0.92);
    --surface-strong: #ffffff;
    --surface-soft: #f6fbff;
    --border: rgba(17, 87, 108, 0.13);
    --shadow: 0 24px 64px rgba(12, 48, 70, 0.12);
    --text: #12384a;
    --muted: #587385;
    --accent: #0f6b73;
    --accent-strong: #114f64;
    --info: #2558c8;
    --warning: #d67a10;
    --danger: #cd4b5c;
    --success: #1a8e62;
    --navy: #10253b;
    --card-teal: #eaf8f8;
    --card-blue: #edf4ff;
    --card-orange: #fff6ea;
    --card-red: #fff2f2;
    --card-green: #eefbf3;
    --radius-xl: 2rem;
    --radius-lg: 1.5rem;
    --radius-md: 1rem;
    --radius-sm: 0.75rem;
    --font: "Trebuchet MS", "Aptos", "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    min-height: 100%;
    background:
        radial-gradient(circle at top left, rgba(49, 119, 203, 0.12), transparent 30rem),
        radial-gradient(circle at bottom right, rgba(15, 107, 115, 0.12), transparent 24rem),
        linear-gradient(180deg, #f8fcff 0%, var(--bg) 100%);
    color: var(--text);
    font-family: var(--font);
}

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

img {
    max-width: 100%;
    display: block;
}

.is-hidden {
    display: none !important;
}

.eyebrow {
    margin: 0 0 0.35rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--muted);
}

.app-shell {
    min-height: 100vh;
}

.auth-screen {
    position: relative;
    min-height: 100vh;
    overflow: hidden;
}

.auth-backdrop {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 18% 16%, rgba(56, 133, 224, 0.18), transparent 18rem),
        radial-gradient(circle at 85% 8%, rgba(20, 98, 115, 0.16), transparent 20rem),
        linear-gradient(145deg, #fdfefe 0%, #e4f0fb 55%, #d7e9fa 100%);
}

.auth-panel {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(18rem, 30rem);
    gap: 2rem;
    padding: 2.25rem;
    align-items: center;
}

.auth-hero {
    display: grid;
    gap: 1.5rem;
}

.auth-mark {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 0.8rem 1rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(14, 72, 106, 0.12);
    font-weight: 800;
    color: #103a74;
    box-shadow: 0 14px 28px rgba(16, 58, 116, 0.08);
}

.auth-hero-card,
.auth-card,
.sidebar,
.shell-header,
.card,
.list-card,
.panel-card,
.modal-panel {
    background: var(--surface);
    backdrop-filter: blur(18px);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.auth-hero-card {
    border-radius: 2rem;
    padding: 2rem;
}

.auth-logo {
    width: min(100%, 32rem);
    margin-inline: auto;
}

.auth-subtitle {
    margin: 0;
    text-align: center;
    color: #446b87;
    font-size: 1.05rem;
}

.auth-card {
    border-radius: 2rem;
    padding: 2rem;
    display: grid;
    gap: 1rem;
}

.section-heading h1,
.section-heading h2,
.section-heading h3,
.view-title {
    margin: 0;
    font-size: clamp(1.8rem, 4vw, 2.4rem);
    line-height: 1.1;
}

.section-heading p,
.header-subtitle,
.helper-text,
.field > span,
.field small {
    color: var(--muted);
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    width: fit-content;
    padding: 0.7rem 1rem;
    border-radius: 999px;
    font-size: 0.95rem;
    font-weight: 700;
    background: #dff9f2;
    color: var(--accent);
}

.auth-tabs,
.segmented,
.toolbar-row,
.action-row,
.stat-grid,
.summary-grid,
.field-grid,
.inline-fields,
.split-card {
    display: grid;
    gap: 0.85rem;
}

.auth-tabs {
    grid-template-columns: repeat(3, 1fr);
}

.segmented {
    grid-template-columns: repeat(2, 1fr);
}

.tab-button,
.segmented-button,
.ghost-button,
.primary-button,
.secondary-button,
.danger-button,
.sidebar-footer-button,
.nav-button,
.icon-button {
    appearance: none;
    border: 0;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.tab-button,
.segmented-button,
.ghost-button,
.secondary-button,
.sidebar-footer-button,
.nav-button {
    min-height: 3rem;
    border-radius: 1rem;
    background: rgba(17, 87, 108, 0.06);
    color: var(--text);
    padding: 0.85rem 1rem;
    font-weight: 700;
}

.tab-button.is-active,
.segmented-button.is-active,
.nav-button.is-active {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
    color: #fff;
    box-shadow: 0 14px 26px rgba(15, 95, 112, 0.24);
}

.primary-button,
.secondary-button,
.danger-button {
    min-height: 3.2rem;
    border-radius: 1.1rem;
    padding: 0.95rem 1.2rem;
    font-weight: 800;
}

.primary-button {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
    color: #fff;
    box-shadow: 0 16px 28px rgba(17, 79, 100, 0.24);
}

.secondary-button {
    background: linear-gradient(135deg, #eef5ff 0%, #dbe9ff 100%);
    color: var(--info);
}

.danger-button {
    background: linear-gradient(135deg, #fff0f3 0%, #ffe2e7 100%);
    color: var(--danger);
}

.ghost-button {
    background: rgba(255, 255, 255, 0.76);
    border: 1px solid var(--border);
}

.sidebar-footer-button.is-danger {
    color: var(--danger);
    background: #fff1f4;
}

.tab-button:hover,
.segmented-button:hover,
.ghost-button:hover,
.primary-button:hover,
.secondary-button:hover,
.danger-button:hover,
.sidebar-footer-button:hover,
.nav-button:hover {
    transform: translateY(-1px);
}

.auth-form {
    display: none;
    gap: 0.85rem;
}

.auth-form.is-active {
    display: grid;
}

.field {
    display: grid;
    gap: 0.45rem;
}

.field > span {
    font-size: 0.92rem;
    font-weight: 700;
}

.field input,
.field select,
.field textarea,
.field-grid input,
.field-grid select,
.field-grid textarea,
.surface-input {
    width: 100%;
    border-radius: 1rem;
    border: 1px solid rgba(17, 87, 108, 0.12);
    background: rgba(255, 255, 255, 0.92);
    min-height: 3rem;
    padding: 0.85rem 0.95rem;
    color: var(--text);
    outline: none;
}

.field textarea,
.surface-input.is-textarea {
    min-height: 7.5rem;
    resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.surface-input:focus {
    border-color: rgba(37, 88, 200, 0.35);
    box-shadow: 0 0 0 4px rgba(37, 88, 200, 0.08);
}

.field-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.shell-screen {
    position: relative;
    min-height: 100vh;
    padding: 1.35rem;
}

.sidebar-scrim {
    position: fixed;
    inset: 0;
    z-index: 20;
    background: rgba(7, 27, 39, 0.38);
    backdrop-filter: blur(4px);
}

.sidebar {
    position: fixed;
    top: 1.35rem;
    left: 1.35rem;
    bottom: 1.35rem;
    z-index: 30;
    width: min(21rem, calc(100vw - 2.7rem));
    border-radius: 2rem;
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transform: translateX(calc(-100% - 2rem));
    transition: transform 0.22s ease;
}

.shell-screen.is-sidebar-open .sidebar {
    transform: translateX(0);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 1rem;
    border-radius: 1.5rem;
    background: linear-gradient(135deg, rgba(14, 107, 115, 0.12) 0%, rgba(37, 88, 200, 0.1) 100%);
}

.brand-mark {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 1.2rem;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
    color: #fff;
    font-size: 1.25rem;
    font-weight: 900;
}

.sidebar-nav {
    display: grid;
    gap: 0.65rem;
}

.nav-button {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    justify-content: space-between;
    text-align: left;
}

.nav-button .nav-meta {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.nav-button small {
    font-size: 0.77rem;
    color: inherit;
    opacity: 0.68;
}

.sidebar-footer {
    margin-top: auto;
    display: grid;
    gap: 0.65rem;
}

.shell-main {
    display: grid;
    grid-template-rows: auto 1fr;
    gap: 1rem;
}

.shell-header {
    border-radius: 2rem;
    padding: 1.35rem 1.5rem;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
}

.header-leading {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.menu-toggle-button {
    width: 3.2rem;
    min-width: 3.2rem;
    min-height: 3.2rem;
    padding: 0.7rem;
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.28rem;
}

.menu-toggle-lines {
    display: block;
    width: 100%;
    height: 0.18rem;
    border-radius: 999px;
    background: var(--text);
}

.header-icon-button {
    position: relative;
    width: 3.2rem;
    min-width: 3.2rem;
    min-height: 3.2rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 1rem;
}

.header-icon-symbol {
    width: 1.35rem;
    height: 1.35rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
}

.header-icon-symbol svg {
    width: 100%;
    height: 100%;
    display: block;
}

.header-icon-button .badge {
    position: absolute;
    top: -0.35rem;
    right: -0.35rem;
    min-width: 1.4rem;
    height: 1.4rem;
    padding: 0 0.35rem;
    border-radius: 999px;
    background: linear-gradient(135deg, #ff6a7a 0%, #e63959 100%);
    color: #fff;
    font-size: 0.68rem;
    box-shadow: 0 12px 24px rgba(230, 57, 89, 0.24);
}

.view-root {
    display: grid;
    gap: 1rem;
    align-content: start;
}

.page-section {
    display: grid;
    gap: 1rem;
}

.page-banner,
.card,
.list-card,
.panel-card {
    border-radius: 1.6rem;
    padding: 1.2rem;
}

.page-banner {
    background: linear-gradient(135deg, var(--accent-strong) 0%, #1b8ca0 100%);
    color: #fff;
    box-shadow: 0 24px 48px rgba(13, 67, 86, 0.2);
}

.page-banner p {
    margin: 0.25rem 0 0;
    color: rgba(255, 255, 255, 0.8);
}

.card,
.list-card,
.panel-card {
    background: var(--surface);
}

.list-card.card-accent-teal { background: linear-gradient(135deg, #f4fcfc 0%, var(--card-teal) 100%); }
.list-card.card-accent-blue { background: linear-gradient(135deg, #f7faff 0%, var(--card-blue) 100%); }
.list-card.card-accent-orange { background: linear-gradient(135deg, #fffaf2 0%, var(--card-orange) 100%); }
.list-card.card-accent-red { background: linear-gradient(135deg, #fff6f7 0%, var(--card-red) 100%); }
.list-card.card-accent-green { background: linear-gradient(135deg, #f5fff8 0%, var(--card-green) 100%); }

.card-header,
.list-card-header,
.entity-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: start;
}

.card-title,
.entity-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 800;
}

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

.chip-row,
.meta-row,
.info-grid,
.button-grid,
.toolbar-row,
.action-row,
.summary-grid,
.stat-grid,
.split-card,
.check-grid {
    display: grid;
    gap: 0.75rem;
}

.chip-row {
    grid-template-columns: repeat(auto-fit, minmax(8rem, max-content));
}

.chip,
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    width: fit-content;
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 800;
    background: rgba(17, 87, 108, 0.08);
    color: var(--text);
}

.chip.is-info,
.badge {
    background: rgba(37, 88, 200, 0.12);
    color: var(--info);
}

.chip.is-danger { background: rgba(205, 75, 92, 0.12); color: var(--danger); }
.chip.is-success { background: rgba(26, 142, 98, 0.12); color: var(--success); }
.chip.is-warning { background: rgba(214, 122, 16, 0.12); color: var(--warning); }
.badge {
    min-width: 1.75rem;
}

.toolbar-row {
    grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
}

.action-row {
    grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
}

.summary-grid {
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
}

.stat-grid {
    grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
}

.split-card {
    grid-template-columns: minmax(0, 1fr) minmax(0, 20rem);
    align-items: start;
}

.check-grid {
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
}

.stat-card {
    border-radius: 1.4rem;
    padding: 1rem;
    border: 1px solid rgba(17, 87, 108, 0.08);
}

.stat-card.teal { background: linear-gradient(135deg, #f4fcfc 0%, var(--card-teal) 100%); }
.stat-card.blue { background: linear-gradient(135deg, #f7faff 0%, var(--card-blue) 100%); }
.stat-card.orange { background: linear-gradient(135deg, #fffaf2 0%, var(--card-orange) 100%); }
.stat-card.red { background: linear-gradient(135deg, #fff6f7 0%, var(--card-red) 100%); }
.stat-card.green { background: linear-gradient(135deg, #f5fff8 0%, var(--card-green) 100%); }

.stat-card h3,
.stat-card p {
    margin: 0;
}

.stat-card strong {
    display: block;
    margin-top: 0.55rem;
    font-size: 1.9rem;
}

.entity-list {
    display: grid;
    gap: 0.85rem;
}

.empty-state {
    padding: 1.4rem;
    border-radius: 1.2rem;
    background: rgba(17, 87, 108, 0.05);
    color: var(--muted);
    text-align: center;
}

.hero-value {
    font-size: 2.3rem;
    font-weight: 900;
}

.stack {
    display: grid;
    gap: 0.85rem;
}

.inline-fields {
    grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
}

.owner-fields {
    display: grid;
    gap: 0.75rem;
}

.avatar-stack {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.avatar-preview {
    width: 5.5rem;
    height: 5.5rem;
    border-radius: 1.4rem;
    overflow: hidden;
    background: linear-gradient(135deg, #d8f2ee 0%, #bce7f3 100%);
    border: 1px solid rgba(17, 87, 108, 0.12);
}

.avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.permission-grid {
    display: grid;
    gap: 0.85rem;
}

.permission-card {
    padding: 1rem;
    border-radius: 1.2rem;
    border: 1px solid rgba(17, 87, 108, 0.1);
    background: rgba(255, 255, 255, 0.85);
}

.permission-card h4 {
    margin: 0 0 0.25rem;
}

.switch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 0;
    border-top: 1px solid rgba(17, 87, 108, 0.08);
}

.switch-row:first-of-type {
    border-top: 0;
}

.switch-row input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    padding: 1rem;
    background: rgba(7, 27, 39, 0.48);
    backdrop-filter: blur(6px);
}

.modal-panel {
    width: min(96vw, 60rem);
    max-height: min(90vh, 60rem);
    overflow: auto;
    border-radius: 1.8rem;
    padding: 1.25rem;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: start;
    margin-bottom: 1rem;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.65rem;
}

.modal-body {
    display: grid;
    gap: 1rem;
}

.icon-button {
    width: 2.7rem;
    height: 2.7rem;
    border-radius: 999px;
    background: rgba(17, 87, 108, 0.08);
    color: var(--text);
    font-size: 1.7rem;
    line-height: 1;
}

.toast-container {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 60;
    display: grid;
    gap: 0.75rem;
}

.toast {
    min-width: min(22rem, 92vw);
    max-width: 26rem;
    padding: 0.9rem 1rem;
    border-radius: 1.1rem;
    background: rgba(16, 37, 59, 0.94);
    color: #fff;
    box-shadow: 0 18px 48px rgba(7, 27, 39, 0.28);
}

.toast.is-error { background: rgba(153, 33, 62, 0.96); }
.toast.is-success { background: rgba(22, 106, 79, 0.96); }

.loading-state {
    display: grid;
    place-items: center;
    min-height: 14rem;
    color: var(--muted);
}

@media (max-width: 1100px) {
    .auth-panel,
    .split-card {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .auth-panel,
    .shell-screen {
        padding: 1rem;
    }

    .auth-card,
    .auth-hero-card,
    .sidebar,
    .shell-header,
    .card,
    .list-card,
    .panel-card,
    .modal-panel {
        border-radius: 1.35rem;
    }

    .field-grid,
    .toolbar-row,
    .action-row,
    .summary-grid,
    .stat-grid,
    .check-grid,
    .inline-fields {
        grid-template-columns: 1fr;
    }

    .shell-header {
        align-items: start;
        flex-direction: column;
    }

    .header-leading {
        width: 100%;
    }

    .header-actions {
        width: 100%;
        justify-content: flex-end;
    }
}
