@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Outfit:wght@500;600;700;800&display=swap');

:root {
    --bg: #f5f7f9;
    --bg-soft: #edf0f3;
    --surface: rgba(255, 255, 255, 0.95);
    --surface-strong: #ffffff;
    --surface-muted: #fbfcfd;
    --ink: #1e293b;
    --ink-light: #475569;
    --muted: #94a3b8;
    --line: rgba(226, 232, 240, 0.8);
    --accent: #3b82f6;
    --accent-dark: #2563eb;
    --accent-soft: rgba(59, 130, 246, 0.1);
    --gold: #f59e0b;
    --gold-soft: rgba(245, 158, 11, 0.1);
    --danger: #ef4444;	
    --danger-soft: rgba(239, 68, 68, 0.1);
    --success: #10b981;
    --success-soft: rgba(16, 185, 129, 0.1);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.05), 0 4px 6px -2px rgba(0,0,0,0.03);
    --shadow-premium: 0 20px 25px -5px rgba(15, 23, 42, 0.1), 0 10px 10px -5px rgba(15, 23, 42, 0.04);
    --radius-xl: 20px;
    --radius-lg: 14px;
    --radius-md: 10px;
    --font-body: 'Inter', -apple-system, system-ui, sans-serif;
    --font-display: 'Outfit', sans-serif;
}

* {
    box-sizing: border-box;
}

html, body {
    overflow-x: hidden;
    width: 100%;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    overflow-x: hidden;
}

body {
    min-height: 100vh;
    color: var(--ink);
    font-family: var(--font-body);
    background-color: var(--bg);
    background-image: 
        radial-gradient(at 0% 0%, rgba(37, 99, 235, 0.05) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(5, 150, 105, 0.05) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(217, 119, 6, 0.05) 0px, transparent 50%),
        radial-gradient(at 0% 100%, rgba(225, 29, 72, 0.05) 0px, transparent 50%);
}

a {
    color: inherit;
}

code {
    display: inline-flex;
    align-items: center;
    padding: 0.3rem 0.65rem;
    border-radius: 8px;
    background: var(--bg-soft);
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
}

.stat-card {
    padding: 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: linear-gradient(135deg, #ffffff 0%, #fcfdfe 100%);
    overflow: hidden;
    position: relative;
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-premium);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-card span {
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    position: relative;
    z-index: 2;
}

.stat-card strong {
    font-size: 2.25rem;
    color: var(--ink);
    line-height: 1;
    font-family: var(--font-display);
    position: relative;
    z-index: 2;
}

.stat-card::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 60px;
    height: 60px;
    background: var(--accent-soft);
    border-radius: 0 0 0 100%;
    opacity: 0.3;
    z-index: 1;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--line);
    border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--muted);
}

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

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

.page-shell.dashboard-shell {
    display: block; /* Use block to manage fixed positioning of sidebar */
    min-height: 100vh;
}

.sidebar {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 2rem;
    padding: 2.5rem 1.75rem;
    color: #ffffff;
    background: #0f172a;
    border-right: 1px solid var(--line);
    position: fixed; /* Fixed to viewport */
    top: 0;
    left: 0;
    width: 290px;
    height: 100vh;
    z-index: 1001;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
}

.sidebar.active {
    transform: translateX(0) !important;
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
}

.sidebar-header {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar h1 {
    font-size: 1.5rem;
    color: #fff;
    margin: 0;
}

.sidebar-close {
    display: none !important;
    color: #fff;
    border-color: rgba(255, 255, 255, 0.2);
}

@media (max-width: 900px) {
    .sidebar-close {
        display: flex !important;
    }
}

.mobile-header {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: var(--surface-strong);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 999;
}

.mobile-header-spacer {
    width: 40px;
    height: 40px;
}

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 1000;
}

.sidebar-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

.hamburger {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: transparent;
    border: 0;
    cursor: pointer;
    padding: 8px;
}

.hamburger span {
    width: 20px;
    height: 2px;
    background: var(--ink);
    border-radius: 2px;
}

.sidebar h1,
.page-header h2,
.hero-copy h2,
.form-header h3,
.panel-header h3,
.stat-card strong,
.billing-total strong {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: -0.03em;
}

.sidebar-copy {
    margin: 0.85rem 0 0;
    color: rgba(246, 241, 232, 0.76);
    line-height: 1.7;
}

