:root {
    font-family: "Inter", "Poppins", "Segoe UI", sans-serif;
    color: #1e1b4b;
    background-color: #f7f8ff;
    --card-bg: #ffffff;
    --border: #e4e7fb;
    --text-muted: #6b6c8d;
    --accent: #7b5bff;
    --accent-soft: #f1edff;
    --success: #0ea5e9;
    --warning: #f97316;
}

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100dvh;
    background: radial-gradient(circle at top, #fff, #f4f5ff 55%, #eef0ff);
    color: #1f275f;
}

.dashboard-shell {
    display: flex;
    min-height: 100dvh;
    background: radial-gradient(circle at top, #fff, #f4f5ff 55%, #eef0ff);
}

.sidebar {
    width: 88px;
    background: linear-gradient(180deg, #6a5bfb, #7e39db);
    padding: 1.75rem 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    color: #fff;
}

.nav-avatar {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 0.02em;
    border: none;
    color: #fff;
    cursor: pointer;
    font-family: inherit;
}

.nav-avatar:focus-visible {
    outline: 3px solid rgba(255, 255, 255, 0.8);
    outline-offset: 2px;
}

.nav-links {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.nav-item {
    width: 56px;
    height: 56px;
    border-radius: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: inherit;
    text-decoration: none;
    background: transparent;
    border: 1px solid transparent;
    font-size: 1.2rem;
    font-weight: 600;
}

.nav-item.active {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.35);
    box-shadow: 0 10px 30px rgba(19, 0, 117, 0.25);
}

.nav-item.logout {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.35);
    font-size: 1rem;
}

.nav-icon {
    color: #fff;
    font-size: 1.1rem;
    line-height: 1;
}

.content-area {
    flex: 1;
    padding: 2rem clamp(1rem, 4vw, 3.5rem);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-width: 0;
}

.top-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 1.25rem;
    align-items: flex-start;
}

.top-bar h1 {
    margin: 0.35rem 0 0;
    font-size: clamp(1.8rem, 4vw, 2.4rem);
}

.page-subtitle {
    margin: 0.35rem 0 0;
    color: var(--text-muted);
    font-size: 0.95rem;
}

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

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

.search-field {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.4rem 0.4rem 0.4rem 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    box-shadow: inset 0 2px 6px rgba(91, 93, 166, 0.08);
}

.search-field input {
    border: none;
    background: transparent;
    outline: none;
    font-size: 0.95rem;
    padding: 0.4rem 0.6rem 0.4rem 0;
    width: 160px;
}

.search-field button {
    border: none;
    background: var(--accent);
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.95rem;
}

