/* SmartShamba Diary — Shared Styles (Azure Harvest Design System) */

/* ---------- Reset & Base ---------- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    /* Surface hierarchy */
    --surface: #f9f9ff;
    --surface-bright: #f9f9ff;
    --surface-dim: #d8d9e3;
    --surface-container-lowest: #ffffff;
    --surface-container-low: #f2f3fd;
    --surface-container: #ecedf7;
    --surface-container-high: #e6e8f2;
    --surface-container-highest: #e0e2ec;
    --surface-variant: #e0e2ec;
    --surface-tint: #005bc0;

    /* Primary */
    --primary: #005bbf;
    --primary-container: #1a73e8;
    --primary-fixed: #d8e2ff;
    --primary-fixed-dim: #adc7ff;
    --on-primary: #ffffff;
    --on-primary-container: #ffffff;
    --on-primary-fixed: #001a41;
    --on-primary-fixed-variant: #004493;
    --inverse-primary: #adc7ff;

    /* Secondary */
    --secondary: #005ac1;
    --secondary-container: #4d8efe;
    --secondary-fixed: #d8e2ff;
    --secondary-fixed-dim: #adc6ff;
    --on-secondary: #ffffff;
    --on-secondary-container: #00285c;
    --on-secondary-fixed: #001a41;
    --on-secondary-fixed-variant: #004494;

    /* Tertiary */
    --tertiary: #006d2a;
    --tertiary-container: #16893a;
    --tertiary-fixed: #8ffa9b;
    --tertiary-fixed-dim: #73dc82;
    --on-tertiary: #ffffff;
    --on-tertiary-container: #000701;
    --on-tertiary-fixed: #002108;
    --on-tertiary-fixed-variant: #00531e;

    /* Error */
    --error: #ba1a1a;
    --error-container: #ffdad6;
    --on-error: #ffffff;
    --on-error-container: #93000a;

    /* Neutrals */
    --on-surface: #191c23;
    --on-surface-variant: #414754;
    --on-background: #191c23;
    --outline: #727785;
    --outline-variant: #c1c6d6;
    --inverse-surface: #2d3038;
    --inverse-on-surface: #eff0fa;

    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;

    /* Radius (No-Line Rule) */
    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    --radius-full: 9999px;

    /* Shadows (Primary-tinted ambient only) */
    --shadow-sm: 0 2px 8px rgba(0, 91, 191, 0.04);
    --shadow-md: 0 4px 16px rgba(0, 91, 191, 0.06);
    --shadow-lg: 0 8px 24px rgba(0, 91, 191, 0.08);
    --shadow-fab: 0 8px 24px rgba(0, 91, 191, 0.15);
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

::selection {
    background: var(--primary-fixed);
    color: var(--on-primary-fixed-variant);
}

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

* {
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: "Manrope", system-ui, sans-serif;
    color: var(--on-surface);
    background: var(--surface);
    min-height: 100dvh;
    overflow-x: hidden;
    width: 100vw;
    position: relative;
}

/* ---------- Layout Containers ---------- */
.container-fluid {
    width: 100%;
    padding-left: var(--space-5);
    padding-right: var(--space-5);
    margin-left: auto;
    margin-right: auto;
}