.sidebar-nav {
    display: grid;
    gap: 0.35rem;
    padding-top: 1rem;
}

.sidebar-sep {
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.4);
    padding: 1.5rem 1rem 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.8rem 1rem;
    border-radius: var(--radius-md);
    color: rgba(255, 255, 255, 0.65);
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.95rem;
    font-weight: 500;
}

.nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
    transform: translateX(4px);
}

.nav-link.active {
    color: #fff;
    background: var(--accent);
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
    box-shadow: 0 8px 16px rgba(59, 130, 246, 0.25);
}

.nav-form {
    margin: 0;
}

.nav-button {
    width: 100%;
    border: 0;
    text-align: left;
    cursor: pointer;
}

.profile-card {
    display: grid;
    gap: 0.45rem;
    padding: 1rem;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.profile-role,
.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.profile-role {
    color: rgba(246, 241, 232, 0.68);
}

.eyebrow {
    color: var(--accent);
    font-weight: 700;
    font-family: var(--font-display);
}

.main-content {
    margin-left: 290px; /* Compensate for fixed sidebar on desktop */
    padding: clamp(1.1rem, 2.4vw, 2rem);
    min-height: 100vh;
}

.main-content.single-column {
    margin-left: 0;
    padding: clamp(1.2rem, 4vw, 2.75rem);
}

.login-shell {
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(300px, 430px);
    gap: clamp(1.25rem, 3vw, 2rem);
    align-items: stretch;
}

.login-hero,
.panel,
.stat-card,
.alert {
    position: relative;
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    background: var(--surface-strong);
    box-shadow: var(--shadow-premium);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.panel:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-premium);
}

.login-hero {
    overflow: hidden;
    padding: clamp(2rem, 5vw, 4rem);
    background: #0f172a;
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-hero::before {
    content: "";
    position: absolute;
    top: -10%;
    right: -10%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.15) 0%, transparent 70%);
    filter: blur(40px);
}

.login-hero::before,
.login-hero::after {
    content: "";
    position: absolute;
    border-radius: 999px;
    pointer-events: none;
}

.login-hero::before {
    top: -140px;
    right: -70px;
    width: 280px;
    height: 280px;
    background: rgba(15, 118, 110, 0.08);
}

.login-hero::after {
    bottom: -110px;
    left: -60px;
    width: 220px;
    height: 220px;
    background: rgba(183, 121, 31, 0.08);
}

.hero-copy {
    position: relative;
    z-index: 1;
}

.hero-copy h2 {
    margin-top: 0.65rem;
    font-size: clamp(2.5rem, 5vw, 4rem);
    line-height: 1.1;
    font-family: var(--font-display);
    font-weight: 800;
}

.hero-copy p {
    max-width: 50ch;
    margin: 1.5rem 0 0;
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.1rem;
    line-height: 1.7;
}

.hero-stat-grid {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 2rem;
}

.hero-stat-card {
    padding: 1.25rem;
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
    transition: transform 0.3s ease;
}

.hero-stat-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.08);
}

.hero-stat-card span {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.hero-stat-card strong {
    color: #fff;
    font-size: 1.1rem;
    margin-top: 0.5rem;
    display: block;
}

.hero-stat-card p {
    color: rgba(255, 255, 255, 0.45);
    font-size: 0.85rem;
    margin-top: 0.75rem;
}

.hero-stat-card span,
.stat-card span,
.mini-grid span,
.support-grid span,
.billing-total span {
    display: block;
    color: var(--muted);
}

.hero-stat-card strong {
    display: block;
    margin-top: 0.3rem;
    font-size: 1.05rem;
}

.hero-stat-card p {
    margin: 0.65rem 0 0;
    color: var(--muted);
    font-size: 0.95rem;
    line-height: 1.6;
}

.hero-points {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
    margin-top: 1.6rem;
}

.hero-points span,
.header-pill,
.status-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.62rem 0.95rem;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-dark);
    font-size: 0.9rem;
    font-weight: 700;
}

.login-card,
.panel {
    padding: 1.5rem;
}

.login-card {
    display: grid;
    align-content: start;
    gap: 1.25rem;
}

.form-header {
    display: grid;
    gap: 0.35rem;
}

