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

/* ── Base ──────────────────────────────────────────── */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: #1a1a2e;
    background: #f0f2f5;
}

/* ── Login / Change Password ────────────────────────── */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;

    /* Dark navy base */
    background-color: #0b1628;

    /* Intersecting diagonal line overlay */
    background-image:
        repeating-linear-gradient(
            -52deg,
            transparent 0, transparent 90px,
            rgba(120, 165, 230, 0.07) 90px,
            rgba(120, 165, 230, 0.07) 91px
        ),
        repeating-linear-gradient(
            52deg,
            transparent 0, transparent 90px,
            rgba(120, 165, 230, 0.07) 90px,
            rgba(120, 165, 230, 0.07) 91px
        ),
        repeating-linear-gradient(
            -30deg,
            transparent 0, transparent 180px,
            rgba(140, 180, 240, 0.05) 180px,
            rgba(140, 180, 240, 0.05) 182px
        ),
        repeating-linear-gradient(
            30deg,
            transparent 0, transparent 180px,
            rgba(140, 180, 240, 0.05) 180px,
            rgba(140, 180, 240, 0.05) 182px
        ),
        radial-gradient(
            ellipse 80% 60% at 50% 50%,
            rgba(30, 58, 110, 0.55) 0%,
            transparent 70%
        );
}

/* ── Login card — light frosted glass ────────────────── */
.login-card {
    background: rgba(255, 255, 255, 0.87);
    backdrop-filter: blur(28px) saturate(200%);
    -webkit-backdrop-filter: blur(28px) saturate(200%);
    border: 1px solid rgba(255, 255, 255, 0.65);
    border-radius: 22px;
    box-shadow:
        0 32px 64px -16px rgba(0, 0, 0, 0.55),
        0 0 0 1px rgba(255, 255, 255, 0.55) inset;
    padding: 2.75rem 2.5rem 2.5rem;
    width: 100%;
    max-width: 420px;
    position: relative;
    overflow: hidden;
}

/* Gradient accent line along the top edge */
.login-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        #4895ef 30%,
        #4361ee 60%,
        transparent 100%
    );
}

/* ── Login icon badge ────────────────────────────────── */
.login-icon-wrap {
    width: 58px;
    height: 58px;
    margin: 0 auto 1.5rem;
    background: linear-gradient(135deg, #4361ee, #4895ef);
    border-radius: 17px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.375rem;
    color: #fff;
    box-shadow:
        0 8px 24px rgba(67, 97, 238, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}

/* ── Login header ────────────────────────────────────── */
.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h1 {
    font-size: 1.55rem;
    font-weight: 700;
    color: #0f1f4a;
    letter-spacing: -0.3px;
}

.login-header p {
    color: #6b7280;
    margin-top: 0.3rem;
    font-size: 0.875rem;
}

/* ── Alerts ──────────────────────────────────────────── */
.alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: #dc2626;
    padding: .75rem 1rem;
    font-size: .875rem;
    margin-bottom: 1.25rem;
}

/* Scoped error style inside the light frosted card */
.login-card .alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 10px;
    color: #dc2626;
}

/* ── Forms ───────────────────────────────────────────── */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: .875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: .375rem;
}

.form-group input {
    width: 100%;
    padding: .65rem .875rem;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    font-size: .9375rem;
    color: #1a1a2e;
    background: #fff;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}

.form-group input:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, .12);
}

.form-hint {
    display: block;
    font-size: .8rem;
    color: #9ca3af;
    margin-top: .3rem;
}

/* ── Floating label fields (login card) ──────────────── */
.login-card .float-group {
    position: relative;
    margin-bottom: 1.125rem;
}

.login-card .float-group input {
    width: 100%;
    padding: 1.5rem 1rem 0.5rem;
    border: 1.5px solid rgba(209, 213, 219, 0.9);
    border-radius: 10px;
    font-size: 0.9375rem;
    color: #111827;
    background: rgba(255, 255, 255, 0.75);
    outline: none;
    transition: border-color .2s, box-shadow .2s, background .2s;
}

.login-card .float-group label {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.9375rem;
    color: #9ca3af;
    pointer-events: none;
    transition: top .18s ease, font-size .18s ease, color .18s ease, transform .18s ease;
    transform-origin: left center;
}

/* Float label up when focused or has a value */
.login-card .float-group input:focus ~ label,
.login-card .float-group input:not(:placeholder-shown) ~ label,
.login-card .float-group input:-webkit-autofill ~ label {
    top: 0.55rem;
    transform: translateY(0);
    font-size: 0.7rem;
    font-weight: 600;
    color: #4361ee;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.login-card .float-group input:focus {
    background: #fff;
    border-color: #4361ee;
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.13);
}

