/* ============ Owner area ============ */
:root {
  --ink: #1d1420;
  --plum: #6d2b86;
  --plum-dark: #521d66;
  --lilac: #cb6ce6;
  --soft: #f4ecf7;
  --page: #f6f3f7;
  --card: #ffffff;
  --muted: #6b5f70;
  --line: #e7dfea;
  --ok: #2f7a4a;
  --ok-soft: #e4f3e9;
  --bad: #b0261c;
  --r: 18px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font: 15.5px/1.5 var(--font); color: var(--ink); background: var(--page); -webkit-text-size-adjust: 100%; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.02em; margin: 0 0 .5em; }
h3 { font-size: 1.02rem; margin-top: 22px; }
a { color: var(--plum); }
p { margin: 0 0 .6em; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: .84rem; }
.center { text-align: center; }
.hint { font-size: .84rem; color: var(--muted); margin: 8px 0 0; }
:focus-visible { outline: 3px solid var(--lilac); outline-offset: 2px; }
.notice { background: #fff3cd; color: #5c4400; text-align: center; font-size: .8rem; padding: 5px 16px; margin: 0; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 20px; border: 1.5px solid var(--plum); border-radius: 999px; background: var(--plum); color: #fff; font: 700 .94rem var(--font); text-decoration: none; cursor: pointer; transition: background .25s var(--ease), transform .2s var(--ease); }
.btn:hover { background: var(--plum-dark); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: wait; }
.btn.small { min-height: 40px; padding: 6px 14px; font-size: .86rem; }
.btn.ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--plum); background: #fff; }
.btn.danger { background: #fff; border-color: #ebc9c5; color: var(--bad); }
.btn.danger.armed { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn svg { width: 18px; height: 18px; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 12px; background: transparent; color: var(--ink); cursor: pointer; transition: background .2s; }
.icon-btn:hover { background: var(--soft); }
.icon-btn:disabled { opacity: .25; cursor: default; background: none; }
.icon-btn.round { border-radius: 50%; background: #fff; border: 1px solid var(--line); width: 44px; height: 44px; }
.chip-btn { min-height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font: 600 .86rem var(--font); color: var(--ink); cursor: pointer; }
.chip-btn:hover { border-color: var(--plum); }
.link { background: none; border: 0; color: var(--plum); text-decoration: underline; font: inherit; cursor: pointer; min-height: 40px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0; }
.row.tight { margin: 0; }
.row.end { justify-content: flex-end; margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--line); }

/* Top bar */
.bar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px max(16px, env(safe-area-inset-left)); background: rgb(255 255 255 / 92%); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.bar-brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; min-width: 0; }
.bar-brand img { border-radius: 10px; }
.bar-brand span { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.bar-brand b { font-size: .95rem; white-space: nowrap; }
.bar-brand small { font-size: .74rem; color: var(--muted); white-space: nowrap; }
.bar-actions { display: flex; align-items: center; gap: 6px; }
.lang { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--soft); }
.lang button { min-width: 38px; height: 32px; border: 0; border-radius: 999px; background: transparent; font: 700 .76rem var(--font); color: var(--muted); cursor: pointer; }
.lang button[aria-pressed="true"] { background: #fff; color: var(--plum); box-shadow: 0 1px 4px rgb(0 0 0 / 10%); }

/* Tabs: in the bar on computers, at the bottom on phones */
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--soft); border-radius: 999px; }
.tabs button { position: relative; display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 16px; border: 0; border-radius: 999px; background: transparent; font: 600 .88rem var(--font); color: var(--muted); cursor: pointer; transition: background .25s var(--ease), color .25s var(--ease); }
.tabs button[aria-current] { background: #fff; color: var(--plum); box-shadow: 0 1px 6px rgb(29 20 32 / 10%); }
.tabs svg { width: 18px; height: 18px; }
.count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--lilac); color: #fff; font: 700 .72rem/20px var(--font); text-align: center; font-style: normal; }

/* Layout */
.app { width: min(1180px, 100% - 28px); margin: 0 auto; padding: 22px 0 110px; }
.view { animation: viewIn .35s var(--ease); }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } }
.toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.toolbar h1 { font-size: 1.4rem; margin: 0; }
.compact { width: auto; min-height: 40px; padding: 6px 12px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin: 0 0 16px; }
.stats div { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; }
.stats b { display: block; font-size: 1.25rem; letter-spacing: -.02em; overflow-wrap: anywhere; }
.stats span { font-size: .78rem; color: var(--muted); }
.empty { background: var(--card); border: 1.5px dashed var(--line); border-radius: var(--r); padding: 32px 20px; text-align: center; color: var(--muted); }
.empty .btn { margin-top: 8px; }

