/* ============================================================
   ShiftBud — shared design system
   Warm restaurant palette: forest green + warm paper
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,400..800&family=Hanken+Grotesk:wght@400..800&family=Spectral:ital,wght@0,400;0,500;0,600;0,700;1,400&family=Spline+Sans+Mono:wght@400;500;600&display=swap');

:root {
  /* paper / surfaces */
  --bg:          #f3f1ea;
  --bg-deep:     #ece8dd;
  --surface:     #ffffff;
  --surface-2:   #faf8f2;
  --border:      #e4e0d4;
  --border-2:    #d9d4c5;

  /* greens */
  --green:        #2d6a4f;
  --green-deep:   #1b4332;
  --green-700:    #235741;
  --green-light:  #52b788;
  --green-mist:   #e6efe9;
  --green-mist-2: #d6e6dc;

  /* warm accents */
  --amber:     #b45309;
  --amber-bg:  #fbe7d2;
  --plum:      #7c5295;
  --plum-bg:   #ece1f1;
  --terra:     #c0492f;
  --terra-bg:  #f8ddd6;
  --teal:      #2a7d77;

  /* semantic status colors: green=confirmed, orange=pending, red=conflict */
  --st-green:  #157f47;
  --st-orange: #e07d10;
  --st-red:    #d23123;

  /* ink */
  --ink:       #20231f;
  --ink-2:     #4a4d44;
  --muted:     #7c7e72;
  --faint:     #a7a89b;

  --radius:    14px;
  --radius-sm: 9px;
  --radius-lg: 20px;

  --shadow-sm: 0 1px 2px rgba(31,40,30,.05), 0 1px 3px rgba(31,40,30,.04);
  --shadow:    0 2px 6px rgba(31,40,30,.06), 0 8px 24px rgba(31,40,30,.06);
  --shadow-lg: 0 12px 40px rgba(27,40,30,.16);

  --font-body:    'Hanken Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Bricolage Grotesque', var(--font-body);
  --font-mono:    'Spline Sans Mono', ui-monospace, monospace;
}

/* ---- Dark theme ---- */
[data-theme="dark"] {
  --bg:          #15171a;
  --bg-deep:     #0f1113;
  --surface:     #1d2024;
  --surface-2:   #23272c;
  --border:      #2e333a;
  --border-2:    #3a4048;

  --green:        #3fa06e;
  --green-deep:   #14241c;
  --green-700:    #2e7d57;
  --green-light:  #57c08c;
  --green-mist:   #1c2b24;
  --green-mist-2: #24382e;

  --amber:     #e0913a;
  --amber-bg:  #3a2c16;
  --plum:      #b08fc7;
  --plum-bg:   #2e2536;
  --terra:     #e0795f;
  --terra-bg:  #3a221b;
  --teal:      #4bb0a8;

  --st-green:  #3aa86a;
  --st-orange: #e89233;
  --st-red:    #e0584a;

  --ink:       #e8e9e4;
  --ink-2:     #b3b6ad;
  --muted:     #8b8f85;
  --faint:     #6a6e66;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.3), 0 1px 3px rgba(0,0,0,.25);
  --shadow:    0 2px 6px rgba(0,0,0,.35), 0 8px 24px rgba(0,0,0,.3);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.5);
}
html { transition: background .25s ease; }

* , *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button { font-family: inherit; cursor: pointer; }
::selection { background: var(--green-mist-2); }

/* scrollbars */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 20px; border: 3px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--faint); background-clip: padding-box; border: 3px solid transparent; }

/* ---------------- Typography helpers ---------------- */
.display { font-family: var(--font-display); letter-spacing: -.02em; }
.mono    { font-family: var(--font-mono); }
.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 600;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted);
}

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid transparent; border-radius: 10px;
  padding: 9px 15px; font-size: 13.5px; font-weight: 600;
  transition: all .16s ease; white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--green); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--green-deep); transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-ghost { background: var(--surface); color: var(--ink-2); border-color: var(--border-2); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--faint); color: var(--ink); }
