/* ADNEXA Translate — customer app. Mobile-first (≈390px), RTL, light. */
:root {
  --ink: #0f172a; --ink-2: #475569; --muted: #64748b; --line: #e2e8f0; --bg: #f6f7fb; --card: #ffffff;
  --brand: #1a56db; --brand-2: #1446b8; --brand-soft: #e8effd; --ok: #15803d; --ok-soft: #e7f6ec;
  --warn: #b45309; --warn-soft: #fef3e2; --bad: #b91c1c; --bad-soft: #fdecec;
  --radius: 14px; --tap: 48px;
  --font: system-ui, -apple-system, "Segoe UI", Tahoma, "Geeza Pro", Arial, sans-serif;
  /* The shared document editor reads these (light theme for customers). */
  --brand-bg: #eef1f6; --brand-card: #ffffff; --brand-border: #dbe2ec; --brand-text: #0f172a;
  --brand-text-dim: #64748b; --brand-gold: #1a56db; --brand-gold-dark: #1446b8; --brand-gold-light: #1446b8;
  --brand-blue: #1a56db; --brand-green: #15803d; --brand-red: #b91c1c; --brand-font: var(--font);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.55; }
[hidden] { display: none !important; }
a { color: var(--brand); }
button, input, select { font: inherit; }
:focus-visible { outline: 3px solid rgba(26, 86, 219, .35); outline-offset: 2px; }

/* ---------- shell ---------- */
.shell { min-height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
  background: rgba(255, 255, 255, .94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; font-size: 17px; white-space: nowrap; }
.brand span { direction: ltr; unicode-bidi: isolate; }
.topnav { display: none; gap: 4px; margin-inline-start: 18px; }
.topnav a { padding: 8px 12px; border-radius: 10px; color: var(--ink-2); text-decoration: none; }
.topnav a[aria-current="page"] { background: var(--brand-soft); color: var(--brand-2); font-weight: 700; }
.logout { margin-inline-start: auto; min-height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; color: var(--ink-2); cursor: pointer; font-size: 14px; }

.view { flex: 1; width: 100%; max-width: 720px; margin: 0 auto;
  padding: 18px max(16px, env(safe-area-inset-right)) calc(96px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
.view:focus { outline: none; }
h1 { font-size: 22px; margin: 4px 0 14px; }
h2 { font-size: 17px; margin: 0 0 10px; }
.lead { color: var(--muted); margin: -8px 0 16px; font-size: 15px; }

.tabbar {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(4, 1fr);
  background: #fff; border-top: 1px solid var(--line); padding: 4px 6px calc(4px + env(safe-area-inset-bottom));
}
.tabbar a { min-height: 54px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  text-decoration: none; color: var(--muted); font-size: 12px; border-radius: 12px; }
.tabbar i { font-style: normal; font-size: 20px; line-height: 1; }
.tabbar a[aria-current="page"] { color: var(--brand); font-weight: 700; background: var(--brand-soft); }

@media (min-width: 760px) {
  .topnav { display: flex; }
  .tabbar { display: none; }
  .view { padding-bottom: 40px; }
}

/* ---------- building blocks ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.btn { min-height: var(--tap); padding: 0 18px; border-radius: 12px; border: 1px solid var(--line); background: #fff;
  color: var(--ink); font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; text-decoration: none; font-size: 16px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:not(:disabled):active { background: var(--brand-2); }
.btn-danger { color: var(--bad); }
.btn-block { width: 100%; }
.btn-sm { min-height: 44px; padding: 0 14px; font-size: 15px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > .btn { flex: 1 1 140px; }
.muted { color: var(--muted); font-size: 14px; }
.alert { border-radius: 12px; padding: 12px 14px; margin: 10px 0; font-size: 15px; }
.alert-error { background: var(--bad-soft); color: var(--bad); }
.alert-ok { background: var(--ok-soft); color: var(--ok); }
.alert-warn { background: var(--warn-soft); color: var(--warn); }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; font-size: 15px; color: var(--ink-2); }
.field input, .field select { min-height: var(--tap); border: 1px solid var(--line); border-radius: 12px; padding: 0 14px;
  background: #fff; color: var(--ink); font-size: 16px; width: 100%; }
.field input:focus, .field select:focus { border-color: var(--brand); outline: none; }
.ltr { direction: ltr; text-align: left; unicode-bidi: isolate; }

/* ---------- auth ---------- */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px calc(24px + env(safe-area-inset-bottom)); }
.auth-card { width: min(100%, 400px); background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 24px 20px; }
.auth-brand { display: flex; align-items: center; gap: 10px; font-size: 20px; margin-bottom: 4px; }
.auth-brand span { direction: ltr; unicode-bidi: isolate; }

/* ---------- new translation ---------- */
.drop { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 190px; padding: 22px 16px; text-align: center; border: 2px dashed #b9c7df; border-radius: 18px; background: #fff;
  cursor: pointer; transition: border-color .15s, background .15s; }
.drop:hover, .drop.drag { border-color: var(--brand); background: var(--brand-soft); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop .drop-icon { font-size: 36px; line-height: 1; color: var(--brand); }
.drop strong { font-size: 17px; }
.file { display: flex; align-items: center; gap: 12px; }
.file .file-icon { flex: none; width: 44px; height: 52px; border-radius: 8px; background: var(--brand-soft); color: var(--brand-2);
  display: grid; place-items: center; font-size: 12px; font-weight: 700; text-transform: uppercase; }
.file .file-main { flex: 1; min-width: 0; }
.file .file-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: ltr; text-align: right; unicode-bidi: plaintext; }
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice label { position: relative; min-height: 64px; display: flex; flex-direction: column; justify-content: center; gap: 2px;
  padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 14px; background: #fff; cursor: pointer; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice label:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.choice small { color: var(--muted); font-size: 12px; }
.choice b { font-size: 15px; }
.langs { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: end; }
.langs .field { margin-bottom: 0; }
.langs .swap { min-width: 44px; padding: 0; margin-bottom: 2px; font-size: 18px; }
.langs > div { grid-column: 1 / -1; }
.review { margin: 4px 0 10px; padding-inline-start: 20px; color: var(--warn); font-size: 14px; }
.review li { margin: 3px 0; }
details.advanced { margin: 14px 0 14px; }
details.advanced summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; color: var(--ink-2); font-size: 15px; }
.steps { list-style: none; margin: 8px 0 0; padding: 0; }
.steps li { display: flex; align-items: center; gap: 10px; min-height: 36px; color: var(--muted); }
.steps li::before { content: ""; width: 20px; height: 20px; flex: none; border-radius: 50%; border: 2px solid var(--line); }
.steps li.done { color: var(--ink); }
.steps li.done::before { content: "✓"; border-color: var(--ok); background: var(--ok); color: #fff; font-size: 12px; display: grid; place-items: center; }
.steps li.now { color: var(--brand-2); font-weight: 700; }
.steps li.now::before { border-color: var(--brand); border-top-color: transparent; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- documents ---------- */
.doc { display: flex; flex-direction: column; gap: 10px; }
.doc-head { display: flex; gap: 10px; align-items: flex-start; }
.doc-name { flex: 1; min-width: 0; font-weight: 700; overflow-wrap: anywhere; unicode-bidi: plaintext; text-align: right; }
.doc-meta { color: var(--muted); font-size: 13px; }
.chip { flex: none; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--line); color: var(--ink-2); }
.chip-READY { background: var(--ok-soft); color: var(--ok); }
.chip-TRANSLATING { background: var(--brand-soft); color: var(--brand-2); }
.chip-FAILED { background: var(--bad-soft); color: var(--bad); }
.chip-DRAFT { background: var(--warn-soft); color: var(--warn); }
.chip-NEEDS_REVIEW { background: var(--warn-soft); color: var(--warn); }
.doc-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }

/* ---------- usage ---------- */
.meter { height: 14px; border-radius: 999px; background: var(--line); overflow: hidden; margin: 12px 0 8px; }
.meter span { display: block; height: 100%; background: var(--brand); border-radius: inherit; }
.meter.warn span { background: var(--warn); }
.big { font-size: 20px; font-weight: 800; margin: 0; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; }

/* ---------- editor overlay: customer theme tweaks ---------- */
.kde .kde-gold { color: #fff; }
.kde .kde-top { background: #fff; }
.kde .kde-simple-btn { color: var(--ink); }

@media (prefers-reduced-motion: reduce) { .steps li.now::before { animation: none; } }