/* Day */
.day-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.day-title { position: relative; text-align: center; flex: 1; }
.day-title h1 { font-size: 1.6rem; margin: 0; }
.kicker { font-size: .76rem; letter-spacing: .14em; text-transform: uppercase; font-weight: 700; color: var(--plum); margin: 0; }
.date-pick { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; min-height: 0; }
.date-pick::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: 100%; height: 100%; cursor: pointer; }
.view-day .center { margin-bottom: 14px; }
.route-card { background: var(--ink); color: #fff; border-radius: var(--r); padding: 18px; margin-bottom: 18px; }
.route-top { display: flex; gap: 12px; align-items: flex-start; }
.route-top p { color: #d6cbdb; font-size: .86rem; margin: 2px 0 0; overflow-wrap: anywhere; }
.route-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: rgb(203 108 230 / 20%); color: var(--lilac); flex: none; }
.route-card .btn { background: var(--lilac); border-color: var(--lilac); color: var(--ink); }
.route-card .btn.ghost { background: transparent; color: #fff; border-color: rgb(255 255 255 / 30%); }
.route-card .hint { color: #cbbfd0; }
.route-card .row { margin-bottom: 0; }
.stops { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; counter-reset: s; }
.stop { position: relative; display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; transition: box-shadow .3s var(--ease), opacity .3s; }
.stop:hover { box-shadow: 0 10px 26px rgb(29 20 32 / 7%); }
.stop::before { content: ""; position: absolute; left: 30px; top: -13px; height: 12px; border-left: 2px dashed var(--line); }
.stop:first-child::before { display: none; }
.stop-num { width: 34px; height: 34px; border-radius: 50%; background: var(--plum); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: .92rem; }
.stop.done .stop-num { background: var(--ok); }
.stop.cancelled { opacity: .55; }
.stop.cancelled .stop-num { background: #999; }
.stop-main { display: flex; flex-direction: column; gap: 3px; width: 100%; text-align: left; background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; min-width: 0; }
.stop-main b { font-size: 1.05rem; }
.stop-time { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-weight: 700; color: var(--plum); font-size: .86rem; }
.stop-addr, .stop-note { display: flex; gap: 6px; align-items: flex-start; color: var(--muted); font-size: .88rem; overflow-wrap: anywhere; }
.stop-addr svg, .stop-note svg { width: 16px; height: 16px; margin-top: 2px; }
.stop-note { color: #7a5a1c; background: #fdf6e7; border-radius: 10px; padding: 6px 8px; margin-top: 4px; }
.stop-meta { font-size: .88rem; }
.stop-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.act { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--ink); font: 600 .8rem var(--font); text-decoration: none; cursor: pointer; transition: all .2s var(--ease); }
.act svg { width: 16px; height: 16px; }
.act:hover { border-color: var(--plum); }
.act.on { background: var(--ok-soft); border-color: #b9dcc5; color: var(--ok); }
.stop-order { display: flex; flex-direction: column; gap: 2px; }
.tag { display: inline-block; font-style: normal; font-size: .72rem; font-weight: 700; border-radius: 99px; padding: 2px 9px; background: var(--soft); color: var(--plum); white-space: nowrap; }
.tag.done, .tag.paid, .tag.booked { background: var(--ok-soft); color: var(--ok); }
.tag.cancelled, .tag.declined { background: #eee; color: #555; }
.tag.new { background: var(--lilac); color: #fff; }
.fab { position: fixed; right: max(20px, calc((100vw - 1180px) / 2)); bottom: 24px; z-index: 15; display: inline-flex; align-items: center; gap: 8px; min-height: 54px; padding: 0 22px; border: 0; border-radius: 999px; background: var(--ink); color: #fff; font: 700 .94rem var(--font); cursor: pointer; box-shadow: 0 14px 30px rgb(29 20 32 / 28%); transition: transform .25s var(--ease); }
.fab:hover { transform: translateY(-2px); }

/* Week */
.week { display: grid; gap: 10px; }
.wday { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 10px; min-width: 0; }
.wday.today { border: 2px solid var(--plum); }
.wday header { display: flex; justify-content: space-between; align-items: center; }
.wday-title { display: flex; align-items: baseline; gap: 6px; background: none; border: 0; padding: 4px; font: inherit; color: var(--ink); cursor: pointer; text-transform: capitalize; }
.wday-title span { font-size: .82rem; color: var(--muted); font-weight: 600; }
.wday-title b { font-size: 1.15rem; }
.wjob { display: flex; flex-direction: column; width: 100%; margin-top: 8px; padding: 9px 10px; border: 0; border-left: 4px solid var(--plum); border-radius: 10px; background: var(--soft); text-align: left; font: inherit; font-size: .86rem; line-height: 1.35; color: var(--ink); cursor: pointer; overflow-wrap: anywhere; }
.wjob.done { border-left-color: var(--ok); }
.wjob.cancelled { opacity: .55; text-decoration: line-through; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.free { color: var(--muted); font-size: .82rem; margin: 8px 4px; }

/* Lists */
.list { display: grid; gap: 8px; margin-top: 12px; }
.item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; text-align: left; font: inherit; color: var(--ink); cursor: pointer; transition: border-color .2s, box-shadow .2s; }
.item:hover { border-color: #d4c3db; box-shadow: 0 6px 16px rgb(29 20 32 / 5%); }
.item-main { display: flex; flex-direction: column; min-width: 0; flex: 1; overflow-wrap: anywhere; }
.avatar { width: 42px; height: 42px; border-radius: 50%; background: var(--soft); color: var(--plum); display: grid; place-items: center; font-weight: 800; font-size: .86rem; flex: none; }
.search { margin-top: 4px; }

/* Forms */
label { display: flex; flex-direction: column; gap: 5px; font-weight: 600; font-size: .86rem; min-width: 0; }
input, select, textarea { font: inherit; font-size: 16px; font-weight: 500; width: 100%; min-height: 48px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--plum); box-shadow: 0 0 0 4px rgb(203 108 230 / 16%); }
textarea { resize: vertical; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.full { grid-column: 1 / -1; }
.section-label { font-size: .76rem; letter-spacing: .12em; text-transform: uppercase; font-weight: 700; color: var(--plum); margin: 8px 0 -4px; }
.check { flex-direction: row; align-items: center; gap: 10px; font-weight: 500; }
.check input { width: 22px; height: 22px; min-height: 0; flex: none; margin: 0; accent-color: var(--plum); }
.info { background: var(--soft); border-radius: 14px; padding: 12px 14px; margin-bottom: 18px; overflow-wrap: anywhere; }
.info p { margin: 0 0 4px; display: flex; gap: 6px; align-items: flex-start; flex-wrap: wrap; }
.info .row { margin-bottom: 0; }
dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 16px 0; }
dt { color: var(--muted); font-size: .86rem; }
dd { margin: 0; overflow-wrap: anywhere; white-space: pre-line; }

/* Drawer */
dialog { width: min(560px, 100%); max-width: 100%; height: 100%; max-height: 100%; margin: 0 0 0 auto; border: 0; padding: 0 20px 40px; color: var(--ink); background: #fff; overflow-x: hidden; }
dialog[open] { animation: drawerIn .35s var(--ease); }
@keyframes drawerIn { from { transform: translateX(40px); opacity: 0; } }
dialog::backdrop { background: rgb(20 10 25 / 45%); backdrop-filter: blur(2px); }
.drawer-head { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 0; margin-bottom: 8px; background: #fff; border-bottom: 1px solid var(--line); }
.drawer-head h2 { margin: 0; font-size: 1.25rem; overflow-wrap: anywhere; min-width: 0; }

/* Sign in */
.auth { max-width: 420px; margin: 6vh auto 0; background: #fff; border: 1px solid var(--line); border-radius: 24px; padding: 30px 24px; }
.auth-logo { display: block; width: 190px; margin: 0 auto 14px; }
.auth h1 { text-align: center; font-size: 1.3rem; margin-bottom: 18px; }
.auth .grid { grid-template-columns: 1fr; }
.auth .row { justify-content: space-between; }
.auth .btn { flex: 1; }

#toast { position: fixed; left: 50%; bottom: 92px; transform: translate(-50%, 12px); width: max-content; max-width: calc(100% - 32px); background: var(--ink); color: #fff; border-radius: 14px; padding: 12px 18px; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s var(--ease); z-index: 40; font-weight: 600; font-size: .92rem; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.bad { background: var(--bad); }

@media (min-width: 1000px) {
  .week { grid-template-columns: repeat(7, minmax(0, 1fr)); align-items: start; }
  .wday { min-height: 280px; }
  .view-day { max-width: 760px; margin: 0 auto; }
}
/* Phones: bottom navigation like an app */
@media (max-width: 860px) {
  .tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; justify-content: space-around; gap: 0; border-radius: 0; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); background: rgb(255 255 255 / 96%); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line); }
  .tabs button { flex: 1; flex-direction: column; gap: 2px; min-height: 52px; padding: 4px 2px; font-size: .72rem; border-radius: 14px; }
  .tabs button[aria-current] { background: var(--soft); box-shadow: none; }
  .tabs svg { width: 22px; height: 22px; }
  .count { position: absolute; top: 2px; left: calc(50% + 6px); }
  body.signed .app { padding-bottom: 170px; }
  .fab { bottom: calc(80px + env(safe-area-inset-bottom)); right: 16px; }
  .fab span { display: none; }
  .fab { width: 58px; padding: 0; justify-content: center; }
  .grid { grid-template-columns: 1fr; }
  #toast { bottom: calc(150px + env(safe-area-inset-bottom)); }
  .bar-brand small { display: none; }
  /* a blurred bar would trap the fixed bottom menu inside it */
  .bar { backdrop-filter: none; -webkit-backdrop-filter: none; background: #fff; }
  .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .stats div { padding: 9px 8px; border-radius: 12px; text-align: center; }
  .stats b { font-size: clamp(.78rem, 3.6vw, 1rem); white-space: nowrap; }
  .stats span { font-size: .7rem; }
}
@media (max-width: 420px) {
  .stop { grid-template-columns: 30px minmax(0, 1fr); padding: 12px; }
  .stop-num { width: 30px; height: 30px; }
  .stop-order { grid-column: 1 / -1; flex-direction: row; justify-content: flex-end; margin-top: -6px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
