/* MLS Translation Review. TRAK colors: charcoal header, white panels, TRAK red accent.
   Change --accent here once the exact brand hex codes are confirmed. */
:root {
  --accent: #C8102E;
  --accent-dark: #A30D25;
  --accent-tint: #FBF1F2;
  --ink: #1B1E21;
  --ink-2: #3D454D;
  --muted: #4D555C;
  --line: #DDE1E4;
  --line-2: #EEF0F2;
  --ground: #F3F4F5;
  --panel: #FFFFFF;
  --head: #1E2226;
  --head-2: #2C3236;
  --head-line: #4A5157;
  --problem: #8A3A06;
  --problem-bg: #FBEADB;
  --warn: #6B4E00;
  --warn-bg: #FFF4CC;
  --ok: #1D5E36;
  --ok-bg: #E2F2E8;
  --edited: #174A85;
  --edited-bg: #E3EEFB;
  --stale: #5B2C83;
  --stale-bg: #F0E6F8;
  --radius: 6px;
  --ui: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
}

/* Arial-compatible fonts for measuring and previewing (Liberation Sans / Sans Narrow, licenses in wwwroot/fonts). */
@font-face { font-family: "MLS Arial"; src: url("fonts/LiberationSans-Regular.woff2") format("woff2"); font-weight: 400; font-display: block; }
@font-face { font-family: "MLS Arial"; src: url("fonts/LiberationSans-Bold.woff2") format("woff2"); font-weight: 700; font-display: block; }
@font-face { font-family: "MLS Arial Narrow"; src: url("fonts/LiberationSansNarrow-Regular.woff2") format("woff2"); font-weight: 400; font-display: block; }
@font-face { font-family: "MLS Arial Narrow"; src: url("fonts/LiberationSansNarrow-Bold.woff2") format("woff2"); font-weight: 700; font-display: block; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--ui); color: var(--ink); background: var(--ground); font-size: 15px; }
a { color: var(--accent-dark); }
a:hover { color: #7A0A1C; }
button, input, select, textarea { font: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); font-size: 12px; overflow-wrap: anywhere; }
.label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
h1 { margin: 0; }