/* ── Buttons ─────────────────────────────────────────── */
.btn-login {
    width: 100%;
    padding: .875rem;
    background: linear-gradient(135deg, #4361ee 0%, #3a86ff 100%);
    color: #fff;
    border: none;
    border-radius: 11px;
    font-size: .9375rem;
    font-weight: 600;
    letter-spacing: .025em;
    cursor: pointer;
    margin-top: .5rem;
    transition: transform .15s ease, box-shadow .15s ease;
    box-shadow: 0 4px 20px rgba(67, 97, 238, .45);
}

.btn-login:hover {
    background: linear-gradient(135deg, #3751d9 0%, #2d74e8 100%);
    box-shadow: 0 8px 30px rgba(67, 97, 238, .62);
    transform: translateY(-1px);
}

.btn-login:active {
    transform: translateY(0);
    box-shadow: 0 3px 12px rgba(67, 97, 238, .4);
}

/* ── Sidebar ───────────────────────────────────────── */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 240px;
    background: #0f172a;
    color: #fff;
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 1.375rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, .06);
    font-size: .9375rem;
    font-weight: 700;
    letter-spacing: .5px;
    text-transform: uppercase;
    flex-shrink: 0;
}

.sidebar-logo {
    color: #818cf8;
    font-size: 1.1rem;
}

/* ── Nav section label ──────────────────────────────── */
li.nav-section {
    font-size: .6875rem;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .28);
    padding: 1.25rem 1.5rem .375rem;
    pointer-events: none;
    list-style: none;
}

/* ── Nav links ──────────────────────────────────────── */
.sidebar-nav {
    list-style: none;
    flex: 1;
    padding: .5rem 0;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: .875rem;
    padding: .65rem 1.375rem;
    color: rgba(255, 255, 255, .55);
    text-decoration: none;
    font-size: .875rem;
    border-left: 3px solid transparent;
    transition: color .15s, background .15s, border-color .15s;
}

.sidebar-nav li a i {
    width: 16px;
    text-align: center;
    font-size: .875rem;
    flex-shrink: 0;
}

.sidebar-nav li a:hover {
    color: rgba(255, 255, 255, .9);
    background: rgba(255, 255, 255, .05);
}

.sidebar-nav li a.active {
    color: #a5b4fc;
    background: rgba(99, 102, 241, .14);
    border-left-color: #6366f1;
    font-weight: 500;
}

.sidebar-nav li a.active i {
    color: #818cf8;
}

/* ── Sidebar footer ─────────────────────────────────── */
.sidebar-footer {
    padding: 1rem 1.25rem 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, .06);
    flex-shrink: 0;
}

.sidebar-user-info {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: .875rem;
    min-width: 0;
}

.sidebar-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #6366f1;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .8125rem;
    font-weight: 700;
    flex-shrink: 0;
}

.sidebar-user-details {
    flex: 1;
    min-width: 0;
}

.sidebar-user-name {
    display: block;
    font-size: .875rem;
    font-weight: 500;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    display: block;
    font-size: .75rem;
    color: rgba(255, 255, 255, .35);
    margin-top: .0625rem;
}

.btn-logout {
    display: flex;
    align-items: center;
    gap: .5rem;
    width: 100%;
    background: none;
    border: none;
    color: rgba(255, 255, 255, .38);
    cursor: pointer;
    font-size: .8125rem;
    padding: .375rem .25rem;
    transition: color .15s;
}

.btn-logout:hover { color: #fca5a5; }

.sidebar-footer-actions {
    display: flex;
    flex-direction: column;
    gap: .125rem;
}

.btn-change-pw { text-decoration: none; }
.btn-change-pw:hover { color: #93c5fd; }
.btn-change-pw.active { color: #60a5fa; }

/* ── Change password page ───────────────────────────── */
.change-pw-wrap {
    max-width: 480px;
}

.change-pw-card {
    padding: 2rem;
}

.change-pw-actions {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-top: 1.5rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .65rem 1.25rem;
    border-radius: 8px;
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: background .15s, box-shadow .15s;
}

.btn-primary {
    background: #6366f1;
    color: #fff;
    box-shadow: 0 2px 8px rgba(99, 102, 241, .3);
}

.btn-primary:hover {
    background: #4f46e5;
    box-shadow: 0 4px 14px rgba(99, 102, 241, .4);
}

.btn-secondary {
    background: #f3f4f6;
    color: #374151;
}

.btn-secondary:hover { background: #e5e7eb; }

/* ── App shell ─────────────────────────────────────── */
.app-content {
    margin-left: 240px;
    padding: 2rem 2.25rem;
    min-height: 100vh;
}

/* ── Page header ────────────────────────────────────── */
.page-header {
    margin-bottom: 2rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid #e5e7eb;
}

.page-header h1 {
    font-size: 1.375rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: .625rem;
    margin-bottom: .25rem;
}

.page-header h1 i {
    color: #6366f1;
    font-size: 1.2rem;
}

.page-header p {
    color: #6b7280;
    font-size: .9rem;
}

/* ── Content card ───────────────────────────────────── */
.content-card {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .06);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
}

.content-card-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #374151;
}

/* ── Placeholder state ──────────────────────────────── */
.placeholder-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #9ca3af;
}

.placeholder-state i {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    display: block;
    color: #d1d5db;
}

.placeholder-state p {
    font-size: .9rem;
}

/* ── Page header flex variant ───────────────────────── */
.page-header-flex {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
}

/* ── Alerts (success / error) ───────────────────────── */
.alert {
    display: flex;
    align-items: center;
    gap: .625rem;
    border-radius: 8px;
    padding: .75rem 1rem;
    font-size: .875rem;
    margin-bottom: 1.25rem;
}

.alert-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #16a34a;
}

.alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
}

/* ── Buttons — primary / secondary ──────────────────── */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .55rem 1.125rem;
    background: #6366f1;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: .875rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background .15s;
}

.btn-primary:hover  { background: #4f46e5; }
.btn-primary:active { background: #4338ca; }

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .55rem 1.125rem;
    background: #f3f4f6;
    color: #374151;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    font-size: .875rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, border-color .15s;
}

.btn-secondary:hover {
    background: #e5e7eb;
    text-decoration: none;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-secondary:focus {
    text-decoration: none;
}

/* ── Icon action buttons ─────────────────────────────── */
.action-btns {
    display: flex;
    align-items: center;
    gap: .375rem;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: .8125rem;
    transition: background .15s, color .15s;
}

.btn-icon:disabled {
    opacity: .35;
    cursor: not-allowed;
}

.btn-edit      { background: #eff6ff; color: #3b82f6; }
.btn-edit:hover { background: #dbeafe; }

.btn-deactivate      { background: #fff7ed; color: #ea580c; }
.btn-deactivate:hover { background: #fed7aa; }

.btn-activate      { background: #f0fdf4; color: #16a34a; }
.btn-activate:hover { background: #bbf7d0; }

.btn-lock      { background: #fef2f2; color: #dc2626; }
.btn-lock:hover { background: #fecaca; }

.btn-unlock      { background: #faf5ff; color: #9333ea; }
.btn-unlock:hover { background: #f3e8ff; }

/* ── Table ───────────────────────────────────────────── */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
}

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

.data-table thead th {
    text-align: left;
    padding: .5rem .875rem;
    font-size: .6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #6b7280;
    border-bottom: 1.5px solid #cbd5e1;
    white-space: nowrap;
    background: #f8fafc;
}

.data-table tbody tr {
    border-bottom: 1px solid #e2e8f0;
    transition: background .1s;
}

.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover      { background: #f8fafc; }

.data-table tbody td {
    padding: .6rem .875rem;
    color: #374151;
    vertical-align: middle;
}

.td-num   { color: #9ca3af; font-size: .8125rem; width: 40px; }
.td-date  { color: #6b7280; white-space: nowrap; font-size: .8125rem; }
.td-muted { color: #9ca3af; font-size: .8125rem; white-space: nowrap; }
.td-dash  { color: #d1d5db; }

.history-run-id { font-weight: 600; color: #4b5563; font-size: .875rem; }
.history-count  {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 20px;
    padding: 0 6px;
    background: #e0e7ff;
    color: #4361ee;
    border-radius: 99px;
    font-size: .7rem;
    font-weight: 700;
    margin-left: .4rem;
    vertical-align: middle;
}

/* ── History page ───────────────────────────────────── */
.hist-cost-banner {
    display: flex;
    align-items: center;
    gap: 0;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: .875rem 1.5rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 1px 4px rgba(0,0,0,.05);
}

.hist-cost-item {
    display: flex;
    flex-direction: column;
    gap: .2rem;
    flex: 1;
}

.hist-cost-label {
    font-size: .75rem;
    color: #9ca3af;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.hist-cost-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: #111827;
}

.hist-cost-divider {
    width: 1px;
    height: 36px;
    background: #e5e7eb;
    margin: 0 1.5rem;
    flex-shrink: 0;
}

.hist-card { padding: 0; overflow: hidden; }

/* Tab bar */
.hist-tab-bar {
    display: flex;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
    padding: 0 1.25rem;
    gap: .25rem;
}

.hist-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .875rem 1rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: #6b7280;
    font-size: .875rem;
    font-weight: 500;
    cursor: pointer;
    transition: color .15s, border-color .15s;
    white-space: nowrap;
    margin-bottom: -1px;
}

.hist-tab-btn:hover { color: #374151; }

.hist-tab-btn.active {
    color: #4361ee;
    border-bottom-color: #4361ee;
    background: none;
}

/* Tab panels */
.hist-tab-panel { display: none; }
.hist-tab-panel.active { display: block; }

/* Scrollable table wrapper */
.hist-table-scroll {
    max-height: 480px;
    overflow-y: auto;
    overflow-x: auto;
}

/* Sticky header inside scroll */
.hist-table thead th {
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 2;
    box-shadow: 0 1px 0 #e5e7eb;
}

.hist-cost-cell {
    font-weight: 600;
    color: #059669;
    white-space: nowrap;
}

.hist-file-icon {
    color: #16a34a;
    margin-right: .35rem;
    font-size: .875rem;
}

.user-cell {
    display: flex;
    flex-direction: column;
    gap: .15rem;
}

.user-cell-name {
    font-weight: 600;
    color: #111827;
    font-size: .875rem;
}

.user-cell-meta {
    display: flex;
    align-items: center;
    gap: .3rem;
}

.user-cell-label {
    font-size: .75rem;
    color: #9ca3af;
    font-weight: 500;
}

.username-cell {
    font-family: 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
    font-size: .8125rem;
    background: #f3f4f6;
    padding: .2rem .45rem;
    border-radius: 4px;
    color: #374151;
}

/* ── Badges ──────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .2rem .55rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-role-admin  { background: #ede9fe; color: #7c3aed; }
.badge-role-user   { background: #eff6ff; color: #2563eb; }

.badge-status-active   { background: #f0fdf4; color: #15803d; }
.badge-status-inactive { background: #f3f4f6; color: #6b7280; }

.badge-locked   { background: #fef2f2; color: #dc2626; }

/* ── Inline form (for icon-button forms) ────────────── */
.inline-form { display: inline; }

/* ── Form select ─────────────────────────────────────── */
.form-select {
    width: 100%;
    padding: .65rem .875rem;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    font-size: .9375rem;
    color: #1a1a2e;
    background: #fff;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .875rem center;
    padding-right: 2.25rem;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
}

.form-select:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, .12);
}

/* ── Modal ───────────────────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-overlay.is-open {
    display: flex;
}

body.modal-open { overflow: hidden; }

.modal {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, .18);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: modalIn .18s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(-12px) scale(.97); }
    to   { opacity: 1; transform: translateY(0)      scale(1);   }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.modal-header h2 {
    font-size: 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: .5rem;
    color: #111827;
}

.modal-header h2 i { color: #6366f1; }

.modal-close {
    background: none;
    border: none;
    font-size: 1.375rem;
    line-height: 1;
    color: #9ca3af;
    cursor: pointer;
    padding: .125rem .25rem;
    border-radius: 4px;
    transition: color .15s, background .15s;
}

.modal-close:hover { color: #374151; background: #f3f4f6; }

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.modal-body .form-group:last-child { margin-bottom: 0; }

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .625rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid #e5e7eb;
    flex-shrink: 0;
}

/* ── Upload zone ─────────────────────────────────────── */
.upload-zone {
    border: 2px dashed #d1d5db;
    border-radius: 12px;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: border-color .2s, background .2s;
    background: #fafafa;
}

.upload-zone.drag-over {
    border-color: #6366f1;
    background: #eef2ff;
}

.upload-zone-icon {
    font-size: 3rem;
    color: #6366f1;
    margin-bottom: 1rem;
    display: block;
}

.upload-zone-title {
    font-size: 1rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: .25rem;
}

.upload-zone-sub {
    font-size: .875rem;
    color: #9ca3af;
    margin-bottom: .875rem;
}

.upload-browse-btn {
    cursor: pointer;
}

.upload-input-hidden {
    display: none;
}

.upload-selected-name {
    margin-top: .875rem;
    font-size: .875rem;
    color: #6366f1;
    font-weight: 500;
    min-height: 1.25rem;
}

.upload-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 1.25rem;
}

/* ── Preview ─────────────────────────────────────────── */
.preview-danger-banner {
    display: flex;
    align-items: center;
    gap: .75rem;
    background: #fef2f2;
    border: 1.5px solid #fecaca;
    border-radius: 10px;
    padding: .875rem 1.25rem;
    color: #b91c1c;
    font-size: .9rem;
    margin-bottom: 1.25rem;
}

.preview-danger-banner i { font-size: 1.1rem; flex-shrink: 0; }

.preview-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid #f3f4f6;
}

.preview-stat {
    display: flex;
    align-items: center;
    gap: .75rem;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: .75rem 1rem;
    min-width: 180px;
}

.preview-stat-icon {
    font-size: 1.375rem;
    flex-shrink: 0;
}

.preview-stat-green  { color: #16a34a; }
.preview-stat-blue   { color: #2563eb; }
.preview-stat-orange { color: #d97706; }

.preview-stat-label {
    display: block;
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #9ca3af;
    font-weight: 600;
    margin-bottom: .15rem;
}

.preview-stat-value {
    display: block;
    font-size: .9375rem;
    font-weight: 700;
    color: #111827;
}

.preview-stat-value small {
    font-weight: 400;
    font-size: .8rem;
    color: #6b7280;
}

.preview-warnings {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
    padding: .875rem 1rem;
    margin-bottom: 1.25rem;
}

.preview-warnings-title {
    font-size: .8125rem;
    font-weight: 600;
    color: #92400e;
    margin-bottom: .625rem;
    display: flex;
    align-items: center;
    gap: .4rem;
}

.preview-warnings-list {
    display: flex;
    flex-wrap: wrap;
    gap: .375rem;
}

.preview-warning-badge {
    background: #fef3c7;
    border: 1px solid #fcd34d;
    color: #78350f;
    font-size: .75rem;
    font-family: 'Fira Code', 'Consolas', monospace;
    padding: .15rem .5rem;
    border-radius: 4px;
}

.preview-sample-label {
    font-size: .8125rem;
    font-weight: 600;
    color: #6b7280;
    margin-bottom: .75rem;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.preview-footer-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .75rem;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid #f3f4f6;
}

.btn-confirm-import {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .6rem 1.375rem;
    background: #dc2626;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: .9rem;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s;
}

.btn-confirm-import:hover { background: #b91c1c; }

/* ── Progress overlays ───────────────────────────────── */
.progress-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 400;
    align-items: center;
    justify-content: center;
}

.progress-overlay.is-open {
    display: flex;
}

.progress-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, .22);
    padding: 2.5rem 2.25rem;
    width: 100%;
    max-width: 400px;
    text-align: center;
    animation: modalIn .2s ease;
}

.progress-card-icon {
    font-size: 2.5rem;
    color: #6366f1;
    margin-bottom: 1.25rem;
}

.progress-card-icon i {
    animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1;    transform: scale(1); }
    50%       { opacity: 0.6; transform: scale(0.92); }
}

.progress-card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: .375rem;
}

.progress-card-sub {
    font-size: .875rem;
    color: #6b7280;
    margin-bottom: 1.5rem;
    min-height: 1.25rem;
}

/* ── Progress bar ────────────────────────────────────── */
.progress-track {
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: .75rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #818cf8);
    border-radius: 999px;
    transition: width .25s ease;
    width: 0%;
}

.progress-fill.indeterminate {
    width: 40%;
    animation: indeterminate 1.5s ease-in-out infinite;
}

@keyframes indeterminate {
    0%   { transform: translateX(-150%); }
    100% { transform: translateX(350%); }
}

.progress-pct {
    font-size: .875rem;
    font-weight: 600;
    color: #6366f1;
}

.progress-elapsed {
    margin-top: .25rem;
    font-size: .78rem;
    font-weight: 600;
    color: #64748b;
}

/* ── Upload history ──────────────────────────────────── */
.log-filename {
    font-size: .875rem;
    color: #374151;
}

.dup-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}

.dup-toolbar-actions {
    display: flex;
    align-items: center;
    gap: .625rem;
    flex: 0 0 auto;
}

.dup-toolbar-copy {
    min-width: 0;
}

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

.content-card-headline .content-card-title {
    margin: 0;
}

.dup-run-form {
    display: flex;
    align-items: center;
    gap: .625rem;
    margin: 0;
}

a.btn-secondary.disabled {
    opacity: .45;
    pointer-events: none;
    cursor: default;
}

.dup-muted {
    color: #64748b;
    font-size: .86rem;
    margin-top: .25rem;
}

.dup-group-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: .75rem;
}

.dup-group-card {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: .875rem;
    background: #fff;
    display: grid;
    gap: .25rem;
}

.dup-group-card strong {
    color: #111827;
    font-size: .95rem;
}

.dup-group-card span {
    color: #64748b;
    font-size: .8rem;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: .2rem .5rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
}

.status-completed {
    background: #dcfce7;
    color: #166534;
}

.status-running,
.status-pending,
.status-cancelling {
    background: #e0e7ff;
    color: #3730a3;
}

.status-failed,
.status-cancelled {
    background: #fee2e2;
    color: #991b1b;
}

.settings-muted {
    color: #64748b;
    font-size: .86rem;
    margin: .25rem 0 1rem;
}

.settings-provider-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1rem;
}

.settings-provider-card {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    padding: 1rem;
}

.settings-provider-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: .875rem;
}

.settings-provider-head strong,
.settings-provider-head span {
    display: block;
}

.settings-provider-head strong {
    color: #111827;
    font-size: .98rem;
}

.settings-provider-head span {
    color: #64748b;
    font-size: .8rem;
}

.settings-secret-state {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .65rem .75rem;
    border-radius: 8px;
    background: #f8fafc;
    color: #475569;
    font-size: .84rem;
    margin-bottom: 1rem;
}

.settings-toggle {
    display: flex;
    align-items: center;
    gap: .5rem;
    color: #374151;
    font-size: .88rem;
    margin-bottom: 1rem;
}

.settings-actions {
    display: flex;
    justify-content: flex-end;
}

.settings-remove-form {
    margin-top: .75rem;
    padding-top: .75rem;
    border-top: 1px solid #e5e7eb;
}

.dup-ai-toggle {
    margin: 0;
    height: 36px;
    padding: 0 .7rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #f8fafc;
    white-space: nowrap;
}

.dup-ai-check {
    border-color: #c7d2fe;
    background: #eef2ff;
    color: #312e81;
    font-weight: 700;
}

.dup-config-button {
    height: 36px;
}

.btn-table-action {
    min-height: 30px;
    padding: .35rem .65rem;
    font-size: .78rem;
}

.current-data-actions {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
}

.row-action-menu {
    position: relative;
    display: inline-flex;
    justify-content: flex-end;
}

.row-action-toggle {
    border: 1px solid #dbe3ef;
    background: #fff;
    color: #334155;
}

.row-action-toggle:hover,
.row-action-menu.is-open .row-action-toggle {
    border-color: #6366f1;
    background: #eef2ff;
    color: #4f46e5;
}

.row-action-dropdown {
    position: fixed;
    z-index: 30;
    display: none;
    min-width: 220px;
    padding: .45rem;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 14px 34px rgba(15, 23, 42, .16);
}

.row-action-menu.is-open .row-action-dropdown {
    display: grid;
    gap: .2rem;
}

.row-action-item {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    align-items: center;
    gap: .6rem;
    padding: .58rem .65rem;
    border-radius: 7px;
    color: #334155;
    font-size: .82rem;
    font-weight: 500;
    line-height: 1.15;
    text-decoration: none;
    white-space: nowrap;
}

.row-action-item i {
    width: 18px;
    color: #475569;
    font-size: .78rem;
    text-align: center;
}

.row-action-item:hover,
.row-action-item:focus {
    background: #f1f5f9;
    color: #4f46e5;
    text-decoration: none;
}

.row-action-item:hover i,
.row-action-item:focus i {
    color: #4f46e5;
}

.row-action-item.disabled {
    opacity: .45;
    pointer-events: none;
}

.table-person-date {
    display: grid;
    gap: .15rem;
}

.table-person-date strong {
    color: #111827;
    font-size: .84rem;
}

.table-person-date span {
    color: #64748b;
    font-size: .76rem;
    white-space: nowrap;
}

.fv-upload-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: .7rem 1rem;
    border-radius: 8px;
    font-size: .88rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    margin: 0;
    background: #0f766e;
    color: #fff;
}

.fv-upload-button:hover,
.fv-upload-button:focus {
    background: #115e59;
}

.fv-run-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: .7rem 1rem;
    border-radius: 8px;
    font-size: .88rem;
    font-weight: 700;
    line-height: 1;
    background: #4f46e5;
    color: #fff;
}

.fv-run-button:hover,
.fv-run-button:focus {
    background: #4338ca;
}

.raw-freshness-modal {
    width: min(620px, calc(100vw - 2rem));
}

.raw-freshness-copy {
    margin: 0 0 1rem;
    color: #475569;
    font-size: .9rem;
    line-height: 1.5;
}

.raw-freshness-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .75rem;
}

.raw-freshness-grid div {
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    background: #f8fafc;
    padding: .8rem .9rem;
}

.raw-freshness-grid span {
    display: block;
    margin-bottom: .25rem;
    color: #64748b;
    font-size: .72rem;
}

.raw-freshness-grid strong {
    display: block;
    color: #0f172a;
    font-size: .9rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.raw-freshness-alert {
    margin-top: 1rem;
}

.fv-flow-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: .875rem;
}

.fv-flow-step {
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    padding: .95rem;
    background: #f8fafc;
}

.fv-flow-step span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 999px;
    background: #eef2ff;
    color: #4f46e5;
    font-weight: 800;
    font-size: .78rem;
    margin-bottom: .65rem;
}

.fv-flow-step strong {
    display: block;
    color: #111827;
    font-size: .94rem;
}

.fv-flow-step p {
    color: #64748b;
    font-size: .84rem;
    line-height: 1.45;
    margin: .35rem 0 0;
}

.btn-compact {
    min-height: 34px;
    padding: .42rem .7rem;
    border-radius: 7px;
    line-height: 1;
}

.form-help {
    display: block;
    margin-top: .35rem;
    color: #64748b;
    font-size: .78rem;
    line-height: 1.4;
}

.dup-review-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.dup-review-sticky {
    position: sticky;
    top: 0;
    z-index: 20;
    padding: .75rem 0 .65rem;
    margin: -.75rem 0 .75rem;
    background: #f3f4f6;
    border-bottom: 1px solid #dbe3ef;
}

.dup-review-topbar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: .75rem;
    align-items: stretch;
}

.dup-review-summary {
    display: grid;
    grid-template-columns: repeat(5, minmax(130px, 1fr));
    gap: .75rem;
    margin-bottom: .75rem;
}

.dup-review-summary > div {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    padding: .85rem;
}

.dup-review-summary .dup-review-back-card {
    min-width: 130px;
}

.dup-review-back-card {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 130px;
}

.dup-review-summary span,
.dup-review-meta,
.dup-store-card-head span,
.dup-store-details dt {
    color: #64748b;
    font-size: .76rem;
}

.dup-review-summary strong {
    display: block;
    margin-top: .2rem;
    color: #111827;
}

.dup-review-stage {
    position: relative;
}

.dup-review-list {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: .75rem;
    scroll-snap-type: x mandatory;
    scrollbar-gutter: stable;
    scrollbar-width: none;
}

.dup-review-list::-webkit-scrollbar {
    display: none;
}

.dup-review-nav {
    position: absolute;
    top: 50%;
    z-index: 5;
    width: 48px;
    height: 48px;
    border: 2px solid #4f46e5;
    border-radius: 999px;
    background: rgba(255, 255, 255, .92);
    color: #4f46e5;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transform: translateY(-50%);
    box-shadow: 0 8px 24px rgba(15, 23, 42, .14);
}

.dup-review-nav:hover {
    background: #eef2ff;
    color: #3730a3;
    border-color: #3730a3;
}

.dup-review-nav-prev {
    left: -24px;
}

.dup-review-nav-next {
    right: -24px;
}

.dup-review-group {
    flex: 0 0 100%;
    min-width: 0;
    border: 1px solid #a5b4fc;
    border-radius: 8px;
    background: #fff;
    padding: 0;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(15, 23, 42, .04);
    scroll-snap-align: start;
    scroll-margin-left: 0;
}

.dup-review-group-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: .9rem 1rem;
    border-bottom: 1px solid #a5b4fc;
    background: #c7d2fe;
}

.dup-review-group-head h2 {
    margin: 0;
    color: #1e1b4b;
    font-size: 1rem;
}

.dup-review-title-line {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
}

.dup-review-title-line span {
    color: #3730a3;
    font-size: .82rem;
}

.dup-ai-result {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex: 0 0 auto;
}

.dup-ai-status {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: .25rem .6rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 800;
    text-transform: uppercase;
}

.dup-ai-status-yes {
    background: #dcfce7;
    color: #166534;
}

.dup-ai-status-no {
    background: #fee2e2;
    color: #991b1b;
}

.dup-ai-status-uncertain,
.dup-ai-status-skipped {
    background: #fef3c7;
    color: #92400e;
}

.dup-ai-status-clean {
    background: #e0f2fe;
    color: #075985;
}

.dup-ai-info-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .75rem 1rem 0;
}

.dup-ai-reason {
    min-width: 0;
    margin: 0;
    color: #334155;
    font-size: .86rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dup-review-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem 1rem;
    flex: 0 0 auto;
    justify-content: flex-end;
}

.dup-store-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 34rem), 1fr));
    gap: .875rem;
    padding: 1rem;
}