.screen-content {
    padding: var(--space-4) var(--space-5);
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.scroll-y-only {
    overflow-x: hidden !important;
    overflow-y: auto;
}

.fit-view {
    height: calc(100dvh - 2rem);
    display: flex;
    flex-direction: column;
}

/* ---------- Typography ---------- */
.font-headline {
    font-family: "Plus Jakarta Sans", system-ui, sans-serif;
}
.font-body {
    font-family: "Manrope", system-ui, sans-serif;
}
.font-label {
    font-family: "Manrope", system-ui, sans-serif;
}

.text-display-lg {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.02em;
}
.text-headline-md {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
}
.text-headline-sm {
    font-size: 1.375rem;
    font-weight: 700;
    line-height: 1.3;
}
.text-title-lg {
    font-size: 1.375rem;
    font-weight: 600;
    line-height: 1.3;
}
.text-title-md {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
}
.text-title-sm {
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.4;
}
.text-body-lg {
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
}
.text-body-md {
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.5;
}
.text-body-sm {
    font-size: 0.75rem;
    font-weight: 400;
    line-height: 1.5;
}
.text-label-lg {
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.4;
}
.text-label-md {
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.4;
}
.text-label-sm {
    font-size: 0.6875rem;
    font-weight: 600;
    line-height: 1.4;
}

/* ---------- Material Symbols ---------- */
.material-symbols-outlined {
    font-variation-settings:
        "FILL" 0,
        "wght" 400,
        "GRAD" 0,
        "opsz" 24;
    vertical-align: middle;
}
.material-symbols-outlined.filled {
    font-variation-settings:
        "FILL" 1,
        "wght" 400,
        "GRAD" 0,
        "opsz" 24;
}

/* ---------- Buttons ---------- */
.btn-primary {
    background: linear-gradient(
        135deg,
        var(--primary) 0%,
        var(--primary-container) 100%
    );
    color: var(--on-primary);
    border: none;
    border-radius: var(--radius-full);
    font-family: "Plus Jakarta Sans", sans-serif;
    font-weight: 700;
    padding: 0 var(--space-6);
    height: 3.5rem;
    cursor: pointer;
    box-shadow: var(--shadow-fab);
    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
}
.btn-primary:active {
    transform: scale(0.96);
}

.btn-secondary {
    background: var(--surface-container-high);
    color: var(--on-primary-fixed-variant);
    border: none;
    border-radius: var(--radius-full);
    font-family: "Plus Jakarta Sans", sans-serif;
    font-weight: 700;
    padding: 0 var(--space-6);
    height: 3.5rem;
    cursor: pointer;
    transition: background 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
}
.btn-secondary:hover {
    background: var(--surface-container-highest);
}

.btn-text {
    background: none;
    border: none;
    color: var(--primary);
    font-family: "Manrope", sans-serif;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    transition: background 0.15s ease;
}
.btn-text:hover {
    background: var(--primary-fixed);
}

/* ---------- Cards (No borders, tonal layering) ---------- */
.card {
    background: var(--surface-container-lowest);
    border-radius: var(--radius-xl);
    padding: var(--space-4);
    box-shadow: var(--shadow-sm);
}
.card-elevated {
    background: var(--surface-container-lowest);
    border-radius: var(--radius-xl);
    padding: var(--space-4);
    box-shadow: var(--shadow-lg);
}
.card-tonal {
    background: var(--surface-container-low);
    border-radius: var(--radius-xl);
    padding: var(--space-4);
}

/* ---------- Input Fields (Modern Outlined style) ---------- */
.input-filled {
    width: 100%;
    height: 3.25rem;
    padding: 0 var(--space-4);
    background: var(--surface-container-lowest);
    border: 1.5px solid var(--outline-variant);
    border-radius: var(--radius-md);
    font-family: "Manrope", sans-serif;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--on-surface);
    transition:
        border-color 0.18s ease,
        box-shadow 0.18s ease,
        background 0.18s ease;
    -webkit-appearance: none;
    appearance: none;
}
.input-filled:hover {
    border-color: var(--outline);
}
.input-filled:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--surface-container-lowest);
    box-shadow: 0 0 0 3px rgba(0, 91, 191, 0.12);
}
.input-filled::placeholder {
    color: var(--outline);
    font-weight: 400;
}
.input-filled:disabled {
    background: var(--surface-container);
    color: var(--outline);
    cursor: not-allowed;
    border-color: var(--outline-variant);
}

/* Textarea variant */
textarea.input-filled {
    height: auto;
    min-height: 7rem;
    padding: var(--space-3) var(--space-4);
    resize: vertical;
    line-height: 1.6;
}

/* Select variant */
select.input-filled {
    padding-right: 2.5rem;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='%23727785' viewBox='0 0 24 24'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.875rem center;
    background-size: 1.25rem;
    background-color: var(--surface-container-lowest);
}

/* Error state */
.input-filled.input-error {
    border-color: var(--error);
    box-shadow: 0 0 0 3px rgba(186, 26, 26, 0.1);
}

/* Form label — used alongside .input-filled */
.field-label {
    display: block;
    font-family: "Manrope", sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--on-surface-variant);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.375rem;
}

/* Form group: label + input + optional hint stacked */
.field-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}
.field-hint {
    font-size: 0.75rem;
    color: var(--outline);
    line-height: 1.4;
}
.field-error-msg {
    font-size: 0.75rem;
    color: var(--error);
    font-weight: 600;
}

/* ---------- Glass Effect (sticky headers) ---------- */
.glass {
    background: rgba(249, 249, 255, 0.94);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

/* ============================================================
   APP SHELL
   ============================================================ */

.app-shell {
    /* Mobile: allow natural document height */
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    position: relative;
    background: var(--surface);
}

.main-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    /* Mobile: main-container scrolls naturally */
    min-height: 0;
}

#app-content {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 5rem; /* space for bottom nav on mobile */
    min-height: 0;
}

/* ── MOBILE (< 640px) ──────────────────────────────────────── */
/* Default: full width. No artificial max-width cap on mobile. */

/* ── TABLET (640px–1023px) ─────────────────────────────────── */
/* No width cap — content should fill the full available width */

/* ── DESKTOP (≥ 1024px) ────────────────────────────────────── */
@media (min-width: 1024px) {
    /* Lock the shell to exactly the viewport so only #app-content
       scrolls — this stops the sidebar from drifting with the body */
    .app-shell {
        flex-direction: row;
        height: 100dvh;
        overflow: hidden;
    }

    .main-container {
        flex: 1;
        max-width: 100%;
        margin: 0;
        padding: 0;
        height: 100%;
        overflow: hidden;
    }

    #app-content {
        padding-bottom: 2rem;
        max-width: 100%;
        width: 100%;
        height: 100%;
        overflow-y: auto;
    }

    /* All screen root divs (direct children of #app-content) are capped at
       920px and centred — headers, content sections, everything inside them. */
    #app-content > * {
        max-width: 920px;
        margin-left: auto;
        margin-right: auto;
        width: 100%;
    }

    /* Welcome / onboarding / auth screens manage their own full-viewport layout */
    #app-content > .welcome-root,
    #app-content > .otp-root,
    #app-content > .onboarding-root,
    #app-content > .onboarding-enter,
    #app-content > .add-farm-root,
    #app-content > .admin-app-shell {
        max-width: 100%;
    }

    .bottom-nav {
        display: none !important;
    }
}

