/* reflact XLIFF — participant UI theme (reflact corporate identity)
   Brand blue #0C5ADB, near-black ink, Mulish-first system sans, clean & flat.
   Self-hosted-free font stack (no external requests → GDPR-safe). */

:root {
    --brand: #0c5adb;
    --brand-dark: #0a48ae;
    --brand-darker: #083b90;
    --brand-tint: #eaf1fe;
    --brand-tint-2: #f4f8ff;

    --ink: #1c2430;
    --ink-strong: #141a23;
    --muted: #5b6675;
    --muted-2: #8a93a1;

    --line: #e4e8f0;
    --line-strong: #d4dae6;

    --bg: #f4f6fb;
    --surface: #ffffff;
    --surface-2: #f8fafd;

    --accent-2: #f0902a;      /* reflact accent orange — secondary CTA */
    --accent-2-dark: #d97b16;

    --danger: #d92d20;
    --danger-tint: #fdecec;
    --success: #12905a;
    --success-tint: #e7f5ee;
    --warning: #9a6b16;
    --warning-tint: #fff6e6;

    --radius: 14px;
    --radius-sm: 10px;
    --radius-xs: 8px;

    --shadow-sm: 0 1px 2px rgba(16, 42, 90, .06);
    --shadow: 0 8px 30px rgba(16, 42, 90, .08), 0 1px 2px rgba(16, 42, 90, .04);

    --font: 'Mulish', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    border-top: 4px solid var(--brand);
    font-family: var(--font);
    color: var(--ink);
    background:
        radial-gradient(1200px 400px at 100% -10%, var(--brand-tint-2), transparent 60%),
        var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

main { width: min(1080px, calc(100% - 32px)); margin: 40px auto 64px; display: grid; gap: 22px; }
main.narrow { width: min(440px, calc(100% - 32px)); margin-top: 12vh; }

/* ── Brand wordmark (shown only after login) ─────────────────────────────── */
.brand { display: inline-flex; align-items: baseline; gap: 0; font-weight: 800; letter-spacing: -.02em; font-size: 1.6rem; line-height: 1; }
.brand .r-refl { color: var(--muted-2); }
.brand .r-act { color: var(--brand); }
.brand-sub { font-size: .8rem; color: var(--muted); font-weight: 600; letter-spacing: .01em; margin-top: 6px; }

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 30px 32px;
}
.card-sm { padding: 22px 26px; }

h1 { font-size: clamp(1.9rem, 4vw, 2.7rem); font-weight: 800; letter-spacing: -.02em; margin: 0 0 6px; line-height: 1.05; color: var(--ink-strong); }
h2 { margin: 0 0 14px; font-size: 1.3rem; font-weight: 800; letter-spacing: -.01em; color: var(--ink-strong); }
h3 { margin: 0; font-size: 1.02rem; font-weight: 700; display: inline; color: var(--ink-strong); }
p { margin: 0; color: var(--muted); line-height: 1.6; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .86em; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; color: var(--ink); }
.eyebrow { font-size: .74rem; text-transform: uppercase; letter-spacing: .14em; color: var(--brand); font-weight: 800; margin-bottom: 8px; }

/* ── Forms ───────────────────────────────────────────────────────────────── */
form { display: grid; gap: 16px; margin-top: 20px; }
.field { display: grid; gap: 7px; }
label { font-size: .86rem; color: var(--muted); font-weight: 600; }
input[type=text], input[type=email], input[type=password], input[type=number], select, textarea {
    width: 100%; padding: 12px 14px; font: inherit; font-size: .95rem;
    border: 1.5px solid var(--line-strong); border-radius: var(--radius-xs);
    background: var(--surface); color: var(--ink); outline: none;
    transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }
.upload-box { border: 2px dashed var(--line-strong); border-radius: var(--radius-sm); padding: 22px; background: var(--surface-2); transition: border-color .15s, background .15s; }
.upload-box:hover { border-color: var(--brand); background: var(--brand-tint-2); }
input[type=file] { width: 100%; font: inherit; margin-top: 8px; color: var(--muted); }
input[type=file]::file-selector-button { font: inherit; font-weight: 700; border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--ink); padding: 8px 14px; border-radius: var(--radius-xs); cursor: pointer; margin-right: 12px; transition: border-color .15s, color .15s; }
input[type=file]::file-selector-button:hover { border-color: var(--brand); color: var(--brand); }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
    appearance: none; border: 1.5px solid transparent; border-radius: var(--radius-sm);
    padding: 12px 20px; font: inherit; font-size: .93rem; font-weight: 800; cursor: pointer;
    display: inline-flex; align-items: center; gap: 8px; text-decoration: none;
    transition: background .15s, border-color .15s, color .15s, transform .08s, box-shadow .15s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 2px 8px rgba(12, 90, 219, .28); }
