:root {
  color-scheme: light;
  --bg: #f4f1ea;
  --card: #fffdf9;
  --ink: #1c1917;
  --muted: #78716c;
  --line: #e7e0d6;
  --accent: #1c1917;
  --danger: #9f1239;
  --ok: #3f6212;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "DM Sans", system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 10% -10%, #efe7d6 0%, transparent 60%),
    var(--bg);
}

button, input { font: inherit; color: inherit; }

button { cursor: pointer; }

main {
  width: min(920px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0 64px;
}

.narrow { width: min(440px, calc(100% - 32px)); }

h1 {
  margin: 0;
  font-size: 2rem;
  letter-spacing: -0.04em;
}

h2 {
  margin: 0 0 12px;
  font-size: 1.05rem;
}

.lead, .muted { color: var(--muted); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px;
  margin-top: 16px;
}

.login-card { margin-top: 28px; }

label {
  display: block;
  margin: 14px 0 6px;
  font-size: 0.92rem;
  font-weight: 600;
}

input[type="text"],
input[type="password"],
input[type="number"] {
  width: 100%;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 12px;
  background: #fff;
}

.row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.row input,
.row .secret { flex: 1; min-width: 0; }

.primary, .ghost, .danger {
  height: 42px;
  border-radius: 12px;
  padding: 0 14px;
  border: 1px solid transparent;
  white-space: nowrap;
}

.primary { background: var(--accent); color: white; }
.primary:hover { background: #292524; }
.primary:disabled { opacity: 0.55; cursor: wait; }

.ghost, .danger { background: #fff; border-color: var(--line); }
.danger { color: var(--danger); }

.top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
}

.kicker {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.secret {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 1rem;
  letter-spacing: 0.01em;
  word-break: break-all;
}

.code {
  margin-top: 8px;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: clamp(1.8rem, 8vw, 2.5rem);
  letter-spacing: 0.16em;
  text-align: center;
}

.bar {
  height: 4px;
  margin: 14px auto 8px;
  max-width: 220px;
  border-radius: 99px;
  background: #f0ebe3;
  overflow: hidden;
}

.bar > div,
.bar > span { display: block; height: 100%; width: 0; background: var(--ink); }

.center { text-align: center; color: var(--muted); }

.msg { min-height: 1.2em; margin: 10px 0 0; }
.msg.err { color: var(--danger); }
.msg.ok { color: var(--ok); }

.order {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.order:first-of-type { border-top: 0; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }

.limit {
  width: 84px;
  height: 42px;
}

.path {
  color: var(--muted);
  font-size: 0.86rem;
  margin-top: 4px;
  word-break: break-all;
}

.empty { color: var(--muted); margin: 0; }

body.delivery .step {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

body.delivery .field,
body.delivery .code-hit {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 12px;
}

body.delivery .field { min-height: 52px; }
body.delivery .field .secret { flex: 1; }
body.delivery .field-action { color: var(--muted); font-size: 0.85rem; font-weight: 700; }
body.delivery .field-line { display: flex; gap: 8px; align-items: stretch; }
body.delivery .field-line .field { flex: 1; }
body.delivery .field-line .ghost { height: auto; }

body.delivery .uses { display: flex; gap: 6px; min-height: 10px; margin-top: 10px; }
body.delivery .pip { width: 10px; height: 10px; border-radius: 99px; background: #e7e0d6; }
body.delivery .pip.used { background: var(--ink); }
body.delivery #take,
body.delivery #signedIn { width: 100%; margin-top: 12px; }
body.delivery .code-hit {
  display: block;
  margin-top: 14px;
  border: 0;
  background: transparent;
  padding: 8px 0 0;
}
body.delivery .code-hit.code-locked { cursor: not-allowed; }
body.delivery .code-hit.code-locked .code {
  user-select: none;
  opacity: 0.45;
}
body.delivery .hint { margin: 12px 0 0; color: var(--muted); font-size: 0.88rem; }

[hidden] { display: none !important; }

@media (max-width: 760px) {
  .order, .top, .row { display: block; }
  .actions { justify-content: flex-start; margin-top: 10px; }
  .primary, .ghost, .danger { margin-top: 8px; }
  .top .ghost { margin-top: 12px; }
}