/* ── FULL-WIDTH SCREENS (welcome, otp, onboarding) ──────────
   These screens render their own layout root that spans the
   full viewport. We must let #app-content step aside for them.
   The welcome.js injects .welcome-root / .otp-root which are
   direct children of #app-content and handle their own sizing. */
#app-content:has(.welcome-root),
#app-content:has(.otp-root) {
    max-width: 100% !important;
    padding-bottom: 0;
}

/* Fallback for browsers without :has() — welcome.js adds
   data-screen="auth" to #app-content when it renders */
#app-content[data-screen="auth"] {
    max-width: 100% !important;
    padding-bottom: 0;
}

/* ============================================================
   WELCOME / AUTH SCREEN LAYOUT
   ============================================================ */

.welcome-root,
.otp-root {
    min-height: 100dvh;
    width: 100%;
    display: flex;
    background: var(--surface);
}

/* Mobile: stacked, card fills width */
.welcome-panel,
.otp-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    padding: 1.5rem;
}

.welcome-card,
.otp-card {
    width: 100%;
    background: var(--surface-container-lowest);
    border-radius: var(--radius-xl);
    padding: 2rem 1.5rem;
    box-shadow: var(--shadow-md);
}

/* Hero panel — hidden on mobile & tablet */
.welcome-hero {
    display: none;
}

/* Tablet (≥ 640px): centred card, capped width */
@media (min-width: 640px) {
    .welcome-panel,
    .otp-panel {
        align-items: center;
        padding: 2rem;
    }
    .welcome-card,
    .otp-card {
        max-width: 460px;
        padding: 2.5rem;
    }
}

/* Desktop (≥ 1024px): two-column split, equal halves */
@media (min-width: 1024px) {
    .welcome-hero {
        display: flex;
        flex: 1 1 0;
        flex-direction: column;
        justify-content: center;
        padding: 4rem 4rem 4rem 5rem;
        background: var(--surface-container-low);
        border-right: 1px solid var(--outline-variant);
    }
    .welcome-panel,
    .otp-panel {
        flex: 1 1 0;
        padding: 3rem;
        justify-content: center;
        align-items: center;
    }
    .welcome-card,
    .otp-card {
        width: 100%;
        max-width: 440px;
        padding: 2.5rem;
    }
}

/* Hero copy */
.welcome-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--on-primary-fixed-variant);
    background: var(--primary-fixed);
    padding: 4px 14px;
    border-radius: var(--radius-full);
    margin-bottom: 1.5rem;
    width: fit-content;
}
.welcome-hero-badge .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary);
    display: inline-block;
}
.welcome-hero h1 {
    font-family: "Plus Jakarta Sans", system-ui, sans-serif;
    font-size: 2.25rem;
    font-weight: 800;
    line-height: 1.2;
    color: var(--on-surface);
    margin-bottom: 1rem;
}
.welcome-hero .hero-sub {
    font-size: 0.9375rem;
    color: var(--on-surface-variant);
    line-height: 1.7;
    margin-bottom: 2rem;
}
.welcome-feature-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 1rem;
}
.welcome-feature-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: var(--primary-fixed);
    color: var(--on-primary-fixed-variant);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.welcome-feature-icon .material-symbols-outlined {
    font-size: 1.125rem;
}
.welcome-feature-text p:first-child {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--on-surface);
    margin: 0;
}
.welcome-feature-text p:last-child {
    font-size: 0.8125rem;
    color: var(--on-surface-variant);
    margin: 0;
}

/* ============================================================
   DESKTOP SIDEBAR
   ============================================================ */

.desktop-sidebar {
    display: none;
}

@media (min-width: 1024px) {
    .desktop-sidebar {
        display: flex;
        flex-direction: column;
        width: 260px;
        /* Fill exact viewport height and scroll internally */
        height: 100dvh;
        overflow-y: auto;
        background: var(--surface-container-low);
        border-right: 1px solid var(--outline-variant);
        /* position: sticky is replaced by the parent overflow:hidden approach */
        position: relative;
        padding: 2rem 1rem;
        gap: 0.5rem;
        z-index: 100;
        flex-shrink: 0;
    }

    /* Hide sidebar on screens with no nav (unauthenticated / onboarding) */
    .no-sidebar .desktop-sidebar {
        display: none;
    }
}

/* ---------- Sidebar Items ---------- */
.sidebar-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1.25rem;
    border-radius: var(--radius-lg);
    color: var(--on-surface-variant);
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
}
.sidebar-item:hover {
    background: var(--surface-container-high);
}
.sidebar-item.active {
    background: var(--primary-fixed);
    color: var(--on-primary-fixed-variant);
}
.sidebar-item .material-symbols-outlined {
    font-size: 1.5rem;
}

