/* Orderly system: warm grey ground, white hairline panels, near-black ink, one sans at 500,
   a tracked mono for labels and tickets, colour only for status, the stripe as the one ornament. */
:root {
  --ground: #ededea;
  --panel: #ffffff;
  --panel-2: #fafaf8;
  --ink: #0e0e0c;
  --ink-2: #4a4a46;
  --muted: #8a8a84;
  --line: #d9d9d4;
  --line-soft: #e6e6e2;
  --line-strong: #bdbdb7;
  --ok: #1f7a3f;
  --warn: #b8860b;
  --bad: #a52e26;
  --radius: 10px;
  --radius-sm: 7px;
  --font: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --ease-out: cubic-bezier(.23, 1, .32, 1);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--ground);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "cv11";
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--ink-2); }
img, svg { display: block; }
h1, h2, h3, h4 { margin: 0; font-weight: 500; letter-spacing: -0.02em; line-height: 1.15; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }

.wrap { max-width: 1232px; margin: 0 auto; padding: 0 32px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.stack > * + * { margin-top: 12px; }
.row { display: flex; align-items: center; gap: 12px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.grow { flex: 1; }
.mono, .label { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
.mono.ink { color: var(--ink); }
.rule { height: 1px; background: var(--line); }
.hair { height: 10px; background: repeating-linear-gradient(135deg, var(--ink) 0 1px, transparent 1px 7px); opacity: .28; }
.stripe { background: repeating-linear-gradient(135deg, var(--ink) 0 10px, var(--ground) 10px 22px); }

/* Brand */
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 500; font-size: 18px; letter-spacing: -0.02em; }
.brand-mark { width: 22px; height: 22px; border-radius: 50%; background: repeating-linear-gradient(135deg, var(--ink) 0 3px, var(--ground) 3px 6px); }

/* Buttons: press to 97% in 160 ms, strong ease-out. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px;
  border-radius: var(--radius-sm); border: 1px solid var(--line-strong);
  background: var(--panel); color: var(--ink);
  font-weight: 500; font-size: 14.5px; letter-spacing: -0.005em; cursor: pointer; white-space: nowrap;
  transition: transform 160ms var(--ease-out), background 160ms ease, border-color 160ms ease;
}
.btn:hover { background: #f6f6f3; color: var(--ink); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-primary:hover { background: #262624; border-color: #262624; color: #fff; }
.btn-danger { color: var(--bad); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: #e4e4e0; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13.5px; }
.btn-lg { height: 46px; padding: 0 20px; font-size: 15px; }
.btn svg { width: 16px; height: 16px; }

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .label-text { font-size: 13px; font-weight: 500; color: var(--ink); }
.field .hint { font-size: 12.5px; color: var(--muted); }
.input, input:not([type]), input[type=text], input[type=email], input[type=password], input[type=number], input[type=tel], input[type=search], select, textarea {
  width: 100%; height: 40px; padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--panel); color: var(--ink);
  transition: border-color 120ms ease;
}
textarea { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus, .input:focus { outline: none; border-color: var(--ink); }
input::placeholder, textarea::placeholder { color: #a8a8a2; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; }
.check input { width: 15px; height: 15px; accent-color: var(--ink); margin: 0; }

/* Panels */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.card-pad { padding: 18px 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); }
.card-head h3 { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; font-weight: 500; color: var(--ink); }

/* Status: a dot and a word. */
.pill {
  display: inline-flex; align-items: center; gap: 7px;
  height: 24px; padding: 0 10px; border-radius: 999px;
  font-size: 12.5px; font-weight: 500; border: 1px solid var(--line); background: var(--panel); color: var(--ink); white-space: nowrap;
}
.pill .dot, .pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--line-strong); display: block; flex: none; }
.pill .dot { display: none; }
.pill-green::before { background: var(--ok); }
.pill-red::before { background: var(--bad); }
.pill-amber::before { background: var(--warn); }
.pill-live::before { animation: breathe 1.6s ease-in-out infinite; }
.pill-plain::before { display: none; }
.notice { padding: 11px 14px; border-radius: var(--radius-sm); font-size: 14px; border: 1px solid var(--line); background: var(--panel); }
.notice-ok { border-color: var(--ok); }
.notice-error { border-color: var(--bad); color: var(--bad); }
.notice-warn { border-color: var(--warn); }

/* Tables */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-family: var(--mono); font-weight: 500; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 10px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 13px 16px; border-bottom: 1px solid #ececea; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.link-row { cursor: pointer; }
.table tr.link-row:hover td { background: var(--panel-2); }
.table .num, .num { font-variant-numeric: tabular-nums; }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); font-size: 14px; }