.btn-soft { background: var(--green-mist); color: var(--green-deep); }
.btn-soft:hover { background: var(--green-mist-2); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.btn:disabled { opacity: .45; pointer-events: none; }

.icon-btn {
  display: grid; place-items: center;
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--border-2);
  color: var(--ink-2); transition: all .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); border-color: var(--faint); }
.icon-btn svg { width: 18px; height: 18px; }

/* ---------------- Card ---------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 20px 22px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 16px 22px; border-bottom: 1px solid var(--border);
}
.card-head h3 { font-size: 15px; font-weight: 700; letter-spacing: -.01em; }

/* ---------------- Avatar ---------------- */
.avatar {
  --sz: 36px;
  width: var(--sz); height: var(--sz);
  border-radius: 50%; flex: none;
  display: grid; place-items: center;
  font-weight: 700; font-size: calc(var(--sz) * .38);
  color: #fff; letter-spacing: .01em;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.25);
  position: relative;
}
.avatar .on-dot {
  position: absolute; right: -1px; bottom: -1px;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--green-light); border: 2.5px solid var(--surface);
}
.avatar-stack { display: flex; }
.avatar-stack .avatar { margin-left: -10px; box-shadow: inset 0 0 0 2px rgba(255,255,255,.25), 0 0 0 2.5px var(--surface); }
.avatar-stack .avatar:first-child { margin-left: 0; }

