/* ChefTask PWA — brand: ink #111 on paper #fff, line-art logo, big kitchen-proof touch targets. */
:root {
  --ink: #111111;
  --paper: #ffffff;
  --muted: #6b6b6b;
  --line: #e6e6e6;
  --soft: #f5f5f4;
  --ok: #157f3d;
  --warn: #b45309;
  --urgent: #b91c1c;
  --info: #1d4ed8;
  --radius: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 16px/1.45 -apple-system, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input {
  font: inherit; color: var(--ink); background: var(--paper);
  border: 1.5px solid var(--line); border-radius: 10px; padding: 12px 14px; width: 100%;
}
input:focus { outline: none; border-color: var(--ink); }
h2 { font-size: 18px; margin: 0; }
.hint { color: var(--muted); font-size: 13px; margin: 6px 0 0; text-align: center; }
[hidden] { display: none !important; }

.view { min-height: 100dvh; display: flex; flex-direction: column; }

/* ---------- login ---------- */
#view-login { align-items: center; justify-content: center; padding: 24px; }
.login-card { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 10px; }
.login-logo { width: 230px; align-self: center; }
.login-tag { text-align: center; color: var(--muted); letter-spacing: .14em; font-size: 12px;
  text-transform: uppercase; margin: 0 0 14px; }
.login-card label { font-size: 13px; color: var(--muted); margin-top: 4px; }
.lang-label { text-align: center; color: var(--muted); font-size: 12px; text-transform: uppercase;
  letter-spacing: .08em; margin: 0 0 6px; }
.lang-row { display: flex; gap: 8px; justify-content: center; margin-bottom: 10px; }
.lang-btn.active { font-weight: 700; }
.lang-btn { border: 1.5px solid var(--line); border-radius: 999px; padding: 6px 14px; font-size: 14px; }
.lang-btn.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
#login-existing { display: flex; flex-direction: column; gap: 8px; }
.login-err { color: var(--urgent); font-size: 14px; text-align: center; margin: 4px 0 0; }

.btn-primary {
  background: var(--ink); color: var(--paper); border-radius: 12px; padding: 14px 18px;
  font-weight: 600; text-align: center;
}
.btn-primary:disabled { opacity: .4; }
.btn-primary.sm { padding: 8px 12px; font-size: 14px; border-radius: 10px; }
.btn-ghost { color: var(--muted); padding: 10px; text-decoration: underline; font-size: 14px; }
.btn-icon { font-size: 20px; padding: 8px; border-radius: 10px; }
.btn-icon.big { font-size: 24px; width: 52px; height: 52px; border: 1.5px solid var(--line); border-radius: 14px; }
.btn-icon.big.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* ---------- onboarding ---------- */
#view-onboarding { align-items: center; justify-content: center; padding: 24px; }
.ob-card { width: 100%; max-width: 440px; display: flex; flex-direction: column; gap: 14px; text-align: center; }
.ob-mark { width: 64px; align-self: center; }
.ob-progress { height: 5px; background: var(--soft); border-radius: 99px; overflow: hidden; }
#ob-bar { height: 100%; width: 0; background: var(--ink); transition: width .3s; }
.ob-step { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .1em; margin: 0; }
.ob-question { font-size: 22px; font-weight: 600; margin: 0; }
.ob-readback { background: var(--soft); border-radius: 10px; padding: 10px 14px; font-size: 15px; margin: 0; }
.ob-input-row { display: flex; gap: 8px; }
.ob-mic-row { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-top: 6px; }

/* ---------- mic button ---------- */
.mic-btn {
  width: 84px; height: 84px; border-radius: 50%; border: 2px solid var(--ink);
  display: flex; align-items: center; justify-content: center; position: relative;
  background: var(--paper); transition: transform .1s;
  touch-action: none; user-select: none; -webkit-user-select: none;
}
.mic-btn.rec { background: var(--ink); }
.mic-btn.rec .mic-icon { background: var(--paper); }
.mic-btn.rec::after {
  content: ""; position: absolute; inset: -8px; border-radius: 50%;
  border: 2px solid var(--ink); opacity: .5; animation: pulse 1.2s infinite;
}
@keyframes pulse { 0% { transform: scale(1); opacity: .5; } 100% { transform: scale(1.25); opacity: 0; } }
.mic-icon {
  width: 26px; height: 26px; background: var(--ink);
  -webkit-mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 15a4 4 0 0 0 4-4V6a4 4 0 1 0-8 0v5a4 4 0 0 0 4 4zm6-4a6 6 0 0 1-12 0H4a8 8 0 0 0 7 7.94V22h2v-3.06A8 8 0 0 0 20 11h-2z"/></svg>') center/contain no-repeat;
          mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 15a4 4 0 0 0 4-4V6a4 4 0 1 0-8 0v5a4 4 0 0 0 4 4zm6-4a6 6 0 0 1-12 0H4a8 8 0 0 0 7 7.94V22h2v-3.06A8 8 0 0 0 20 11h-2z"/></svg>') center/contain no-repeat;
}
.mic-btn.main { width: 76px; height: 76px; flex: none; }

/* ---------- app shell ---------- */
.topbar {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--paper); z-index: 5;
}
.topbar-mark { width: 34px; height: 34px; object-fit: contain; }
.topbar-mid { flex: 1; display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.topbar-mid strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill { font-size: 11px; padding: 3px 9px; border-radius: 99px; white-space: nowrap; }
.pill.on { background: #dcfce7; color: var(--ok); }
.pill.off { background: #fee2e2; color: var(--urgent); }

.tabs {
  display: flex; gap: 4px; overflow-x: auto; padding: 8px 10px; border-bottom: 1px solid var(--line);
  position: sticky; top: 55px; background: var(--paper); z-index: 4; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab { padding: 8px 14px; border-radius: 999px; font-size: 14px; color: var(--muted); white-space: nowrap; }
.tab.active { background: var(--ink); color: var(--paper); }
.tab .badge { background: var(--urgent); color: #fff; border-radius: 99px; font-size: 10px; padding: 1px 6px; margin-left: 4px; }

.panel { display: none; flex: 1; flex-direction: column; }
.panel.active { display: flex; }

/* ---------- talk ---------- */
#panel-talk { height: calc(100dvh - 110px); }
.chat { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 84%; padding: 10px 14px; border-radius: 16px; font-size: 15px; white-space: pre-wrap; word-break: break-word; }
.msg.chef { align-self: flex-end; background: var(--ink); color: var(--paper); border-bottom-right-radius: 4px; }
.msg.bot { align-self: flex-start; background: var(--soft); border-bottom-left-radius: 4px; }
.msg.sys { align-self: center; color: var(--muted); font-size: 13px; background: none; padding: 2px; }
.banner {
  align-self: stretch; border-left: 4px solid var(--info); background: var(--soft);
  padding: 10px 14px; border-radius: 10px; font-size: 14px;
}
.banner.warning { border-color: var(--warn); background: #fef3c7; }
.banner.urgent { border-color: var(--urgent); background: #fee2e2; }
.banner .b-kind { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 6px 14px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { border: 1.5px solid var(--line); border-radius: 999px; padding: 8px 14px; font-size: 14px; white-space: nowrap; }
.chip:active { background: var(--soft); }
.talk-controls {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px calc(12px + var(--safe-b));
  border-top: 1px solid var(--line);
}
.typed-row { flex: 1; display: flex; gap: 8px; }

/* ---------- cards / panels ---------- */
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 6px; }
.refresh { text-decoration: none; font-size: 18px; }
.cards { padding: 10px 14px calc(20px + var(--safe-b)); display: flex; flex-direction: column; gap: 10px; overflow-y: auto; }
.card { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.card.low { border-color: var(--warn); background: #fffbeb; }
.card.done { opacity: .5; }
.card-title { font-weight: 600; display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.card-sub { color: var(--muted); font-size: 13px; margin-top: 3px; }
.card-actions { display: flex; gap: 8px; margin-top: 10px; }
.tag { font-size: 11px; padding: 2px 8px; border-radius: 99px; background: var(--soft); color: var(--muted); white-space: nowrap; }
.tag.warn { background: #fef3c7; color: var(--warn); }
.tag.urgent { background: #fee2e2; color: var(--urgent); }
.tag.ok { background: #dcfce7; color: var(--ok); }
.qty { font-variant-numeric: tabular-nums; }
.empty { color: var(--muted); text-align: center; padding: 30px 0; }
.row-2 { display: flex; gap: 10px; }
.row-2 > * { flex: 1; }

/* order lines table */
.po-lines { margin-top: 8px; border-top: 1px dashed var(--line); padding-top: 8px; font-size: 14px; }
.po-line { display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; }

/* ---------- intake modal ---------- */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50;
  display: flex; align-items: flex-end; justify-content: center;
}
.modal-card {
  background: var(--paper); border-radius: 18px 18px 0 0; width: 100%; max-width: 560px;
  max-height: 92dvh; overflow-y: auto; padding: 16px 16px calc(20px + var(--safe-b));
  display: flex; flex-direction: column; gap: 12px;
}
.modal-head { display: flex; justify-content: space-between; align-items: center; }
.modal-head h3 { margin: 0; }
.mode-row { display: flex; gap: 8px; }
.mode-btn { flex: 1; border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 6px; font-size: 13px; }
.mode-btn.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.file-drop {
  border: 2px dashed var(--line); border-radius: var(--radius); padding: 26px;
  text-align: center; display: block; font-size: 15px; color: var(--muted);
}
#intake-preview { width: 100%; border-radius: 10px; max-height: 240px; object-fit: contain; background: var(--soft); }
#intake-lines { display: flex; flex-direction: column; gap: 8px; }
.iline { display: grid; grid-template-columns: 24px 1fr 64px 56px; gap: 6px; align-items: center; }
.iline input { padding: 8px 10px; font-size: 14px; }
.iline input[type=checkbox] { width: 20px; height: 20px; padding: 0; accent-color: var(--ink); }
.iline.off input:not([type=checkbox]) { opacity: .35; }

/* ---------- toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: calc(90px + var(--safe-b)); transform: translateX(-50%);
  background: var(--ink); color: var(--paper); padding: 10px 18px; border-radius: 999px;
  font-size: 14px; z-index: 99; max-width: 88vw; text-align: center;
}
