:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --ink: #1b1f24;
  --muted: #667085;
  --line: #e3e6eb;
  --accent: #1f5f8b;
  --accent-ink: #ffffff;
  --danger: #b42318;
  --ok: #067647;
  --warn: #b54708;
  --radius: 8px;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Noto Sans Georgian", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111418; --panel: #191d23; --ink: #e8eaee; --muted: #98a2b3; --line: #2b313a;
    --accent: #5aa5d6; --accent-ink: #0b1218; --danger: #f97066; --ok: #47cd89; --warn: #fdb022;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.45; }
[hidden] { display: none !important; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 10px 20px; background: var(--panel); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 650; letter-spacing: .2px; display: flex; align-items: center; gap: 8px; }
.lock-icon { width: 14px; height: 14px; border: 2px solid var(--accent); border-radius: 3px; position: relative; top: 2px; }
.lock-icon::before { content: ""; position: absolute; left: 1px; top: -9px; width: 8px; height: 8px; border: 2px solid var(--accent); border-bottom: 0; border-radius: 6px 6px 0 0; }
nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.who { color: var(--muted); font-size: 13px; margin: 0 8px; }

main { max-width: 1120px; margin: 24px auto; padding: 0 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.narrow { max-width: 440px; margin: 40px auto; }
h1 { font-size: 20px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }

label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
input, select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--bg); color: var(--ink); font: inherit;
}
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
input[type=file] { padding: 6px; }

button {
  font: inherit; cursor: pointer; border-radius: 6px; padding: 8px 14px; border: 1px solid transparent;
  background: var(--accent); color: var(--accent-ink); font-weight: 550;
}
button:disabled { opacity: .55; cursor: progress; }
button.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
button.link { background: transparent; color: var(--ink); padding: 6px 10px; font-weight: 500; }
button.link.active { color: var(--accent); }
button.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
button.small { padding: 4px 10px; font-size: 13px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 600; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: color-mix(in srgb, var(--accent) 7%, transparent); }
td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; border: 1px solid var(--line); white-space: nowrap; }
.badge.new { color: var(--accent); border-color: var(--accent); }
.badge.in_progress, .badge.translated { color: var(--warn); border-color: var(--warn); }
.badge.notarized, .badge.delivered { color: var(--ok); border-color: var(--ok); }
.badge.cancelled { color: var(--muted); }

dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; }
dl.kv dt { color: var(--muted); font-size: 13px; }
dl.kv dd { margin: 0; white-space: pre-wrap; word-break: break-word; }

.notice { padding: 10px 12px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); font-size: 14px; }
.notice.warn { border-color: var(--warn); }
.notice.err { border-color: var(--danger); color: var(--danger); }
code.copy { display: block; padding: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; word-break: break-all; font-size: 13px; }

#toast {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 6px; font-size: 14px; max-width: 90vw;
}
#toast.err { background: var(--danger); color: #fff; }

@media (max-width: 700px) {
  .hide-sm { display: none; }
  main { margin-top: 12px; }
}

.mb12 { margin-bottom: 12px; } .mt12 { margin-top: 12px; } .mb0 { margin-bottom: 0; }
.flex1 { flex: 1; } .flex2 { flex: 2; } .minw220 { min-width: 220px; } .w220 { width: 220px; }
.maxw560 { max-width: 560px; } .maxw640 { max-width: 640px; }
.auto { width: auto; }

.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 64px; }
.pw-wrap button.eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); min-width: 52px; }
