:root {
  --bg: #f3f1ec;
  --card: #ffffff;
  --ink: #181816;
  --muted: #6d6a63;
  --line: #dedad1;
  --field: #faf9f6;
  --accent: #1f5c46;
  --accent-ink: #ffffff;
  --soft: #e7efe9;
  --danger: #a3341f;
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151514;
    --card: #1d1d1b;
    --ink: #ecebe6;
    --muted: #9b988f;
    --line: #34332f;
    --field: #191917;
    --accent: #6fbf9a;
    --accent-ink: #10231b;
    --soft: #1f2d26;
    --danger: #e6896f;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 15px/1.5 "IBM Plex Sans", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }
.mono { font-family: "IBM Plex Mono", ui-monospace, monospace; letter-spacing: .02em; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

/* header */
.top {
  width: 100%; max-width: 480px; margin: 0 auto;
  padding: 28px 16px 0;
  display: flex; align-items: center; justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; font-weight: 600; font-size: 17px; }
.lang { display: flex; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.lang button { border: 0; background: none; padding: 4px 9px; font-size: 12px; font-weight: 500; color: var(--muted); cursor: pointer; }
.lang button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }

main { width: 100%; max-width: 480px; margin: 28px auto 0; padding: 0 16px; flex: 1; }

/* tabs */
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: var(--line); border-radius: 12px; margin-bottom: 14px; }
.tabs button {
  border: 0; background: none; padding: 9px; border-radius: 9px;
  font-weight: 500; color: var(--muted); cursor: pointer;
}
.tabs button[aria-selected="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgb(0 0 0 / .08); }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 22px; }

/* drop zone */
.drop {
  display: block; cursor: pointer;
  border: 1.5px dashed var(--line); border-radius: var(--radius);
  background: var(--field);
  transition: border-color .15s, background .15s;
  margin-bottom: 20px;
}
.drop:hover, .drop.over { border-color: var(--accent); background: var(--soft); }
.drop.has-file { border-style: solid; cursor: default; }
.drop-empty { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 34px 16px; text-align: center; }
.drop-empty svg { color: var(--accent); margin-bottom: 4px; }
.drop-empty .muted { font-size: 13px; }
.drop-file, .file-row { display: flex; align-items: center; gap: 12px; padding: 14px; }
.file-icon {
  flex: none; width: 42px; height: 48px; border-radius: 6px;
  background: var(--soft); color: var(--accent);
  display: grid; place-items: center;
  font: 600 10px/1 "IBM Plex Mono", monospace; text-transform: uppercase;
  overflow: hidden; padding: 0 3px;
}
.file-meta { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.file-meta strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.file-meta .muted { font-size: 13px; }

/* fields */
.field { margin-bottom: 18px; }
.field > label, .label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; }
input:not([type]), input[type="text"] {
  width: 100%; padding: 10px 12px;
  background: var(--field); border: 1px solid var(--line); border-radius: 8px;
  outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--soft); }
input.invalid { border-color: var(--danger); }
.hint { margin: 6px 0 0; font-size: 12.5px; color: var(--muted); }
.with-btn { display: flex; gap: 8px; }
.with-btn input { flex: 1; min-width: 0; }

.seg { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg label { position: relative; cursor: pointer; }
.seg label + label { border-left: 1px solid var(--line); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; text-align: center; padding: 8px 4px; font-size: 14px; color: var(--muted); }
.seg input:checked + span { background: var(--ink); color: var(--bg); font-weight: 500; }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -2px; }

/* buttons */
.primary {
  width: 100%; border: 0; border-radius: 8px; padding: 12px 16px;
  background: var(--accent); color: var(--accent-ink); font-weight: 600; cursor: pointer;
  transition: opacity .15s;
}
.primary:hover { opacity: .9; }
.primary:disabled { opacity: .5; cursor: not-allowed; }
.ghost {
  border: 1px solid var(--line); background: var(--card); border-radius: 8px;
  padding: 10px 14px; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.ghost:hover { border-color: var(--muted); }
.link { border: 0; background: none; padding: 4px; color: var(--accent); font-weight: 500; cursor: pointer; font-size: 14px; }
.link:hover { text-decoration: underline; }
.center { display: block; margin: 12px auto 0; }
.row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }

.error { margin: -4px 0 14px; color: var(--danger); font-size: 14px; }

/* progress */
.progress { margin-bottom: 16px; }
.bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.progress-row { display: flex; justify-content: space-between; font-size: 12.5px; margin-top: 6px; font-variant-numeric: tabular-nums; }

/* done */
.done h2 { margin: 12px 0 4px; font-size: 19px; font-weight: 600; }
.done > p { margin: 0 0 18px; }
.check { width: 36px; height: 36px; border-radius: 50%; background: var(--soft); color: var(--accent); display: grid; place-items: center; }
.ticket { margin: 0 0 18px; border: 1px solid var(--line); border-radius: var(--radius); }
.ticket div { display: flex; justify-content: space-between; gap: 16px; padding: 10px 14px; }
.ticket div + div { border-top: 1px solid var(--line); }
.ticket dt { color: var(--muted); font-size: 13px; flex: none; }
.ticket dd { margin: 0; text-align: right; font-weight: 500; word-break: break-all; }

.lead { margin: 0 0 18px; color: var(--muted); }
.found .file-row { border: 1px solid var(--line); border-radius: var(--radius); background: var(--field); margin-bottom: 16px; }

.foot {
  width: 100%; max-width: 480px; margin: 0 auto; padding: 24px 16px 28px;
  display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px;
}
.foot a { color: var(--muted); }

@media (max-width: 420px) {
  .panel { padding: 18px 16px; }
  .row { grid-template-columns: 1fr; }
}
