@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }
button, input, select, textarea { font-family: 'Nunito', sans-serif; }

:root {
  --cream: #FFF8F0; --salmon: #FA8072; --salmon-light: #FFB4A8; --salmon-dark: #e86f62;
  --wasabi: #8DB560; --wasabi-light: #B8D89A; --wasabi-dark: #6B9340;
  --rice: #FFF5E6; --nori: #3D3D3D; --pink: #FFD1DC; --peach: #FFDAB9; --ink: #1B2836;
  --muted: #6B6259;
}

body { font-family: 'Nunito', sans-serif; background: var(--cream); color: var(--nori); }

/* ===== Linear-style shell: the cream page IS the rail's background; the view
   lives on a raised white canvas. ===== */
.shell { display: flex; min-height: 100vh; padding: 12px 12px 12px 0; }
aside.rail {
  flex: 0 0 212px; padding: 22px 18px; display: flex; flex-direction: column; gap: 24px;
  position: sticky; top: 12px; height: calc(100vh - 24px);
}
.brandrow { display: flex; align-items: center; gap: 9px; align-self: flex-start; text-decoration: none; color: var(--nori); }
.brandrow img { width: 34px; height: 34px; border-radius: 9px; object-fit: cover; flex: none; }
.brandname { font-weight: 800; font-size: 1.05rem; letter-spacing: -0.4px; line-height: 1.1; overflow-wrap: anywhere;
  max-width: 112px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Org switcher — same details/summary pattern as smb-backoffice */
details.orgsw { position: relative; align-self: flex-start; }
details.orgsw > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 6px;
  padding: 5px 8px; margin: -5px -8px; border-radius: 10px;
}
details.orgsw > summary:hover { background: var(--rice); }
details.orgsw > summary::-webkit-details-marker { display: none; }
details.orgsw .swcaret { color: var(--muted); font-size: 11px; flex: none; }
details.orgsw .menu {
  position: absolute; top: calc(100% + 6px); left: 0; background: #fff;
  border: 1px solid var(--peach); border-radius: 10px; box-shadow: 0 6px 18px rgba(0,0,0,.08);
  padding: 6px; z-index: 60; min-width: 180px; display: flex; flex-direction: column;
}
details.orgsw .menu a {
  padding: 7px 10px; border-radius: 7px; color: var(--nori);
  text-decoration: none; font-weight: 700; font-size: 14px;
  display: flex; align-items: center; gap: 6px;
}
details.orgsw .menu .ck { width: 14px; flex: none; color: var(--salmon); }
details.orgsw .menu .onm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
details.orgsw .menu a:hover { background: var(--rice); }
nav.views { display: flex; flex-direction: column; gap: 4px; }
nav.views a {
  font-weight: 800; font-size: 0.83rem; text-decoration: none; padding: 9px 16px;
  border-radius: 10px; color: var(--muted); display: flex; align-items: center; gap: 11px;
}
nav.views a svg { flex: 0 0 auto; opacity: .85; }
nav.views a:hover { background: var(--rice); color: var(--salmon-dark); }
nav.views a.active { background: var(--salmon); color: #fff; }
nav.views a .navbadge {
  margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--salmon); color: #fff; font-size: 0.65rem; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center;
}
nav.views a.active .navbadge { background: #fff; color: var(--salmon-dark); }
nav.views.railfoot { margin-top: auto; }
.whoami {
  display: flex; align-items: center; gap: 11px; font-weight: 800; font-size: 0.78rem;
  color: var(--muted); padding: 9px 16px;
}
.whoami svg { flex: 0 0 auto; opacity: .85; }
.whoami .wn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.whoami .wr { margin-left: auto; font-size: 0.6rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.05em; background: var(--rice); color: var(--salmon-dark); border: 1px solid var(--peach);
  border-radius: 999px; padding: 2px 8px; }
main.content {
  flex: 1; min-width: 0; background: #fff; border: 1px solid #f4ece1; border-radius: 20px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.04); padding: 1.7rem 1.9rem 4rem;
}
.pagehead { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 1.5rem; flex-wrap: wrap; gap: 1rem; }
.pagehead h1 { font-size: 1.55rem; font-weight: 800; letter-spacing: -0.7px; }
.pagehead p { color: var(--muted); font-size: 0.88rem; margin-top: 0.2rem; }
.pageactions { display: inline-flex; align-items: center; gap: 0.8rem; flex-wrap: wrap; }

/* Settings sub-tabs */
.subpill { display: inline-flex; gap: 0.25rem; background: var(--rice); border: 1px solid var(--peach); border-radius: 50px; padding: 0.28rem; margin-bottom: 1.5rem; }
.subpill a { padding: 0.45rem 1.15rem; border-radius: 50px; text-decoration: none; font-weight: 800; font-size: 0.83rem; color: var(--muted); }
.subpill a:hover { color: var(--nori); }
.subpill a.on { background: #fff; color: var(--nori); box-shadow: 0 2px 8px rgba(0,0,0,0.07); }

/* Stop-list editor (schedule drawer): Time in | Time out | Location */
.stophead { display: flex; gap: 0.45rem; margin: 0.4rem 0 0.35rem; }
.stophead span { font-size: 0.66rem; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 0.6px; }
.stophead .sh-time { flex: 0 0 96px; }
.stophead .sh-loc { flex: 1; }
.stophead .sh-del { flex: 0 0 20px; }
.stoprow { display: flex; align-items: center; gap: 0.45rem; margin-bottom: 0.6rem; }
.stoprow .field { margin-bottom: 0 !important; padding: 0.65rem 0.6rem; font-size: 0.84rem; }
.stoprow select[name=stop_time], .stoprow select[name=stop_out] { flex: 0 0 96px; }
.stoprow select[name=stop_loc] { flex: 1; min-width: 0; }
.stop-del { border: none; background: none; cursor: pointer; color: #c9c0b4; font-size: 1.25rem; line-height: 1; padding: 0.2rem; flex-shrink: 0; }
.stop-del:hover { color: var(--salmon-dark); }
.stopeditor .addstop { padding: 0.2rem 0.3rem 0.6rem; font-size: 0.82rem; color: var(--salmon-dark); }
/* All rows removed = off day. "Add a shift" is THE action; leave buttons stay quiet. */
.stopeditor.empty .stophead, .stopeditor.empty .addstop { display: none; }
.stopempty { text-align: center; padding: 1.3rem 0.6rem 1rem; color: var(--muted); font-weight: 700;
  font-size: 0.88rem; border: 1.5px dashed #eee3d3; border-radius: 12px; margin: 0.3rem 0 0.6rem; }
.stopempty .addshift { display: block; margin: 0.8rem auto 0; background: var(--wasabi-dark); color: #fff;
  border: none; border-radius: 50px; padding: 0.65rem 1.6rem; font-family: 'Nunito'; font-weight: 800;
  font-size: 0.88rem; cursor: pointer; }
.stopempty .addshift:hover { transform: translateY(-1px); }
.leaverow { display: flex; justify-content: center; gap: 1.1rem; margin-top: 0.85rem; }
.leavebtn { border: none; background: none; cursor: pointer; font-family: 'Nunito'; font-weight: 700;
  font-size: 0.76rem; color: #b9b0a4; padding: 0.2rem 0.2rem; }
.leavebtn:hover { color: var(--nori); }

/* Leave chips (schedule cells, live list) + timesheet letter marks */
.leavechip { display: inline-block; font-weight: 800; font-size: 0.7rem; border-radius: 50px; padding: 0.22rem 0.7rem; }
.leavechip.sick { background: #FFE4EC; color: #c0506f; }
.leavechip.vac { background: #DDEDF7; color: #3d7ea6; }
.leavemark { font-weight: 800; font-size: 0.78rem; width: 22px; height: 22px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; }
.leavemark.sick { background: #FFE4EC; color: #c0506f; }
.leavemark.vac { background: #DDEDF7; color: #3d7ea6; }

/* Team today — read-only board (supervisors' whole dashboard; admins can peek) */
.teamlist { max-width: 640px; }
.teamrow { display: flex; align-items: center; gap: 0.8rem; background: #fff; border: 1px solid #f0e7da;
  border-radius: 12px; padding: 0.65rem 0.9rem; margin-bottom: 0.55rem; }
.teamrow .tinfo { flex: 1; min-width: 0; }
.teamrow .tname { font-weight: 800; font-size: 0.9rem; }
.teamrow .tstatus { font-size: 0.76rem; color: var(--muted); font-weight: 700; }
.teamrow .tstatus.bad { color: #cf5560; }
.tdotsrow { display: inline-flex; gap: 4px; }

/* Timesheet drawer: one card per scheduled stop — location name carries the color,
   the verdict sits right, the raw check-in hides behind "View check-in". */
.stopcard { border: 1px solid #f0e7da; border-left-width: 4px; border-radius: 12px;
  padding: 0.65rem 0.85rem; margin-bottom: 0.55rem; display: flex; flex-wrap: wrap;
  align-items: center; gap: 0.2rem 0.8rem; }
.stopcard .scmain { flex: 1; min-width: 0; }
.scname { font-weight: 800; font-size: 0.9rem; color: var(--nori); }
.scsched { font-size: 0.76rem; color: var(--muted); font-weight: 700; }
.stopcard.s-ok { border-left-color: #7CAF4E; }
.stopcard.s-late { border-left-color: #F4B942; }
.stopcard.s-miss { border-left-color: #F0777F; }
.stopcard.s-pending { border-left-color: #e3d6c4; }
.stopcard.s-extra { border-left-color: #e3d6c4; }
.scright { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.v { font-weight: 800; font-size: 0.76rem; }
.v-ok { color: #5c8836; } .v-late { color: #ab7c14; } .v-miss { color: #cf5560; }
.v-pend { color: var(--muted); }
.v-off { font-size: 0.66rem; background: #FFE0E0; color: #c0392b; border-radius: 50px; padding: 0.14rem 0.55rem; }
.pencilbtn { border: none; background: none; cursor: pointer; color: #c9c0b4; padding: 0.15rem; display: inline-flex; }
.pencilbtn:hover { color: var(--nori); }
.stopcard.clickable { cursor: pointer; }
.stopcard.clickable:hover { background: #fffaf3; }
.scdetail { display: none; width: 100%; border-top: 1px dashed #f0e7da; margin-top: 0.5rem;
  padding-top: 0.55rem; font-size: 0.82rem; color: var(--nori); }
.stopcard.open .scdetail { display: block; }
.scdetail .loc { color: var(--muted); font-weight: 700; text-decoration: none; }
.scdetail .loc:hover { color: var(--nori); text-decoration: underline; }

/* Right drawer (schedule day editor) — grid stays visible and clickable */
.drawer {
  position: fixed; top: 12px; right: 12px; bottom: 12px; width: 480px; max-width: calc(100vw - 24px);
  background: #fff; border: 1px solid #f4ece1; border-radius: 20px;
  box-shadow: -14px 0 44px rgba(0,0,0,0.13); padding: 1.3rem 1.4rem; z-index: 150;
  display: flex; flex-direction: column;
  transform: translateX(calc(100% + 24px)); visibility: hidden;
  /* visibility flips only after the slide-out finishes, so closing animates too */
  transition: transform 0.22s ease, visibility 0s linear 0.22s;
}
.drawer.open { transform: none; visibility: visible; transition: transform 0.22s ease; }
.drawer .dhead { display: flex; align-items: flex-start; gap: 0.6rem; margin-bottom: 0.7rem; }
.drawtabs { display: flex; gap: 0.25rem; background: var(--rice); border: 1px solid var(--peach);
  border-radius: 50px; padding: 0.22rem; margin-bottom: 0.9rem; flex-shrink: 0; }
.drawtabs button { flex: 1; padding: 0.45rem 0.8rem; border: none; background: none; border-radius: 50px;
  font-family: 'Nunito'; font-weight: 800; font-size: 0.8rem; color: var(--muted); cursor: pointer; }
.drawtabs button.on { background: #fff; color: var(--nori); box-shadow: 0 2px 8px rgba(0,0,0,0.07); }
.drawtabs button:disabled { opacity: 0.4; cursor: default; }
.drawer .dbody { flex: 1; overflow-y: auto; min-height: 0; }
.drawer .dfoot { margin-top: 0.9rem; }
.drawer .save-row { display: flex; gap: 0.55rem; }
.drawer .save-row .btn:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }
.dayactions { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.6rem; flex-wrap: wrap; }
.day-zone.editing { outline: 2px dashed #d3c3a9; outline-offset: -4px; border-radius: 10px; }
.planline { font-size: 0.82rem; font-weight: 700; color: #888; margin-top: 0.4rem; }
.assigned-chip { font-size: 0.68rem; font-weight: 800; background: var(--rice); border: 1px solid var(--peach); color: var(--muted); border-radius: 50px; padding: 0.1rem 0.5rem; }

/* Settings tables: hint bar + collapsible add-row form + flat table */
.hintbar { display: flex; align-items: center; gap: 0.8rem; color: var(--muted); font-size: 0.85rem;
  font-weight: 600; margin-bottom: 0.9rem; flex-wrap: wrap; }
.hintbar .grow { flex: 1; }
.searchbar { width: 280px; margin-bottom: 0 !important; padding: 0.6rem 0.9rem; background: #fff; }
.usertable th a { color: inherit; text-decoration: none; }
.usertable th a:hover { color: var(--salmon-dark); }
.formcard { display: none; background: var(--rice); border: 1px solid var(--peach); border-radius: 14px;
  padding: 0.9rem 1rem; margin-bottom: 0.9rem; }
.formcard.open { display: block; }
.formgrid { display: flex; gap: 0.7rem; align-items: flex-end; flex-wrap: wrap; }
.formgrid > div { min-width: 130px; }
.formgrid label { margin-top: 0; }
.formgrid .field { margin-bottom: 0; background: #fff; }
/* Borderless inputs inside table rows — visible on hover/focus, autosave on change */
.cellinput { border: none; background: transparent; font-family: 'Nunito'; font-weight: 700;
  font-size: 0.88rem; color: var(--nori); padding: 0.3rem 0.45rem; border-radius: 8px; width: 100%; }
.cellinput:hover { background: var(--cream); }
.cellinput:focus { background: var(--cream); outline: 2px solid var(--peach); }
.tablecard { background: #fff; border: 1px solid #f0e7da; border-radius: 14px; overflow: auto; }
.usertable { width: 100%; border-collapse: collapse; }
.usertable th { background: var(--rice); text-align: left; font-size: 0.7rem; font-weight: 800; color: #a99; text-transform: uppercase; letter-spacing: 0.6px; padding: 0.7rem 0.9rem; white-space: nowrap; }
.usertable td { padding: 0.6rem 0.9rem; border-top: 1px solid #f6efe5; font-size: 0.88rem; vertical-align: middle; white-space: nowrap; }
.usertable .ucell { display: inline-flex; align-items: center; gap: 0.6rem; font-weight: 800; }
.usertable .avatar { width: 32px; height: 32px; font-size: 0.72rem; }
.chip-invited { font-size: 0.66rem; font-weight: 800; background: #FFF1D6; color: #9a6a00; border-radius: 50px; padding: 0.15rem 0.55rem; }
.rowactions { display: inline-flex; align-items: center; gap: 0.2rem; }
.rowactions .btn-text { padding: 0.3rem 0.4rem; font-size: 0.8rem; }
.secthead { font-size: 0.78rem; font-weight: 800; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.06em; margin-bottom: 0.7rem; }
.emptycard { background: var(--rice); border: 1.5px dashed var(--peach); border-radius: 14px;
  padding: 1.6rem 1.2rem; text-align: center; color: var(--muted); font-weight: 700; }
.lr-status { font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; }
.st-pending { color: #ab7c14; }
.st-approved { color: #5c8836; }
.st-denied { color: #cf5560; }
.st-cancelled { color: var(--muted); }

/* Auth pages (logged-out): plain top bar + centered container */
.topnav {
  position: sticky; top: 0; z-index: 50; display: flex; justify-content: space-between; align-items: center;
  padding: 0.9rem 2rem; background: rgba(255,248,240,0.92); backdrop-filter: blur(12px);
  border-bottom: 2px solid var(--peach);
}
.brand { display: flex; align-items: center; gap: 0.55rem; }
.brand .logo { width: 36px; height: 36px; border-radius: 9px; object-fit: cover; display: block; }
.brand b { font-weight: 800; font-size: 1.15rem; letter-spacing: -0.5px; }
.brand .tag { font-size: 0.7rem; font-weight: 700; color: var(--muted); background:#fff; border:1px solid var(--peach); padding: 0.15rem 0.5rem; border-radius: 50px; margin-left: 0.3rem; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 2rem; }
.page-title { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 1.6rem; flex-wrap: wrap; gap: 1rem; }
.page-title h1 { font-size: 1.9rem; font-weight: 800; letter-spacing: -1px; }
.page-title p { color: var(--muted); font-size: 0.9rem; margin-top: 0.2rem; }

.btn { border: none; cursor: pointer; padding: 0.7rem 1.4rem; border-radius: 50px; font-family: 'Nunito'; font-weight: 800; font-size: 0.9rem; display: inline-flex; align-items: center; gap: 0.45rem; transition: transform 0.2s; text-decoration: none; }
@media (hover: hover) { .btn:hover { transform: translateY(-2px); } }
.btn-salmon { background: var(--salmon); color: #fff; box-shadow: 0 5px 16px rgba(250,128,114,0.35); }
.btn-ghost { background: transparent; color: var(--muted); border: 2px solid var(--peach); font-weight: 700; }
.btn-go { background: var(--wasabi-dark); color:#fff; }

.card { background: #fff; border-radius: 20px; padding: 1.3rem; border: 1px solid #f4ece1; box-shadow: 0 8px 24px rgba(0,0,0,0.04); }
.card h3 { font-size: 1.1rem; font-weight: 800; margin-bottom: 0.2rem; }
.card .sub { color: var(--muted); font-size: 0.82rem; margin-bottom: 1.1rem; }
.card-head { display:flex; justify-content: space-between; align-items: center; margin-bottom: 1.1rem; }
.card-head h3 { margin: 0; }

.entry { display: flex; align-items: center; gap: 0.9rem; padding: 0.85rem 0; border-bottom: 1px solid #f6efe5; }
.entry:last-child { border-bottom: none; }
.thumb { width: 52px; height: 52px; border-radius: 14px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 1.7rem; background:#f1ece3; overflow:hidden; }
.thumb img { width:100%; height:100%; object-fit:cover; }
.t1 { background: linear-gradient(150deg,#FFE3D6,#FFD1DC); } .t2 { background: linear-gradient(150deg,#FFF5E6,#B8D89A); }
.t3 { background: linear-gradient(150deg,#FFDAB9,#FFB4A8); } .t4 { background: linear-gradient(150deg,#D9E8F5,#B8D89A); }
.entry .info { flex: 1; min-width: 0; }
.entry .info .name { font-weight: 800; font-size: 0.95rem; }
.entry .info .loc { font-size: 0.78rem; color: var(--muted); display:flex; align-items:center; gap:0.3rem; }
.entry .info a.loc { text-decoration:none; color: var(--salmon-dark); font-weight:700; }
.entry .info a.loc:hover { text-decoration: underline; }
.entry .right { display: flex; align-items: center; gap: 0.6rem; }
.pill { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.25rem 0.65rem; border-radius: 50px; font-size: 0.7rem; font-weight: 800; }
.pill-in { background: var(--wasabi-light); color: var(--wasabi-dark); }
.pill-out { background: var(--pink); color: #b54a5e; }
.pill-check { background: var(--peach); color: var(--salmon-dark); }
.pill-warn { background: #FFF1D6; color: #9a6a00; }
.pill-bad { background: #FFE0E0; color: #c0392b; }
.status-icons { display:flex; gap:0.35rem; justify-content:flex-end; }
.st { width:26px; height:26px; border-radius:50%; display:inline-flex; align-items:center; justify-content:center; font-size:0.9rem; font-weight:800; }
.st-ok { background:var(--wasabi-light); color:var(--wasabi-dark); }
.st-late { background:#FFF1D6; color:#9a6a00; }
.st-off { background:#FFE0E0; color:#c0392b; }
.st-bad { background:#FFE0E0; color:#c0392b; }
.entry .time { font-size: 0.82rem; color: var(--muted); font-weight: 700; white-space: nowrap; }
.zone { font-size:0.66rem; font-weight:800; padding:0.12rem 0.5rem; border-radius:50px; display:inline-block; margin-top:0.3rem; }
.zone-ok { background:#fff; color:var(--wasabi-dark); box-shadow: inset 0 0 0 1.5px var(--wasabi-light); }
.zone-off { background:#FFE0E0; color:#c0392b; }

.alert { display:flex; align-items:center; gap:0.6rem; background:#FFECEC; border:1px solid #FFD0D0; color:#c0392b; padding:0.8rem 1.1rem; border-radius:14px; font-weight:700; font-size:0.85rem; margin-bottom:1.4rem; }

.sgroup { font-size:0.72rem; font-weight:800; color:var(--muted); text-transform:uppercase; letter-spacing:1px; margin:1.2rem 0 0.4rem; }
.sgroup.first { margin-top:0; }
.btn-mini { padding:0.4rem 0.85rem; font-size:0.76rem; border-radius:50px; font-family:'Nunito'; font-weight:800; border:none; cursor:pointer; display:inline-flex; align-items:center; gap:0.3rem; transition:transform 0.2s; }
.btn-mini:hover { transform:translateY(-1px); }
.btn-mark { background:#ede8df; color:#8a8278; }
.btn-text { background:none; border:none; cursor:pointer; font-family:'Nunito'; font-weight:700; font-size:0.88rem; color:var(--muted); padding:0.7rem 0.3rem; }
.btn-text:hover { color:var(--nori); }

.avatar { width: 38px; height: 38px; border-radius: 50%; display:flex; align-items:center; justify-content:center; font-weight: 800; color: #fff; font-size: 0.85rem; flex-shrink: 0; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

label { display: block; font-size: 0.78rem; font-weight: 800; color: var(--muted); margin-bottom: 0.35rem; margin-top: 0.2rem; }
.field { width: 100%; padding: 0.75rem 0.9rem; border-radius: 12px; border: 2px solid var(--peach); background: var(--cream); font-family: 'Nunito'; font-weight: 700; font-size: 0.9rem; color: var(--nori); margin-bottom: 1rem; }
select.field { appearance:none; cursor:pointer; }

.code-chip { background:var(--rice); border:1px solid var(--peach); border-radius:50px; padding:0.4rem 0.5rem 0.4rem 0.85rem; font-weight:800; letter-spacing:0.12rem; font-size:0.82rem; display:inline-flex; align-items:center; gap:0.55rem; }
.chip-copy { border:none; background:none; cursor:pointer; color:#bdb09c; font-size:0.95rem; padding:0; line-height:1; letter-spacing:0; transition:color 0.2s; }
.chip-copy:hover { color:var(--salmon); }

/* manage */
.manage-grid { display:grid; grid-template-columns:280px 1fr; gap:1.4rem; align-items:start; }
/* config panel (right side) — extra vertical breathing room */
.manage-grid > .card:not(.emp-list) { padding:1.6rem; }
.manage-grid > .card:not(.emp-list) label { margin-top:0.7rem; }
.manage-grid > .card:not(.emp-list) .field { margin-bottom:1.25rem; }
.emp-list a.person { display:flex; align-items:center; gap:0.7rem; cursor:pointer; padding:0.6rem 0.7rem; border-radius:12px; border-bottom:1px solid #f6efe5; text-decoration:none; color:var(--nori); }
.emp-list a.person:last-child { border-bottom:none; }
.emp-list a.person.sel { background:var(--rice); border-bottom-color:transparent; }
.emp-list .pname { font-weight: 700; font-size: 0.9rem; flex: 1; }
.emp-head { display:flex; align-items:center; gap:0.9rem; margin-bottom:1rem; }
.emp-head .avatar { width:54px; height:54px; font-size:1.1rem; }
.emp-head .meta { flex:1; }
.emp-head .meta .nm { font-size:1.2rem; font-weight:800; }
.emp-head .meta .ph { color:var(--muted); font-size:0.85rem; font-weight:700; }
.assign-current { display:flex; align-items:center; gap:0.5rem; background:rgba(141,181,96,0.12); color:var(--wasabi-dark); border-radius:12px; padding:0.7rem 0.9rem; font-weight:800; font-size:0.85rem; margin-bottom:1.1rem; }
.override-row { display:flex; align-items:center; gap:0.5rem; font-size:0.82rem; color: var(--muted); padding:0.4rem 0; }
.override-row b { color:var(--nori); }
.hours-row { display:flex; gap:0.8rem; flex-wrap:wrap; }
.hours-row > div { flex:1; min-width:130px; }
.mini-lbl { font-size:0.72rem; font-weight:800; color:var(--muted); display:block; margin-bottom:0.3rem; }
.day-toggles { display:flex; gap:0.35rem; margin-bottom:1rem; flex-wrap:wrap; }
.day { width:38px; height:38px; border-radius:50%; border:2px solid var(--peach); background:#fff; color:#c9c0b4; font-weight:800; font-size:0.76rem; cursor:pointer; font-family:'Nunito'; transition:all 0.15s; }
.day:hover { border-color:var(--wasabi); }
.day.on { background:var(--wasabi-dark); border-color:var(--wasabi-dark); color:#fff; }
.kloc { display:flex; align-items:center; gap:0.8rem; padding:0.7rem 0; border-bottom:1px solid #f6efe5; }
.kloc:last-child { border-bottom:none; }
.kic { width:40px; height:40px; border-radius:12px; background:var(--rice); display:flex; align-items:center; justify-content:center; font-size:1.2rem; flex-shrink:0; }
.kloc .kn { flex:1; } .kloc .kn b { font-weight:800; font-size:0.9rem; display:block; } .kloc .kn span { color:var(--muted); font-size:0.76rem; font-weight:700; }

/* grids */
.grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 1.4rem; align-items: start; }
.week-nav { display:flex; align-items:center; gap: 0.6rem; }
.week-nav a, .week-nav button { border:2px solid var(--peach); background:#fff; border-radius:50px; min-width:32px; height:32px; cursor:pointer; font-weight:800; color: var(--muted); font-family:'Nunito'; display:inline-flex; align-items:center; justify-content:center; text-decoration:none; padding:0 0.6rem; }
.week-nav .label { font-weight:800; font-size:0.9rem; min-width: 150px; text-align:center; }

/* ===== Shared week grid (Schedule + Timesheet) — same shell, different cell bodies ===== */
.week-grid {
  display: grid;
  grid-template-columns: 172px repeat(7, 1fr);
  font-variant-numeric: tabular-nums;
  background: #fff;
  border: 1px solid #f0e7da;
  border-radius: 14px;
  overflow: hidden;
}
.week-grid > div { padding: 0.55rem 0.4rem; text-align: center; font-size: 0.82rem; }
.week-colhead {
  background: var(--rice); font-weight: 800; color: #a99; font-size: 0.72rem;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.week-colhead.today { background: var(--peach); color: var(--salmon-dark); }
.week-colhead .dow { display: block; }
.week-colhead .dnum { display: block; font-size: 0.95rem; color: var(--nori); }
.week-name {
  text-align: left !important; display: flex; align-items: center; gap: 0.55rem;
  font-weight: 800; font-size: 0.88rem;
}
.week-name.invited-row { opacity: 0.6; }
.week-name .chip-invited { flex-shrink: 0; }
.week-name .avatar { width: 30px; height: 30px; font-size: 0.72rem; }

/* Shared day-cell base — schedule keeps chip borders (merged spans); timesheet is flat */
.week-cell {
  position: relative; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 0.72rem; line-height: 1.35; cursor: pointer;
  box-sizing: border-box; min-height: 42px;
}
.week-cell .toff { color: #d9d2c6; font-weight: 700; }
.week-cell:hover .dot { transform: scale(1.18); }
.week-cell.editing { outline: 2px dashed #d3c3a9; outline-offset: -2px; }

.sch-week .week-cell {
  margin: 5px 6px; padding: 0.45rem 0.35rem !important;
  background: #fff; border: 1px solid #eee3d3; border-radius: 12px;
}
.sch-week .week-cell:hover { border-color: #e0cdae; background: #fffdf8; }
.sch-week .week-cell.off { background: transparent; border-color: transparent; color: #d9d2c6; font-weight: 700; }
.sch-week .week-cell.off:hover { background: rgba(141,181,96,0.12); border-color: transparent; }

.ts-week .week-cell {
  margin: 0; padding: calc(0.45rem + 5px) 0.2rem !important;
  min-height: 52px; /* sch cell min-height + its vertical margins */
  background: transparent; border: none; border-radius: 8px;
}
.ts-week .week-cell:hover { background: rgba(141,181,96,0.12); }
.ts-week .week-cell.off { color: #d9d2c6; font-weight: 700; }
.ts-week .week-cell.off:hover { background: rgba(141,181,96,0.12); }

.dots { display: inline-flex; gap: 4px; align-items: center; }
/* One dot per day: green in & on time · yellow late · red overdue, not in ·
   pin = clocked in off the expected location · hollow = scheduled, not due yet */
.dot { width: 16px; height: 16px; border-radius: 50%; display: inline-flex; align-items: center;
  justify-content: center; flex-shrink: 0; transition: transform 0.12s ease; }
.d-ok { background: #7CAF4E; }
.d-late { background: #F4B942; }
.d-miss { background: #F0777F; }
.d-pending { background: transparent; border: 2px dashed #e3d6c4; }
.dayinvalid .dot { filter: grayscale(1); opacity: 0.4; }
.dot.dlg { width: 12px; height: 12px; vertical-align: middle; }
.dot.dlg svg { width: 7px; height: 7px; }
.legend { color: var(--muted); font-size: 0.85rem; }

/* Holiday row — pinned under the day headers */
.hol-label {
  display: flex; align-items: center; justify-content: flex-end;
  font-size: 0.62rem; font-weight: 800; color: #c4b8a8; text-transform: uppercase;
  letter-spacing: 0.6px; padding-right: 0.7rem !important;
}
.hol-cell { padding: 0.35rem 0.3rem !important; }
.holchip {
  display: inline-block; background: var(--pink); color: #b54a5e; font-weight: 800;
  font-size: 0.7rem; border-radius: 50px; padding: 0.22rem 0.7rem; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Schedule cell body (plan text) */
.week-cell .stopline { display: block; }
.week-cell .stopline + .stopline { margin-top: 0.25rem; }
.week-cell .loc-nm { font-weight: 800; color: var(--nori); display: block; }
.week-cell .tm { color: var(--muted); font-weight: 700; }
.seg-label { z-index: 2; pointer-events: none; }
.day-zones { position: absolute; inset: 0; display: flex; z-index: 1; border-radius: inherit; overflow: hidden; }
.day-zone { flex: 1; cursor: pointer; }
.sch-seg:hover .day-zone + .day-zone { border-left: 1px dashed rgba(0,0,0,0.15); }
.day-zone:hover { background: rgba(141,181,96,0.18); }
.sch-merged { display: flex; align-items: center; justify-content: center; gap: 0.4rem; }

/* bottom-right toasts */
.toast-wrap { position: fixed; bottom: 1.2rem; right: 1.2rem; z-index: 300; display: flex; flex-direction: column; gap: 0.6rem; max-width: 340px; }
.toast { background: var(--ink); color: #fff; padding: 0.85rem 1.1rem; border-radius: 14px; box-shadow: 0 12px 32px rgba(0,0,0,0.25); font-weight: 700; font-size: 0.88rem; display: flex; align-items: center; gap: 0.9rem; animation: toastin 0.25s ease; }
.toast span { flex: 1; }
.toast.hide { opacity: 0; transform: translateY(8px); transition: all 0.3s ease; }
.toast-undo { background: none; border: none; color: var(--salmon-light); font-weight: 800; cursor: pointer; font-family: 'Nunito'; font-size: 0.85rem; white-space: nowrap; }
@keyframes toastin { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }

/* schedule edit modal + clickable cells */
.sched-click { cursor: pointer; }
.sched-click:hover { background: rgba(141,181,96,0.16); }
.modal-overlay { position: fixed; inset: 0; background: rgba(27,40,54,0.45); display: none; align-items: center; justify-content: center; z-index: 200; padding: 1rem; }
.modal-overlay.open { display: flex; }
.modal-box { background: #fff; border-radius: 22px; padding: 1.6rem; width: 100%; max-width: 380px; max-height: 85vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.25); }
.modal-box h3 { font-size: 1.15rem; font-weight: 800; margin-bottom: 1rem; }

.icon-btn { border: 2px solid var(--peach); background: #fff; border-radius: 10px; width: 34px; height: 34px; cursor: pointer; color: var(--muted); font-size: 1rem; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; transition: all 0.2s; }
.icon-btn:hover { color: var(--salmon); border-color: var(--salmon); }
.modal-box { position: relative; }
.modal-close { position: absolute; top: 1rem; right: 1.1rem; border: none; background: none; cursor: pointer; font-size: 1.4rem; line-height: 1; color: var(--muted); }
.modal-close:hover { color: var(--nori); }

.kloc.loc-click { cursor: pointer; border-radius: 12px; }
.kloc.loc-click:hover { background: var(--rice); }

/* greyed default field (e.g. radius) — faint until you focus it */
.field.softdefault { color: #c9c0b4; border-color: #f0e7da; }
.field.softdefault:hover, .field.softdefault:focus { color: var(--nori); border-color: var(--peach); }

@media (max-width: 860px) {
  .grid { grid-template-columns: 1fr; }
  .manage-grid { grid-template-columns: 1fr; }
}

/* Rail collapses to a horizontal wrap bar above the canvas */
@media (max-width: 760px) {
  .shell { flex-direction: column; padding: 0 8px 8px; }
  aside.rail { position: static; height: auto; flex: none; width: 100%; flex-direction: row;
    align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 6px; }
  .brandrow img { width: 28px; height: 28px; border-radius: 8px; }
  .brandname { font-size: 0.92rem; }
  nav.views { flex-direction: row; flex-wrap: wrap; gap: 4px; }
  nav.views a { padding: 7px 12px; font-size: 0.78rem; gap: 7px; }
  nav.views.railfoot { margin-top: 0; margin-left: auto; }
  .whoami { display: none; }
  main.content { padding: 1.1rem 0.9rem 3rem; border-radius: 16px; }

  /* drawer becomes a bottom sheet */
  .drawer { top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; max-height: 78vh;
    transform: translateY(calc(100% + 16px)); }
  .drawer.open { transform: none; }
}

@media (max-width: 600px) {
  .topnav { padding: 0.7rem 1rem; }
  .wrap { padding: 1.1rem; }
  .page-title { margin-bottom: 1.1rem; gap: 0.6rem; }
  .page-title h1 { font-size: 1.45rem; }
  .pagehead { margin-bottom: 1.1rem; gap: 0.6rem; }
  .pagehead h1 { font-size: 1.3rem; }
  .card { padding: 1rem; border-radius: 16px; }
  .subpill a { padding: 0.4rem 0.8rem; font-size: 0.78rem; }

  /* weekly grids scroll horizontally instead of squashing */
  .week-grid { font-size: 0.72rem; grid-template-columns: 104px repeat(7, 64px); overflow-x: auto; }
  .week-grid > div { padding: 0.5rem 0.25rem; }
  .week-name { gap: 0.35rem; }
  .week-name .avatar { width: 26px; height: 26px; font-size: 0.66rem; }
  .week-cell { min-height: 40px; }
  .sch-week .week-cell { margin: 4px 3px; }

  .week-nav { flex-wrap: wrap; }
  .week-nav .label { min-width: 0; }

  /* toasts span the bottom */
  .toast-wrap { left: 0.8rem; right: 0.8rem; bottom: 0.8rem; max-width: none; }
}

/* ===== Viewbar: search / filter / sort over the Schedule & Timesheet grids
   (TunaBooks pattern — state lives in the URL, the grid refetches as a fragment) ===== */
.viewbar { display: flex; align-items: center; gap: 0.55rem; flex-wrap: wrap; margin: 0 0 0.9rem; }
.searchbox { display: inline-flex; align-items: center; gap: 0.45rem; background: #fff;
  border: 2px solid var(--peach); border-radius: 999px; padding: 0.42rem 0.9rem; transition: border-color .12s; }
.searchbox:focus-within { border-color: var(--salmon-light); }
.searchbox svg { flex: 0 0 auto; color: #cdbfae; }
.searchbox input { border: 0; outline: none; font-family: 'Nunito', sans-serif; font-size: 0.85rem;
  font-weight: 700; color: var(--nori); width: 200px; background: none; }
.searchbox input::placeholder { color: #cdbfae; font-weight: 600; }
.matchnote { font-size: 0.78rem; font-weight: 700; color: var(--muted); }
.fbicon { display: inline-flex; align-items: center; color: #cdbfae; margin-right: -0.25rem; }
.barbtn { border: 0; background: none; color: var(--muted); font-family: 'Nunito', sans-serif;
  font-size: 0.8rem; font-weight: 800; display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.5rem 0.7rem; border-radius: 10px; cursor: pointer; }
.barbtn:hover { background: var(--rice); color: var(--salmon-dark); }
details.ddmenu { position: relative; display: inline-block; }
details.ddmenu summary { list-style: none; cursor: pointer; }
details.ddmenu summary::-webkit-details-marker { display: none; }
details.ddmenu[open] .barbtn { background: var(--rice); color: var(--salmon-dark); }
details.ddmenu .menu { position: absolute; left: 0; top: calc(100% + 6px); background: #fff;
  border: 2px solid var(--peach); border-radius: 12px; padding: 5px; white-space: nowrap;
  box-shadow: 0 6px 16px rgba(61, 61, 61, .12); z-index: 7; text-align: left; }
details.ddmenu .menu a { display: block; color: var(--salmon-dark); text-decoration: none; font-weight: 700;
  font-size: 0.84rem; padding: 0.45rem 0.75rem; border-radius: 8px; cursor: pointer; }
details.ddmenu .menu a:hover { background: var(--rice); }
details.ddmenu .menu .mhint { display: block; font-size: 0.7rem; font-weight: 700; color: var(--muted); }
.catopt2 { display: flex; align-items: center; gap: 0.5rem; min-width: 150px; color: var(--salmon-dark);
  text-decoration: none; font-weight: 700; font-size: 0.84rem; padding: 0.45rem 0.75rem;
  border-radius: 8px; cursor: pointer; }
.catopt2:hover { background: var(--rice); }
.catopt2 .ck { margin-left: auto; opacity: 0; font-weight: 800; padding-left: 0.8rem; }
.catopt2.on .ck { opacity: 1; }
.catopt2:not(.on) { color: var(--muted); }
/* Export dropdown (TunaBooks / smb-backoffice pattern) */
details.ddmenu .menu.expanel { min-width: 250px; padding: 0.75rem 0.75rem 0.5rem; right: 0; left: auto; }
.exlabel { font-size: 0.62rem; font-weight: 800; text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted); padding: 0 2px 6px; }
.exrow { display: flex; align-items: center; gap: 6px; padding: 0 2px; }
.exrow input { font-family: 'Nunito', sans-serif; font-size: 0.75rem; font-weight: 700; color: var(--nori);
  border: 1.5px solid var(--peach); border-radius: 8px; padding: 5px 7px; width: 118px; background: var(--cream); }
.exdash { color: #cdbfae; font-weight: 800; }
.expresets { display: flex; gap: 4px; padding: 8px 2px 4px; }
.expresets a { font-size: 0.7rem; font-weight: 800; color: var(--salmon-dark); background: var(--rice);
  border-radius: 999px; padding: 3px 10px; cursor: pointer; }
.expresets a:hover { background: var(--peach); }
.exsep { border-top: 1px solid #f5efe8; margin: 8px 0 4px; }
.fbempty { grid-column: 1 / -1; text-align: left !important; font-style: italic;
  color: var(--muted); font-weight: 600; padding: 1.1rem 1rem !important; }

@media (max-width: 600px) {
  .searchbox input { width: 130px; }
}