/* TRAK mark (logo placeholder) */
.trakmark { display: inline-flex; align-items: center; gap: 8px; color: #fff; }
.trakmark-bar { width: 6px; height: 28px; background: var(--accent); }
.trakmark-word { font-weight: 700; font-size: 24px; letter-spacing: .08em; }

/* Buttons */
.btn { border-radius: 4px; padding: 11px 18px; min-height: 44px; font-size: 15px; font-weight: 600; cursor: pointer; border: 1px solid transparent; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-dark); }
.btn-secondary { background: #fff; color: var(--ink); border-color: #9AA2A9; font-weight: 500; }
.btn-link { background: none; color: var(--ink-2); text-decoration: underline; font-weight: 400; padding: 11px 8px; }
.btn-ghost-dark { background: transparent; color: #fff; border-color: #5A6268; font-size: 13px; padding: 8px 14px; min-height: 36px; font-weight: 500; }
.btn-wide { width: 100%; }
.linklike { background: none; border: 0; padding: 0; color: var(--accent-dark); text-decoration: underline; cursor: pointer; font-size: 13px; }

/* Notices */
.notice { margin: 0; padding: 10px 14px; border-radius: 4px; background: var(--line-2); color: var(--ink-2); font-size: 14px; }
.notice-error { background: var(--problem-bg); color: var(--problem); }
.notice-warn { background: var(--warn-bg); color: var(--warn); }
.warn-text { color: var(--problem); margin: 0; }

/* Sign-in page */
.login-page { min-height: 100vh; display: flex; flex-direction: column; background: var(--head); }
.login-header { padding: 20px 32px; }
.login-main { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px 16px 64px; }
.login-card { width: 100%; max-width: 420px; background: #fff; border-radius: var(--radius); padding: 40px 36px; display: flex; flex-direction: column; gap: 18px; }
.login-card h1 { font-size: 26px; }
.login-card p { margin: 0; line-height: 1.5; }
.accent-rule { width: 40px; height: 4px; background: var(--accent); }
.login-form { display: flex; flex-direction: column; gap: 8px; }
.login-form label { font-size: 13px; font-weight: 600; color: var(--muted); margin-top: 6px; }
.login-form input { padding: 10px 12px; border: 1px solid #9AA2A9; border-radius: 4px; min-height: 44px; }
.login-form button { margin-top: 14px; }

/* App shell */
.app { min-height: 100vh; display: flex; flex-direction: column; }
.topbar { background: var(--head); color: #fff; display: flex; flex-wrap: wrap; align-items: center; gap: 14px 28px; padding: 12px 28px; }
.brand { display: flex; align-items: center; gap: 14px; }
.brand-divider { width: 1px; height: 26px; background: var(--head-line); }
.brand-name { font-size: 16px; font-weight: 500; color: #E4E7EA; }
.topbar-pickers { display: flex; flex-wrap: wrap; gap: 12px; flex: 1 1 auto; }
.topbar-pickers label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #C9CED3; }
.topbar-pickers select { color: #fff; background: var(--head-2); border: 1px solid var(--head-line); border-radius: 4px; padding: 7px 10px; min-height: 36px; font-size: 14px; }
.topbar-user { display: flex; align-items: center; gap: 14px; font-size: 13px; }
.topbar-user form { margin: 0; }
.user-text { text-align: right; line-height: 1.3; }
.user-name { font-weight: 600; }
.user-role { color: #B6BCC2; }

.page-message { max-width: 720px; margin: 48px auto; padding: 0 16px; }
.page-message h1 { font-size: 24px; margin-bottom: 12px; }

.toolbar { background: #fff; border-bottom: 1px solid var(--line); padding: 14px 28px; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px 22px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.field input, .field select { font-size: 14px; font-weight: 400; color: var(--ink); padding: 8px 12px; border: 1px solid #C3C9CE; border-radius: 4px; min-height: 40px; background: #fff; }
.field-search { flex: 0 1 300px; }
.field-search input { width: 100%; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { font-size: 13px; font-weight: 500; min-height: 36px; padding: 6px 12px; border-radius: 18px; cursor: pointer; border: 1px solid #C3C9CE; background: #fff; color: var(--ink); }
.pill-on { background: var(--head); border-color: var(--head); color: #fff; }
.pill-count { opacity: .75; margin-left: 4px; font-variant-numeric: tabular-nums; }
.progress { margin-left: auto; min-width: 220px; display: flex; flex-direction: column; gap: 6px; }
.progress-text { font-size: 13px; color: var(--ink-2); }
.progress-track { height: 8px; background: #E4E7EA; border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); }

.workspace { flex: 1; display: flex; flex-wrap: wrap; align-items: flex-start; gap: 20px; padding: 20px 28px 32px; }

/* String list */
.list { flex: 1 1 340px; max-width: 440px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.list-head { padding: 12px 16px; border-bottom: 1px solid #E4E7EA; font-size: 13px; color: var(--muted); display: flex; justify-content: space-between; gap: 10px; }
.list-scroll { height: calc(100vh - 250px); min-height: 420px; overflow-y: auto; }
.list-empty { padding: 24px 16px; margin: 0; color: var(--muted); }
.row { display: block; width: 100%; height: 92px; overflow: hidden; text-align: left; cursor: pointer; padding: 10px 16px; border: 0; border-bottom: 1px solid var(--line-2); border-left: 4px solid transparent; background: #fff; color: var(--ink); }
.row:hover { background: #F8F9FA; }
.row-on, .row-on:hover { background: var(--accent-tint); border-left-color: var(--accent); }
.row-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.row-enum { font-family: var(--mono); font-size: 12px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-badges { display: flex; gap: 4px; flex: none; }
.row-en, .row-tr, .row-cat { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-en { font-size: 14px; font-weight: 500; margin-top: 5px; }
.row-tr { font-size: 13px; color: var(--muted); margin-top: 2px; }
.row-cat { font-size: 11px; margin-top: 4px; color: #5B636B; text-transform: uppercase; letter-spacing: .06em; }

.badge { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 10px; white-space: nowrap; }
.badge-todo { background: var(--line-2); color: var(--ink-2); }
.badge-missing { background: #fff; color: var(--ink-2); border: 1px dashed #9AA2A9; }
.badge-edited { background: var(--edited-bg); color: var(--edited); }
.badge-approved { background: var(--ok-bg); color: var(--ok); }
.badge-problem { background: var(--problem-bg); color: var(--problem); }
.badge-stale { background: var(--stale-bg); color: var(--stale); }
.badge-unsaved { background: var(--warn-bg); color: var(--warn); }

/* Detail */
.detail { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 24px; display: flex; flex-direction: column; gap: 16px; }
.detail-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; align-items: flex-start; }
.detail-enum { font-family: var(--mono); font-size: 18px; font-weight: 500; margin-bottom: 4px; overflow-wrap: anywhere; }
.detail-badges { display: flex; gap: 6px; align-items: center; }
.detail-badges .badge { font-size: 12px; padding: 3px 9px; }
.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 760px) { .pair { grid-template-columns: minmax(0, 1fr); } }
.pair-col { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.toggle { font-size: 13px; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.text-box { font-size: 16px; line-height: 1.45; padding: 12px 14px; border: 1px solid #9AA2A9; border-radius: 4px; min-height: 96px; width: 100%; white-space: pre-wrap; overflow-wrap: anywhere; resize: vertical; color: var(--ink); background: #fff; }
.text-readonly { background: var(--ground); border-color: #E4E7EA; }
.text-spaces { min-height: 0; font-size: 14px; color: var(--muted); }

.preview-block { display: flex; flex-direction: column; gap: 10px; }
.preview-stage { background: #2A2F33; border-radius: var(--radius); padding: 20px; overflow-x: auto; display: flex; flex-wrap: wrap; gap: 24px 40px; }
.preview-none { color: #C9CED3; margin: 0; }
.pv { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.pv-label { font-size: 12px; color: #C9CED3; }
.pv-box { position: relative; line-height: 1.2; outline: 2px dashed #FF8A65; outline-offset: 0; overflow: visible; }
.pv-line { white-space: pre; }
.pv-over { color: #FFE3D9; background: rgba(200, 16, 46, .7); }
.pv-softkey { background: #5B646C; color: #fff; text-align: center; padding: 10px 0; border-radius: 3px; display: flex; flex-direction: column; justify-content: center; }
.pv-popup { background: #fff; color: #111; text-align: center; padding: 24px 0; }
.pv-alert { background: #FFD54A; color: #111; padding: 8px 0; }
.pv-field { background: #F4F5F6; color: #111; padding: 6px 0; }
.pv-popup .pv-over, .pv-alert .pv-over, .pv-field .pv-over { color: #fff; }

.checks ul { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.check-icon { flex: none; margin-top: 1px; }
.check-pass .check-icon { color: #1D6B3D; }
.check-warning { color: var(--warn); }
.check-problem { color: var(--problem); }

.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; border-top: 1px solid #E4E7EA; padding-top: 16px; }
.toast { margin-left: auto; font-size: 13px; max-width: 520px; }
.toast-ok { color: var(--ok); }
.toast-warn { color: var(--warn); }
.toast-error { color: var(--problem); }
.toast-info { color: var(--muted); }

.meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; font-size: 13px; color: var(--ink-2); padding: 14px 24px; }
.meta-head { font-weight: 600; color: var(--ink); }
.meta-id { min-width: 0; }
@media (max-width: 760px) { .meta { grid-template-columns: minmax(0, 1fr); } }

.history { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.history li { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.history-when { color: var(--muted); font-variant-numeric: tabular-nums; }
.history-who { font-weight: 600; }
.history-text { color: var(--ink-2); flex-basis: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.notfound { max-width: 720px; margin: 48px auto; padding: 0 16px; }

@media (max-width: 700px) {
  .topbar, .toolbar, .workspace { padding-left: 16px; padding-right: 16px; }
  .list { max-width: none; }
  .list-scroll { height: 420px; }
  .progress { margin-left: 0; }
}

#blazor-error-ui { background: var(--warn-bg); color: var(--warn); bottom: 0; box-shadow: 0 -1px 2px rgba(0,0,0,.2); display: none; left: 0; padding: 12px 20px; position: fixed; width: 100%; z-index: 1000; }
#blazor-error-ui .reload { margin-left: 12px; }