.dup-store-card {
    min-width: 0;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 0;
    background: #fff;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .05);
}

.dup-store-card-head {
    display: flex;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: 0;
    padding: .75rem .875rem;
    border-bottom: 1px solid #dbe3ef;
    background: linear-gradient(135deg, #eef2ff, #f0fdfa);
}

.dup-store-card-head strong {
    color: #111827;
    font-size: .92rem;
}

.dup-store-details {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .5rem .75rem;
    margin: 0;
    padding: .875rem;
}

.dup-store-details div {
    min-width: 0;
}

.dup-store-details dt {
    margin-bottom: .1rem;
}

.dup-store-details dd {
    margin: 0;
    color: #1f2937;
    font-size: .82rem;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dup-review-tools {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0;
}

.dup-review-search {
    display: flex;
    align-items: center;
    gap: .5rem;
    width: min(460px, 100%);
    min-height: 40px;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    padding: 0 .75rem;
    background: #fff;
}

.dup-review-search i {
    color: #64748b;
}

.dup-review-search input {
    width: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    color: #111827;
    font-size: .88rem;
}

.dup-review-filter {
    min-height: 40px;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    padding: 0 .75rem;
    background: #fff;
    color: #111827;
    font-size: .88rem;
}

#dupReviewCount {
    color: #64748b;
    font-size: .82rem;
    font-weight: 700;
}

.dup-carousel {
    position: relative;
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) 34px;
    align-items: center;
    gap: .5rem;
    padding: 0 .875rem .875rem;
}