.ghost-button {
    border-radius: 999px;
    border: 1px solid var(--border);
    padding: 0.6rem 1.25rem;
    background: linear-gradient(135deg, #f4f0ff, #fff);
    box-shadow: 0 15px 30px rgba(63, 81, 181, 0.15);
    color: #4338ca;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.card {
    background: var(--card-bg);
    border-radius: 28px;
    padding: 1.5rem;
    border: 1px solid var(--border);
    box-shadow: 0 25px 60px rgba(121, 117, 197, 0.15);
    min-width: 0;
    overflow-wrap: anywhere;
}

.hero-card {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    background: linear-gradient(135deg, #f6f1ff, #ffffff);
}

.hero-meta {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.hero-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
}

.hero-stat {
    padding: 1rem;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(108, 112, 255, 0.15);
}

.hero-stat span {
    display: block;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.hero-stat strong {
    font-size: 1.05rem;
}

.metrics-grid,
.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.metric-card,
.module-card {
    padding: 1.2rem;
    border-radius: 24px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    text-decoration: none;
    color: inherit;
}

.metric-card h3,
.module-card h3 {
    margin: 0.3rem 0;
    font-size: 1.5rem;
}

.metric-label {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
}

.chip {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0 0.75rem;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 600;
}

.dual-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.conversion-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.conversion-list li {
    display: flex;
    justify-content: space-between;
    font-weight: 600;
    color: #1f275f;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.data-table th,
.data-table td {
    text-align: left;
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--border);
    color: #33325a;
}

.data-table th {
    font-weight: 600;
    color: var(--text-muted);
}

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

.panel-header h2 {
    margin: 0;
    font-size: 1.25rem;
}

.panel-subtitle {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.profit-layout {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: center;
}

.progress-ring {
    --size: 160px;
    width: var(--size);
    height: var(--size);
    border-radius: 50%;
    background: conic-gradient(var(--accent) calc(var(--progress, 0) * 1%), var(--accent-soft) 0);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    color: #1f275f;
    font-weight: 700;
    font-size: 1.5rem;
}

.progress-ring::after {
    content: "";
    position: absolute;
    width: calc(var(--size) - 28px);
    height: calc(var(--size) - 28px);
    border-radius: 50%;
    background: #fff;
    box-shadow: inset 0 5px 12px rgba(0, 0, 0, 0.06);
}

.progress-ring span {
    position: relative;
    z-index: 1;
    text-align: center;
    line-height: 1.2;
}

.progress-ring small {
    display: block;
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-muted);
}

.app-footer {
    margin-top: auto;
    padding-top: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
}

.primary-button {
    border: none;
    border-radius: 16px;
    padding: 0.9rem 1.8rem;
    background: linear-gradient(120deg, #ff7a84, #ff9767);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 18px 30px rgba(255, 122, 132, 0.3);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.primary-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 35px rgba(255, 122, 132, 0.4);
}

.primary-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: none;
}

img,
svg {
    max-width: 100%;
}

table {
    width: 100%;
}

.alert {
    margin: 0 0 1rem;
    padding: 0.85rem 1rem;
    border-radius: 16px;
    background: #fff5f0;
    border: 1px solid rgba(255, 125, 104, 0.4);
    color: #b45309;
    font-weight: 600;
}

body.drawer-open {
    overflow: hidden;
}

.module-drawer {
    position: fixed;
    inset: 0;
    background: rgba(10, 6, 31, 0.45);
    display: flex;
    justify-content: flex-start;
    align-items: stretch;
    z-index: 1100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.module-drawer.open {
    opacity: 1;
    pointer-events: auto;
}

.drawer-panel {
    width: min(420px, 90vw);
    background: #f8f7ff;
    border-radius: 0 28px 28px 0;
    padding: 1.75rem;
    box-shadow: 0 40px 60px rgba(24, 13, 73, 0.3);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    transform: translateX(-40px);
    transition: transform 0.25s ease;
}

.module-drawer.open .drawer-panel {
    transform: translateX(0);
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.drawer-close {
    border: none;
    background: rgba(123, 91, 255, 0.15);
    color: #1f275f;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
}

.drawer-modules {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow-y: auto;
    padding-right: 0.35rem;
}

.drawer-module {
    display: flex;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-radius: 18px;
    background: #fff;
    text-decoration: none;
    color: inherit;
    border: 1px solid rgba(123, 91, 255, 0.12);
    box-shadow: 0 12px 25px rgba(25, 12, 66, 0.08);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.drawer-module:hover {
    transform: translateX(6px);
    box-shadow: 0 18px 34px rgba(25, 12, 66, 0.16);
}

.drawer-module-icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: rgba(123, 91, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
}

.drawer-module-icon svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
}

.drawer-module-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.drawer-module-content strong {
    font-size: 1rem;
}

.drawer-module-content span {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.4;
}

.drawer-footer {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(123, 91, 255, 0.15);
}

.drawer-footer a {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border-radius: 18px;
    padding: 0.9rem 1.25rem;
    text-decoration: none;
    color: #fff;
    font-weight: 600;
    background: linear-gradient(120deg, #f87171, #ef4444);
    box-shadow: 0 12px 30px rgba(191, 36, 36, 0.35);
}

.drawer-footer a:hover {
    box-shadow: 0 18px 40px rgba(191, 36, 36, 0.45);
    transform: translateY(-1px);
}

@media (max-width: 960px) {
    .dashboard-shell {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        padding: 0.75rem 1rem;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        min-height: auto;
    }

    .nav-avatar,
    .nav-item {
        width: 48px;
        height: 48px;
        border-radius: 14px;
    }



    .content-area {
        padding: 1.5rem;
    }

    .card {
        border-radius: 22px;
        padding: 1.2rem;
    }
}

@media (max-width: 640px) {
    .content-area {
        padding: 1rem;
        gap: 1rem;
    }

    .top-bar h1 {
        font-size: clamp(1.35rem, 8vw, 1.8rem);
    }

    .hero-card {
        grid-template-columns: 1fr;
    }

    .hero-stats {
        grid-template-columns: 1fr;
    }

    .ghost-button,
    .primary-button {
        width: 100%;
    }

    .drawer-panel {
        width: 100vw;
        border-radius: 0;
        padding: 1rem;
    }
}

.module-card svg {
    width: 32px;
    height: 32px;
    stroke: currentColor;
    display: block;
}

.module-card p {
    margin: 0;
    color: var(--text-muted);
    line-height: 1.5;
}

.module-card:hover {
    box-shadow: 0 25px 45px rgba(86, 81, 176, 0.25);
    transform: translateY(-4px);
}

.save-form {
    margin-top: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
    align-items: center;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