/* ============================================================
   RESPONSIVE UTILITIES
   ============================================================ */

@media (max-width: 1023px) {
    .desktop-only {
        display: none !important;
    }
}
@media (min-width: 1024px) {
    .mobile-only {
        display: none !important;
    }
    .responsive-grid-2 {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    .responsive-grid-3 {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    .responsive-grid-4 {
        grid-template-columns: repeat(4, 1fr) !important;
    }
}

/* ============================================================
   BOTTOM NAV (Mobile)
   ============================================================ */

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 920px;
    background: var(--surface-container-lowest);
    box-shadow: 0 -2px 16px rgba(0, 91, 191, 0.06);
    display: flex;
    align-items: center;
    justify-content: space-around;
    height: 5rem;
    padding-bottom: env(safe-area-inset-bottom, 0);
    z-index: 100;
}

/* Tablet: keep nav full width (same as mobile) */

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    color: var(--on-surface-variant);
    background: none;
    border: none;
    min-width: 4rem;
}
.nav-item .nav-icon {
    width: 4rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    transition: all 0.2s ease;
}
.nav-item.active .nav-icon {
    background: var(--primary-fixed);
    color: var(--on-primary-fixed-variant);
}
.nav-item.active {
    color: var(--on-primary-fixed-variant);
}
.nav-item .nav-label {
    font-family: "Manrope", sans-serif;
    font-size: 0.6875rem;
    font-weight: 600;
}
.nav-item.active .nav-label {
    font-weight: 700;
}

/* ============================================================
   FAB
   ============================================================ */

.fab {
    position: fixed;
    bottom: 6rem;
    right: 1.5rem;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: var(--radius-full);
    background: linear-gradient(
        135deg,
        var(--primary) 0%,
        var(--primary-container) 100%
    );
    color: var(--on-primary);
    border: none;
    box-shadow: var(--shadow-fab);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 99;
    transition: transform 0.15s ease;
}
.fab:active {
    transform: scale(0.92);
}

@media (min-width: 1024px) {
    .fab {
        right: 3rem;
        bottom: 3rem;
    }
}

/* ============================================================
   PAGE TRANSITIONS
   ============================================================ */

.page-enter {
    animation: pageSlideIn 0.25s ease-out forwards;
}
.page-exit {
    animation: pageSlideOut 0.2s ease-in forwards;
}
@keyframes pageSlideIn {
    from {
        opacity: 0;
        transform: translateX(12px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}
@keyframes pageSlideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(-12px);
    }
}

.onboarding-enter {
    animation: onboardSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
@keyframes onboardSlideIn {
    from {
        opacity: 0;
        transform: translateX(40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ============================================================
   PROGRESS BAR & STEP DOTS
   ============================================================ */

.progress-track {
    width: 100%;
    height: 0.375rem;
    background: var(--surface-container-highest);
    border-radius: var(--radius-full);
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(
        135deg,
        var(--primary),
        var(--primary-container)
    );
    border-radius: var(--radius-full);
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.step-dots {
    display: flex;
    gap: 0.375rem;
}
.step-dot {
    width: 2rem;
    height: 0.375rem;
    border-radius: var(--radius-full);
    background: var(--surface-container-highest);
    transition: background 0.3s ease;
}
.step-dot.active {
    background: var(--primary);
}
.step-dot.completed {
    background: var(--tertiary-container);
}

/* ============================================================
   CHIP
   ============================================================ */

.chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-full);
    background: var(--surface-container-low);
    color: var(--on-surface-variant);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    border: none;
}
.chip.selected {
    background: var(--primary-fixed);
    color: var(--on-primary-fixed-variant);
}

/* ============================================================
   UTILITY
   ============================================================ */

.text-muted {
    color: var(--on-surface-variant);
}
.text-primary {
    color: var(--primary);
}
.text-error {
    color: var(--error);
}
.text-success {
    color: var(--tertiary);
}
.bg-surface {
    background: var(--surface);
}

.no-scrollbar::-webkit-scrollbar {
    display: none;
}
.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.ghost-border {
    border: 1px solid rgba(193, 198, 214, 0.15);
}

.logo-rounded {
    border-radius: 50%;
    object-fit: contain;
    background: #ffffff;
    /* force square so 50% always produces a circle, not an ellipse */
    aspect-ratio: 1 / 1;
}

/* ============================================================
   ADMIN SHELL
   ============================================================ */

.admin-shell {
    width: 100%;
    max-width: 72rem;
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--space-5);
    padding-right: var(--space-5);
    padding-bottom: max(2rem, env(safe-area-inset-bottom));
}
@media (min-width: 768px) {
    .admin-shell {
        padding-left: var(--space-8);
        padding-right: var(--space-8);
    }
}

/* ============================================================
   HIDE NUMBER SPINNERS
   ============================================================ */

input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type="number"] {
    -moz-appearance: textfield;
}

/* ============================================================
   OTP DIGIT FOCUS
   ============================================================ */

.otp-digit:focus {
    border-color: var(--primary) !important;
    background: var(--surface-container-high) !important;
    box-shadow: 0 0 0 1px var(--primary);
}

/* ============================================================
   CONNECTIVITY BANNER
   ============================================================ */

.offline-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--error);
    color: white;
    text-align: center;
    padding: 0.5rem;
    font-size: 0.75rem;
    font-weight: 700;
    z-index: 1000;
    display: none;
    animation: slideDown 0.3s ease-out;
}
.is-offline .offline-banner {
    display: block;
}
@keyframes slideDown {
    from {
        transform: translateY(-100%);
    }
    to {
        transform: translateY(0);
    }
}