.dup-carousel-frame {
    position: relative;
    height: clamp(180px, 22vw, 285px);
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    background: #f8fafc;
}

.dup-carousel-slide {
    position: absolute;
    inset: 0;
    display: none;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: zoom-in;
}

.dup-carousel-slide.is-active {
    display: block;
}

.dup-carousel-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.dup-carousel-nav {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    background: #fff;
    color: #334155;
    cursor: pointer;
}

.dup-carousel-nav:hover {
    border-color: #6366f1;
    color: #4f46e5;
}

.dup-carousel-count {
    position: absolute;
    right: 42px;
    bottom: .5rem;
    z-index: 2;
    padding: .15rem .45rem;
    border-radius: 999px;
    background: rgba(15, 23, 42, .72);
    color: #fff;
    font-size: .7rem;
    font-weight: 700;
}

.dup-image-empty {
    display: grid;
    place-items: center;
    min-height: 90px;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    color: #64748b;
    font-size: .82rem;
    background: #f8fafc;
    margin: 0 .875rem .875rem;
}

.dup-image-modal {
    width: min(960px, calc(100vw - 2rem));
}

.dup-lightbox-body {
    display: grid;
    place-items: center;
    min-height: 320px;
    max-height: calc(100vh - 180px);
    background: #0f172a;
    overflow: hidden;
}