/* ---------------- Badge / status ---------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 20px;
  font-size: 11.5px; font-weight: 600; line-height: 1.4;
  white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st-pending        { background: #fbe6cc; color: #9a5400; }
.st-confirmed      { background: #d6f0e0; color: #0f6a3f; }
.st-swap_requested { background: #f9ddd8; color: #a8281a; }
.st-cancelled      { background: #f9ddd8; color: #a8281a; }
.st-covered        { background: #d6f0e0; color: #0f6a3f; }

.role-tag {
  font-family: var(--font-mono);
  font-size: 10.5px; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; color: var(--muted);
}

/* ---------------- Coverage bar ---------------- */
.cov-track { height: 9px; border-radius: 20px; background: var(--bg-deep); overflow: hidden; }
.cov-fill  { height: 100%; border-radius: 20px; background: linear-gradient(90deg, var(--green-light), var(--green)); transition: width .5s cubic-bezier(.2,.7,.2,1); }
.cov-fill.warn { background: linear-gradient(90deg, #e8b06a, var(--amber)); }
.cov-fill.bad  { background: linear-gradient(90deg, #e08a72, var(--terra)); }

/* ---------------- Timeline (week schedule) ---------------- */
.tl {
  display: grid;
  grid-template-columns: 46px repeat(7, 1fr);
  gap: 0;
  position: relative;
}
.tl-axis { position: relative; }
.tl-axis .hr {
  position: absolute; right: 8px; transform: translateY(-50%);
  font-family: var(--font-mono); font-size: 10px; color: var(--faint);
}
.tl-col { position: relative; border-left: 1px solid var(--border); }
.tl-col.is-today { background: linear-gradient(180deg, rgba(82,183,136,.07), rgba(82,183,136,0)); }
.tl-colhead {
  text-align: center; padding: 8px 0 10px;
  border-bottom: 1px solid var(--border);
}
.tl-colhead .dow { font-family: var(--font-mono); font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.tl-colhead .dnum { font-family: var(--font-display); font-size: 19px; font-weight: 700; margin-top: 2px; }
.tl-colhead.is-today .dnum { color: var(--green); }
.tl-colhead.is-today .today-pip { display:inline-block; width:5px;height:5px;border-radius:50%;background:var(--green);margin-left:5px;vertical-align:middle; }

.tl-gridlines { position: absolute; inset: 0; pointer-events: none; }
.tl-gridlines .gl { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--border); }

.tl-track { position: relative; }
.tl-now { position: absolute; left: 0; right: 0; height: 0; border-top: 2px solid var(--st-red); z-index: 8; pointer-events: none; }
.tl-now-dot { position: absolute; left: -1px; top: -4px; width: 7px; height: 7px; border-radius: 50%; background: var(--st-red); }
.shift-bar {
  position: absolute; left: 5px; right: 5px;
  border-radius: 8px; padding: 6px 8px; overflow: hidden;
  cursor: pointer; transition: transform .13s ease, box-shadow .13s ease, filter .13s;
  border: 1px solid rgba(0,0,0,.05);
  color: #fff; font-size: 11.5px; min-height: 24px;
}
.shift-bar:hover { transform: translateX(-1px) scale(1.015); box-shadow: var(--shadow); z-index: 5; filter: brightness(1.04); }
.shift-bar .sb-name { font-weight: 700; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shift-bar .sb-time { font-family: var(--font-mono); font-size: 10px; opacity: .9; margin-top: 1px; }
.shift-bar.is-cancelled { background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.16) 0 6px, transparent 6px 12px); opacity: .8; }
.shift-bar .sb-flag { position: absolute; top: 5px; right: 6px; font-size: 10px; }
.shift-bar.compact { padding: 3px 5px; }
.shift-bar.compact .sb-name { font-size: 10.5px; letter-spacing: .02em; }
.shift-bar.compact .sb-flag { top: 2px; right: 3px; font-size: 9px; }

/* ---------------- Alert item ---------------- */
.alert-item {
  display: flex; gap: 12px; padding: 14px 16px;
  border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); transition: all .16s;
}
.alert-item:hover { box-shadow: var(--shadow-sm); border-color: var(--border-2); }
.alert-item.urgent { border-color: #ecc4b8; background: linear-gradient(180deg, #fdf3ef, var(--surface) 60%); }
.alert-ico { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.alert-ico svg { width: 19px; height: 19px; }
.alert-body { flex: 1; min-width: 0; }
.alert-body .at { font-weight: 700; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.alert-body .ad { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; line-height: 1.4; }
.alert-meta { font-family: var(--font-mono); font-size: 10.5px; color: var(--faint); margin-top: 6px; }

/* ---------------- Task item ---------------- */
.task-item { display: flex; align-items: flex-start; gap: 11px; padding: 11px 4px; border-bottom: 1px solid var(--border); }
.task-item:last-child { border-bottom: none; }
.task-check {
  width: 20px; height: 20px; border-radius: 6px; flex: none; margin-top: 1px;
  border: 1.8px solid var(--border-2); background: var(--surface);
  display: grid; place-items: center; transition: all .15s; cursor: pointer;
}
.task-check:hover { border-color: var(--green-light); }
.task-check.done { background: var(--green); border-color: var(--green); }
.task-check svg { width: 12px; height: 12px; color: #fff; opacity: 0; transition: opacity .12s; }
.task-check.done svg { opacity: 1; }
.task-text { flex: 1; min-width: 0; }
.task-text .tt { font-size: 13.5px; font-weight: 600; }
.task-item.is-done .tt { text-decoration: line-through; color: var(--faint); }
.task-text .td { font-size: 12px; color: var(--muted); margin-top: 1px; }

/* ---------------- Message bubble (WhatsApp inbox) ---------------- */
.msg-row { display: flex; gap: 10px; margin-bottom: 14px; }
.msg-row.out { flex-direction: row-reverse; }
.bubble { max-width: 78%; padding: 9px 13px; border-radius: 14px; font-size: 13px; line-height: 1.45; box-shadow: var(--shadow-sm); white-space: pre-wrap; }
.msg-row.in  .bubble { background: var(--surface); border-bottom-left-radius: 4px; }
.msg-row.out .bubble { background: var(--green-mist); border-bottom-right-radius: 4px; color: var(--green-deep); }
.bubble .b-time { display:block; font-family: var(--font-mono); font-size: 9.5px; color: var(--faint); margin-top: 4px; }
.intent-chip { font-family: var(--font-mono); font-size: 10px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--plum); background: var(--plum-bg); padding: 2px 7px; border-radius: 12px; }

/* ---------------- Modal ---------------- */
.modal-scrim { position: fixed; inset: 0; background: rgba(27,40,30,.34); backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 80; padding: 24px; animation: fade .18s ease; }
.modal { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: 100%; max-width: 460px; overflow: hidden; animation: pop .22s cubic-bezier(.2,.8,.2,1); display: flex; flex-direction: column; max-height: calc(100vh - 48px); }
.modal-head { padding: 20px 24px 0; flex-shrink: 0; }
.modal-head h3 { font-family: var(--font-display); font-size: 20px; font-weight: 700; }
.modal-body { padding: 18px 24px; display: grid; gap: 13px; overflow-y: auto; flex: 1; min-height: 0; }
.modal-foot { padding: 16px 24px; display: flex; align-items: center; justify-content: flex-end; gap: 10px; background: var(--surface-2); border-top: 1px solid var(--border); flex-wrap: wrap; flex-shrink: 0; }
.modal-foot .sh-sendcheck { font-size: 13px; font-weight: 600; margin-right: auto; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.97); } }

.field label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; font-family: inherit; font-size: 13.5px;
  border: 1px solid var(--border-2); border-radius: 9px; background: var(--surface-2);
  color: var(--ink); outline: none; transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--green-light); box-shadow: 0 0 0 3px var(--green-mist); background: var(--surface); }

/* shared shift-detail modal */
.sb-detail-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 14px 16px; background: var(--surface-2); border-radius: 12px; }
.sb-dv { font-size: 14.5px; font-weight: 700; margin-top: 3px; }
.sb-note { font-size: 13px; color: var(--ink-2); background: var(--amber-bg); padding: 10px 12px; border-radius: 10px; }
.sb-note-info { background: var(--green-mist); color: var(--green-deep); }
[data-theme="dark"] .sb-note-info { color: var(--green-light); }
.sb-note-draft { background: #ece9df; color: #55524a; }
[data-theme="dark"] .sb-note-draft { background: var(--surface-2); color: var(--ink-2); }
.sb-cat-badge { background: var(--green-mist); color: var(--green-deep); }
[data-theme="dark"] .sb-cat-badge { color: var(--green-light); }
.sb-cand { padding: 8px 10px; border: 1px solid var(--border-2); border-radius: 10px; background: var(--surface-2); cursor: pointer; width: 100%; transition: all .14s; }
.sb-cand:hover { border-color: var(--green-light); background: var(--green-mist); }

/* legend */
.sb-legend { display: flex; gap: 14px; flex-wrap: wrap; }
.sb-legend span { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); font-weight: 500; }
.sb-legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }

/* ---------------- Toast ---------------- */
.toast-wrap { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 120; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  display: flex; align-items: center; gap: 10px;
  background: var(--green-deep); color: #fff;
  padding: 11px 18px; border-radius: 12px; font-size: 13px; font-weight: 600;
  box-shadow: var(--shadow-lg); animation: toastIn .26s cubic-bezier(.2,.8,.2,1);
}
.toast svg { width: 16px; height: 16px; }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px); } }

/* ---------------- Stat ---------------- */
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat .s-val { font-family: var(--font-display); font-size: 30px; font-weight: 700; letter-spacing: -.02em; line-height: 1; }
.stat .s-lab { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.stat .s-sub { font-size: 11.5px; font-weight: 600; }

/* utility */
.row { display: flex; align-items: center; }
.between { justify-content: space-between; }
.gap6{gap:6px}.gap8{gap:8px}.gap10{gap:10px}.gap12{gap:12px}.gap16{gap:16px}
.col { display: flex; flex-direction: column; }
.muted { color: var(--muted); }
.scroll-y { overflow-y: auto; }
.fade-in { animation: slideUp .32s cubic-bezier(.2,.7,.2,1); }
@keyframes slideUp { from { transform: translateY(7px); } }