/* ============================================================
   SYNC STATUS
   ============================================================ */

.sync-status {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.625rem;
    font-weight: 600;
}
.sync-status.pending {
    color: var(--outline);
}
.sync-status.synced {
    color: var(--tertiary);
}

/* ============================================================
   ONBOARDING SCREENS
   ============================================================ */

/* Root shell — full-viewport, escapes the narrow main-container */
.onboarding-root {
    min-height: 100dvh;
    width: 100%;
    display: flex;
    background: var(--surface);
}

/* ── Mobile: single centred column ── */
.onboarding-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.5rem;
    overflow-y: auto;
}

/* Inner content cap so text doesn't stretch too wide */
.onboarding-body {
    width: 100%;
    max-width: 26rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ── Tablet (≥ 640px): a little more breathing room ── */
@media (min-width: 640px) {
    .onboarding-panel {
        padding: 3rem 2rem;
    }
}

/* ── Desktop (≥ 1024px): two-column split matching welcome/OTP ── */
@media (min-width: 1024px) {
    .onboarding-side {
        display: flex !important; /* overrides the mobile display:none */
        flex: 1 1 0;
        flex-direction: column;
        justify-content: center;
        padding: 4rem 4rem 4rem 5rem;
        background: var(--surface-container-low);
        border-right: 1px solid var(--outline-variant);
    }
    .onboarding-panel {
        flex: 1 1 0;
        padding: 3rem;
        justify-content: center;
        overflow-y: auto;
    }
    .onboarding-body {
        max-width: 28rem;
    }
}

/* Side panel — hidden on mobile, shown on desktop via above rule */
.onboarding-side {
    display: none;
}

/* ── About You screen ── */

/* Back button */
.onboarding-back-btn {
    background: var(--surface-container-high);
    border: none;
    border-radius: var(--radius-full);
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s ease;
}
.onboarding-back-btn:hover {
    background: var(--surface-container-highest);
}

/* Form field group */
.about-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
}
.about-field label {
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--on-surface-variant);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.about-field .field-hint {
    font-size: 0.8125rem;
    color: var(--on-surface-variant);
    line-height: 1.5;
    margin-top: 0.25rem;
}

/* Farm count toggle buttons */
.farm-count-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 0.75rem;
    border-radius: var(--radius-lg);
    border: 2px solid var(--outline-variant);
    background: var(--surface-container-low);
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: "Manrope", sans-serif;
}
.farm-count-btn .farm-count-icon {
    font-size: 1.5rem;
    line-height: 1;
}
.farm-count-btn .farm-count-label {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--on-surface-variant);
}
.farm-count-btn .farm-count-sub {
    font-size: 0.75rem;
    color: var(--outline);
    line-height: 1.3;
    text-align: center;
}
.farm-count-btn.selected {
    border-color: var(--primary);
    background: var(--primary-fixed);
}
.farm-count-btn.selected .farm-count-label {
    color: var(--on-primary-fixed-variant);
}
.farm-count-btn.selected .farm-count-sub {
    color: var(--on-primary-fixed-variant);
    opacity: 0.75;
}

/* Validation error */
.about-error {
    display: none;
    padding: 0.875rem 1rem;
    background: var(--error-container);
    border-radius: var(--radius-lg);
    color: var(--on-error-container);
    font-size: 0.875rem;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
}
.about-error.visible {
    display: flex;
}

/* Step badge e.g. "Step 2 of 5" */
.onboarding-step-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--on-primary-fixed-variant);
    background: var(--primary-fixed);
    padding: 4px 14px;
    border-radius: var(--radius-full);
    margin-bottom: 1.5rem;
}

/* Feature list items (value props) */
.onboarding-feature {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    width: 100%;
    margin-bottom: 1.25rem;
}
.onboarding-feature-icon {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.onboarding-feature-icon .material-symbols-outlined {
    font-size: 1.375rem;
}
.onboarding-feature-text h3 {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--on-surface);
    margin: 0 0 0.125rem;
    line-height: 1.3;
}
.onboarding-feature-text p {
    font-size: 0.8125rem;
    color: var(--on-surface-variant);
    line-height: 1.55;
    margin: 0;
}

/* Info box — "What to expect" */
.onboarding-info-box {
    width: 100%;
    background: var(--surface-container-low);
    border-radius: var(--radius-xl);
    padding: 1.25rem 1.5rem;
    margin-bottom: 2rem;
}
.onboarding-info-box .label {
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--on-surface-variant);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.5rem;
}
.onboarding-info-box p {
    font-size: 0.875rem;
    color: var(--on-surface-variant);
    line-height: 1.6;
    margin: 0;
}