.dup-lightbox-body img {
    max-width: 100%;
    max-height: calc(100vh - 190px);
    object-fit: contain;
    display: block;
}

.dup-compare-dialog {
    width: min(1500px, calc(100vw - 2rem));
    max-width: calc(100vw - 2rem);
}

.dup-compare-body {
    display: flex;
    gap: .875rem;
    padding: 1rem;
    max-height: calc(100vh - 190px);
    overflow-x: auto;
    overflow-y: auto;
}

.dup-compare-item {
    flex: 1 1 0;
    min-width: 360px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
}

.dup-compare-footer {
    justify-content: flex-end;
    padding: .75rem 1rem;
}

.dup-compare-item header {
    padding: .75rem;
    border-bottom: 1px solid #eef2f7;
}

.dup-compare-item strong,
.dup-compare-item span {
    display: block;
}

.dup-compare-item strong {
    color: #111827;
    font-size: .9rem;
}

.dup-compare-item span {
    color: #64748b;
    font-size: .76rem;
    margin-top: .15rem;
}

.dup-compare-viewer {
    position: relative;
    background: #0f172a;
}

.dup-compare-viewer img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: contain;
    display: block;
}

.dup-compare-nav {
    position: absolute;
    top: 50%;
    width: 36px;
    height: 36px;
    border: 1px solid #c7d2fe;
    border-radius: 8px;
    background: rgba(255, 255, 255, .92);
    color: #4f46e5;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transform: translateY(-50%);
}

