/* FieldOps: status colors are the T568B pairs. Blue scheduled, orange in progress, green done, brown neutral. */
:root {
  --concrete: #e7eaec;
  --panel: #ffffff;
  --panel-2: #f3f5f6;
  --ink: #18212b;
  --text: #1c2630;
  --muted: #5a6672;
  --line: #cfd5da;
  --blue: #1f5fa8;
  --orange: #d9640f;
  --green: #2e8540;
  --brown: #7a5230;
  --warn-bg: #fdf0e4;
  --danger: #b3261e;
  --focus: #1f5fa8;
  --on-accent: #ffffff;
  --radius-lg: 18px;
  --radius: 12px;
  --radius-sm: 8px;
  --font: 'Barlow', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-cond: 'Barlow Condensed', 'Barlow', system-ui, sans-serif;
  --tabbar-h: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --concrete: #11171d;
    --panel: #1a222b;
    --panel-2: #222c36;
    --ink: #0b1015;
    --text: #e6eaee;
    --muted: #9aa6b1;
    --line: #2e3a46;
    --blue: #5b9be3;
    --orange: #f08a3c;
    --green: #5bbd6e;
    --brown: #c0946a;
    --warn-bg: #3a2614;
    --danger: #ff8a80;
    --focus: #8fbdf0;
    --on-accent: #0b1015;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--concrete);
  color: var(--text);
  font: 17px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
svg { width: 22px; height: 22px; flex: none; }
a { color: var(--blue); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- shell ---------- */
.shell { min-height: 100%; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--ink); color: #fff;
  padding: calc(var(--safe-t) + 10px) 16px 12px;
  display: flex; align-items: center; gap: 12px;
}
.topbar h1 { font-size: 20px; font-weight: 600; margin: 0; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .iconbtn { color: #fff; }
.main { flex: 1; width: 100%; max-width: 720px; margin: 0 auto; padding: 16px 16px calc(var(--tabbar-h) + var(--safe-b) + 28px); }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: var(--panel); border-top: 1px solid var(--line);
  display: grid; grid-template-columns: 1fr 1fr 88px 1fr 1fr; align-items: center;
}
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 12px; font-weight: 500; color: var(--muted); text-decoration: none;
  padding: 8px 0; background: none; border: 0;
}
.tab svg { width: 24px; height: 24px; }
.tab[aria-current="page"] { color: var(--text); }
.tab[aria-current="page"] svg { color: var(--blue); }

/* The mic: a solid orange key with an orange/white striped collar, like the orange-white conductor */
.mic {
  position: relative; justify-self: center; width: 72px; height: 72px; margin-top: -26px;
  border-radius: 50%; border: 0; padding: 0; cursor: pointer;
  background: repeating-conic-gradient(var(--orange) 0 12deg, #fff 12deg 24deg);
  box-shadow: 0 6px 18px rgba(24, 33, 43, .28);
  display: grid; place-items: center;
}
.mic::before {
  content: ""; position: absolute; inset: 6px; border-radius: 50%;
  background: var(--orange);
}
.mic svg { position: relative; width: 30px; height: 30px; color: #fff; }
.mic[data-state="recording"]::before { background: var(--danger); }
.mic[data-state="recording"] { animation: spin 2.4s linear infinite; }
.mic[data-state="recording"] svg { animation: spin 2.4s linear infinite reverse; }
.mic[data-state="sending"]::before { background: var(--muted); }
@keyframes spin { to { transform: rotate(360deg); } }
.mic-timer {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 31;
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 18px);
  background: var(--ink); color: #fff; border-radius: 999px; padding: 8px 16px;
  font: 600 16px var(--font-cond); letter-spacing: .02em; white-space: nowrap;
}

/* ---------- common ---------- */
.iconbtn { background: none; border: 0; padding: 8px; border-radius: 10px; display: inline-grid; place-items: center; cursor: pointer; color: var(--text); }
.iconbtn svg { width: 24px; height: 24px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 18px; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--panel); font-weight: 600; text-decoration: none; color: var(--text); cursor: pointer;
}
.btn svg { width: 20px; height: 20px; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: var(--on-accent); }
.btn.go { background: var(--green); border-color: var(--green); color: var(--on-accent); }
.btn.quiet { background: transparent; border-color: transparent; color: var(--muted); }
.btn.small { min-height: 40px; padding: 0 10px; font-size: 15px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; }
.btnrow > .btn { flex: 1 1 auto; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px; }
.stack > * + * { margin-top: 12px; }
.muted { color: var(--muted); }
.num { font-family: var(--font-cond); font-weight: 600; letter-spacing: .01em; font-variant-numeric: tabular-nums; }
.h2 { font-size: 15px; font-weight: 600; color: var(--muted); margin: 24px 4px 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--panel-2); }
.chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--brown)); }