/* Logo mark on onboarding screens */
.onboarding-logo {
    width: 4.5rem;
    height: 4.5rem;
    object-fit: contain;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    margin-bottom: 1.75rem;
}

/* Side-panel illustration grid (desktop) */
.onboarding-side-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 2.5rem;
}
.onboarding-side-tile {
    background: var(--surface-container-lowest);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
}
.onboarding-side-tile .tile-label {
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--on-surface-variant);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.375rem;
}
.onboarding-side-tile .tile-value {
    font-family: "Plus Jakarta Sans", system-ui, sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--on-surface);
    line-height: 1;
}
.onboarding-side-tile .tile-sub {
    font-size: 0.75rem;
    color: var(--on-surface-variant);
    margin-top: 0.25rem;
}

/* ============================================================
   LOCATION SUGGESTIONS DROPDOWN
   ============================================================ */

.location-suggestions {
    position: absolute;
    top: calc(100% + 0.375rem);
    left: 0;
    right: 0;
    background: var(--surface-container-lowest);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 600;
    overflow: hidden;
    max-height: 18rem;
    overflow-y: auto;
}

.loc-suggestion-item {
    width: 100%;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    font-family: "Manrope", sans-serif;
    transition: background 0.12s ease;
}

.loc-suggestion-item:hover,
.loc-suggestion-item:focus {
    background: var(--surface-container-low);
}

.loc-suggestion-item + .loc-suggestion-item {
    border-top: 1px solid var(--outline-variant);
}

.loc-suggestion-primary {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--on-surface);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.loc-suggestion-secondary {
    display: block;
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--on-surface-variant);
    margin-top: 0.125rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================================
   ADD FARM V2 SCREEN
   ============================================================ */

/* Full-viewport two-column root (matches onboarding pattern) */
.add-farm-root {
    min-height: 100dvh;
    width: 100%;
    display: flex;
    background: var(--surface);
}

/* Side panel — hidden on mobile */
.add-farm-side {
    display: none;
}

/* Main scrollable panel */
.add-farm-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Inner content wrapper */
.add-farm-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.5rem 1.5rem 2rem;
    max-width: 100%;
}

@media (min-width: 640px) {
    .add-farm-body {
        padding: 2rem;
        max-width: 640px;
        margin: 0 auto;
        width: 100%;
    }
}

@media (min-width: 1024px) {
    .add-farm-side {
        display: flex;
        flex: 0 0 340px;
        flex-direction: column;
        justify-content: flex-start;
        padding: 3rem 2.5rem 3rem 3rem;
        background: var(--surface-container-low);
        border-right: 1px solid var(--outline-variant);
        position: sticky;
        top: 0;
        height: 100dvh;
        overflow-y: auto;
    }
    .add-farm-body {
        max-width: 600px;
        padding: 2rem 2.5rem 3rem;
    }
}

/* Screen header row */
.add-farm-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.add-farm-header h1 {
    font-family: "Plus Jakarta Sans", system-ui, sans-serif;
    font-size: 1.375rem;
    font-weight: 800;
    color: var(--on-surface);
    line-height: 1.2;
    margin: 0;
    flex: 1;
}
.add-farm-header p {
    font-size: 0.8125rem;
    color: var(--on-surface-variant);
    margin: 0.25rem 0 0;
}

/* Section card within the form */
.add-farm-card {
    background: var(--surface-container-lowest);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Section label inside a card */
.add-farm-section-label {
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--on-surface-variant);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: -0.25rem; /* tighten gap to first field */
}

/* Field label + input stack */
.add-farm-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.add-farm-field label {
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--on-surface-variant);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.add-farm-field .field-hint {
    font-size: 0.8125rem;
    color: var(--outline);
    line-height: 1.5;
}

/* Location search input + button wrapper */
.location-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.location-input-wrap .input-filled {
    border-radius: var(--radius-md);
    padding-right: 3.25rem;
}
.location-search-btn {
    position: absolute;
    right: 0.5rem;
    background: linear-gradient(
        135deg,
        var(--primary),
        var(--primary-container)
    );
    border: none;
    border-radius: 50%;
    width: 2.25rem;
    height: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.15s ease;
}
.location-search-btn:active {
    transform: scale(0.93);
}

/* Map container */
.add-farm-map-wrap {
    position: relative;
    border-radius: var(--radius-xl);
    overflow: hidden;
    background: var(--surface-container);
}
.add-farm-map {
    height: 240px;
    width: 100%;
    transition: height 0.3s ease;
}
@media (min-width: 640px) {
    .add-farm-map {
        height: 300px;
    }
}