.form-header p {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

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

.credential-item {
    display: grid;
    gap: 0.3rem;
    padding: 0.95rem 1rem;
    border-radius: var(--radius-md);
    background: var(--surface-muted);
    border: 1px solid rgba(20, 32, 51, 0.08);
}

.credential-item span {
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.credential-item strong {
    font-size: 1rem;
}

form,
.auth-form {
    display: grid;
    gap: 1rem;
}

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

.grid-form .full-span {
    grid-column: 1 / -1;
}

label {
    display: grid;
    gap: 0.45rem;
}

label span {
    font-size: 0.92rem;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    min-height: 52px;
    padding: 0.85rem 1rem;
    border: 1px solid rgba(20, 32, 51, 0.12);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--ink);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

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

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: rgba(15, 118, 110, 0.55);
    box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
    transform: translateY(-1px);
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 52px;
}

.checkbox-row input {
    width: auto;
    min-height: auto;
    transform: scale(1.1);
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 52px;
    padding: 0.95rem 1.2rem;
    border: 0;
    border-radius: 14px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.button:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 28px rgba(17, 85, 109, 0.18);
}

.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--surface);
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    font-size: 0;
    position: relative;
    overflow: hidden;
}

.icon-button::before {
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1;
}

.icon-button-edit::before {
    content: "✎";
}

.icon-button-delete::before,
.icon-button-close::before,
.sidebar-close::before {
    content: "×";
    font-size: 1.15rem;
}

.icon-button:hover {
    background: var(--bg-soft);
    transform: scale(1.1);
}

.icon-button.danger {
    color: var(--danger);
    border-color: var(--danger-soft);
}

.icon-button.danger:hover {
    background: var(--danger-soft);
}

.sidebar-close,
.sidebar-close:hover {
    color: #fff;
}

.search-form-mini input {
    height: 38px;
    min-height: 38px;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    width: 200px;
}

.card-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.inline-form {
    display: inline;
}

.button-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #fff;
    font-weight: 700;
}

.button-secondary {
    background: var(--surface-strong);
    color: var(--ink);
    border: 1px solid var(--line);
    font-weight: 600;
}

.button-secondary:hover {
    background: var(--bg-soft);
}

.auth-form .button {
    width: 100%;
    margin-top: 0.25rem;
}

.button-compact {
    min-height: 38px;
    padding: 0 1rem;
    font-size: 0.85rem;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 2rem;
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--line);
}

.page-header h2 {
    font-size: 2.25rem;
    color: var(--ink);
    margin: 0.5rem 0 0;
}

.page-header p {
    color: var(--muted);
    font-size: 1.05rem;
    margin-top: 0.5rem;
    line-height: 1.7;
}

.note-text {
    margin-bottom: 1rem;
}

.section-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: 0 0 1.25rem;
}

.section-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.7rem 1rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 700;
    text-decoration: none;
    transition: transform 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.section-tab:hover {
    color: var(--accent-dark);
    border-color: rgba(37, 99, 235, 0.2);
    transform: translateY(-1px);
}

.header-pill {
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(20, 32, 51, 0.08);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
    width: 100%;
}

/* Unified stat card handled above */

.dashboard-grid {
    display: flex;
    flex-direction: row;
    gap: 2rem;
    align-items: flex-start;
    width: 100%;
}

.dashboard-grid > .stack:nth-child(1) {
    flex: 1;
    min-width: 0;
}

.dashboard-grid > .stack:nth-child(2) {
    width: 350px;
    flex-shrink: 0;
}

@media (max-width: 1100px) {
    .dashboard-grid {
        flex-direction: column;
    }
    .dashboard-grid > .stack:nth-child(2) {
        width: 100%;
    }
}

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

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

.chart-panel {
    margin-bottom: 2rem;
}

.chart-wrap {
    position: relative;
    height: 350px;
}

.client-list,
.campaign-grid {
    display: grid;
    gap: 1rem;
}

.client-card,
.campaign-card {
    padding: 1rem;
    border-radius: var(--radius-lg);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.76), rgba(244, 237, 226, 0.8));
    border: 1px solid rgba(20, 32, 51, 0.08);
}

.client-card-top,
.campaign-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.client-card h4,
.campaign-card h4 {
    margin: 0;
    font-size: 1.08rem;
}

.client-card p,
.campaign-card p,
.muted,
.cell-note {
    margin: 0.35rem 0 0;
    color: var(--muted);
    line-height: 1.6;
}

.mini-grid,
.support.mini-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 1rem;
}

.mini-grid div span {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--muted);
    margin-bottom: 0.35rem;
    letter-spacing: 0.05em;
}