.btn-primary:hover { background: var(--brand-dark); }
.btn-secondary { background: var(--accent-2); color: #fff; box-shadow: 0 2px 8px rgba(240, 144, 42, .28); }
.btn-secondary:hover { background: var(--accent-2-dark); }
.btn-ghost { background: var(--surface); border-color: var(--line-strong); color: var(--muted); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn-sm { padding: 8px 14px; font-size: .82rem; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 18px; align-items: center; }

/* ── Notices ─────────────────────────────────────────────────────────────── */
.notice { border-radius: var(--radius-sm); padding: 14px 18px; margin-bottom: 16px; font-size: .93rem; line-height: 1.5; border: 1px solid transparent; }
.notice-error { background: var(--danger-tint); color: #a01b12; border-color: #f6c9c5; }
.notice-success { background: var(--success-tint); color: #0c6b42; border-color: #bfe6d1; }
.notice-warning { background: var(--warning-tint); color: #8a5a12; border-color: #f3dca6; }
.notice-warning strong { color: #6b4610; }
.error-segment-list { margin: 10px 0 0; padding: 0; list-style: none; display: grid; gap: 5px; }
.error-segment-list li { font-size: .83rem; background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--accent-2); border-radius: 8px; padding: 7px 11px; color: var(--muted); }

/* ── Session bar / meta ──────────────────────────────────────────────────── */
.session-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.session-meta { display: flex; gap: 22px; flex-wrap: wrap; }
.meta-item { font-size: .84rem; color: var(--muted); }
.meta-item strong { color: var(--ink-strong); font-weight: 800; }

/* ── Progress ────────────────────────────────────────────────────────────── */
.progress-wrap { margin-top: 18px; }
.progress-label { display: flex; justify-content: space-between; font-size: .86rem; color: var(--muted); margin-bottom: 8px; font-weight: 600; }
.progress-track { height: 9px; background: #e9edf5; border-radius: 99px; overflow: hidden; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--brand), #4a8bf5); border-radius: 99px; transition: width .4s ease; }

/* ── Tables ──────────────────────────────────────────────────────────────── */
.preview-table { width: 100%; border-collapse: collapse; margin-top: 16px; font-size: .87rem; }
.preview-table th, .preview-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.preview-table th { color: var(--muted); font-size: .74rem; text-transform: uppercase; letter-spacing: .09em; font-weight: 800; }
.preview-table td:first-child { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .74rem; color: var(--muted-2); max-width: 240px; word-break: break-all; }

details summary { cursor: pointer; color: var(--muted); font-size: .9rem; user-select: none; list-style: none; font-weight: 600; }
details summary::-webkit-details-marker { display: none; }
details summary::before { content: '▸ '; color: var(--brand); font-size: .82rem; }
details[open] summary::before { content: '▾ '; }
details summary:hover { color: var(--brand); }
.divider { border: none; border-top: 1px solid var(--line); margin: 24px 0; }

/* ── Translation status ──────────────────────────────────────────────────── */
#translate-status { font-size: .9rem; color: var(--muted); margin-top: 10px; min-height: 1.4em; }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.82); } }
.spinner { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--brand); animation: pulse 1.1s ease-in-out infinite; flex-shrink: 0; }
.status-row { display: flex; align-items: center; gap: 9px; }
.status-details { margin-top: 8px; font-size: .82rem; color: var(--muted); display: flex; gap: 18px; flex-wrap: wrap; }
.status-detail-label { opacity: .7; }
.status-last { margin-top: 6px; font-size: .82rem; color: var(--muted-2); font-style: italic; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* ── Analysis ────────────────────────────────────────────────────────────── */
.analysis-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; margin-top: 18px; }
@media (max-width: 720px) { .analysis-grid { grid-template-columns: 1fr; } }
.analysis-block { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 16px 18px; }
.analysis-block-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .11em; color: var(--brand); font-weight: 800; margin-bottom: 7px; }
.analysis-block-value { font-size: .9rem; line-height: 1.55; color: var(--ink); }

/* ── Glossary ────────────────────────────────────────────────────────────── */
.glossary-wrap { margin-top: 22px; }
.glossary-table { width: 100%; border-collapse: collapse; font-size: .87rem; margin-top: 10px; }
.glossary-table th { text-align: left; padding: 9px 10px; border-bottom: 2px solid var(--line-strong); color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .09em; font-weight: 800; }
.glossary-table td { padding: 6px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.glossary-table tr:last-child td { border-bottom: none; }
.glossary-table td:first-child { font-weight: 700; }
.glossary-table td:nth-child(3) { color: var(--muted); font-size: .82rem; font-style: italic; }
.glossary-table td:last-child { width: 32px; padding: 6px; }
.gloss-input { border: 1px solid transparent; background: transparent; width: 100%; font-size: .87rem; font-family: inherit; color: var(--ink); padding: 4px 7px; border-radius: 6px; outline: none; transition: border-color .15s, background .15s, box-shadow .15s; }
.gloss-input:focus { border-color: var(--brand); background: var(--surface); box-shadow: 0 0 0 3px var(--brand-tint); }
.gloss-input.gloss-locked { cursor: default; }
.gloss-input.gloss-locked:focus { border-color: transparent; background: transparent; box-shadow: none; }
.glossary-table td:first-child .gloss-input { font-weight: 700; }
.glossary-table td:nth-child(3) .gloss-input { color: var(--muted); font-size: .82rem; font-style: italic; }
.btn-row-del { appearance: none; border: none; background: none; cursor: pointer; color: var(--muted-2); font-size: .95rem; line-height: 1; padding: 4px 6px; border-radius: 6px; transition: color .12s, background .12s; }
.btn-row-del:hover { color: var(--danger); background: var(--danger-tint); }
.glossary-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.btn-add-row { appearance: none; border: 1.5px dashed var(--line-strong); background: transparent; color: var(--muted); font: inherit; font-size: .82rem; font-weight: 700; padding: 7px 14px; border-radius: var(--radius-xs); cursor: pointer; transition: border-color .15s, color .15s; }
.btn-add-row:hover { border-color: var(--brand); color: var(--brand); }
.btn-glossary-save { appearance: none; border: 1.5px solid var(--brand); background: var(--brand-tint); color: var(--brand-dark); font: inherit; font-size: .82rem; font-weight: 800; padding: 7px 16px; border-radius: var(--radius-xs); cursor: pointer; transition: background .15s; }
.btn-glossary-save:hover { background: #dbe8fd; }
.glossary-save-hint { font-size: .78rem; color: var(--success); font-style: italic; font-weight: 600; }
.badge { display: inline-block; background: var(--brand-tint); color: var(--brand-dark); border-radius: 999px; padding: 3px 10px; font-size: .76rem; font-weight: 800; }

@keyframes slideIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.slide-in { animation: slideIn .35s ease forwards; }

/* ── Hero header / gear ──────────────────────────────────────────────────── */
.hero-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.btn-gear { appearance: none; border: 1.5px solid var(--line-strong); border-radius: 12px; background: var(--surface); width: 44px; height: 44px; font-size: 1.15rem; cursor: pointer; flex-shrink: 0; margin-top: 2px; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); transition: border-color .15s, color .15s, background .15s; }
.btn-gear:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-tint-2); }

/* ── Settings modal ──────────────────────────────────────────────────────── */
.modal-backdrop { display: none; position: fixed; inset: 0; background: rgba(20, 26, 35, .5); z-index: 100; align-items: center; justify-content: center; padding: 16px; backdrop-filter: blur(3px); }
.modal-backdrop.open { display: flex; }
.modal { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 30px 90px rgba(16, 42, 90, .28); width: min(800px, 100%); max-height: 90vh; overflow-y: auto; padding: 30px; display: grid; gap: 22px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal-title { font-size: 1.25rem; font-weight: 800; margin: 0; color: var(--ink-strong); }
.btn-close { appearance: none; border: 1.5px solid var(--line-strong); border-radius: 10px; background: transparent; width: 38px; height: 38px; font-size: 1.15rem; cursor: pointer; line-height: 1; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); transition: border-color .15s, color .15s; }
.btn-close:hover { border-color: var(--danger); color: var(--danger); }
.settings-section-header { font-size: .76rem; font-weight: 800; color: var(--brand); letter-spacing: .1em; text-transform: uppercase; padding-bottom: 6px; border-bottom: 2px solid var(--brand); margin-bottom: -8px; }
.prompt-section { display: grid; gap: 10px; }
.prompt-section-title { font-size: 1rem; font-weight: 800; margin: 0; color: var(--ink-strong); }
.prompt-section-hint { font-size: .82rem; color: var(--muted); margin: 0; line-height: 1.55; }
.prompt-textarea { width: 100%; min-height: 180px; padding: 12px 14px; font: inherit; font-size: .85rem; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; border: 1.5px solid var(--line-strong); border-radius: var(--radius-xs); background: var(--surface-2); color: var(--ink); resize: vertical; outline: none; transition: border-color .15s, box-shadow .15s; }
.prompt-textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }
.prompt-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.modal-divider { border: none; border-top: 1px solid var(--line); margin: 0; }

/* ── Locale chips ────────────────────────────────────────────────────────── */
.locale-list { display: grid; gap: 10px; }
.locale-group-label { font-size: .68rem; font-weight: 800; color: var(--muted-2); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 3px; }
.locale-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.locale-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border: 1.5px solid var(--line-strong); border-radius: 999px; background: var(--surface); font: inherit; font-size: .8rem; font-weight: 600; cursor: pointer; white-space: nowrap; transition: border-color .15s, background .15s; }
.locale-chip:hover { border-color: var(--brand); }
.locale-chip.active { border-color: var(--brand); background: var(--brand-tint); color: var(--brand-dark); font-weight: 800; }
.locale-badge { font-size: .62rem; font-weight: 800; padding: 1px 6px; border-radius: 999px; line-height: 1.5; }
.locale-badge.preset { background: var(--brand-tint); color: var(--brand-dark); }
.locale-badge.custom { background: var(--brand); color: #fff; }
.locale-edit-panel { border: 1.5px solid var(--line); border-radius: var(--radius-sm); padding: 16px; background: var(--surface-2); display: grid; gap: 10px; }
.locale-edit-title { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: .9rem; color: var(--ink-strong); }
.locale-status-badge { font-size: .64rem; font-weight: 800; padding: 2px 8px; border-radius: 999px; line-height: 1.5; }
.locale-status-badge.preset { background: var(--brand-tint); color: var(--brand-dark); }
.locale-status-badge.custom { background: var(--brand); color: #fff; }

/* ── Toast ───────────────────────────────────────────────────────────────── */
.toast { position: fixed; bottom: 24px; right: 24px; background: var(--ink-strong); color: #fff; border-radius: var(--radius-sm); padding: 13px 20px; font-size: .9rem; font-weight: 700; box-shadow: 0 12px 34px rgba(16, 42, 90, .28); z-index: 200; opacity: 0; transform: translateY(8px); transition: opacity .25s, transform .25s; pointer-events: none; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--danger); }

/* ── User / quota bar ────────────────────────────────────────────────────── */
.user-bar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; font-size: .87rem; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 9px 18px; box-shadow: var(--shadow-sm); }
.user-bar-who strong { color: var(--ink-strong); font-weight: 800; }
.user-bar-role { display: inline-block; margin-left: 6px; padding: 2px 9px; border-radius: 999px; background: var(--brand-tint); color: var(--brand-dark); font-size: .72rem; font-weight: 800; }
.user-bar-actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.user-bar-actions a { color: var(--brand); font-weight: 800; text-decoration: none; }
.user-bar-actions a:hover { text-decoration: underline; }
.user-bar-actions strong { color: var(--ink-strong); }

/* ── Wizard stepper ──────────────────────────────────────────────────────── */
.stepper { list-style: none; display: flex; margin: 22px 0 0; padding: 0; }
.stepper li { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; position: relative; font-size: .8rem; font-weight: 700; color: var(--muted-2); text-align: center; }
.stepper li::before { content: ''; position: absolute; top: 17px; left: -50%; width: 100%; height: 2px; background: var(--line); z-index: 0; }
.stepper li:first-child::before { display: none; }
.stepper li .step-dot { position: relative; z-index: 1; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: #eef1f7; color: var(--muted-2); font-weight: 800; font-size: .95rem; transition: background .2s, color .2s, box-shadow .2s; }
.stepper li .step-label { position: relative; z-index: 1; }
.stepper li.active { color: var(--brand); }
.stepper li.active .step-dot { background: var(--brand); color: #fff; box-shadow: 0 0 0 4px var(--brand-tint); }
.stepper li.done { color: var(--ink); }
.stepper li.done .step-dot { background: var(--brand); color: #fff; }
.stepper li.done .step-dot::after { content: '✓'; }
.stepper li.done .step-dot { font-size: 0; }
.stepper li.done .step-dot::after { font-size: 1rem; }
.stepper li.done::before, .stepper li.active::before { background: var(--brand); }
@media (max-width: 560px) { .stepper li .step-label { font-size: .68rem; } }

/* ── Wizard navigation row ───────────────────────────────────────────────── */
.wizard-nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.wizard-nav form { margin: 0; }
.step-panel { animation: none; }

/* ── Pro / debug panel ───────────────────────────────────────────────────── */
.pro-panel { border-style: dashed; border-color: var(--line-strong); background: var(--surface-2); }
.pro-panel .badge { background: #fff3e0; color: var(--accent-2-dark); }

@media (max-width: 720px) {
    main { width: min(100% - 18px, 100%); margin: 22px auto 40px; }
    .card { padding: 22px; border-radius: 16px; }
}
