:root {
  --ink: #1c2633;
  --ink-2: #2f3d4f;
  --paper: #f5f1ea;
  --card: #ffffff;
  --line: #e2dbcf;
  --muted: #6d7480;
  --accent: #e0542b;
  --accent-soft: #fde6dc;
  --ok: #2b7a57;
  --ok-soft: #e2f3ea;
  --warn: #a86d00;
  --warn-soft: #fff1d1;
  --bad: #b8322a;
  --bad-soft: #fde3e0;
  --info: #2c5d8f;
  --info-soft: #e3edf8;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(28, 38, 51, .06), 0 4px 14px rgba(28, 38, 51, .06);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--info); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.row { display: flex; gap: .5rem; align-items: center; }
.grow { flex: 1; }
.hidden { display: none !important; }

.btn {
  border: 1px solid var(--line); background: var(--card); border-radius: 9px; padding: .45rem .8rem;
  font-weight: 600; font-size: .88rem; display: inline-flex; gap: .35rem; align-items: center; white-space: nowrap;
}
.btn:hover { border-color: #cbbfae; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { color: var(--bad); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.sm { padding: .25rem .55rem; font-size: .8rem; }

.chip { display: inline-flex; align-items: center; gap: .3rem; border-radius: 999px; padding: .12rem .55rem; font-size: .75rem; font-weight: 700; background: #eee; white-space: nowrap; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.info { background: var(--info-soft); color: var(--info); }
.chip.ink { background: var(--ink); color: #fff; }
.chip.accent { background: var(--accent-soft); color: var(--accent); }

.demo-tag { background: #ffd84d; color: #3d3200; font-weight: 800; font-size: .7rem; letter-spacing: .04em; padding: .15rem .45rem; border-radius: 5px; text-transform: uppercase; }

.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: .7rem 1rem; border-radius: 10px; box-shadow: var(--shadow); z-index: 50; max-width: 90vw; font-size: .9rem; }
.toast.err { background: var(--bad); }

.modal-back { position: fixed; inset: 0; background: rgba(20, 26, 34, .45); display: flex; align-items: center; justify-content: center; z-index: 40; padding: 1rem; }
.modal { background: var(--card); border-radius: 14px; box-shadow: var(--shadow); width: min(760px, 100%); max-height: 90vh; overflow: auto; padding: 1.2rem 1.3rem; }
.modal h2 { margin: 0 0 .6rem; font-size: 1.15rem; }
.modal h3 { font-size: .95rem; margin: 1.1rem 0 .4rem; }
.modal table { border-collapse: collapse; width: 100%; font-size: .88rem; }
.modal td, .modal th { padding: .3rem .4rem; border-bottom: 1px solid var(--line); text-align: left; }
.modal input[type=text], .modal input[type=number], .modal input[type=time] { width: 100%; padding: .35rem .45rem; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.modal textarea { width: 100%; min-height: 260px; font-family: ui-monospace, monospace; font-size: .8rem; border: 1px solid var(--line); border-radius: 8px; padding: .6rem; }
.field-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .6rem; }
.field-grid label { font-size: .78rem; color: var(--muted); display: grid; gap: .2rem; }
