/* =============================================================================
   CRM Śuka — mobile-first design system (no framework)
   Brand tokens come from shuka-ev.org: cream, dark green, plum, Poppins.
   ============================================================================= */
:root {
  --cream: #fdf6be;
  --cream-2: #fefae0;
  --green: #18724d;
  --green-2: #00aa5d;
  --green-soft: #e3f3ea;
  --plum: #9f5069;
  --plum-soft: #f7e6ec;
  --pink: #f49baf;
  --ink: #2e3a33;
  --text: #4b5148;
  --muted: #6b6e59;
  --line: #e8e3c9;
  --card: #ffffff;
  --amber: #b7791f;
  --amber-soft: #fdf0d5;
  --red: #b3261e;
  --red-soft: #fbe4e2;
  --grey-soft: #eeeee6;
  --radius: 22px;
  --radius-sm: 14px;
  --shadow: 0 6px 30px rgba(46, 58, 51, .07);
  --nav-h: 64px;
  --font: Poppins, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
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(--cream);
  min-height: 100vh;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
}
a { color: var(--plum); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { color: var(--green); line-height: 1.2; margin: 0 0 .5rem; font-weight: 700; }
h1 { font-size: 1.7rem; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .8rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.tiny { font-size: .75rem; }
.center { text-align: center; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85em; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.hide { display: none !important; }

/* ---- layout ------------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(253, 246, 190, .92);
  backdrop-filter: saturate(150%) blur(10px);
  -webkit-backdrop-filter: saturate(150%) blur(10px);
  padding: env(safe-area-inset-top) 0 0;
}
.topbar-inner {
  max-width: 1080px; margin: 0 auto; padding: 12px 18px;
  display: flex; align-items: center; gap: 12px;
}
.brand { display: flex; align-items: baseline; gap: 8px; color: var(--green); }
.brand-word { font-weight: 800; font-size: 1.25rem; letter-spacing: .04em; }
.brand-sub { font-size: .62rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.topbar .who { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: .85rem; color: var(--muted); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--green); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .8rem;
}
.avatar.soft { background: var(--green-soft); color: var(--green); }
.avatar.plum { background: var(--plum-soft); color: var(--plum); }

main.wrap { max-width: 1080px; margin: 0 auto; padding: 8px 18px 32px; }

/* Bottom navigation (mobile) → left rail on desktop */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: #fff; border-top: 1px solid var(--line);
  display: flex; justify-content: space-around;
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 20px rgba(46, 58, 51, .05);
}
.nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--muted); font-size: .68rem; font-weight: 500; padding: 4px 0; border-radius: 12px; position: relative;
}
.nav a svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav a.active { color: var(--green); }
.nav a.active svg { stroke-width: 2.2; }
.nav .dot {
  position: absolute; top: 2px; right: calc(50% - 16px);
  min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
  background: var(--plum); color: #fff; font-size: .62rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
@media (min-width: 900px) {
  body { padding-bottom: 0; }
  .nav {
    top: 0; bottom: 0; right: auto; width: 88px; flex-direction: column; justify-content: flex-start;
    border-top: 0; border-right: 1px solid var(--line); padding: 92px 8px 12px; gap: 6px; box-shadow: none;
  }
  .nav a { flex: 0 0 auto; padding: 10px 0; }
  .nav a:hover { background: var(--cream-2); text-decoration: none; }
  .nav a.active { background: var(--green-soft); }
  .nav .dot { right: 14px; top: 6px; }
  .topbar-inner, main.wrap { padding-left: 112px; }
  main.wrap { padding-right: 32px; }
}

/* ---- cards / lists -------------------------------------------------------- */
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; margin-bottom: 14px;
}
.card.tight { padding: 12px 14px; }
.card.soft { background: var(--cream-2); box-shadow: none; border: 1px solid var(--line); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.card-head h2 { margin: 0; }
.grid { display: grid; gap: 14px; }
@media (min-width: 720px) { .grid.two { grid-template-columns: 1fr 1fr; } .grid.three { grid-template-columns: repeat(3, 1fr); } }

.list { display: flex; flex-direction: column; }
.row {
  display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); color: inherit;
}
.row:first-child { border-top: 0; }
a.row:hover { text-decoration: none; background: linear-gradient(90deg, transparent, var(--cream-2) 30%, transparent); }
.row .grow { flex: 1; min-width: 0; }
.row .title { font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .sub { font-size: .82rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .chev { color: #b9b7a3; }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
@media (min-width: 720px) { .kpis { grid-template-columns: repeat(4, 1fr); } }
.kpi { background: #fff; border-radius: var(--radius-sm); padding: 14px; box-shadow: var(--shadow); }
.kpi .n { font-size: 1.7rem; font-weight: 800; color: var(--green); line-height: 1; }
.kpi .l { font-size: .75rem; color: var(--muted); margin-top: 4px; }
.kpi.warn .n { color: var(--amber); }
.kpi.plum .n { color: var(--plum); }

/* Day hero (today's tour) */
.hero {
  background: var(--green); color: #fff; border-radius: var(--radius); padding: 20px; margin-bottom: 14px;
  background-image: radial-gradient(circle at 90% -20%, rgba(255,255,255,.18), transparent 45%);
}
.hero h2, .hero h1 { color: #fff; }
.hero .big { font-size: 2.4rem; font-weight: 800; line-height: 1; }
.hero .muted { color: rgba(255,255,255,.75); }
.hero .btn { background: #fff; color: var(--green); }
.hero .btn:hover { background: var(--cream); }
.hero .btn-ghost { background: transparent; color: #fff; border: 1.5px solid rgba(255,255,255,.45); }
.hero .btn-ghost:hover { background: rgba(255,255,255,.14); }
.hero.amber { background: var(--amber); }
.hero.amber .btn { color: var(--amber); }
.hero.quiet { background: #fff; color: var(--ink); }
.hero.quiet h2 { color: var(--green); }
.hero.quiet .muted { color: var(--muted); }

/* Day strip (next 14 days) */
.strip { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 10px; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
.strip::-webkit-scrollbar { display: none; }
.day {
  flex: 0 0 76px; scroll-snap-align: start; background: #fff; border-radius: var(--radius-sm); padding: 10px 6px;
  text-align: center; box-shadow: var(--shadow); color: var(--ink); border: 2px solid transparent;
}
.day:hover { text-decoration: none; }
.day .wd { font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.day .dn { font-size: 1.35rem; font-weight: 800; line-height: 1.1; color: var(--green); }
.day .cnt { font-size: .78rem; font-weight: 600; margin-top: 4px; }
.day.today { border-color: var(--green); }
.day.has { background: var(--green-soft); }
.day.need { background: var(--amber-soft); }
.day.need .cnt { color: var(--amber); }
.day.full .cnt { color: var(--plum); }
.day.closed { opacity: .55; background: var(--grey-soft); }
.day.empty .cnt { color: #b9b7a3; font-weight: 400; }

/* Pills */
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .72rem; font-weight: 600; white-space: nowrap; }
.pill-green { background: var(--green-soft); color: var(--green); }
.pill-amber { background: var(--amber-soft); color: var(--amber); }
.pill-red { background: var(--red-soft); color: var(--red); }
.pill-plum { background: var(--plum-soft); color: var(--plum); }
.pill-grey { background: var(--grey-soft); color: var(--muted); }

/* Progress (seats) */
.seats { display: flex; gap: 4px; margin: 6px 0; }
.seats i { flex: 1; height: 8px; border-radius: 4px; background: var(--grey-soft); }
.seats i.on { background: var(--green-2); }
.seats i.pend { background: var(--amber); }

/* ---- buttons / forms ------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 999px; padding: 12px 20px; font: inherit; font-weight: 600; font-size: .95rem;
  background: var(--green); color: #fff; cursor: pointer; transition: transform .05s ease, background .15s;
  text-decoration: none !important; -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: #135d3f; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 14px; font-size: .82rem; }
.btn-xs { padding: 5px 10px; font-size: .75rem; }
.btn-soft { background: var(--green-soft); color: var(--green); }
.btn-soft:hover { background: #d3ebdc; }
.btn-plum { background: var(--plum); }
.btn-plum:hover { background: #86415a; }
.btn-ghost { background: transparent; color: var(--muted); border: 1.5px solid var(--line); }
.btn-ghost:hover { background: var(--cream-2); }
.btn-danger { background: var(--red); }
.btn-danger:hover { background: #8f1c15; }
.btn-cream { background: var(--cream); color: var(--ink); }
.btn-cream:hover { background: #f8ee9c; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.actions.end { justify-content: flex-end; }

label { display: block; font-weight: 600; font-size: .85rem; margin-bottom: 6px; color: var(--ink); }
label .opt { color: var(--muted); font-weight: 400; }
.field { margin-bottom: 14px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=time], input[type=date], input[type=search], input[type=tel], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: #fff;
  border: 1.5px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--green-2); box-shadow: 0 0 0 4px rgba(0, 170, 93, .12); }
textarea { min-height: 110px; resize: vertical; }
input[type=time] { font-size: 1.4rem; font-weight: 700; color: var(--green); text-align: center; letter-spacing: .02em; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 500; font-size: .9rem; }
.check input { width: 20px; height: 20px; accent-color: var(--green); }
.help { font-size: .78rem; color: var(--muted); margin-top: 4px; }
.inline { display: flex; gap: 10px; align-items: flex-end; }
.inline > * { flex: 1; }

/* Quick time chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: 7px 14px;
  font: inherit; font-weight: 600; font-size: .85rem; color: var(--ink); cursor: pointer;
}
.chip:hover, .chip.on { border-color: var(--green); background: var(--green-soft); color: var(--green); }

/* Segmented filter tabs */
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 8px; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { flex: 0 0 auto; padding: 7px 14px; border-radius: 999px; font-size: .85rem; font-weight: 600; color: var(--muted); background: #fff; border: 1.5px solid var(--line); }
.tabs a.on { background: var(--green); border-color: var(--green); color: #fff; }
.tabs a:hover { text-decoration: none; }

/* Flash */
.flash { border-radius: var(--radius-sm); padding: 12px 16px; margin-bottom: 12px; font-weight: 500; display: flex; gap: 10px; align-items: flex-start; }
.flash.success { background: var(--green-soft); color: var(--green); }
.flash.error { background: var(--red-soft); color: var(--red); }
.flash.info { background: var(--plum-soft); color: var(--plum); }
.flash.warning { background: var(--amber-soft); color: var(--amber); }

/* Tables (desktop detail) */
table.tbl { width: 100%; border-collapse: collapse; font-size: .88rem; }
.tbl th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl-wrap { overflow-x: auto; }

/* Detail definition list */
.dl { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; font-size: .9rem; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; }

/* Message bubble (inbox) */
.bubble { background: var(--cream-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; white-space: pre-wrap; word-wrap: break-word; }
.bubble.reply { background: var(--green-soft); border-color: transparent; }

/* Modal (bottom sheet on mobile) */
.sheet-bg { position: fixed; inset: 0; background: rgba(46, 58, 51, .45); z-index: 40; display: none; }
.sheet-bg.open { display: block; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; background: #fff; border-radius: 24px 24px 0 0;
  padding: 18px 18px calc(18px + env(safe-area-inset-bottom)); transform: translateY(100%); transition: transform .22s ease;
  max-height: 92vh; overflow: auto;
}
.sheet.open { transform: translateY(0); }
.sheet .handle { width: 44px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 14px; }
@media (min-width: 720px) {
  .sheet { left: 50%; right: auto; bottom: auto; top: 50%; width: 520px; border-radius: var(--radius); transform: translate(-50%, -50%) scale(.98); opacity: 0; pointer-events: none; }
  .sheet.open { transform: translate(-50%, -50%) scale(1); opacity: 1; pointer-events: auto; }
  .sheet .handle { display: none; }
}

/* Toast */
.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 16px); transform: translateX(-50%) translateY(20px); opacity: 0;
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: .85rem; z-index: 50; transition: all .2s; pointer-events: none; max-width: 90vw; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (min-width: 900px) { .toast { bottom: 24px; } }

/* Pager */
.pager { display: flex; justify-content: center; gap: 8px; margin-top: 12px; }

/* Empty state */
.empty { text-align: center; padding: 30px 10px; color: var(--muted); }
.empty .ico { font-size: 2rem; margin-bottom: 6px; }

/* ---- public pages (login / cancel) ---------------------------------------- */
body.public { display: flex; align-items: center; justify-content: center; padding: 20px; }
.public-card { width: 100%; max-width: 440px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px 24px; }
.public-card .brand { margin-bottom: 18px; }
.public-card h1 { font-size: 1.5rem; }
.public-footer { margin-top: 22px; font-size: .78rem; color: var(--muted); text-align: center; }

/* Utilities */
.mt { margin-top: 12px; } .mt2 { margin-top: 20px; } .mb0 { margin-bottom: 0; } .mb { margin-bottom: 12px; }
.flex { display: flex; align-items: center; gap: 10px; } .between { justify-content: space-between; } .wrapf { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.ico { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -4px; }
code.k { background: var(--cream-2); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; font-size: .82em; }