/* Map guide overlay */
.map-guide-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 500;
    padding: 2rem 1.5rem;
    text-align: center;
}
.map-guide-icon {
    width: 4rem;
    height: 4rem;
    border-radius: var(--radius-xl);
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}
.map-guide-overlay h3 {
    color: #fff;
    font-family: "Plus Jakarta Sans", sans-serif;
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}
.map-guide-overlay p {
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.8125rem;
    line-height: 1.55;
    max-width: 17rem;
    margin-bottom: 1.25rem;
}
.map-guide-dismiss-btn {
    background: #fff;
    color: var(--primary);
    border: none;
    border-radius: var(--radius-full);
    padding: 0.5rem 1.75rem;
    font-family: "Manrope", sans-serif;
    font-size: 0.875rem;
    font-weight: 700;
    cursor: pointer;
}

/* Map bottom controls row */
.map-controls-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.625rem;
}
.map-stat-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    background: var(--primary-fixed);
    color: var(--on-primary-fixed-variant);
    border-radius: var(--radius-full);
    padding: 0.3rem 0.875rem;
    font-size: 0.8125rem;
    font-weight: 700;
}

/* Map helper / validation text below map */
.map-helper {
    font-size: 0.8125rem;
    font-weight: 600;
    min-height: 1.25rem;
    margin-top: 0.375rem;
}

/* Plus Code toggle */
.pluscode-toggle-btn {
    background: none;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    color: var(--primary);
    font-family: "Manrope", sans-serif;
    font-size: 0.8125rem;
    font-weight: 600;
    padding: 0.25rem 0;
}

/* Validation error banner */
.add-farm-error {
    display: none;
    padding: 0.875rem 1rem;
    background: var(--error-container);
    border-radius: var(--radius-lg);
    color: var(--on-error-container);
    font-size: 0.875rem;
    align-items: center;
    gap: 0.5rem;
}
.add-farm-error.visible {
    display: flex;
}

/* Action buttons row */
.add-farm-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
}
.add-farm-actions .btn-secondary {
    flex: 1;
    font-size: 0.9375rem;
}
.add-farm-actions .btn-primary {
    flex: 2;
    font-size: 1rem;
}

/* ============================================================
   SKIP-TO-CONTENT LINK (Accessibility)
   ============================================================ */

.skip-link {
    position: absolute;
    top: -100%;
    left: 1rem;
    background: var(--primary);
    color: var(--on-primary);
    padding: 0.75rem 1.5rem;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    font-family: "Manrope", sans-serif;
    font-weight: 700;
    font-size: 0.9375rem;
    z-index: 9999;
    text-decoration: none;
    transition: top 0.2s ease;
    white-space: nowrap;
}
.skip-link:focus {
    top: 0;
    outline: 3px solid var(--on-primary);
    outline-offset: 2px;
}

/* ============================================================
   HAMBURGER BUTTON — hidden everywhere (bottom nav on mobile/tablet,
   sidebar always visible on desktop)
   ============================================================ */

#hamburger-btn {
    display: none !important;
}

/* ============================================================
   SIDEBAR OVERLAY BACKDROP (mobile / tablet)
   ============================================================ */

#sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(25, 28, 35, 0.48);
    z-index: 148;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    cursor: pointer;
}
#sidebar-overlay.visible {
    display: block;
    animation: overlayFadeIn 0.22s ease-out;
}
@keyframes overlayFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ============================================================
   MOBILE SIDEBAR DRAWER (< 1024px)

   On desktop the sidebar is handled by the existing rules in
   the "DESKTOP SIDEBAR" section. Here we override it to act
   as an off-canvas drawer on smaller screens.
   ============================================================ */

@media (max-width: 1023px) {
    /* Always keep the element rendered so the CSS transform
       animation works; hide it visually until drawer-open. */
    .desktop-sidebar {
        /* Positioning */
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 280px;
        height: 100dvh !important;
        z-index: 149 !important;
        /* Layout (mirrors desktop sidebar) */
        display: flex !important;
        flex-direction: column;
        padding: 1.75rem 1rem;
        gap: 0.5rem;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        background: var(--surface-container-low);
        border-right: none; /* replaced by shadow when open */
        /* Off-screen animation */
        transform: translateX(-110%);
        visibility: hidden;
        transition:
            transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
            visibility 0s linear 0.3s; /* delay visibility until after slide-out */
        will-change: transform;
    }

    /* Sidebar is only interactive when a nav config is active */
    .desktop-sidebar:not(.sidebar-has-nav) {
        /* Keep off-screen and inaccessible on no-nav screens */
        pointer-events: none;
    }

    /* Open state */
    .desktop-sidebar.drawer-open {
        transform: translateX(0);
        visibility: visible;
        transition:
            transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
            visibility 0s linear 0s; /* show immediately on open */
        box-shadow:
            0 0 0 0 transparent,
            /* no spread */ 0.5rem 0 2rem rgba(0, 0, 0, 0.12),
            2rem 0 4rem rgba(0, 0, 0, 0.08);
    }

    /* Close button inside drawer (shown on mobile only) */
    .sidebar-close-btn {
        display: flex;
    }
}

/* Desktop: hide the close button (sidebar is always visible) */
@media (min-width: 1024px) {
    .sidebar-close-btn {
        display: none !important;
    }
}