/* Transcript */
.transcript { display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 86%; padding: 9px 13px; border-radius: 12px; font-size: 14px; line-height: 1.45; transition: opacity 180ms var(--ease-out), transform 180ms var(--ease-out); }
@starting-style { .msg { opacity: 0; transform: translateY(4px); } }
.msg.agent { background: #f1f1ee; align-self: flex-start; border-bottom-left-radius: 4px; }
.msg.caller { background: var(--ink); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }

/* Ticket: mono on white, hairline rules, no paper gimmicks. */
.ticket { font-family: var(--mono); font-size: 12px; background: var(--panel-2); border-left: 1px solid var(--line-soft); padding: 16px; display: flex; flex-direction: column; gap: 9px; }
.ticket-head { display: flex; flex-direction: column; gap: 2px; padding-bottom: 9px; border-bottom: 1px solid var(--line); }
.ticket-head b { font-family: var(--font); font-size: 13px; font-weight: 500; letter-spacing: -0.01em; }
.ticket-head span { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink); font-weight: 500; order: -1; }
.ticket-cust { display: flex; flex-direction: column; gap: 2px; padding-bottom: 9px; border-bottom: 1px solid var(--line); }
.ticket-cust b { font-family: var(--font); font-size: 13.5px; font-weight: 500; letter-spacing: -0.01em; }
.ticket-cust span { color: var(--muted); }
.ticket-lines { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.ticket-lines li { display: grid; grid-template-columns: 22px 1fr auto; gap: 8px; align-items: start; }
.ticket-lines li > span:nth-child(2) { font-family: var(--font); font-size: 13.5px; line-height: 1.35; }
.ticket-lines li {  border-radius: 4px; transition: opacity 180ms var(--ease-out), transform 180ms var(--ease-out); }
@starting-style { .ticket-lines li { opacity: 0; transform: translateY(3px); } }
.ticket-lines li.flash { animation: wash 600ms ease forwards; }
.ticket-lines .sub { display: block; color: var(--muted); }
.ticket-lines .note { display: block; color: var(--bad); }
.ticket-lines li.none { display: block; color: var(--muted); padding: 18px 0; }
.ticket-total { display: flex; justify-content: space-between; padding-top: 9px; border-top: 1px solid var(--line); font-weight: 500; margin-top: auto; }
.ticket-total span:first-child { font-family: var(--font); font-size: 13.5px; }
.stamp { border: 1px solid var(--ink); border-radius: 6px; text-align: center; padding: 8px 10px; font-weight: 500; transition: opacity 240ms var(--ease-out), transform 240ms var(--ease-out); }
@starting-style { .stamp { opacity: 0; transform: scale(.95); } }
.stamp big { display: block; font-size: 12px; }
.stamp small { font-size: 11px; color: var(--muted); font-weight: 400; }

/* Call button and level meter */
.call-btn { flex: none; height: 46px; padding: 0 20px 0 16px; border-radius: 999px; border: 0; cursor: pointer; display: inline-flex; align-items: center; gap: 9px; background: var(--ink); color: #fff; font: 500 14.5px/1 var(--font); white-space: nowrap; transition: transform 160ms var(--ease-out), background 160ms ease; }
.call-btn.live { width: 46px; padding: 0; justify-content: center; }
.call-btn.live span { display: none; }
.call-btn:hover { background: #262624; }
.call-btn:active { transform: scale(.95); }
.call-btn:disabled { opacity: .6; cursor: progress; transform: none; }
.call-btn.live { background: var(--bad); }
.call-btn svg { width: 19px; height: 19px; transition: transform 200ms var(--ease-out); }
.call-btn.live svg { transform: rotate(135deg); }
.wave { display: flex; align-items: center; gap: 3px; height: 24px; margin-left: auto; opacity: 0; transition: opacity 200ms ease; }
.on-call .wave { opacity: 1; }
.wave i { display: block; width: 3px; height: 4px; border-radius: 2px; background: var(--ink); opacity: .2; transition: height 80ms linear, opacity 200ms; }
.wave.on i { opacity: 1; }

@keyframes wash { from { background: #e4e4e0; } to { background: transparent; } }
@keyframes breathe { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

@media (prefers-reduced-motion: reduce) {
  .msg, .ticket-lines li, .stamp { transition: opacity 180ms ease; transform: none !important; }
  .pill-live::before { animation: none; }
}
@media (max-width: 720px) {
  .form-grid { grid-template-columns: 1fr; }
  .wrap { padding: 0 20px; }
}
