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

/* ─────────────────────────────────────────────
   TOKENS — iOS-inspired Legal App
   ───────────────────────────────────────────── */
:root {
    /* Surfaces */
    --bg:            #f2f4f8;
    --surface:       #ffffff;
    --surface-alt:   #f0f4fa;
    --surface-glass: rgba(255,255,255,0.82);
    --surface-deep:  #e8edf6;

    /* Text */
    --text:          #0f1824;
    --text-2:        #2c3a4e;
    --muted:         #556070;

    /* Brand */
    --primary:       #1460c8;
    --primary-hover: #1050aa;
    --primary-soft:  #e7f0ff;
    --accent:        #ff7a1a;

    /* Status */
    --ok:            #1b8a4a;
    --error:         #bf2c2c;

    /* Structure */
    --border:        #d4dce8;
    --border-light:  rgba(180, 200, 230, 0.5);

    /* Radius — iOS continuous curve */
    --radius:        20px;
    --radius-sm:     12px;
    --radius-xs:     8px;
    --radius-pill:   999px;

    /* Shadows — iOS layered */
    --shadow:        0 2px 8px rgba(10,25,55,0.06), 0 8px 24px rgba(10,25,55,0.07);
    --shadow-lg:     0 4px 12px rgba(10,25,55,0.06), 0 16px 40px rgba(10,25,55,0.1);
    --shadow-card:   0 1px 3px rgba(10,25,55,0.05), 0 6px 20px rgba(10,25,55,0.06);

    /* Timing */
    --ease-spring:   cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-smooth:   cubic-bezier(0.4, 0, 0.2, 1);
    --dur-fast:      150ms;
    --dur-mid:       240ms;

    /* Bottom nav height + iOS safe area */
    --bottom-nav-h:  64px;
    --safe-top:      env(safe-area-inset-top, 0px);
    --safe-bottom:   env(safe-area-inset-bottom, 0px);
    --safe-left:     env(safe-area-inset-left, 0px);
    --safe-right:    env(safe-area-inset-right, 0px);
}

/* ─────────────────────────────────────────────
   RESET + BASE
   ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

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

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Space Grotesk", "Segoe UI", sans-serif;
    font-size: 16px;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    background-image: radial-gradient(ellipse 70% 50% at 95% 0%, #d7e8ff 0%, transparent 55%);
    -webkit-font-smoothing: antialiased;
    /* space for iOS bottom tab bar on mobile */
    padding-bottom: 0;
    overflow-x: hidden; /* prevent horizontal scroll from overflowing selects */
}

a {
    color: var(--primary);
    text-decoration: none;
}

/* ─────────────────────────────────────────────
   NAVBAR — iOS frosted glass
   ───────────────────────────────────────────── */
.topnav {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    padding-top: calc(12px + var(--safe-top));
    background: var(--surface-glass);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--border-light);
    box-shadow: 0 1px 0 rgba(255,255,255,0.6) inset,
                0 2px 10px rgba(10,25,55,0.05);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text);
    flex-shrink: 0;
    letter-spacing: -0.01em;
}

.brand-logo {
    width: 32px;
    height: 32px;
    display: block;
}

.hero-logo {
    width: min(100%, 260px);
    height: auto;
    margin-bottom: 12px;
    filter: drop-shadow(0 4px 14px rgba(6,18,42,0.22));
}

/* Desktop menu */
.menu {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    margin-left: 14px;
}