.field { display: block; }
.field > span { display: block; font-size: 14px; font-weight: 600; color: var(--muted); margin: 0 0 6px 2px; }
.input, .select, .textarea {
  width: 100%; min-height: 48px; padding: 10px 12px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--panel);
}
.textarea { min-height: 110px; resize: vertical; line-height: 1.4; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 > :first-child { grid-column: 1 / -1; }
@media (min-width: 560px) { .grid3 { grid-template-columns: 1.3fr 1fr 1fr; } .grid3 > :first-child { grid-column: auto; } }
.input[type="date"], .input[type="time"] { min-width: 0; }

.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; }
.switch input { appearance: none; width: 50px; height: 30px; border-radius: 999px; background: var(--line); position: relative; cursor: pointer; flex: none; transition: background .15s; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.switch input:checked { background: var(--green); }
.switch input:checked::after { transform: translateX(20px); }

.days { display: flex; gap: 6px; }
.days button { flex: 1; min-height: 44px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--panel); font-weight: 600; cursor: pointer; }
.days button[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }

.notice { border-radius: var(--radius); padding: 12px 14px; background: var(--warn-bg); border-left: 4px solid var(--orange); font-size: 15px; }
.notice.error { border-left-color: var(--danger); }
.empty { text-align: center; padding: 36px 20px; color: var(--muted); }
.empty p { margin: 0 0 14px; }
.skeleton { height: 92px; border-radius: var(--radius-lg); background: linear-gradient(90deg, var(--panel) 0, var(--panel-2) 50%, var(--panel) 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite; margin-bottom: 12px; }
@keyframes shimmer { to { background-position: -200% 0; } }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 60;
  top: calc(var(--safe-t) + 12px); max-width: calc(100% - 32px);
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: var(--radius); font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
}
.toast.error { background: var(--danger); }

/* ---------- day ---------- */
.dayhead { display: flex; align-items: center; gap: 4px; margin: 0 0 14px; }
.dayhead .when { flex: 1; text-align: center; }
.dayhead .dow { font: 700 26px/1.1 var(--font-cond); }
.dayhead .date { font-size: 15px; color: var(--muted); }

.job { display: grid; grid-template-columns: 78px 1fr; gap: 10px; margin-bottom: 12px; }
.job .clock { padding-top: 14px; text-align: right; }
.job .clock b { display: block; font: 700 22px/1 var(--font-cond); }
.job .clock span { display: block; font: 500 14px/1.3 var(--font-cond); color: var(--muted); }
.job .clock .until { margin-top: 6px; white-space: nowrap; }
.jobcard {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg);
  border-left: 6px solid var(--c, var(--blue)); padding: 12px 14px 14px; min-width: 0;
}
.jobcard .co { font-size: 19px; font-weight: 600; line-height: 1.25; }
.jobcard .sum { color: var(--muted); margin: 2px 0 6px; }
.jobcard .addr { font-size: 15px; margin-bottom: 10px; }
.jobcard .state { font-size: 13px; font-weight: 700; color: var(--c); margin-bottom: 2px; }