.mini-grid div strong {
    font-size: 1.25rem;
    color: var(--ink);
    font-family: var(--font-display);
}

.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--line);
    background: var(--surface-strong);
    width: 100%;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

th {
    text-align: left;
    padding: 1.25rem 1rem;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 1rem 1.25rem;
}

td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--line);
    font-size: 0.95rem;
}

tbody tr {
    transition: background 0.2s ease;
}

tbody tr:hover {
    background: var(--bg-soft);
}

.client-card, .campaign-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.client-card:hover, .campaign-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
    border-color: var(--accent);
}

.status-chip {
    white-space: nowrap;
}

.status-active {
    background: var(--accent-soft);
    color: var(--accent-dark);
}

.status-paused {
    background: var(--gold-soft);
    color: var(--gold);
}

.status-completed {
    background: rgba(17, 85, 109, 0.12);
    color: var(--accent-dark);
}

.premium-gradient {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%) !important;
    color: #ffffff !important;
    position: relative;
    overflow: hidden;
}

.premium-gradient h2, 
.premium-gradient h3, 
.premium-gradient h4,
.premium-gradient strong {
    color: #ffffff !important;
}

.premium-gradient p,
.premium-gradient span {
    color: rgba(255, 255, 255, 0.65) !important;
}

.premium-gradient::before {
    content: "";
    position: absolute;
    top: -50px;
    right: -50px;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.1) 0%, transparent 70%);
    pointer-events: none;
}

.billing-panel {
    background: var(--surface-strong);
}

.billing-total {
    display: grid;
    gap: 0.45rem;
    margin-bottom: 1rem;
}

.billing-total strong {
    font-size: 2.3rem;
}

.billing-lines {
    display: grid;
    gap: 0.85rem;
}

.billing-lines div {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid rgba(20, 32, 51, 0.08);
}

.alert {
    padding: 0.95rem 1rem;
    margin-bottom: 1rem;
    border-radius: 18px;
}

.main-content.single-column > .alert {
    width: min(1180px, 100%);
    margin-left: auto;
    margin-right: auto;
}

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

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

/* Handled above */

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

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        transform: translateX(-100%);
        width: 300px;
    }
}

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

    .sidebar {
        gap: 1.25rem;
    }

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

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
    overflow-y: auto;
}

body.modal-open {
    overflow: hidden;
}

body.sidebar-open {
    overflow: hidden;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--surface-strong);
    width: min(600px, 100%);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--line);
    overflow: hidden;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body {
    padding: 1.5rem;
    max-height: 80vh;
    overflow-y: auto;
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 2000;
    display: grid;
    gap: 0.75rem;
}

.toast {
    background: #ffffff;
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--accent);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 300px;
    animation: toastIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.error { border-left-color: var(--danger); }
.toast.success { border-left-color: var(--success); }

@keyframes toastIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.mb-base { margin-bottom: 1.5rem; }
.full-span { grid-column: 1 / -1; }
@media (max-width: 900px) {
    .page-shell.dashboard-shell {
        display: block;
    }

    .main-content {
        margin-left: 0; /* No margin on mobile */
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-110%);
        width: 290px;
        box-shadow: none;
    }

    .sidebar.active {
        transform: translateX(0);
        box-shadow: 10px 0 40px rgba(0,0,0,0.4);
    }

    .mobile-header {
        display: flex;
    }

    .login-shell {
        grid-template-columns: 1fr;
    }

    .login-hero {
        padding: 2rem;
    }

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

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

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

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

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

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

    .mini-grid {
        grid-template-columns: 1fr;
    }

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

    .panel-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.25rem;
    }

    .search-form-mini input {
        width: 100%;
    }
}
/* Skeleton Loader Animation */
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.loading-skeleton {
    background: linear-gradient(90deg, var(--bg-soft) 25%, var(--line) 50%, var(--bg-soft) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
    height: 1em;
    width: 100%;
}

.fade-in {
    animation: fadeIn 0.4s ease-out forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.empty-state {
    padding: 3rem;
    text-align: center;
    color: var(--muted);
    font-size: 1.1rem;
    background: var(--bg-soft);
    border-radius: 16px;
    border: 2px dashed var(--line);
    margin: 1rem 0;
}

.single-column-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.auth-form-shell {
    max-width: 480px;
    margin: 40px auto;
}