.menu-auth {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.user-pill {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    border-radius: var(--radius-pill);
    background: var(--surface-alt);
    border: 1px solid var(--border);
    color: var(--text-2);
    font-size: 0.82rem;
    font-weight: 600;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.menu a {
    color: var(--text-2);
    font-weight: 600;
    font-size: 0.93rem;
    padding: 7px 11px;
    border-radius: var(--radius-xs);
    transition: background var(--dur-fast) var(--ease-smooth),
                color var(--dur-fast) var(--ease-smooth);
}

.menu a:hover {
    background: var(--surface-alt);
    color: var(--text);
}

.menu a.nav-active {
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 700;
}

/* Dropdown group */
.menu-group {
    position: relative;
}

.menu-group-btn {
    border: 0;
    background: transparent;
    color: var(--text-2);
    font-weight: 600;
    font-size: 0.93rem;
    padding: 7px 11px;
    border-radius: var(--radius-xs);
    cursor: pointer;
    font-family: inherit;
    line-height: 1.2;
    transition: background var(--dur-fast), color var(--dur-fast);
}

.menu-group-btn:hover,
.menu-group.active .menu-group-btn,
.menu-group.open .menu-group-btn {
    background: var(--primary-soft);
    color: var(--primary);
}

.menu-submenu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 180px;
    z-index: 200;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    animation: dropdown-in var(--dur-fast) var(--ease-smooth);
}

@keyframes dropdown-in {
    from { opacity: 0; transform: translateY(-6px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.menu-submenu a {
    display: block;
    padding: 9px 11px;
    border-radius: var(--radius-xs);
    font-size: 0.92rem;
}

.menu-group:hover .menu-submenu,
.menu-group:focus-within .menu-submenu,
.menu-group.open .menu-submenu {
    display: block;
}

/* Hamburger */
.nav-toggle {
    display: none;
    margin-left: auto;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-xs);
    color: var(--text);
    transition: background var(--dur-fast);
    flex-shrink: 0;
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
}

.nav-toggle:hover { background: var(--surface-alt); }

.hamburger-bar {
    display: block;
    width: 22px;
    height: 2px;
    background: currentColor;
    position: relative;
    transition: background var(--dur-mid);
}

.hamburger-bar::before,
.hamburger-bar::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 2px;
    background: currentColor;
    left: 0;
    transition: transform var(--dur-mid) var(--ease-smooth),
                top var(--dur-mid) var(--ease-smooth);
}

.hamburger-bar::before { top: -6px; }
.hamburger-bar::after  { top:  6px; }

.topnav.nav-open .hamburger-bar           { background: transparent; }
.topnav.nav-open .hamburger-bar::before   { top: 0; transform: rotate(45deg); }
.topnav.nav-open .hamburger-bar::after    { top: 0; transform: rotate(-45deg); }

/* ─────────────────────────────────────────────
   BOTTOM TAB BAR — iOS style (mobile only)
   ───────────────────────────────────────────── */
.bottom-tabbar {
    display: none;  /* shown via media query */
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 90;
    height: calc(var(--bottom-nav-h) + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    padding-left: var(--safe-left);
    padding-right: var(--safe-right);
    background: rgba(248, 250, 254, 0.88);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border-top: 1px solid var(--border-light);
    box-shadow: 0 -1px 0 rgba(255,255,255,0.7) inset,
                0 -4px 16px rgba(10,25,55,0.07);
}

.bottom-tabbar-inner {
    display: flex;
    align-items: stretch;
    height: var(--bottom-nav-h);
    max-width: 480px;
    margin: 0 auto;
}

.tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    text-decoration: none;
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    padding: 6px 4px;
    border-radius: 10px;
    transition: color var(--dur-fast), background var(--dur-fast);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    min-width: 44px;
    min-height: 44px;
}

.tab-item.active {
    color: var(--primary);
}

.tab-item:active {
    background: var(--surface-alt);
    transform: scale(0.94);
}

.tab-icon {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform var(--dur-fast) var(--ease-spring);
}

.tab-item.active .tab-icon {
    stroke-width: 2.2;
}

.tab-item:active .tab-icon {
    transform: scale(0.88);
}

/* ─────────────────────────────────────────────
   PAGE LAYOUT
   ───────────────────────────────────────────── */
.page {
    max-width: min(1680px, calc(100vw - 24px));
    margin: 28px auto;
    padding: 0 16px 40px;
}

/* ─────────────────────────────────────────────
   HERO
   ───────────────────────────────────────────── */
.hero {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    gap: 20px;
    align-items: stretch;
    margin-bottom: 20px;
}

/* ─────────────────────────────────────────────
   CARD — iOS elevated surface
   ───────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    padding: 24px;
    transition: box-shadow var(--dur-mid) var(--ease-smooth);
    min-width: 0;
    max-width: 100%;
}

.card:focus-within {
    box-shadow: var(--shadow);
}

.hero-main {
    background: linear-gradient(145deg, #0b2848 0%, #1255a0 48%, #1e6fd6 100%);
    color: #fff;
    position: relative;
    overflow: hidden;
}

/* Subtle shine overlay */
.hero-main::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.08) 0%, transparent 60%);
    pointer-events: none;
    border-radius: inherit;
}

