*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    background: #F0F2F5;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* ── App bar ── */
.msl-appbar { background: linear-gradient(to right, #0B2D6E, #1447AF) !important; }
.appbar-logo { height: 26px; width: auto; margin-right: 10px; vertical-align: middle; }
.appbar-brand { color: #fff; font-weight: 600; letter-spacing: 0.3px; }

/* ── Page wrapper ── */
.page-content { min-height: calc(100vh - 48px); }



/* ════════════════════════════════════════
   SESSION / UPLOAD PAGE
════════════════════════════════════════ */

/* Mobile-first: stacked layout */
.upload-layout {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 48px);
}

/* ── Sidebar ── */
.upload-sidebar {
    background: #fff;
    border-bottom: 1px solid #E2E8F0;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.sidebar-claim { display: flex; flex-direction: column; gap: 2px; }
.sidebar-label { color: #8A9BB0; font-size: 10px; text-transform: uppercase; letter-spacing: 0.8px; line-height: 1 !important; margin: 0; display: block; }
.sidebar-case  { font-weight: 700; color: #1A1A2E; font-size: 18px; line-height: 1.2; margin: 0; }

.sidebar-stats { display: flex; flex-direction: row; flex-wrap: wrap; gap: 6px; }

.stat-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: #F0F2F5;
    border-radius: 99px;
    color: #5A6A7E;
}
.stat-row--success { background: #EBF8EE; color: #2E7D32; }
.stat-row--warn    { background: #FFF8E1; color: #E65100; }

.stat-icon  { font-size: 14px !important; flex-shrink: 0; }
.stat-value { font-weight: 700; font-size: 12px; flex-shrink: 0; }
.stat-label { font-size: 12px; }

.sidebar-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sidebar-actions .mud-button { width: 100%; }
.sidebar-actions .mud-button-root { height: 100%; }

.sidebar-hint { color: #8A9BB0; font-size: 12px; text-align: center; }
.sidebar-instructions { display: none; }
.sidebar-security-note { display: none; }

.btn-label-short { display: inline; }
.btn-label-full  { display: none; }

.add-files-label {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 16px;
    min-height: 36px;
    align-self: stretch;
    border: 1px solid rgba(0, 0, 0, 0.23);
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    flex: 1;
    min-width: 0;
    color: rgba(0, 0, 0, 0.87);
    background: transparent;
    user-select: none;
    transition: background-color 0.2s;
}
.add-files-label:hover { background: rgba(0, 0, 0, 0.04); }
.add-files-label--disabled { opacity: 0.38; pointer-events: none; cursor: default; }

/* ── Main content ── */
.upload-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Progress bar */
.upload-progress { padding: 20px; text-align: center; }
.text-center { text-align: center; }

/* ── Status banner ── */
.upload-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    flex-shrink: 0;
}

.upload-banner--info    { background: #EFF6FF; color: #1D4ED8; border-bottom: 1px solid #BFDBFE; }
.upload-banner--warn    { background: #FFFBEB; color: #B45309; border-bottom: 1px solid #FDE68A; }
.upload-banner--success { background: #F0FDF4; color: #15803D; border-bottom: 1px solid #BBF7D0; }

.upload-banner--clickable { cursor: pointer; }
.upload-banner--clickable:hover { filter: brightness(0.96); }

.banner-icon { font-size: 18px !important; flex-shrink: 0; }

.submit-progress-strip {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 16px;
    background: #fff;
    border-bottom: 1px solid #E2E8F0;
    flex-shrink: 0;
}
.submit-progress-label { font-size: 12px; color: #5A6A7E; }

@keyframes add-files-pulse {
    0%, 100% { border-color: rgba(0,0,0,0.23); box-shadow: none; background: transparent; transform: scale(1); }
    50%       { border-color: #E65100; box-shadow: 0 0 0 8px rgba(230,81,0,0.7), 0 0 24px 4px rgba(230,81,0,0.4); background: rgba(230,81,0,0.1); transform: scale(1.06); }
}
.add-files-flash { animation: add-files-pulse 0.65s ease-in-out 5; transform-origin: center; }

@keyframes btn-glow {
    0%, 100% { box-shadow: none; transform: scale(1); }
    50%       { box-shadow: 0 0 0 8px rgba(230,81,0,0.7), 0 0 24px 4px rgba(230,81,0,0.4); transform: scale(1.06); }
}
@keyframes btn-bg-flash {
    0%, 100% { filter: none; }
    50%       { filter: brightness(1.35) saturate(1.4); }
}
.btn-flash { animation: btn-glow 0.65s ease-in-out 5; border-radius: 4px; transform-origin: center; }
.btn-flash .mud-button-root { animation: btn-bg-flash 0.65s ease-in-out 5; }

.submit-wrap { flex: 1; }

/* ── Drop zone ── */
.dz-hidden { display: none !important; }

.drop-zone-wrap {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 6vh 24px 24px;
    text-align: center;
    cursor: pointer;
    /* label reset */
    margin: 0;
    font: inherit;
    color: inherit;
}

.drop-zone-wrap--active {
    border-color: #1B4F8A !important;
    background: #EFF4FB !important;
}
.drop-zone-wrap--active .drop-zone-icon { color: #1B4F8A !important; }
.drop-zone-wrap--active .drop-zone-title { color: #1B4F8A; }

/* Compact drop zone — mobile only (replaced by page-level drag on desktop) */
.drop-zone-compact { display: none; position: relative; }

/* Full-page drag overlay — hidden by default, desktop only */
.page-drag-overlay { display: none; }

/* Invisible InputFile stretches over the entire drop zone — handles click + drag-and-drop natively */
.drop-zone-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 1;
}

.drop-zone-icon {
    font-size: 64px !important;
    color: #CBD5E0;
    margin-bottom: 16px;
    pointer-events: none;
}

.drop-zone-title { font-weight: 600; color: #4A5568; margin-bottom: 4px; pointer-events: none; }
.drop-zone-sub   { color: #8A9BB0; pointer-events: none; }

/* ── File list ── */
.file-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    -webkit-overflow-scrolling: touch;
}

/* ── File card ── */
.file-card {
    background: #fff;
    border: 1px solid #E2E8F0;
    border-left: 3px solid #E65100;
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
}

.file-card--done {
    opacity: 0.85;
    border-left-color: #2E7D32;
}

.file-card-top {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: #F8FAFC;
    border-bottom: 1px solid #E2E8F0;
}

.file-card-bottom {
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.file-card-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.file-type-icon { color: #E65100; font-size: 22px !important; flex-shrink: 0; }
.file-card--done .file-type-icon { color: #2E7D32; }

.file-card-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
    gap: 2px;
}

.file-card-name {
    font-size: 14px;
    font-weight: 500;
    color: #1A1A2E;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-card-size { font-size: 11px; color: #8A9BB0; }

.file-status-chip { margin-top: 4px; }

.file-card-doctype { font-size: 12px; }
.file-card-doctype .mud-input-slot { font-size: 12px !important; }
.file-card-doctype .mud-typography-input { font-size: 12px !important; }
.file-card-doctype label.mud-input-label { font-size: 12px !important; }
.file-card-doctype label.mud-input-label-outlined { transform: translate(14px, 9px) scale(1); }

.mud-select-popover .mud-list-item-text,
.mud-select-popover .mud-list-item,
.mud-list-item-text .mud-typography-body1 { font-size: 12px; }

@keyframes doctype-pulse {
    0%, 100% { background: #F8FAFC; }
    50%       { background: #F9B98A; }
}
.doctype-flash .file-card-top { animation: doctype-pulse 0.8s ease-in-out 4; }

.file-submitted-badge {
    display: inline-flex;
    align-self: flex-start;
    align-items: center;
    gap: 4px;
    background: #EBF8EE;
    color: #2E7D32;
    font-size: 12px;
    font-weight: 500;
    padding: 3px 10px 3px 6px;
    border-radius: 99px;
}

.file-card-error { font-size: 11px; }

.file-card-actions {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.file-card-actions .mud-icon-button {
    border-radius: 50% !important;
    width: 40px;
    height: 40px;
    min-width: 0;
    flex-shrink: 0;
}


/* ════════════════════════════════════════
   DESKTOP (≥ 768px)
════════════════════════════════════════ */
@media (min-width: 768px) {

    /* Two-column layout: sidebar | main */
    .upload-layout {
        flex-direction: row;
        height: calc(100vh - 48px);
    }

    .upload-sidebar {
        width: 300px;
        flex-shrink: 0;
        border-bottom: none;
        border-right: 1px solid #E2E8F0;
        padding: 16px 24px 28px;
        gap: 20px;
        overflow-y: auto;
    }

    .sidebar-actions {
        display: flex;
        flex-direction: column;
        align-items: stretch;
    }
    .sidebar-actions .add-files-label {
        align-self: auto;
    }

    .upload-main {
        flex: 1;
        overflow: hidden;
        position: relative;
    }

    .btn-label-short { display: none; }
    .btn-label-full  { display: inline; }

    /* Stats: vertical column with full-width rows on desktop */
    .sidebar-stats { flex-direction: column; }
    .stat-row {
        border-radius: 8px;
        padding: 8px 10px;
        gap: 8px;
    }
    .stat-icon  { font-size: 16px !important; }
    .stat-value { font-size: 14px; }
    .stat-label { flex: 1; }

    /* Sidebar instructions + security note — desktop only */
    .sidebar-instructions { display: block; }
    .sidebar-steps {
        margin: 8px 0 0;
        padding-left: 18px;
        font-size: 12px;
        color: #5A6A7E;
        line-height: 1.7;
        display: flex;
        flex-direction: column;
        gap: 4px;
    }
    .sidebar-steps strong { color: #1A1A2E; font-weight: 600; }
    .sidebar-security-note {
        margin-top: auto;
        background: #EBF8EE;
        border: 1px solid rgba(46,125,50,.2);
        border-radius: 8px;
        padding: 10px 12px;
        font-size: 12px;
        color: #2E7D32;
        line-height: 1.5;
    }

    /* Compact drop zone hidden on desktop — page-level drag overlay used instead */
    .drop-zone-compact { display: none !important; }

    /* Full-page drag overlay */
    .upload-main--dragging .page-drag-overlay {
        display: flex;
        position: absolute;
        inset: 0;
        z-index: 10;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        background: #F0F2F5;
        cursor: copy;
    }
    .page-drag-overlay-inner {
        pointer-events: none;
        text-align: center;
        border: 3px dashed #1B4F8A;
        border-radius: 16px;
        background: white;
        position: absolute;
        inset: 32px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
    }
    .page-drag-overlay .drop-zone-icon { color: #1B4F8A !important; margin-bottom: 12px; }
    .page-drag-overlay .drop-zone-title { color: #1B4F8A; }

    /* Hide file cards (and their tooltips) while the overlay is active */
    .upload-main--dragging .file-list,
    .upload-main--dragging .drop-zone-compact,
    .upload-main--dragging .upload-progress { visibility: hidden; }

    /* Drop zone fills the right panel on desktop */
    .drop-zone-wrap {
        margin: 32px;
        border: 2px dashed #CBD5E0;
        border-radius: 16px;
        background: #fff;
        padding: 80px 40px;
        justify-content: center;
        transition: border-color 0.2s, background 0.2s;
    }

    .drop-zone-wrap:hover {
        border-color: #1B4F8A;
        background: #EFF4FB;
    }

    .drop-zone-wrap:hover .drop-zone-icon { color: #1B4F8A; }

    .file-list { padding: 20px; gap: 10px; }
}

/* ── Dialogs: button spacing + styling ── */
.mud-dialog-actions { padding: 12px 16px !important; }
.mud-dialog-actions button + button { margin-left: 8px; }

.mud-dialog-actions .mud-button-text {
    border-radius: 6px !important;
    padding: 6px 18px !important;
}
.mud-dialog-actions .mud-button-text-default {
    border: 1px solid rgba(0,0,0,0.23) !important;
}
.mud-dialog-actions .mud-button-text-primary {
    background-color: var(--mud-palette-primary) !important;
    color: var(--mud-palette-primary-text) !important;
}
.mud-dialog-actions .mud-button-text-primary:hover {
    background-color: var(--mud-palette-primary-darken) !important;
}
.mud-dialog-actions .mud-button-text-error {
    background-color: var(--mud-palette-error) !important;
    color: var(--mud-palette-white) !important;
}

/* ── Dialogs: card style on mobile ── */
@media (max-width: 599px) {
    .mud-dialog-container {
        align-items: flex-start !important;
    }
    .mud-dialog {
        max-width: calc(100% - 40px) !important;
        border-radius: 8px !important;
        margin-top: 20vh;
    }
}

/* ── Snackbar: full-width centred on mobile ── */
@media (max-width: 599px) {
    .mud-snackbar-location-top-right {
        left: 12px !important;
        right: 12px !important;
    }
    .mud-snackbar-location-top-right .mud-snackbar {
        min-width: 0 !important;
        max-width: 100% !important;
        width: 100% !important;
    }
}

/* ════════════════════════════════════════
   HOME PAGE
════════════════════════════════════════ */
.home-outer {
    min-height: calc(100vh - 48px);
    display: flex;
    flex-direction: column;
}

.home-hero {
    background: linear-gradient(160deg, #0B2D6E 0%, #1447AF 100%);
    padding: 40px 32px 52px;
    position: relative;
    overflow: hidden;
}
.home-hero::before {
    content: '';
    position: absolute;
    top: -40px; right: -60px;
    width: 280px; height: 280px;
    background: radial-gradient(circle, rgba(255,255,255,.07) 0%, transparent 70%);
    border-radius: 50%;
}
.home-hero::after {
    content: '';
    position: absolute;
    bottom: -20px; left: -40px;
    width: 200px; height: 200px;
    background: radial-gradient(circle, rgba(0,157,123,.18) 0%, transparent 70%);
    border-radius: 50%;
}

.hero-eyebrow {
    font-size: .7rem;
    font-weight: 600;
    color: rgba(255,255,255,.6);
    letter-spacing: .12em;
    text-transform: uppercase;
    margin-bottom: 12px;
    position: relative; z-index: 1;
}
.hero-title {
    font-family: 'Fraunces', serif;
    font-size: 2rem;
    font-weight: 400;
    color: white;
    line-height: 1.15;
    letter-spacing: -.02em;
    position: relative; z-index: 1;
}
.hero-title em {
    font-style: italic;
    font-weight: 300;
    color: rgba(255,255,255,.75);
}
.hero-body {
    margin-top: 14px;
    font-size: .875rem;
    color: rgba(255,255,255,.65);
    line-height: 1.6;
    position: relative; z-index: 1;
}

.home-desktop-trust { display: none; }

.home-right {
    flex: 1;
    background: #EEF2F7;
    padding-bottom: 24px;
}

.home-logo-wrap { display: none; }

.home-form-card {
    background: white;
    margin: -28px 24px 0;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(11,45,110,.10), 0 1px 4px rgba(11,45,110,.06);
    padding: 28px 24px;
    position: relative;
    z-index: 2;
}
.home-form-title {
    font-family: 'Fraunces', serif;
    font-size: 1.1rem;
    font-weight: 500;
    color: #111827 !important;
    margin-bottom: 20px;
    letter-spacing: -.01em;
}

.home-trust-strip {
    padding: 20px 24px 0;
    display: flex;
    gap: 16px;
}
.home-trust-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    flex: 1;
}
.home-trust-icon {
    width: 32px; height: 32px;
    border-radius: 8px;
    background: #C8F0E4;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1rem;
}
.home-trust-label {
    font-size: .7rem;
    font-weight: 600;
    color: #374151;
    line-height: 1.3;
}
.home-trust-sub {
    font-size: .65rem;
    color: #6B7280;
    margin-top: 2px;
}

.home-success { text-align: center; padding: 12px 0 8px; }
.home-success-icon { font-size: 52px !important; color: #009d7b; display: block; margin: 0 auto 16px; }
.home-success-title {
    font-family: 'Fraunces', serif;
    font-size: 1.25rem;
    color: #009d7b;
    margin-bottom: 8px;
    font-weight: 500;
}
.home-success-body { font-size: .875rem; color: #6B7280; line-height: 1.6; margin-bottom: 12px; }
.home-success-note { font-size: .75rem; color: #9CA3AF; }

.home-submit-btn.mud-button-filled-primary {
    background: linear-gradient(283deg, #009d7b, #69b760) !important;
    box-shadow: 0 4px 14px rgba(0,157,123,.35) !important;
}
.home-submit-btn.mud-button-filled-primary:hover {
    filter: brightness(1.07);
    box-shadow: 0 6px 20px rgba(0,157,123,.45) !important;
}

/* ── HOME PAGE — DESKTOP ───────────────────────────────── */
@media (min-width: 768px) {
    .home-outer { flex-direction: row; min-height: calc(100vh - 48px); }

    .home-hero {
        flex: 1;
        padding: 56px 48px;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
    .hero-title { font-size: 2.75rem; }

    .home-desktop-trust {
        display: flex;
        flex-direction: column;
        gap: 10px;
        margin-top: 36px;
        position: relative; z-index: 1;
    }
    .home-desktop-trust-item {
        display: flex;
        align-items: center;
        gap: 10px;
        font-size: .8rem;
        color: rgba(255,255,255,.65);
    }
    .home-desktop-trust-item::before {
        content: '';
        width: 6px; height: 6px;
        background: #69b760;
        border-radius: 50%;
        flex-shrink: 0;
    }

    .home-right {
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: center;
        padding: 48px;
    }
    .home-logo-wrap {
        display: flex;
        justify-content: center;
        margin-bottom: 80px;
    }
    .home-logo-img { height: 72px; width: auto; }

    .home-form-card { margin: 0; padding: 36px 32px; }
    .home-form-title { font-size: 1.4rem; margin-bottom: 24px; color: #111827 !important; }
    .home-trust-strip {
        padding: 20px 24px 0;
        justify-content: center;
        gap: 32px;
    }
    .home-trust-strip .home-trust-item { flex: 0 0 auto; }
}