/* Sidebar close button base styles */
.sidebar-close-btn {
    display: none; /* shown via mobile media query above */
    width: 2.25rem;
    height: 2.25rem;
    border-radius: var(--radius-md);
    background: var(--surface-container-high);
    border: none;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    color: var(--on-surface-variant);
    transition: background 0.15s ease;
    flex-shrink: 0;
    min-width: 44px;
    min-height: 44px;
}
.sidebar-close-btn:hover {
    background: var(--surface-container-highest);
}
.sidebar-close-btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
.sidebar-close-btn .material-symbols-outlined {
    font-size: 1.25rem;
}

/* ============================================================
   SIDEBAR VISUAL IMPROVEMENTS
   ============================================================ */

/* Clearer active-item indicator using a left accent stripe
   via the ::before pseudo (NOT a border-left on the element) */
.sidebar-item {
    position: relative;
    font-family: "Manrope", sans-serif;
    font-size: 0.9375rem;
    letter-spacing: -0.01em;
}
.sidebar-item::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: var(--primary);
    border-radius: 0 var(--radius-full) var(--radius-full) 0;
    transition: height 0.2s ease;
}
.sidebar-item.active::before {
    height: 60%;
}
.sidebar-item:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ============================================================
   BOTTOM NAV ACCESSIBILITY IMPROVEMENTS
   ============================================================ */

.nav-item:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: var(--radius-lg);
}

/* Ensure labels are readable at minimum font size */
.nav-item .nav-label {
    font-size: 0.6875rem; /* 11px — above minimum 11px threshold */
    font-weight: 600;
    letter-spacing: 0.01em;
}

/* ============================================================
   LAYOUT CONSISTENCY — CONTENT PADDING WHEN HAMBURGER IS
   SHOWN (prevents content from being hidden under the button)
   ============================================================ */

/* Hamburger removed — no top padding compensation needed. */

/* ============================================================
   RESPONSIVE TYPOGRAPHY REFINEMENTS
   ============================================================ */

/* Slightly tighter display size on small screens */
@media (max-width: 639px) {
    .text-display-lg {
        font-size: 2.5rem;
    }
    .text-headline-md {
        font-size: 1.5rem;
    }
}

/* ============================================================
   IMPROVED CARD INTERACTIVE STATES
   ============================================================ */

/* Tappable cards (when they wrap a button or have onclick) */
button.card,
a.card {
    cursor: pointer;
    transition: background 0.15s ease;
    text-align: left;
    width: 100%;
    border: none;
}
button.card:hover,
a.card:hover {
    background: var(--surface-container-low);
}
button.card:focus-visible,
a.card:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ============================================================
   ROTATING SYNC ICON (used in buttons while loading)
   ============================================================ */

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}
.rotating {
    display: inline-block;
    animation: spin 0.8s linear infinite;
}

/* ============================================================
   MODAL DIALOG
   ============================================================ */

/* Backdrop */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(25, 28, 35, 0.56);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    animation: modalBackdropIn 0.2s ease-out;
}
@keyframes modalBackdropIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Dialog box */
.modal-dialog {
    background: var(--surface-container-lowest);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 22rem;
    box-shadow:
        0 8px 40px rgba(0, 0, 0, 0.18),
        0 2px 8px rgba(0, 0, 0, 0.08);
    animation: modalDialogIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}
@keyframes modalDialogIn {
    from {
        opacity: 0;
        transform: scale(0.88) translateY(8px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Icon zone */
.modal-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 50%;
    margin: 0 auto 1rem;
    flex-shrink: 0;
}
.modal-icon.error {
    background: var(--error-container);
    color: var(--on-error-container);
}
.modal-icon.warning {
    background: #fff3e0;
    color: #e65100;
}
.modal-icon.info {
    background: var(--primary-fixed);
    color: var(--on-primary-fixed-variant);
}
.modal-icon.success {
    background: var(--tertiary-fixed);
    color: var(--on-tertiary-fixed-variant);
}
.modal-icon .material-symbols-outlined {
    font-size: 1.75rem;
}

/* Body */
.modal-body {
    padding: 2rem 1.75rem 1.25rem;
    text-align: center;
}
.modal-title {
    font-family: "Plus Jakarta Sans", system-ui, sans-serif;
    font-size: 1.125rem;
    font-weight: 800;
    color: var(--on-surface);
    margin-bottom: 0.5rem;
    line-height: 1.25;
}
.modal-message {
    font-size: 0.9rem;
    color: var(--on-surface-variant);
    line-height: 1.6;
}

/* Actions row */
.modal-actions {
    display: flex;
    gap: 0.625rem;
    padding: 1.25rem 1.75rem 1.75rem;
}
.modal-actions .btn-primary,
.modal-actions .btn-secondary {
    flex: 1;
    height: 3rem;
    font-size: 0.9375rem;
}
/* Destructive variant for delete/remove confirms */
.modal-actions .btn-danger {
    flex: 1;
    height: 3rem;
    font-size: 0.9375rem;
    background: var(--error);
    color: var(--on-error);
    border: none;
    border-radius: var(--radius-full);
    font-family: "Plus Jakarta Sans", sans-serif;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.15s ease;
}
.modal-actions .btn-danger:active {
    opacity: 0.82;
}