/* ---------- ticket ---------- */
.tkt-id { font: 700 18px var(--font-cond); color: var(--muted); }
.tkt-title { font-size: 24px; font-weight: 700; line-height: 1.2; margin: 2px 0 10px; }
.kv { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 16px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.note { border-left: 3px solid var(--line); padding: 2px 0 2px 12px; margin-bottom: 14px; }
.note[data-kind="internal"] { border-left-color: var(--brown); }
.note[data-kind="resolution"] { border-left-color: var(--green); }
.note .meta { font-size: 13px; color: var(--muted); margin-bottom: 2px; }
.note .body { white-space: pre-wrap; overflow-wrap: anywhere; }

.list { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--line); text-decoration: none; color: inherit; background: none; border-left: 0; border-right: 0; border-bottom: 0; width: 100%; text-align: left; cursor: pointer; }
.row:first-child { border-top: 0; }
.row .grow { flex: 1; min-width: 0; }
.row .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .sub { font-size: 14px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .title.wrap { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.row .sub .num { color: var(--text); }
.row > svg { color: var(--muted); width: 18px; height: 18px; }

.filters { display: grid; gap: 8px; margin: 12px 0 14px; }
.filters .seg { margin: 0; }
.trow { display: flex; align-items: center; gap: 12px; padding: 14px; border-top: 1px solid var(--line); text-decoration: none; color: inherit; }
.trow:first-child { border-top: 0; }
.trow .grow { flex: 1; min-width: 0; }
.trow > svg { color: var(--muted); width: 18px; height: 18px; }
.ttitle { font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tco { font-size: 15px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tmeta { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; margin-top: 8px; font-size: 14px; color: var(--muted); }
.tmeta .chip { font-size: 13px; padding: 2px 9px; color: var(--text); }
.tmeta .num { color: var(--text); font-size: 15px; }
@media (min-width: 700px) { .filters { grid-template-columns: 1fr 260px; align-items: center; } .filters .seg:only-child { grid-column: 1 / -1; } }

/* ---------- confirm card ---------- */
.confirm { border: 2px solid var(--blue); border-radius: var(--radius-lg); background: var(--panel); overflow: hidden; }
.confirm header { background: var(--blue); color: var(--on-accent); padding: 10px 14px; display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.confirm header b { font-weight: 600; }
.confirm header span { font-size: 14px; opacity: .9; white-space: nowrap; }
.confirm .body { padding: 12px 14px; }
.confirm .tline { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.confirm .hours { font: 700 30px/1 var(--font-cond); }
.confirm .span { font: 600 18px var(--font-cond); color: var(--muted); }
.confirm .wt { margin: 6px 0 10px; }
.confirm .wt small { color: var(--muted); }
.confirm .txt { white-space: pre-wrap; background: var(--panel-2); border-radius: var(--radius-sm); padding: 10px 12px; }
.confirm ul { margin: 6px 0 0; padding-left: 0; list-style: none; }
.confirm li { padding: 6px 0; border-top: 1px solid var(--line); display: flex; gap: 10px; }
.confirm li:first-child { border-top: 0; }
.confirm .qty { font: 700 18px var(--font-cond); min-width: 36px; }
.confirm .actions { padding: 0 14px 14px; }
.confirm[data-status="committed"] { border-color: var(--green); }
.confirm[data-status="committed"] header { background: var(--green); }
.confirm[data-status="discarded"] { opacity: .55; border-color: var(--line); }
.confirm[data-status="discarded"] header { background: var(--muted); }
.drymode { font-size: 13px; color: var(--muted); padding: 0 14px 12px; }

/* ---------- sheets ---------- */
.scrim { position: fixed; inset: 0; z-index: 50; background: rgba(11, 16, 21, .5); display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  width: 100%; max-width: 560px; max-height: 92vh; overflow: auto;
  background: var(--concrete); border-radius: 22px 22px 0 0; padding: 8px 16px calc(var(--safe-b) + 18px);
  animation: rise .18s ease-out;
}
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 4px auto 10px; }
.sheet h2 { font-size: 21px; margin: 4px 0 14px; }
@keyframes rise { from { transform: translateY(24px); opacity: .6; } }
@media (min-width: 700px) { .scrim { align-items: center; } .sheet { border-radius: 22px; padding-top: 18px; } .sheet .grab { display: none; } }
.question { font-size: 19px; font-weight: 600; line-height: 1.35; margin: 4px 0 16px; }
.choice { width: 100%; min-height: 60px; margin-bottom: 10px; font-size: 18px; }

/* ---------- assistant ---------- */
.chat { display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 88%; padding: 10px 14px; border-radius: 16px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.me { align-self: flex-end; background: var(--ink); color: #fff; border-bottom-right-radius: 6px; }
.msg.bot { align-self: flex-start; background: var(--panel); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.msg.me .heard { display: block; font-size: 12px; opacity: .7; margin-bottom: 2px; }
.composer {
  position: fixed; left: 0; right: 0; z-index: 25;
  bottom: calc(var(--tabbar-h) + var(--safe-b)); padding: 10px 16px; background: var(--concrete);
  border-top: 1px solid var(--line);
}
.composer form { max-width: 720px; margin: 0 auto; display: flex; gap: 8px; }
.composer .input { border-radius: 999px; padding: 0 18px; }
.assistant-main { padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 96px); }
.typing { align-self: flex-start; color: var(--muted); font-size: 15px; padding: 4px 6px; }
.hints { display: grid; gap: 8px; margin-top: 8px; }
.hints button { text-align: left; background: var(--panel); border: 1px dashed var(--line); border-radius: var(--radius); padding: 12px 14px; cursor: pointer; }

/* ---------- sign in ---------- */
.signin { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; background: var(--ink); color: #fff; }
.signin .box { width: 100%; max-width: 380px; }
.signin img { width: 72px; height: 72px; border-radius: 18px; }
.signin h1 { font: 700 40px/1 var(--font-cond); margin: 18px 0 6px; letter-spacing: .01em; }
.signin p { color: #b9c3cc; margin: 0 0 28px; }
.signin .btn { width: 100%; }
.signin .input { background: #fff; color: #18212b; margin-bottom: 10px; }

/* ---------- admin ---------- */
.seg { display: flex; background: var(--panel-2); border-radius: var(--radius); padding: 4px; gap: 4px; margin-bottom: 14px; }
.seg button { flex: 1; min-height: 40px; border: 0; border-radius: 9px; background: none; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--panel); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.urow { padding: 12px 14px; border-top: 1px solid var(--line); }
.urow:first-child { border-top: 0; }
.urow .top { display: flex; align-items: center; gap: 10px; }
.urow .who { flex: 1; min-width: 0; }
.urow .controls { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.urow .controls .select { min-height: 40px; padding: 6px 10px; font-size: 15px; }
.urow .perms { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; margin-top: 8px; }
.urow.dim b { color: var(--muted); font-weight: 500; }
.switch.mini { min-height: 40px; font-size: 15px; }
.switch.mini input { width: 42px; height: 26px; }
.switch.mini input::after { width: 20px; height: 20px; }
.switch.mini input:checked::after { transform: translateX(16px); }
.checkrow { cursor: pointer; }
.checkrow input { width: 22px; height: 22px; accent-color: var(--blue); flex: none; }

.synclist { display: grid; gap: 0; }
.syncrow { display: grid; grid-template-columns: 1fr auto auto; gap: 4px 14px; align-items: baseline; padding: 10px 0; border-top: 1px solid var(--line); }
.syncrow:first-child { border-top: 0; padding-top: 0; }
.syncrow .num { font-size: 18px; text-align: right; }
.syncrow .muted { font-size: 14px; min-width: 104px; text-align: right; }
.syncerr { grid-column: 1 / -1; color: var(--danger); font-size: 14px; }

/* ---------- desktop ---------- */
@media (min-width: 1000px) {
  .shell { flex-direction: row; }
  .tabbar {
    position: sticky; top: 0; height: 100vh; width: 92px; flex: none;
    display: flex; flex-direction: column; justify-content: flex-start; gap: 6px; padding: 18px 0;
    border-top: 0; border-right: 1px solid var(--line);
  }
  .tabbar .mic { order: 99; margin: auto 0 8px; }
  .tab { padding: 10px 0; width: 100%; }
  .content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
  .main { padding-bottom: 40px; }
  .topbar { padding-left: max(16px, calc((100% - 720px) / 2)); padding-right: max(16px, calc((100% - 720px) / 2)); }
  .composer { left: 92px; bottom: 0; }
  .assistant-main { padding-bottom: 110px; }
  .mic-timer { bottom: 28px; left: calc(50% + 46px); }
}