.dup-compare-nav:hover {
    background: #eef2ff;
}

.dup-compare-prev {
    left: .5rem;
}

.dup-compare-next {
    right: .5rem;
}

.dup-compare-count {
    position: absolute;
    right: .5rem;
    bottom: .5rem;
    padding: .15rem .45rem;
    border-radius: 999px;
    background: rgba(15, 23, 42, .78);
    color: #fff;
    font-size: .72rem;
    font-weight: 700;
}

@media (max-width: 760px) {
    .dup-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .dup-toolbar-actions,
    .dup-run-form {
        align-items: stretch;
        flex-direction: column;
        width: 100%;
    }

    .dup-toolbar-actions .btn-primary,
    .dup-toolbar-actions .btn-secondary,
    .dup-ai-toggle {
        justify-content: center;
        width: 100%;
    }

    .dup-review-header,
    .dup-review-group-head,
    .dup-store-card-head {
        flex-direction: column;
    }

    .dup-ai-result {
        width: 100%;
        justify-content: space-between;
    }

    .dup-store-details {
        grid-template-columns: 1fr;
    }

    .dup-store-grid {
        grid-template-columns: 1fr;
    }

    .dup-review-tools {
        align-items: stretch;
        flex-direction: column;
    }

    .dup-ai-info-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .dup-review-meta {
        justify-content: flex-start;
    }

    .dup-review-topbar,
    .dup-review-summary {
        grid-template-columns: 1fr;
    }

    .dup-review-summary .dup-review-back-card {
        min-width: 0;
    }

    .dup-carousel {
        grid-template-columns: 30px minmax(0, 1fr) 30px;
    }

    .dup-compare-body {
        flex-direction: column;
    }

    .dup-compare-item {
        flex-basis: auto;
        min-width: 0;
    }
}