.hero-main h1 {
    margin-top: 0;
    font-size: clamp(1.7rem, 3.5vw, 2.6rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.hero-main p {
    color: rgba(255,255,255,0.88);
    max-width: 52ch;
    font-size: 1.02rem;
}

/* ─────────────────────────────────────────────
   STAT CARDS
   ───────────────────────────────────────────── */
.stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.stat {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 18px 16px;
    transition: transform var(--dur-fast) var(--ease-spring),
                box-shadow var(--dur-fast) var(--ease-smooth);
    cursor: default;
}

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

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
    color: var(--primary);
    letter-spacing: -0.03em;
    line-height: 1;
}

.stat-label {
    margin: 6px 0 0;
    color: var(--muted);
    font-weight: 600;
    font-size: 0.88rem;
}

/* ─────────────────────────────────────────────
   SECTION / GRID
   ───────────────────────────────────────────── */
.section-title {
    margin: 0 0 12px;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.015em;
    color: var(--text);
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.layout-main-aside {
    display: grid;
    grid-template-columns: minmax(0, 1.8fr) minmax(300px, 1fr);
    gap: 18px;
    align-items: start;
}

.main-col, .side-col { min-width: 0; }

.side-sticky {
    position: sticky;
    top: 80px;
}

/* ─────────────────────────────────────────────
   TOOLBAR
   ───────────────────────────────────────────── */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

/* ─────────────────────────────────────────────
   BUTTONS — iOS rounded
   ───────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    padding: 11px 16px;
    min-height: 44px;
    cursor: pointer;
    transition: opacity var(--dur-fast),
                background var(--dur-fast),
                box-shadow var(--dur-fast),
                transform var(--dur-fast) var(--ease-spring);
    font-family: inherit;
    text-decoration: none;
    letter-spacing: -0.01em;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.btn:hover:not(:disabled):not(.is-loading) {
    background: var(--primary-hover);
    box-shadow: 0 4px 16px rgba(20,96,200,0.25);
    transform: translateY(-1px);
}

.btn:active:not(:disabled):not(.is-loading) {
    transform: scale(0.97) translateY(0);
    box-shadow: none;
}

.btn:disabled,
.btn.loading {
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: none;
}

.btn.is-loading {
    opacity: 0.72;
    cursor: wait;
    pointer-events: none;
    position: relative;
}

.btn.is-loading::after {
    content: '';
    width: 13px;
    height: 13px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: btn-spin 0.55s linear infinite;
    flex-shrink: 0;
}

@keyframes btn-spin { to { transform: rotate(360deg); } }

#importOfficialForm.is-busy { opacity: 0.95; }

.btn-svg {
    width: 15px;
    height: 15px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex: 0 0 auto;
}

.btn.small {
    padding: 8px 13px;
    font-size: 0.875rem;
    min-height: 36px;
    border-radius: var(--radius-xs);
}

.btn.secondary {
    background: var(--surface-alt);
    color: var(--text-2);
    border-color: var(--border);
}

.btn.secondary:hover:not(:disabled):not(.is-loading) {
    background: var(--surface-deep);
    box-shadow: 0 2px 10px rgba(10,25,55,0.1);
}

.btn.warn {
    background: #fff4ea;
    color: #7a3600;
    border-color: #ffcfa0;
}

.btn.warn:hover:not(:disabled):not(.is-loading) {
    background: #ffe8d4;
    box-shadow: 0 4px 12px rgba(200,80,0,0.15);
}

.btn.ghost {
    background: transparent;
    border-color: var(--border);
    color: var(--text-2);
}

.btn.ghost:hover:not(:disabled):not(.is-loading) {
    background: var(--surface-alt);
    box-shadow: none;
    transform: none;
}

.actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

/* ─────────────────────────────────────────────
   TABLES
   ───────────────────────────────────────────── */
table {
    width: 100%;
    border-collapse: collapse;
    overflow: hidden;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    font-size: 0.93rem;
}

th, td {
    text-align: left;
    padding: 13px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

th {
    background: #f2f6fe;
    color: #2d405a;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

tr:last-child td { border-bottom: none; }

tbody tr {
    transition: background var(--dur-fast);
}

tbody tr:hover { background: #f8fbff; }

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

.table-wrap table {
    min-width: 720px;
    border: none;
    border-radius: 0;
}

.th-group-divider,
.td-group-divider {
    border-left: 2px solid #b4c6de;
}

/* ─────────────────────────────────────────────
   MOBILE TABLE CARDS (shown < 700px)
   ───────────────────────────────────────────── */
.mobile-cards { display: none; }

/* ─────────────────────────────────────────────
   CHIPS / BADGES
   ───────────────────────────────────────────── */
.muted {
    color: var(--muted);
    font-size: 0.88rem;
}

.chip {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.chip.pending {
    background: #fff4dd;
    color: #7d4a00;
}

.chip.done {
    background: #e2f9eb;
    color: #0f6332;
}

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

/* ─────────────────────────────────────────────
   FORMS — iOS-style
   ───────────────────────────────────────────── */
form.inline { display: inline-block; }

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

label {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-2);
}

input, textarea, select {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-xs);
    font: inherit;
    font-size: 16px; /* prevent iOS zoom */
    background: var(--surface);
    color: var(--text);
    transition: border-color var(--dur-fast),
                box-shadow var(--dur-fast),
                background var(--dur-fast);
    -webkit-appearance: none;
    appearance: none;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(20,96,200,0.12);
    background: #fff;
}

input[type="date"] {
    min-height: 44px;
    padding-right: 12px;
    -webkit-appearance: auto;
    appearance: auto;
}

input[type="date"]::-webkit-calendar-picker-indicator {
    opacity: 1;
    cursor: pointer;
}

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23556070' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    cursor: pointer;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    /* Prevent iOS Safari from expanding select beyond its container */
    -webkit-appearance: none;
    appearance: none;
}

.field {
    display: grid;
    gap: 6px;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

/* ─────────────────────────────────────────────
   TABS — iOS segmented control
   ───────────────────────────────────────────── */
.tabs {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-bottom: 10px;
    padding: 4px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-alt);
}

.tab-btn {
    flex: 1 1 auto;
    border: none;
    background: transparent;
    color: var(--muted);
    border-radius: var(--radius-xs);
    padding: 9px 14px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background var(--dur-fast) var(--ease-smooth),
                color var(--dur-fast),
                box-shadow var(--dur-fast);
    font-family: inherit;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}

.tab-btn.active {
    background: var(--surface);
    color: var(--text);
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(10,25,55,0.1), 0 1px 3px rgba(10,25,55,0.06);
}

.tab-btn:hover:not(.active) {
    background: rgba(255,255,255,0.6);
    color: var(--text-2);
}

.tab-panel {
    display: none;
    gap: 12px;
}

.tab-panel.active {
    display: grid;
}

/* ─────────────────────────────────────────────
   MISC COMPONENTS
   ───────────────────────────────────────────── */
.subheading {
    margin: 4px 0 8px;
    color: var(--text-2);
    font-size: 1rem;
    font-weight: 700;
}

.builder-box {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #f9fbff;
    padding: 14px;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.chip-remove {
    margin-left: 8px;
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0;
}

.alert {
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    margin-bottom: 14px;
    border: 1px solid;
    font-weight: 600;
    font-size: 0.93rem;
}

.alert.success {
    color: #0e6032;
    background: #e3f8eb;
    border-color: #b6e4c7;
}

.alert.error {
    color: #8a1d1d;
    background: #ffe8e8;
    border-color: #f4b4b4;
}

.alert.info {
    color: #1a4780;
    background: #eef5ff;
    border-color: #bad1f0;
}

/* ─────────────────────────────────────────────
   TOAST — iOS notification style
   ───────────────────────────────────────────── */
.toast-stack {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 2000;
    display: grid;
    gap: 8px;
    width: min(400px, calc(100vw - 28px));
    pointer-events: none;
}

.toast {
    padding: 13px 14px 13px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--text);
    font-weight: 600;
    font-size: 0.93rem;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 10px;
    transform: translateX(16px);
    opacity: 0;
    animation: toast-in 200ms var(--ease-spring) forwards;
    pointer-events: auto;
    cursor: default;
    user-select: none;
}

.toast-body {
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.toast-body .toast-link {
    color: inherit;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.toast-close {
    width: 26px;
    height: 26px;
    border-radius: var(--radius-xs);
    border: 1px solid rgba(30,75,136,0.2);
    background: rgba(255,255,255,0.5);
    color: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    line-height: 1;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
    transition: background var(--dur-fast);
}

.toast-close:hover { background: rgba(255,255,255,0.95); }

.toast.success {
    border-color: #b2dfc5;
    background: rgba(227,248,235,0.96);
    color: #0e6032;
}

.toast.error {
    border-color: #f2b0b0;
    background: rgba(255,232,232,0.96);
    color: #8a1d1d;
}

.toast.info {
    border-color: #b8cfe8;
    background: rgba(238,245,255,0.96);
    color: #1a4780;
}

.toast.hiding {
    animation: toast-out 200ms var(--ease-smooth) forwards;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateX(16px) scale(0.96); }
    to   { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes toast-out {
    from { opacity: 1; transform: translateX(0) scale(1); }
    to   { opacity: 0; transform: translateX(16px) scale(0.96); }
}

/* ─────────────────────────────────────────────
   CONFIRM DIALOG — iOS action sheet on mobile
   ───────────────────────────────────────────── */
.confirm-overlay {
    position: fixed;
    inset: 0;
    z-index: 3000;
    background: rgba(10,20,40,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: overlay-in 0.18s var(--ease-smooth);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

@keyframes overlay-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.confirm-dialog {
    background: rgba(255,255,255,0.97);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 24px 60px rgba(10,25,55,0.22);
    padding: 28px 24px 24px;
    max-width: 400px;
    width: 100%;
    animation: dialog-in 0.22s var(--ease-spring);
}

@keyframes dialog-in {
    from { opacity: 0; transform: scale(0.94) translateY(12px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.confirm-dialog h3 {
    margin: 0 0 8px;
    font-size: 1.1rem;
    color: var(--text);
    font-weight: 700;
    letter-spacing: -0.01em;
}

.confirm-dialog p {
    margin: 0 0 22px;
    color: var(--muted);
    font-size: 0.93rem;
    line-height: 1.5;
}

.confirm-dialog .actions {
    justify-content: flex-end;
}

/* ─────────────────────────────────────────────
   LIST + EMPTY
   ───────────────────────────────────────────── */
.list-clean {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 8px;
}

.list-item {
    padding: 14px 16px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    background: var(--surface);
    transition: box-shadow var(--dur-fast),
                transform var(--dur-fast) var(--ease-spring);
}

.list-item:hover {
    box-shadow: var(--shadow-card);
    transform: translateX(2px);
}

.empty {
    padding: 24px 20px;
    background: #f8fbff;
    border: 1.5px dashed #c0d4ee;
    border-radius: var(--radius-sm);
    color: #4d6080;
    text-align: center;
    font-size: 0.93rem;
}

/* ─────────────────────────────────────────────
   DETAILS / SUMMARY
   ───────────────────────────────────────────── */
details {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 11px 14px;
    background: var(--surface);
}

details[open] { background: #f9fbff; }

summary {
    cursor: pointer;
    font-weight: 700;
    color: var(--text-2);
    list-style: none;
}

summary::-webkit-details-marker { display: none; }

code {
    font-family: "JetBrains Mono", "Consolas", monospace;
    font-size: 0.83rem;
    background: var(--surface-alt);
    padding: 1px 5px;
    border-radius: 4px;
    white-space: nowrap;
}

/* ─────────────────────────────────────────────
   MODEL SELECTOR
   ───────────────────────────────────────────── */
.model-selector {
    display: grid;
    grid-template-columns: minmax(250px, 290px) minmax(0, 1fr);
    gap: 16px;
}

.model-sidebar {
    max-height: 86vh;
    display: grid;
    grid-template-rows: auto 1fr;
}

.template-list {
    max-height: calc(86vh - 90px);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
}

.template-family-list {
    max-height: calc(86vh - 90px);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    padding: 6px;
}

.family-block {
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    background: #fbfdff;
    padding: 9px 11px;
    margin-bottom: 8px;
}

.family-block summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.family-items {
    margin-top: 8px;
    border-top: 1px dashed var(--border);
    padding-top: 6px;
}

.template-link {
    display: block;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    transition: background var(--dur-fast);
}

.template-link a { color: var(--text); }
.template-link:last-child { border-bottom: 0; }
.template-link:hover { background: var(--surface-alt); }

.template-link.active {
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 700;
}

.template-link.compact {
    padding: 8px 8px;
    border-bottom-style: dashed;
}

/* ─────────────────────────────────────────────
   MAPPING WORKSPACE
   ───────────────────────────────────────────── */
.mapping-workspace {
    display: grid;
    grid-template-columns: minmax(460px, 1.45fr) minmax(340px, 1fr);
    gap: 16px;
    align-items: start;
}

.template-alias-workspace {
    display: grid;
    grid-template-columns: minmax(460px, 1.2fr) minmax(340px, 1fr);
    gap: 16px;
    align-items: start;
}

.alias-editor-panel {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    background: #fbfdff;
}

.alias-editor-table { min-width: 0 !important; }

.alias-editor-table th:nth-child(1),
.alias-editor-table td:nth-child(1) { width: 56px; }

.alias-editor-table th:nth-child(4),
.alias-editor-table td:nth-child(4) { width: 120px; }

.alias-row.active { background: #eef5ff; }

.metadata-audit {
    margin: 10px 0 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    background: #f5f8ff;
    padding: 12px;
}

.metadata-audit-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(220px, 1fr));
    gap: 10px 14px;
}

.metadata-audit-grid strong {
    display: block;
    font-size: 0.84rem;
    color: var(--muted);
    margin-bottom: 4px;
}

.metadata-audit-grid code {
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block;
    max-width: 100%;
}

.mapping-preview-panel {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    background: #fbfdff;
}

.field-inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.field-inline select {
    width: auto;
    min-width: 96px;
}

.pdf-preview-shell {
    position: relative;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    overflow: hidden;
    background: #f0f3f8;
}

.pdf-preview-shell img {
    display: block;
    width: 100%;
    height: auto;
}

.mapping-preview-panel .pdf-preview-shell {
    min-height: 560px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.mapping-preview-panel .pdf-preview-shell img {
    object-fit: contain;
}

.pdf-pointer {
    position: absolute;
    border: 2px solid var(--accent);
    background: rgba(255,122,26,0.18);
    border-radius: 5px;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.85);
    transition: left 120ms ease, top 120ms ease, width 120ms ease, height 120ms ease;
    pointer-events: none;
}

.pdf-pointer.hidden { display: none; }

.mapping-form-panel {
    display: grid;
    gap: 10px;
}

.mapping-rows {
    max-height: 70vh;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    display: grid;
    gap: 8px;
    padding-right: 4px;
}

.mapping-row {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 11px;
    background: var(--surface);
    display: grid;
    gap: 8px;
    cursor: pointer;
    transition: border-color var(--dur-fast),
                background var(--dur-fast),
                box-shadow var(--dur-fast);
}

.mapping-row:hover {
    background: #f8fbff;
}

.mapping-row.active {
    border-color: #7bb5ff;
    box-shadow: 0 0 0 2px rgba(127,181,255,0.2);
    background: #f4f8ff;
}

.mapping-row-header {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.mapping-row-header code {
    white-space: normal;
    overflow-wrap: anywhere;
    font-size: 0.8rem;
}

.mapping-row-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    color: var(--muted);
    font-size: 0.83rem;
}

@media (min-width: 901px) {
    .mapping-preview-panel {
        position: sticky;
        top: 80px;
    }
}

/* ─────────────────────────────────────────────
   SUMMARY GRID
   ───────────────────────────────────────────── */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.summary-grid div {
    display: grid;
    gap: 2px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    padding: 11px;
}

/* ─────────────────────────────────────────────
   LANDING PAGE
   ───────────────────────────────────────────── */
.landing-page {
    display: grid;
    gap: 22px;
}

.landing-topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--surface-glass);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--border-light);
}

.landing-topbar-inner {
    max-width: min(1680px, calc(100vw - 20px));
    margin: 0 auto;
    padding: 12px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.landing-menu {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 10px;
}

.landing-menu a {
    color: var(--text-2);
    font-weight: 600;
    font-size: 0.93rem;
    padding: 7px 10px;
    border-radius: var(--radius-xs);
    transition: background var(--dur-fast);
}

.landing-menu a:hover { background: var(--surface-alt); }

.landing-topbar .actions { margin-left: auto; }

.landing-hero {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 18px;
}

.landing-hero-main {
    background: linear-gradient(145deg, #0a2744 0%, #1254a8 55%, #1d72d8 100%);
    color: #fff;
    position: relative;
    overflow: hidden;
}

.landing-hero-main::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.07) 0%, transparent 60%);
    pointer-events: none;
    border-radius: inherit;
}

.landing-hero-main h1 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: clamp(1.8rem, 3.2vw, 2.8rem);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.landing-hero-main p {
    color: rgba(255,255,255,0.9);
    max-width: 60ch;
    font-size: 1rem;
}

.landing-hero-side h2 { margin-top: 0; }

.landing-list .list-item {
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    padding: 11px 13px;
}

.landing-section {
    display: grid;
    gap: 12px;
}

.landing-steps {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.step-card {
    position: relative;
    overflow: hidden;
    border-top: 3px solid var(--primary);
}

.step-number {
    display: inline-flex;
    width: 30px;
    height: 30px;
    border-radius: var(--radius-pill);
    align-items: center;
    justify-content: center;
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.step-card h3 {
    margin: 0 0 7px;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.step-card p {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.landing-feature-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.feature-card h3 {
    margin: 0 0 7px;
    font-size: 1rem;
    font-weight: 700;
}

.feature-card p {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.landing-cta {
    text-align: center;
    background: linear-gradient(180deg, #ffffff 0%, #ebf2ff 100%);
}

.landing-cta h2 {
    margin-top: 0;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.landing-cta p {
    margin-top: 0;
    margin-bottom: 16px;
    color: var(--muted);
}

.landing-cta .actions { justify-content: center; }

/* ─────────────────────────────────────────────
   LEAD CHART
   ───────────────────────────────────────────── */
.lead-chart-wrap {
    display: grid;
    grid-template-columns: minmax(170px, 210px) minmax(0, 1fr);
    gap: 14px;
    align-items: center;
    margin-top: 8px;
}

.lead-pie-shell {
    position: relative;
    width: 190px;
    height: 190px;
    margin: 0 auto;
}

.lead-pie {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    box-shadow: inset 0 0 0 10px rgba(255,255,255,0.5),
                0 10px 22px rgba(20,55,105,0.12);
}

.lead-pie-center {
    position: absolute;
    inset: 50% auto auto 50%;
    transform: translate(-50%, -50%);
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: var(--surface);
    border: 1px solid var(--border);
    display: grid;
    place-items: center;
    text-align: center;
    line-height: 1.1;
    box-shadow: 0 2px 8px rgba(10,25,55,0.08);
}

.lead-pie-center span {
    font-size: 0.72rem;
    color: var(--muted);
}

.lead-pie-center strong {
    font-size: 1.2rem;
    color: var(--text);
    font-weight: 700;
}

.lead-legend {
    display: grid;
    gap: 7px;
}

.lead-legend-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    background: var(--surface);
    padding: 8px 12px;
    transition: background var(--dur-fast);
}

.lead-legend-row:hover { background: var(--surface-alt); }

.lead-legend-name {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    min-width: 0;
}

.lead-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    box-shadow: 0 0 0 1px rgba(20,50,80,0.16);
    flex: 0 0 auto;
}

.lead-legend-values {
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
    white-space: nowrap;
    font-size: 0.87rem;
}

/* ─────────────────────────────────────────────
   LOCKED INPUTS
   ───────────────────────────────────────────── */
input.is-locked,
textarea.is-locked,
select.is-locked {
    background: #ecf1f8;
    color: #3d4f6a;
    cursor: not-allowed;
    border-color: #cdd8ea;
}

/* ─────────────────────────────────────────────
   RESPONSIVE — TABLET 768–1024px
   ───────────────────────────────────────────── */
@media (max-width: 1024px) and (min-width: 701px) {
    .mapping-workspace,
    .template-alias-workspace {
        grid-template-columns: 1.2fr 1fr;
    }

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

/* ─────────────────────────────────────────────
   RESPONSIVE — TABLET 900px
   ───────────────────────────────────────────── */
@media (max-width: 900px) {
    .hero, .grid-2 {
        grid-template-columns: 1fr;
    }

    .layout-main-aside {
        grid-template-columns: 1fr;
    }

    .side-sticky {
        position: static;
    }

    .model-selector {
        grid-template-columns: 1fr;
    }

    .model-sidebar {
        max-height: none;
    }

    .template-list {
        max-height: 300px;
    }

    .mapping-workspace,
    .template-alias-workspace {
        grid-template-columns: 1fr;
    }

    .metadata-audit-grid {
        grid-template-columns: 1fr;
    }

    .mapping-preview-panel .pdf-preview-shell {
        min-height: 340px;
    }

    .lead-chart-wrap {
        grid-template-columns: 1fr;
    }

    .lead-pie-shell {
        width: 170px;
        height: 170px;
    }

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

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

/* ─────────────────────────────────────────────
   RESPONSIVE — MOBILE ≤700px (iOS priority)
   ───────────────────────────────────────────── */
@media (max-width: 700px) {

    /* Body: make room for bottom tab bar */
    body {
        padding-bottom: calc(var(--bottom-nav-h) + var(--safe-bottom));
    }

    /* Show bottom tab bar */
    .bottom-tabbar {
        display: block;
    }

    /* Navbar adjustments */
    .topnav {
        flex-wrap: wrap;
        padding: 10px 16px;
        padding-top: calc(10px + var(--safe-top));
        padding-left: calc(16px + var(--safe-left));
        padding-right: calc(16px + var(--safe-right));
    }

    .nav-toggle {
        display: flex;
    }

    /* Mobile menu: drops down as list */
    .menu {
        display: none;
        width: 100%;
        flex-direction: column;
        gap: 2px;
        padding: 10px 0 6px;
        margin-left: 0;
        border-top: 1px solid var(--border-light);
        margin-top: 8px;
        animation: menu-slide-down 0.22s var(--ease-spring);
    }

    @keyframes menu-slide-down {
        from { opacity: 0; transform: translateY(-8px); }
        to   { opacity: 1; transform: translateY(0); }
    }

    .menu-auth {
        width: 100%;
        margin-left: 0;
        justify-content: space-between;
        border-top: 1px solid var(--border-light);
        padding-top: 10px;
    }

    .user-pill {
        max-width: calc(100% - 110px);
    }

    .topnav.nav-open .menu {
        display: flex;
    }

    .menu a {
        padding: 12px 14px;
        border-radius: var(--radius-xs);
        width: 100%;
        font-size: 1rem;
    }

    .menu-group {
        width: 100%;
    }

    .menu-group-btn {
        width: 100%;
        text-align: left;
        padding: 12px 14px;
        border-radius: var(--radius-xs);
        font-size: 1rem;
    }

    .menu-submenu {
        position: static;
        border: 0;
        box-shadow: none;
        background: transparent;
        padding: 4px 0 4px 18px;
        min-width: 0;
        animation: none;
    }

    .menu-submenu a {
        width: 100%;
        padding: 10px 12px;
        font-size: 0.96rem;
    }

    /* Page */
    .page {
        margin: 16px auto;
        padding: 0 14px 24px;
    }

    /* Card */
    .card {
        padding: 18px 16px;
        border-radius: var(--radius-sm);
    }

    /* Hero */
    .hero-main h1 {
        font-size: clamp(1.6rem, 6vw, 2.1rem);
    }

    /* Stats: 2-col grid on mobile */
    .stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .stat-value {
        font-size: 1.75rem;
    }

    /* Toolbar */
    .toolbar {
        align-items: flex-start;
    }

    /* Actions: full width on mobile */
    .actions {
        width: 100%;
    }

    .actions .btn,
    .actions a.btn,
    .actions button.btn {
        flex: 1 1 calc(50% - 4px);
        justify-content: center;
        text-align: center;
    }

    /* Selects: contain within viewport */
    select {
        max-width: 100%;
        width: 100%;
        min-width: 0;
        /* truncate the displayed option text if too long */
        text-overflow: ellipsis;
    }

    /* Fields: prevent overflow */
    .field,
    .field-inline {
        min-width: 0;
        max-width: 100%;
    }

    .field-inline {
        flex-wrap: wrap;
    }

    .field-inline select {
        width: 100%;
        min-width: 0;
    }

    /* Tabs: iOS segment style */
    .tabs {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
        padding: 3px;
        scrollbar-width: none;
    }

    .tabs::-webkit-scrollbar { display: none; }

    .tab-btn {
        white-space: nowrap;
        flex-shrink: 0;
    }

    /* Tables: show mobile card view, hide desktop table */
    .table-wrap {
        display: none;
    }

    .mobile-cards {
        display: grid;
        gap: 10px;
    }

    .mobile-card {
        background: var(--surface);
        border: 1px solid var(--border-light);
        border-radius: var(--radius-sm);
        box-shadow: var(--shadow-card);
        padding: 16px;
        display: grid;
        gap: 10px;
    }

    .mobile-card-header {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 10px;
    }

    .mobile-card-title {
        font-weight: 700;
        font-size: 1rem;
        color: var(--text);
        line-height: 1.3;
    }

    .mobile-card-subtitle {
        font-size: 0.85rem;
        color: var(--muted);
        margin-top: 2px;
    }

    .mobile-card-row {
        display: flex;
        align-items: baseline;
        gap: 8px;
        font-size: 0.88rem;
    }

    .mobile-card-label {
        color: var(--muted);
        font-size: 0.78rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        white-space: nowrap;
        min-width: 70px;
    }

    .mobile-card-value {
        color: var(--text-2);
        flex: 1;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .mobile-card-actions {
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
        padding-top: 8px;
        border-top: 1px solid var(--border-light);
    }

    .mobile-card-actions .btn {
        flex: 1 1 auto;
        justify-content: center;
        min-width: 80px;
    }

    /* Summary grid */
    .summary-grid {
        grid-template-columns: 1fr;
    }

    /* Landing */
    .landing-menu { display: none; }

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

    .landing-feature-grid {
        grid-template-columns: 1fr;
    }

    /* Toast: bottom on mobile (iOS style) */
    .toast-stack {
        top: auto;
        bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + 12px);
        left: 12px;
        right: 12px;
        width: auto;
    }

    @keyframes toast-in {
        from { opacity: 0; transform: translateY(12px) scale(0.96); }
        to   { opacity: 1; transform: translateY(0) scale(1); }
    }

    @keyframes toast-out {
        from { opacity: 1; transform: translateY(0) scale(1); }
        to   { opacity: 0; transform: translateY(12px) scale(0.96); }
    }

    /* Confirm dialog: bottom sheet on iOS */
    .confirm-overlay {
        align-items: flex-end;
        padding: 0;
    }

    .confirm-dialog {
        max-width: 100%;
        border-radius: var(--radius) var(--radius) 0 0;
        padding: 28px 20px calc(24px + var(--safe-bottom)) 20px;
        animation: sheet-in 0.26s var(--ease-spring);
    }

    @keyframes sheet-in {
        from { opacity: 0; transform: translateY(100%); }
        to   { opacity: 1; transform: translateY(0); }
    }

    .confirm-dialog .actions {
        justify-content: stretch;
    }

    .confirm-dialog .actions .btn {
        flex: 1;
        justify-content: center;
    }
}

/* ─────────────────────────────────────────────
   RESPONSIVE — SMALL MOBILE ≤390px (iPhone 14/SE)
   ───────────────────────────────────────────── */
@media (max-width: 390px) {
    .hero-main h1 {
        font-size: 1.55rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .btn {
        font-size: 0.88rem;
        padding: 10px 12px;
    }

    .actions .btn,
    .actions a.btn,
    .actions button.btn {
        flex: 1 1 100%;
    }

    .tabs {
        gap: 3px;
        padding: 3px;
    }

    .tab-btn {
        padding: 8px 10px;
        font-size: 0.84rem;
    }
}
