/* Ta'am Live: the lab's palette (warm paper, cyan planner), built for phones first. */
:root {
  color-scheme: light;
  --bg: #f5f3ee; --panel: #fffdf9; --ink: #171a1d; --muted: #5e6670; --faint: #8b939c; --line: #e0dcd2; --soft: #efece5;
  --cyan: #127f8c; --cyan-ink: #ffffff; --amber: #c47f12; --green: #1f8f5f; --red: #c2412d; --ice: #2f7fc0;
  --ui: "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", sans-serif; --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
}
@media (prefers-color-scheme: dark) { :root {
  color-scheme: dark; --bg: #0a0e13; --panel: #11161d; --ink: #e8edf2; --muted: #8b96a3; --faint: #5f6975; --line: #1f2731; --soft: #161c24;
  --cyan: #3fc1cf; --cyan-ink: #04161a; --amber: #e6a23c; --green: #4cc38a; --red: #f07a66; --ice: #6fb3ea; } }
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 15.5px/1.55 var(--ui); }
button, input, select { font: inherit; color: inherit; }
a { color: var(--cyan); }
h1 { font-size: clamp(28px, 6vw, 40px); line-height: 1.1; margin: 8px 0 12px; text-wrap: balance; }
h2 { font-size: 17px; margin: 0 0 10px; }
p { margin: 0; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); } .fine { font-size: 13px; color: var(--muted); margin-top: 14px; max-width: 62ch; }

.bar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px; padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); flex: 1; min-width: 0; }
.mark { width: 34px; height: 34px; border-radius: 10px; background: var(--cyan); color: var(--cyan-ink); display: grid; place-items: center; font-weight: 700; font-size: 18px; flex: none; }
.brand b { display: block; line-height: 1.1; } .brand small { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clock { font-size: 18px; font-weight: 600; }
.mode { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--soft); color: var(--muted); white-space: nowrap; }
.mode.on { background: color-mix(in srgb, var(--green) 16%, transparent); color: var(--green); }
.mode.chat { background: color-mix(in srgb, var(--amber) 18%, transparent); color: var(--amber); }

main { max-width: 1100px; margin: 0 auto; padding: 18px 16px 48px; }
.intro { max-width: 720px; padding-block: 10px 6px; }
.eyebrow { font: 600 12px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--cyan); }
.lede { color: var(--muted); font-size: 17px; margin-bottom: 18px; }
.primary, .ghost { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 12px; padding: 11px 16px; font-weight: 600; cursor: pointer; border: 1px solid transparent; text-decoration: none; }
.primary { background: var(--cyan); color: var(--cyan-ink); } .ghost { background: var(--panel); border-color: var(--line); color: var(--ink); }
.primary:disabled, .ghost:disabled { opacity: .5; cursor: default; }
.small-btn { padding: 7px 11px; border-radius: 10px; font-size: 13.5px; }

.links { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-top: 22px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 16px; min-width: 0; }
.card .role { font: 600 11.5px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.card ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.card li a { display: flex; justify-content: space-between; gap: 8px; text-decoration: none; padding: 8px 10px; border-radius: 10px; background: var(--soft); color: var(--ink); }
.card li a span { color: var(--cyan); font-size: 13px; white-space: nowrap; }

.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items: start; }
.stack { display: grid; gap: 14px; max-width: 560px; margin: 0 auto; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
@media (max-width: 640px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; display: grid; }
.kpi b { font: 600 22px var(--mono); } .kpi span { font-size: 12.5px; color: var(--muted); }

.row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row b { overflow-wrap: anywhere; } .row small { display: block; color: var(--muted); font-size: 12.5px; }
.tag { font: 600 11.5px var(--mono); padding: 2px 8px; border-radius: 999px; background: var(--soft); color: var(--muted); white-space: nowrap; }
.tag.open { color: var(--amber); background: color-mix(in srgb, var(--amber) 14%, transparent); }
.tag.onboard { color: var(--ice); background: color-mix(in srgb, var(--ice) 14%, transparent); }
.tag.delivered { color: var(--green); background: color-mix(in srgb, var(--green) 14%, transparent); }
.tag.expired { color: var(--red); background: color-mix(in srgb, var(--red) 14%, transparent); }
.tag.cold { color: var(--ice); }
.clockleft { font: 500 12.5px var(--mono); } .clockleft.low { color: var(--red); }

.code { font: 600 44px/1 var(--mono); letter-spacing: .12em; text-align: center; padding: 14px; border-radius: 14px; background: var(--soft); }
.stop { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--soft); }
.stop + .stop { margin-top: 10px; }
.stop .top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.stop form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.stop input, .field input, .field select { width: 100%; min-width: 0; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); font-size: 16px; }
.field { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.form { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form .full { grid-column: 1 / -1; }
.switch { display: flex; gap: 10px; align-items: center; }
.empty { color: var(--muted); font-size: 14px; padding: 8px 0; }
.log { font: 12px/1.6 var(--mono); max-height: 260px; overflow: auto; }
.log div { display: grid; grid-template-columns: 48px 76px minmax(0, 1fr); gap: 8px; border-bottom: 1px dashed var(--line); padding: 3px 0; }
.log .h { color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.planner { font-size: 13px; color: var(--muted); }
.toast { position: fixed; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translate(-50%, 20px); opacity: 0; transition: .2s; background: var(--ink); color: var(--bg); padding: 9px 14px; border-radius: 12px; font-size: 14px; pointer-events: none; max-width: calc(100% - 32px); z-index: 30; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