/* ── Modal footer actions ────────────────────────────── */
.modal-footer-actions {
    display: flex;
    align-items: center;
    gap: .625rem;
}

.dup-reassess-status {
    color: #4f46e5;
    font-size: .8rem;
    font-weight: 700;
}

.dup-compare-body.is-reassessing {
    opacity: .62;
    pointer-events: none;
}

.btn-secondary:disabled,
.btn-primary:disabled {
    opacity: .65;
    cursor: wait;
}

.modal-header-actions {
    display: flex;
    align-items: center;
    gap: .4rem;
    margin-left: auto;
}

.dup-compare-dialog .modal-header {
    align-items: center;
    padding: .85rem 1rem;
}

.dup-compare-dialog .modal-header h2 {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    margin: 0;
    font-size: 1rem;
    line-height: 1.2;
}

.dup-compare-dialog .modal-close {
    width: 34px;
    height: 34px;
}

textarea {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: .65rem .75rem;
    color: #111827;
    font: inherit;
    resize: vertical;
}

/* ── Reset password button ───────────────────────────── */
.btn-reset-pwd {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .5rem .875rem;
    background: #fff7ed;
    color: #c2410c;
    border: 1.5px solid #fed7aa;
    border-radius: 8px;
    font-size: .8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}

.btn-reset-pwd:hover {
    background: #ffedd5;
    border-color: #fdba74;
}
