:root {
    color-scheme: dark;
    --bg: #080b0f;
    --panel: #10151b;
    --panel-soft: #141a21;
    --line: rgba(255, 255, 255, .085);
    --text: #f1f5f8;
    --muted: #8e99a5;
    --accent: #bbde1a;
    --accent-dark: #829d00;
    --warning: #f5a020;
    --danger: #ff6471;
    --success: #31d17c;
    font-family: "Inter", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { width: 100%; max-width: 100%; overflow-x: hidden; overflow-x: clip; background: var(--bg); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { width: 100%; max-width: 100%; min-height: 100vh; margin: 0; overflow-x: hidden; overflow-x: clip; color: var(--text); background: radial-gradient(circle at 82% -10%, rgba(187, 222, 26, .1), transparent 30%), var(--bg); }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }

.login-page {
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        linear-gradient(125deg, rgba(5, 8, 11, .99), rgba(5, 8, 11, .82)),
        radial-gradient(circle at 75% 20%, rgba(187, 222, 26, .18), transparent 36%),
        #080b0f;
}

.login-card {
    width: min(460px, 100%);
    padding: 38px;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: rgba(15, 20, 26, .92);
    box-shadow: 0 32px 100px rgba(0, 0, 0, .5);
    text-align: center;
}

.brand-mark, .brand > span {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    margin: 0 auto 22px;
    border-radius: 14px;
    color: #111500;
    background: var(--accent);
    box-shadow: 0 0 28px rgba(187, 222, 26, .2);
    font-weight: 900;
    letter-spacing: -.04em;
}

.eyebrow {
    margin: 0 0 7px;
    color: var(--accent);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .16em;
    text-transform: uppercase;
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 12px; font-size: clamp(30px, 5vw, 46px); letter-spacing: -.045em; }
h2 { margin-bottom: 0; font-size: 20px; letter-spacing: -.025em; }
.login-copy { margin: 0 auto 28px; color: var(--muted); line-height: 1.65; }
.login-card > small { display: block; margin-top: 16px; color: var(--muted); }

.alert {
    margin-bottom: 18px;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.45;
}
.alert.error { border: 1px solid rgba(255, 100, 113, .28); color: #ffc1c6; background: rgba(255, 100, 113, .09); }

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 15px;
    border: 1px solid transparent;
    border-radius: 9px;
    color: var(--text);
    background: transparent;
    cursor: pointer;
    font-size: 12px;
    font-weight: 800;
    transition: transform .15s ease, border-color .15s ease, background .15s ease;
}
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled { opacity: .42; cursor: not-allowed; }
.button.primary { color: #111500; background: var(--accent); }
.button.primary:hover:not(:disabled) { background: #cfee32; }
.button.ghost { border-color: var(--line); background: rgba(255, 255, 255, .035); }
.button.danger { border-color: rgba(255, 100, 113, .24); color: #ffafb6; background: rgba(255, 100, 113, .08); }
.button.warning { border-color: rgba(245, 160, 32, .3); color: #171006; background: var(--warning); }
.button.full { width: 100%; min-height: 48px; }
.discord-icon { margin-right: 9px; font-size: 19px; }

.topbar {
    position: sticky;
    z-index: 20;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    min-height: 70px;
    padding: 10px max(20px, calc((100vw - 1500px) / 2));
    border-bottom: 1px solid var(--line);
    background: rgba(8, 11, 15, .9);
    backdrop-filter: blur(16px);
}
.brand, .user-menu { display: flex; align-items: center; gap: 11px; }
.brand > span { width: 40px; height: 40px; margin: 0; border-radius: 10px; font-size: 12px; }
.brand div, .user-menu > div { display: grid; gap: 2px; }
.brand strong, .user-menu strong { font-size: 13px; }
.brand small, .user-menu small { color: var(--muted); font-size: 10px; }
.user-menu img, .avatar-fallback { width: 36px; height: 36px; border-radius: 50%; }
.avatar-fallback { display: grid; place-items: center; background: var(--panel-soft); font-weight: 800; }
.user-menu form { margin-left: 6px; }
.panel-link { white-space: nowrap; }
.profile-trigger { display: flex; align-items: center; gap: 11px; padding: 3px 5px; border: 1px solid transparent; border-radius: 10px; color: var(--text); background: transparent; cursor: pointer; text-align: left; }
.profile-trigger:hover { border-color: var(--line); background: rgba(255, 255, 255, .035); }
.profile-trigger > span { display: grid; gap: 2px; }

.shell { width: min(1500px, calc(100% - 40px)); min-width: 0; margin: 0 auto; padding: 34px 0 0; }
.shell > *, .hero > *, .panel-head > *, .progress-copy > *, .sheet-status > * { min-width: 0; }
.shell > :last-child { margin-bottom: 0; }
.hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 24px;
}
.hero h1 { margin-bottom: 8px; }
.hero p:last-child { margin: 0; color: var(--muted); }
.source-state {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 170px;
    padding: 11px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, .025);
}
.source-state > span { width: 9px; height: 9px; border-radius: 50%; background: #737e8a; box-shadow: 0 0 0 5px rgba(115, 126, 138, .1); }
.source-state[data-state="running"] > span { background: var(--accent); box-shadow: 0 0 0 5px rgba(187, 222, 26, .12); animation: pulse 1.2s ease infinite; }
.source-state[data-state="paused"] > span { background: var(--warning); }
.source-state[data-state="completed"] > span { background: var(--success); }
.source-state div { display: grid; gap: 1px; }
.source-state small { color: var(--muted); font-size: 9px; text-transform: uppercase; }
.source-state strong { font-size: 12px; }
@keyframes pulse { 50% { opacity: .48; transform: scale(.7); } }

.summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}
.summary-grid article {
    position: relative;
    overflow: hidden;
    min-height: 124px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: linear-gradient(145deg, rgba(187, 222, 26, .065), rgba(255, 255, 255, .018) 60%), var(--panel);
}
.summary-grid article::after { content: ""; position: absolute; right: -35px; bottom: -55px; width: 130px; height: 130px; border-radius: 50%; background: rgba(187, 222, 26, .045); }
.summary-grid article.warning-card { background: linear-gradient(145deg, rgba(245, 160, 32, .07), rgba(255, 255, 255, .018) 60%), var(--panel); }
.summary-grid article.staff-card { background: linear-gradient(145deg, rgba(62, 207, 142, .09), rgba(255, 255, 255, .018) 60%), var(--panel); }
.summary-grid article.checked-card { background: linear-gradient(145deg, rgba(187, 222, 26, .1), rgba(255, 255, 255, .018) 60%), var(--panel); }
.summary-grid span, .summary-grid small { position: relative; z-index: 1; display: block; color: var(--muted); font-size: 11px; }
.summary-grid strong { position: relative; z-index: 1; display: block; margin: 8px 0 4px; font-family: "DM Mono", monospace; font-size: clamp(28px, 4vw, 38px); line-height: 1; }

.panel { margin-bottom: 16px; padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: rgba(15, 20, 26, .94); box-shadow: 0 15px 50px rgba(0, 0, 0, .14); }
.accounts-panel { min-width: 0; max-width: 100%; overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.panel-actions { display: flex; align-items: center; gap: 8px; }

.sync-form {
    display: grid;
    grid-template-columns: minmax(130px, .65fr) minmax(180px, 1fr) minmax(160px, .75fr) auto;
    align-items: end;
    gap: 12px;
}
label { display: grid; gap: 7px; color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .035em; }
input, select {
    width: 100%;
    min-height: 42px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 9px;
    outline: 0;
    color: var(--text);
    background: #0c1116;
    font-size: 12px;
    text-transform: none;
}
input:focus, select:focus { border-color: rgba(187, 222, 26, .5); box-shadow: 0 0 0 3px rgba(187, 222, 26, .07); }
input[readonly] { color: var(--muted); }
.sync-actions { display: flex; gap: 8px; }

.existing-sync {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px 18px;
    margin-top: 18px;
    padding: 15px 16px;
    border: 1px solid rgba(187, 222, 26, .18);
    border-radius: 12px;
    background: linear-gradient(110deg, rgba(187, 222, 26, .055), rgba(255, 255, 255, .018));
}
.existing-sync-copy { display: grid; gap: 3px; }
.existing-sync-copy .eyebrow { margin: 0; font-size: 8px; }
.existing-sync-copy strong { font-size: 12px; }
.existing-sync-copy span { color: var(--muted); font-size: 10px; }
.existing-sync-progress { display: flex; grid-column: 1 / -1; align-items: center; gap: 12px; }
.existing-sync-progress .progress { flex: 1; margin-top: 0; }
.existing-sync-progress > b { min-width: 48px; color: var(--accent); font-family: "DM Mono", monospace; font-size: 11px; text-align: right; }
.existing-sync-stats { display: grid; grid-column: 1 / -1; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.existing-sync-stats span { display: flex; justify-content: space-between; gap: 8px; padding: 7px 9px; border-radius: 7px; color: var(--muted); background: rgba(255, 255, 255, .025); font-size: 9px; }
.existing-sync-stats strong { color: var(--text); font-family: "DM Mono", monospace; }
.existing-sync[data-state="completed"] { border-color: rgba(62, 207, 142, .25); }
.existing-sync[data-state="completed"] .progress > span { background: linear-gradient(90deg, #239965, var(--success)); }
.existing-sync[data-state="error"] { border-color: rgba(255, 100, 113, .24); }
.existing-sync[data-state="error"] .progress > span { background: var(--danger); }

.progress-shell { margin-top: 18px; padding: 16px; border: 1px solid rgba(255, 255, 255, .065); border-radius: 12px; background: rgba(0, 0, 0, .14); }
.progress-copy, .pagination, .pagination > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.progress-copy > div { display: grid; gap: 3px; }
.progress-copy strong { font-size: 12px; }
.progress-copy span, .resume-note { color: var(--muted); font-size: 10px; }
.progress-metrics { display: flex !important; align-items: stretch; gap: 8px !important; }
.progress-metric { display: grid; align-content: center; min-width: 112px; padding: 7px 10px; border-radius: 8px; background: rgba(255, 255, 255, .025); }
.progress-metric small { color: var(--muted); font-size: 8px; font-weight: 800; letter-spacing: .035em; text-transform: uppercase; }
.progress-metric b { color: var(--accent); font-family: "DM Mono", monospace; font-size: 14px; }
.progress-metric > span { display: flex; align-items: center; gap: 5px; }
.progress-metric em { color: var(--accent); font-family: "DM Mono", monospace; font-size: 10px; font-style: normal; white-space: nowrap; }
.progress-metric select { width: auto; min-height: 24px; padding: 0 22px 0 6px; border-radius: 6px; font-size: 9px; }
.speed-metric { min-width: 190px; }
.progress { height: 8px; margin-top: 13px; overflow: hidden; border-radius: 999px; background: rgba(255, 255, 255, .07); }
.progress > span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent-dark), var(--accent)); transition: width .25s ease; }
.run-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
.run-stats span { display: flex; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 7px; color: var(--muted); background: rgba(255, 255, 255, .025); font-size: 10px; }
.run-stats strong { color: var(--text); font-family: "DM Mono", monospace; }
.resume-note { margin: 11px 0 0; }
.frame-stage {
    position: fixed;
    z-index: -1;
    top: 0;
    left: 0;
    width: 1px;
    height: 1px;
    overflow: hidden;
    contain: strict;
    opacity: .01;
    pointer-events: none;
}
.frame-stage iframe { position: absolute; top: 0; left: 0; width: 1200px; height: 560px; border: 0; }

.filters {
    display: grid;
    grid-template-columns: minmax(230px, 1.6fr) minmax(135px, .8fr) repeat(8, minmax(110px, .7fr)) auto;
    align-items: end;
    gap: 9px;
    margin-bottom: 16px;
}
.sheet-status {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: -4px 0 14px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(255, 255, 255, .02);
}
.sheet-status > span { flex: 0 0 auto; width: 9px; height: 9px; border-radius: 50%; background: #737e8a; box-shadow: 0 0 0 4px rgba(115, 126, 138, .1); }
.sheet-status[data-state="synced"] > span { background: var(--success); box-shadow: 0 0 0 4px rgba(62, 207, 142, .1); }
.sheet-status[data-state="pending"] > span { background: var(--warning); box-shadow: 0 0 0 4px rgba(245, 160, 32, .1); }
.sheet-status[data-state="error"] > span { background: var(--danger); box-shadow: 0 0 0 4px rgba(255, 100, 113, .1); }
.sheet-status > div { display: grid; gap: 2px; }
.sheet-status strong { font-size: 11px; }
.sheet-status small { color: var(--muted); font-size: 9px; line-height: 1.4; }
.database-progress { margin: -4px 0 16px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255, 255, 255, .02); }
.database-progress .progress { height: 6px; margin-top: 10px; }
.database-progress[data-state="completed"] .progress > span { background: linear-gradient(90deg, #239965, var(--success)); }
.database-progress[data-state="error"] .progress > span { background: var(--danger); }
.database-progress[data-state="completed"] .progress-copy > b { color: var(--success); }
.database-progress[data-state="error"] .progress-copy > b { color: var(--danger); }
.table-wrap {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-gutter: stable;
    scrollbar-color: #68737d #0c1116;
    scrollbar-width: thin;
    overscroll-behavior-inline: contain;
    border: 1px solid var(--line);
}
.table-wrap {
    max-height: min(70vh, 760px);
    overflow: auto;
    border-radius: 11px;
}
.table-wrap::-webkit-scrollbar { width: 12px; height: 12px; }
.table-wrap::-webkit-scrollbar-track { background: #0c1116; }
.table-wrap::-webkit-scrollbar-thumb { border: 3px solid #0c1116; border-radius: 999px; background: #68737d; }
.table-wrap::-webkit-scrollbar-thumb:hover { background: #8d99a4; }
.table-wrap:focus { outline: 1px solid rgba(187, 222, 26, .3); outline-offset: 2px; }
table { width: 100%; min-width: 1880px; border-collapse: collapse; font-size: 11px; }
th { position: sticky; z-index: 2; top: 0; padding: 11px 12px; color: var(--muted); background: #151b20; font-size: 9px; letter-spacing: .05em; text-align: left; text-transform: uppercase; }
td { padding: 12px; border-top: 1px solid rgba(255, 255, 255, .055); vertical-align: top; }
tbody tr:hover { background: rgba(255, 255, 255, .018); }
tbody tr.is-duplicate { background: rgba(245, 160, 32, .035); }
tbody tr.is-staff { background: linear-gradient(90deg, rgba(62, 207, 142, .11), rgba(62, 207, 142, .035)); box-shadow: inset 3px 0 0 rgba(62, 207, 142, .75); }
tbody tr.is-staff:hover { background: linear-gradient(90deg, rgba(62, 207, 142, .16), rgba(62, 207, 142, .055)); }
td > small, td > span + small { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; }
.panel-id { color: var(--accent); font-family: "DM Mono", monospace; }
.panel-id-trigger { padding: 0; border: 0; color: var(--accent); background: transparent; cursor: pointer; font: inherit; font-family: "DM Mono", monospace; font-weight: 800; text-align: left; }
.panel-id-trigger:hover { color: #d9f354; text-decoration: underline; text-underline-offset: 3px; }
.panel-id-trigger:focus-visible { border-radius: 3px; outline: 2px solid rgba(187, 222, 26, .55); outline-offset: 3px; }
.birth-date { display: inline-block; white-space: nowrap; }
.birth-date.is-age-alert { display: inline-flex; width: max-content; padding: 4px 8px; border: 1px solid rgba(255, 100, 113, .48); border-radius: 999px; color: #ff9da6; background: rgba(255, 100, 113, .15); box-shadow: 0 0 0 1px rgba(255, 100, 113, .04), 0 5px 16px rgba(255, 100, 113, .08); font-weight: 800; }
.panel-id-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.panel-id-meta { display: inline-flex; align-items: center; gap: 7px; }
.duplicate-expand {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 25px;
    height: 25px;
    padding: 0;
    border: 1px solid rgba(245, 160, 32, .28);
    border-radius: 7px;
    color: #ffc36b;
    background: rgba(245, 160, 32, .09);
    cursor: pointer;
    font-size: 17px;
    line-height: 1;
}
.duplicate-expand:hover { background: rgba(245, 160, 32, .17); }
.copy-value { display: inline-flex; align-items: flex-start; gap: 5px; max-width: 210px; overflow-wrap: anywhere; }
.copy-value button { flex: 0 0 auto; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 5px; color: var(--muted); background: rgba(255, 255, 255, .06); cursor: pointer; }
.duplicates { display: grid; gap: 3px; margin-top: 6px; }
.duplicates span { width: max-content; padding: 3px 5px; border: 1px solid rgba(245, 160, 32, .24); border-radius: 99px; color: #ffc36b; background: rgba(245, 160, 32, .09); font-size: 8px; font-weight: 800; text-transform: uppercase; }
.duplicate-detail > td { padding: 0; background: rgba(245, 160, 32, .025); }
.duplicate-detail-shell { padding: 14px 16px 17px; border-top: 1px solid rgba(245, 160, 32, .14); border-bottom: 1px solid rgba(245, 160, 32, .14); }
.duplicate-detail-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 11px; }
.duplicate-detail-title strong { font-size: 11px; }
.duplicate-detail-title span { color: var(--muted); font-size: 9px; }
.duplicate-subtable-wrap { overflow: auto; border: 1px solid rgba(255, 255, 255, .065); border-radius: 9px; }
.duplicate-subtable { min-width: 1880px; background: rgba(6, 9, 12, .45); }
.duplicate-subtable td { padding: 9px 10px; background: transparent; }
.duplicate-subtable small { display: block; margin-top: 3px; color: var(--muted); font-size: 8px; }
.server-line { display: flex; gap: 6px; margin-bottom: 4px; color: var(--muted); font-size: 9px; }
.server-line b { min-width: 27px; padding: 2px 4px; border-radius: 4px; color: var(--accent); background: rgba(187, 222, 26, .09); font-size: 8px; text-align: center; }
.review-check-cell { width: 130px; min-width: 130px; }
.review-toggle { position: relative; display: inline-flex; align-items: center; cursor: pointer; }
.review-toggle input { position: absolute; width: 1px; height: 1px; min-height: 0; opacity: 0; pointer-events: none; }
.review-toggle span { position: relative; width: 42px; height: 23px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255, 255, 255, .06); transition: .18s ease; }
.review-toggle span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 15px; height: 15px; border-radius: 50%; background: #7f8a95; transition: .18s ease; }
.review-toggle input:checked + span { border-color: rgba(187, 222, 26, .45); background: rgba(187, 222, 26, .16); }
.review-toggle input:checked + span::after { left: 22px; background: var(--accent); }
.review-toggle input:disabled + span { opacity: .5; cursor: wait; }
.sheet-sync-state { display: block; width: max-content; max-width: 120px; margin-top: 7px; padding: 3px 6px; overflow: hidden; border-radius: 999px; color: var(--muted); background: rgba(255, 255, 255, .05); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.sheet-sync-state.is-synced { color: #78e6b2; background: rgba(62, 207, 142, .1); }
.sheet-sync-state.is-pending { color: #ffc36b; background: rgba(245, 160, 32, .1); }
.sheet-sync-state.is-error { color: #ffafb6; background: rgba(255, 100, 113, .1); }
.staff-badge { display: inline-flex; width: max-content; margin: 0; padding: 3px 7px; border: 1px solid rgba(62, 207, 142, .32); border-radius: 999px; color: #78e6b2; background: rgba(62, 207, 142, .12); font-size: 8px; font-weight: 800; letter-spacing: .04em; line-height: 1; text-transform: uppercase; }
.review-note-cell { width: 260px; min-width: 260px; }
.review-note { display: grid; gap: 4px; }
.review-note textarea { width: 100%; min-height: 54px; resize: vertical; padding: 8px 9px; border: 1px solid var(--line); border-radius: 7px; color: var(--text); background: rgba(0, 0, 0, .18); font: inherit; line-height: 1.4; }
.review-note textarea:focus { outline: 0; border-color: rgba(187, 222, 26, .45); box-shadow: 0 0 0 3px rgba(187, 222, 26, .07); }
.review-note textarea:disabled { opacity: .55; cursor: wait; }
.review-note small { color: var(--muted); font-size: 8px; }
.empty-row { padding: 30px; color: var(--muted); text-align: center; }
.pagination { margin-top: 13px; color: var(--muted); font-size: 11px; }
.pagination b { color: var(--text); font-size: 10px; }

body.modal-open { overflow: hidden; }
.profile-modal, .confidentiality-modal {
    max-width: none;
    padding: 0;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 18px;
    color: var(--text);
    background: #0d1217;
    box-shadow: 0 28px 100px rgba(0, 0, 0, .72);
}
.profile-modal [hidden], .confidentiality-modal [hidden] { display: none !important; }
.profile-modal { width: min(460px, calc(100vw - 32px)); }
.confidentiality-modal { width: min(860px, calc(100vw - 32px)); max-height: calc(100vh - 32px); }
.profile-modal::backdrop, .confidentiality-modal::backdrop { background: rgba(2, 5, 8, .88); backdrop-filter: blur(8px); }
.profile-modal-shell { padding: 20px; }
.profile-modal-head, .confidentiality-modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.profile-modal-head { margin-bottom: 18px; }
.profile-modal-head h2, .confidentiality-modal-head h2 { margin: 2px 0 0; font-size: clamp(21px, 3vw, 28px); }
.profile-identity { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, .025); }
.profile-identity img, .profile-identity > .avatar-fallback { width: 46px; height: 46px; border-radius: 50%; }
.profile-identity > div { display: grid; gap: 3px; }
.profile-identity strong { font-size: 13px; }
.profile-identity span { color: var(--muted); font-size: 10px; }
.profile-term-status { display: flex; align-items: center; gap: 10px; margin: 12px 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255, 255, 255, .02); }
.profile-term-status > span { width: 9px; height: 9px; border-radius: 50%; background: var(--warning); box-shadow: 0 0 0 4px rgba(245, 160, 32, .1); }
.profile-term-status[data-accepted="1"] > span { background: var(--success); box-shadow: 0 0 0 4px rgba(62, 207, 142, .1); }
.profile-term-status > div { display: grid; gap: 2px; }
.profile-term-status strong { font-size: 11px; }
.profile-term-status small { color: var(--muted); font-size: 9px; }
.confidentiality-modal-shell { display: grid; grid-template-rows: auto auto minmax(180px, 1fr) auto; gap: 14px; max-height: calc(100vh - 32px); padding: 20px; }
.confidentiality-modal-head small { display: block; margin-top: 5px; color: var(--muted); font-size: 9px; }
.confidentiality-alert { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 11px 13px; border: 1px solid rgba(245, 160, 32, .28); border-radius: 10px; color: #ffd18c; background: rgba(245, 160, 32, .08); }
.confidentiality-alert strong { font-size: 10px; }
.confidentiality-alert span { color: #e6bd80; font-size: 9px; text-align: right; }
.confidentiality-modal[data-required="0"] .confidentiality-alert { display: none; }
.confidentiality-document { min-height: 180px; max-height: min(56vh, 570px); padding: 19px; overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; outline: 0; background: #0a0f13; scrollbar-color: #68737d #0c1116; scrollbar-width: thin; }
.confidentiality-document:focus { border-color: rgba(187, 222, 26, .35); }
.confidentiality-document h3 { margin: 21px 0 8px; color: var(--accent); font-size: 12px; }
.confidentiality-document p { margin: 0 0 10px; color: #bdc6ce; font-size: 11px; line-height: 1.68; }
.confidentiality-document .confidentiality-intro { padding-bottom: 15px; border-bottom: 1px solid var(--line); color: var(--text); font-size: 12px; }
.confidentiality-end { display: grid; place-items: center; gap: 4px; margin-top: 24px; padding: 18px; border: 1px solid rgba(62, 207, 142, .25); border-radius: 10px; background: rgba(62, 207, 142, .06); text-align: center; }
.confidentiality-end > span { display: grid; place-items: center; width: 25px; height: 25px; border-radius: 50%; color: #07130d; background: var(--success); font-size: 13px; font-weight: 900; }
.confidentiality-end strong { font-size: 11px; }
.confidentiality-end small { color: var(--muted); font-size: 9px; }
.confidentiality-actions { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.confidentiality-actions > span { color: var(--muted); font-size: 9px; }
.confidentiality-actions > div { display: flex; align-items: center; gap: 8px; }
.confidentiality-actions form { margin: 0; }
.account-modal {
    width: min(1320px, calc(100vw - 32px));
    max-width: none;
    max-height: calc(100vh - 32px);
    padding: 0;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 18px;
    color: var(--text);
    background: #0d1217;
    box-shadow: 0 28px 100px rgba(0, 0, 0, .72);
}
.account-modal::backdrop { background: rgba(2, 5, 8, .82); backdrop-filter: blur(7px); }
.account-modal-shell { max-height: calc(100vh - 32px); padding: 22px; overflow: auto; scrollbar-color: #68737d #0c1116; scrollbar-width: thin; }
.account-modal-head { position: sticky; z-index: 5; top: -22px; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin: -22px -22px 18px; padding: 21px 22px 17px; border-bottom: 1px solid var(--line); background: rgba(13, 18, 23, .96); backdrop-filter: blur(14px); }
.account-modal-head h2 { margin: 2px 0 5px; font-size: clamp(21px, 3vw, 29px); }
.account-modal-head h2 span { color: var(--accent); font-family: "DM Mono", monospace; }
#accountModalIdentity { margin: 0; color: var(--muted); font-size: 11px; }
.account-modal-duplicates { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 9px; }
.account-modal-duplicates[hidden] { display: none; }
.account-modal-duplicates > span { color: var(--muted); font-size: 8px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.account-modal-duplicates button { padding: 4px 7px; border: 1px solid rgba(245, 160, 32, .26); border-radius: 6px; color: #ffc36b; background: rgba(245, 160, 32, .08); cursor: pointer; font-family: "DM Mono", monospace; font-size: 9px; font-weight: 800; }
.account-modal-duplicates button:hover { background: rgba(245, 160, 32, .16); }
.account-modal-close { display: grid; place-items: center; flex: 0 0 auto; width: 38px; height: 38px; padding: 0; border: 1px solid var(--line); border-radius: 10px; color: var(--text); background: rgba(255, 255, 255, .04); cursor: pointer; font-size: 25px; line-height: 1; }
.account-modal-close:hover { border-color: rgba(255, 100, 113, .35); color: #ffafb6; background: rgba(255, 100, 113, .08); }
.account-period-form { display: grid; grid-template-columns: minmax(170px, .7fr) minmax(170px, .7fr) auto; align-items: end; gap: 10px; margin: 14px 0 12px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, .02); }
.account-modal-status { display: flex; align-items: center; gap: 11px; margin-bottom: 14px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255, 255, 255, .025); }
.account-modal-status > span { flex: 0 0 auto; width: 9px; height: 9px; border-radius: 50%; background: var(--warning); box-shadow: 0 0 0 4px rgba(245, 160, 32, .1); }
.account-modal-status[data-state="loading"] > span { animation: pulse 1.2s ease infinite; }
.account-modal-status[data-state="ready"] > span { background: var(--success); box-shadow: 0 0 0 4px rgba(62, 207, 142, .1); }
.account-modal-status[data-state="error"] > span { background: var(--danger); box-shadow: 0 0 0 4px rgba(255, 100, 113, .1); }
.account-modal-status > div { display: grid; gap: 2px; }
.account-modal-status strong { font-size: 11px; }
.account-modal-status small { color: var(--muted); font-size: 9px; }
.account-modal-section { margin-top: 14px; padding: 16px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255, 255, 255, .018); }
.account-section-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.account-section-head h3 { margin: 2px 0 0; font-size: 14px; }
.allowlist-grid, .account-hours-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.allowlist-grid article, .account-hours-grid article { display: grid; gap: 5px; padding: 14px; border: 1px solid rgba(255, 255, 255, .065); border-radius: 10px; background: rgba(0, 0, 0, .16); }
.allowlist-grid small, .allowlist-grid span, .account-hours-grid span, .account-hours-grid small { color: var(--muted); font-size: 9px; }
.allowlist-grid strong { font-size: 13px; }
.allowlist-grid strong.is-approved { color: #78e6b2; }
.allowlist-grid strong.is-denied { color: #ffafb6; }
.account-hours-grid strong { color: var(--accent); font-family: "DM Mono", monospace; font-size: clamp(25px, 4vw, 38px); }
.allowlist-warning { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 11px; padding: 13px; border: 1px solid rgba(245, 160, 32, .35); border-radius: 10px; color: #ffd18c; background: rgba(245, 160, 32, .09); }
.allowlist-warning[hidden] { display: none; }
.allowlist-warning > div { display: grid; gap: 3px; }
.allowlist-warning strong { font-size: 11px; }
.allowlist-warning span { color: #e6bd80; font-size: 9px; }
.account-chart-grid, .account-character-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.account-chart-grid > article, .account-character-grid > article { min-width: 0; padding: 13px; border: 1px solid rgba(255, 255, 255, .065); border-radius: 10px; background: rgba(0, 0, 0, .16); }
.account-server-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.account-server-title strong { font-size: 11px; }
.account-server-title small { color: var(--muted); font-size: 8px; text-align: right; }
.account-chart-wrap { position: relative; min-height: 250px; overflow: hidden; border-radius: 8px; background: #090e12; }
.account-chart-wrap canvas { display: block; width: 100%; height: 250px; }
.account-chart-legend { display: flex; flex-wrap: wrap; gap: 7px 12px; min-height: 18px; margin-top: 8px; }
.account-chart-legend span { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 8px; }
.account-chart-legend i { width: 8px; height: 8px; border-radius: 50%; }
.account-character-table-wrap { max-height: 330px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.account-character-table { min-width: 680px; font-size: 10px; }
.account-character-table th { padding: 9px; font-size: 8px; }
.account-character-table td { padding: 9px; }
.character-state { display: inline-flex; padding: 3px 7px; border-radius: 999px; color: #ffafb6; background: rgba(255, 100, 113, .1); font-size: 8px; font-weight: 800; text-transform: uppercase; }
.character-state.is-active { color: #78e6b2; background: rgba(62, 207, 142, .11); }
.account-character-panels { display: grid; gap: 12px; }
.account-character-panel-server { min-width: 0; padding: 13px; border: 1px solid rgba(255, 255, 255, .065); border-radius: 10px; background: rgba(0, 0, 0, .16); }
.account-character-panel-list { display: grid; gap: 12px; }
.character-panel-card { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 9px; background: #090e12; }
.character-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.character-panel-head > div { display: grid; gap: 2px; min-width: 0; }
.character-panel-head small { color: var(--muted); font-size: 8px; font-weight: 800; text-transform: uppercase; }
.character-panel-head strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.character-panel-head > span { flex: 0 0 auto; color: var(--accent); font-family: "DM Mono", monospace; font-size: 9px; font-weight: 800; }
.character-panel-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--line); }
.character-detail-block { min-width: 0; min-height: 112px; background: #090e12; }
.character-detail-title { padding: 8px 10px; color: var(--muted); background: #0d1318; font-size: 8px; font-weight: 800; text-transform: uppercase; }
.character-detail-table { width: 100%; font-size: 9px; }
.character-detail-table th { padding: 7px 10px; color: #71808d; font-size: 7px; }
.character-detail-table td { padding: 9px 10px; }
.character-detail-table td:last-child { color: var(--accent); font-weight: 700; }
.character-detail-message { display: flex; align-items: center; justify-content: center; min-height: 74px; margin: 0; padding: 12px; color: var(--muted); font-size: 9px; text-align: center; }
.character-detail-message.is-error { color: #ffc36b; }
.character-panel-empty { margin: 0; padding: 22px; color: var(--muted); font-size: 9px; text-align: center; }
.account-modal-review form { display: grid; grid-template-columns: minmax(150px, .35fr) minmax(300px, 1fr) auto; align-items: end; gap: 12px; }
.account-modal-check { align-content: end; }
.account-modal-check > span:first-child { color: var(--muted); font-size: 9px; }
.account-modal-note textarea { width: 100%; min-height: 76px; resize: vertical; padding: 10px; border: 1px solid var(--line); border-radius: 9px; outline: 0; color: var(--text); background: #0c1116; font: inherit; line-height: 1.45; text-transform: none; }
.account-modal-note textarea:focus { border-color: rgba(187, 222, 26, .5); box-shadow: 0 0 0 3px rgba(187, 222, 26, .07); }

.toast {
    position: fixed;
    z-index: 40;
    right: 20px;
    bottom: 20px;
    max-width: min(420px, calc(100vw - 40px));
    padding: 12px 15px;
    border: 1px solid var(--line);
    border-radius: 9px;
    color: var(--text);
    background: #182028;
    box-shadow: 0 15px 50px rgba(0, 0, 0, .35);
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
    transition: .2s ease;
    font-size: 12px;
}
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 1500px) {
    .filters { grid-template-columns: repeat(4, minmax(150px, 1fr)); }
    .search-field { grid-column: span 2; }
}
@media (max-width: 900px) {
    .summary-grid, .sync-form, .run-stats { grid-template-columns: 1fr 1fr; }
    .sync-actions { align-self: end; }
    .filters { grid-template-columns: 1fr 1fr; }
    .search-field { grid-column: 1 / -1; }
    .progress-copy { align-items: flex-start; flex-direction: column; }
    .progress-metrics { width: 100%; }
    .progress-metric { flex: 1; }
    .account-chart-grid, .account-character-grid { grid-template-columns: 1fr; }
    .character-panel-pair { grid-template-columns: 1fr; }
    .account-modal-review form { grid-template-columns: 1fr; }
}
@media (max-width: 620px), (hover: none) and (pointer: coarse) {
    .dashboard-page { min-width: 0; }
    .topbar {
        width: 100%;
        max-width: 100%;
        align-items: center;
        gap: 8px;
        min-height: 60px;
        padding: max(9px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) 9px max(10px, env(safe-area-inset-left));
    }
    .brand, .user-menu { gap: 7px; }
    .brand { flex: 0 0 auto; }
    .brand > span { width: 36px; height: 36px; border-radius: 9px; font-size: 10px; }
    .brand div, .user-menu > div { display: none; }
    .profile-trigger { gap: 0; padding: 2px; }
    .profile-trigger > span { display: none; }
    .user-menu { min-width: 0; margin-left: auto; }
    .user-menu img, .avatar-fallback { width: 32px; height: 32px; }
    .user-menu form { margin-left: 0; }
    .topbar .button { min-height: 34px; padding-inline: 9px; font-size: 9px; }
    .panel-link { min-height: 34px; padding-inline: 9px; font-size: 9px; }
    .shell { width: calc(100% - 20px); max-width: none; padding: 18px 0 env(safe-area-inset-bottom); }
    .hero { align-items: flex-start; flex-direction: column; gap: 14px; margin-bottom: 16px; }
    .hero h1 { margin-bottom: 7px; font-size: clamp(27px, 8vw, 34px); }
    .hero p:last-child { font-size: 12px; line-height: 1.55; }
    .source-state { width: 100%; }
    .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .summary-grid article { min-height: 108px; padding: 14px; border-radius: 12px; }
    .summary-grid span, .summary-grid small { font-size: 9px; line-height: 1.35; }
    .summary-grid strong { margin-block: 7px 4px; font-size: clamp(23px, 7vw, 29px); }
    .sync-form, .filters { grid-template-columns: minmax(0, 1fr); }
    .run-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .search-field { grid-column: auto; }
    .panel { padding: 14px; border-radius: 13px; }
    .panel-head { align-items: stretch; flex-direction: column; gap: 12px; margin-bottom: 14px; }
    .panel-head > .button { width: 100%; }
    .panel-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
    .panel-actions .button { width: 100%; min-width: 0; padding-inline: 8px; line-height: 1.2; white-space: normal; }
    .sync-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .sync-actions .button { width: 100%; min-width: 0; padding-inline: 8px; }
    .existing-sync { grid-template-columns: minmax(0, 1fr); margin-top: 14px; padding: 12px; }
    .existing-sync .button { width: 100%; }
    .existing-sync-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .progress-shell { margin-top: 14px; padding: 12px; }
    .progress-copy, .pagination { align-items: flex-start; flex-direction: column; }
    .progress-metrics { display: grid !important; grid-template-columns: 1fr; width: 100%; }
    .progress-metric, .speed-metric { width: 100%; min-width: 0; }
    .progress-copy strong, .progress-copy span, .resume-note, .sheet-status small { overflow-wrap: anywhere; }
    .database-progress .progress-copy > b { align-self: flex-start; }
    .accounts-panel .table-wrap { max-height: none; overflow: visible; border: 0; border-radius: 0; }
    .accounts-table { display: block; width: 100%; min-width: 0; }
    .accounts-table > thead { display: none; }
    .accounts-table > tbody { display: grid; gap: 10px; width: 100%; }
    .accounts-table > tbody > tr[data-account-row] {
        display: block;
        width: 100%;
        min-width: 0;
        overflow: hidden;
        border: 1px solid var(--line);
        border-radius: 10px;
        background: rgba(8, 12, 16, .48);
    }
    .accounts-table > tbody > tr[data-account-row] > td,
    .duplicate-subtable > tbody > tr > td[data-label] {
        display: grid;
        grid-template-columns: minmax(96px, .38fr) minmax(0, 1fr);
        gap: 4px 10px;
        width: 100%;
        min-width: 0;
        padding: 10px 11px;
        overflow-wrap: anywhere;
    }
    .accounts-table > tbody > tr[data-account-row] > td:first-child { border-top: 0; }
    .accounts-table td[data-label]::before,
    .duplicate-subtable td[data-label]::before {
        content: attr(data-label);
        grid-column: 1;
        align-self: start;
        color: var(--muted);
        font-size: 8px;
        font-weight: 800;
        letter-spacing: .04em;
        line-height: 1.35;
        text-transform: uppercase;
    }
    .accounts-table td[data-label] > *,
    .duplicate-subtable td[data-label] > * { grid-column: 2; min-width: 0; }
    .accounts-table .review-check-cell,
    .accounts-table .review-note-cell { width: 100%; min-width: 0; }
    .accounts-table .copy-value { max-width: 100%; }
    .accounts-table .panel-id-line { width: 100%; }
    .accounts-table > tbody > tr.duplicate-detail { display: block; width: 100%; min-width: 0; }
    .accounts-table > tbody > tr.duplicate-detail[hidden] { display: none; }
    .accounts-table > tbody > tr.duplicate-detail > td { display: block; width: 100%; }
    .duplicate-detail-shell { padding: 12px; }
    .duplicate-detail-title { align-items: flex-start; flex-direction: column; gap: 4px; }
    .duplicate-subtable-wrap { overflow: visible; border: 0; }
    .duplicate-subtable { display: block; width: 100%; min-width: 0; }
    .duplicate-subtable > thead { display: none; }
    .duplicate-subtable > tbody { display: grid; gap: 8px; width: 100%; }
    .duplicate-subtable > tbody > tr { display: block; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; }
    .accounts-table .empty-row { display: block; width: 100%; border: 1px solid var(--line); border-radius: 10px; }
    .pagination > div { width: 100%; }
    .pagination > span { width: 100%; line-height: 1.45; }
    .pagination .button { flex: 1; }
    .toast { right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); max-width: calc(100vw - 20px); }
    .account-modal { width: calc(100vw - 12px); max-height: calc(100vh - 12px); border-radius: 13px; }
    .profile-modal, .confidentiality-modal { width: calc(100vw - 12px); max-height: calc(100vh - 12px); border-radius: 13px; }
    .profile-modal-shell, .confidentiality-modal-shell { max-height: calc(100vh - 12px); padding: 13px; }
    .confidentiality-modal-shell { gap: 10px; }
    .confidentiality-alert { align-items: flex-start; flex-direction: column; gap: 4px; }
    .confidentiality-alert span { text-align: left; }
    .confidentiality-document { min-height: 160px; max-height: 52vh; padding: 14px; }
    .confidentiality-actions { align-items: stretch; flex-direction: column; }
    .confidentiality-actions > div { display: grid; grid-template-columns: 1fr; }
    .confidentiality-actions .button, .confidentiality-actions form { width: 100%; }
    .account-modal-shell { max-height: calc(100vh - 12px); padding: 13px; }
    .account-modal-head { top: -13px; margin: -13px -13px 13px; padding: 14px 13px 12px; }
    .account-period-form, .allowlist-grid, .account-hours-grid { grid-template-columns: 1fr; }
    .account-period-form .button, .allowlist-warning .button { width: 100%; }
    .allowlist-warning { align-items: stretch; flex-direction: column; }
    .account-modal-section { padding: 12px; }
    .account-chart-wrap, .account-chart-wrap canvas { min-height: 220px; height: 220px; }
}
