/* BFG Together staff portal. Same palette and type as the public site. */
:root {
  --green-900: #0a3a30;
  --green-800: #0f5446;
  --green-700: #15695a;
  --green-100: #e4f0ec;
  --green-50: #f1f7f5;
  --amber: #e8a33d;
  --amber-dark: #c9821f;
  --amber-50: #fdf4e6;
  --cream: #fbf8f3;
  --ink: #1c2522;
  --muted: #5b6b66;
  --line: #e4e2dc;
  --white: #fff;
  --red: #b3372b;
  --red-50: #fbecea;
  --blue: #2b6a8a;
  --blue-50: #e8f2f7;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(16, 42, 36, .06), 0 4px 16px rgba(16, 42, 36, .06);
  --shadow-md: 0 10px 40px rgba(16, 42, 36, .14);
  --ease: cubic-bezier(.2, .7, .2, 1);
  --tabbar: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--ink); background: var(--cream);
  font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased;
  min-height: 100vh; min-height: 100dvh;
}
h1, h2, h3 { font-family: 'Fraunces', Georgia, serif; font-weight: 600; line-height: 1.15; letter-spacing: -.01em; }
a { color: var(--green-700); }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 20px; border-radius: 999px; border: 2px solid transparent;
  font-weight: 600; font-size: 15px; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .2s, transform .15s var(--ease), box-shadow .2s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--amber); color: #2a1c05; }
.btn-primary:hover { background: var(--amber-dark); }
.btn-dark { background: var(--green-800); color: #fff; }
.btn-dark:hover { background: var(--green-900); }
.btn-line { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-line:hover { border-color: var(--green-700); color: var(--green-800); }
.btn-danger { background: #fff; border-color: #eccac5; color: var(--red); }
.btn-danger:hover { background: var(--red-50); }
.btn-sm { min-height: 38px; padding: 0 14px; font-size: 14px; }
.btn-block { width: 100%; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: #fff;
  display: inline-grid; place-items: center; cursor: pointer; flex: none;
}
.icon-btn:hover { border-color: var(--green-700); }
.link-btn { background: none; border: 0; color: var(--green-700); font-weight: 600; cursor: pointer; padding: 6px 0; font-size: 15px; }

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 14px; font-weight: 600; color: var(--ink); }
.field small { color: var(--muted); font-size: 13px; }
.input, select.input, textarea.input {
  width: 100%; min-height: 48px; padding: 11px 14px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--line); background: #fff; font: inherit; font-size: 16px; color: var(--ink);
  transition: border-color .15s, box-shadow .15s; -webkit-appearance: none; appearance: none;
}
select.input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%235b6b66' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 40px;
}
textarea.input { min-height: 84px; resize: vertical; }
.input:focus { outline: none; border-color: var(--green-700); box-shadow: 0 0 0 3px var(--green-100); }
.input[readonly] { background: var(--green-50); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 500; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--green-700); }

.stepper { display: flex; align-items: center; border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: #fff; overflow: hidden; }
.stepper button { width: 46px; height: 46px; border: 0; background: var(--green-50); font-size: 20px; cursor: pointer; color: var(--green-800); }
.stepper input { flex: 1; min-width: 0; border: 0; text-align: center; font: inherit; font-size: 16px; font-weight: 600; height: 46px; background: #fff; }
.stepper input:focus { outline: none; }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--green-50); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { border: 0; background: none; min-height: 40px; border-radius: 9px; font-weight: 600; font-size: 14px; color: var(--muted); cursor: pointer; }
.seg button.on { background: #fff; color: var(--green-800); box-shadow: var(--shadow-sm); }

.error { background: var(--red-50); color: var(--red); border-radius: var(--radius-sm); padding: 10px 14px; font-size: 14px; margin-bottom: 14px; }
.note { background: var(--amber-50); color: #6d4a10; border-radius: var(--radius-sm); padding: 10px 14px; font-size: 14px; }
.muted { color: var(--muted); }

/* ---------- Login page ---------- */
.auth {
  min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(1200px 500px at 50% -10%, var(--green-100), transparent 70%), var(--cream);
}
.auth-card { width: 100%; max-width: 420px; background: #fff; border-radius: 22px; box-shadow: var(--shadow-md); padding: 32px 24px 24px; }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; font-family: 'Fraunces', serif; font-weight: 700; font-size: 20px; color: var(--green-800); text-decoration: none; }
.auth-brand img { width: 44px; height: 44px; }
.auth h1 { font-size: 28px; margin-bottom: 6px; }
.auth p.lead { color: var(--muted); margin-bottom: 22px; font-size: 15px; }
.auth-foot { margin-top: 18px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 14px; }
.auth-foot a { text-decoration: none; }
.demo-box { margin-top: 20px; border-top: 1px dashed var(--line); padding-top: 18px; }
.demo-box p { font-size: 13.5px; color: var(--muted); margin-bottom: 10px; }
.demo-box .row2 .btn, .demo-box .row3 .btn { width: 100%; padding: 0 8px; font-size: 13px; }

/* ---------- App shell ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30; background: rgba(251, 248, 243, .92);
  backdrop-filter: saturate(180%) blur(12px); -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid rgba(16, 42, 36, .08);
}
.topbar-in { display: flex; align-items: center; gap: 12px; height: 60px; padding: 0 16px; max-width: 1180px; margin: 0 auto; }
.topbar .brand { display: flex; align-items: center; gap: 10px; font-family: 'Fraunces', serif; font-weight: 700; font-size: 18px; color: var(--green-800); text-decoration: none; }
.topbar .brand img { width: 36px; height: 36px; }
.topbar .brand small { font-family: 'Inter', sans-serif; font-weight: 600; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--amber-dark); display: block; line-height: 1; margin-top: 2px; }
.topbar .spacer { flex: 1; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; background: var(--green-800); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 14px; flex: none; border: 0; cursor: pointer;
}
.avatar.lg { width: 64px; height: 64px; font-size: 22px; cursor: default; }
.avatar.sm { width: 32px; height: 32px; font-size: 12px; cursor: default; }
.demo-banner { background: var(--amber-50); color: #6d4a10; font-size: 13px; text-align: center; padding: 7px 16px; }
.demo-banner button { background: none; border: 0; text-decoration: underline; color: inherit; cursor: pointer; font-size: 13px; }

.shell { max-width: 1180px; margin: 0 auto; display: grid; grid-template-columns: 1fr; }
.sidenav { display: none; }
main#view { padding: 20px 16px calc(var(--tabbar) + var(--safe-b) + 28px); min-width: 0; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: #fff;
  border-top: 1px solid var(--line); padding-bottom: var(--safe-b);
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  height: var(--tabbar); text-decoration: none; color: var(--muted); font-size: 11.5px; font-weight: 600; position: relative;
}
.tabbar a svg { width: 24px; height: 24px; }
.tabbar a.on { color: var(--green-800); }
.tabbar a.on::before { content: ""; position: absolute; top: 0; left: 28%; right: 28%; height: 3px; border-radius: 0 0 3px 3px; background: var(--amber); }
.dot { position: absolute; top: 9px; left: calc(50% + 8px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; display: grid; place-items: center; }

@media (min-width: 900px) {
  .shell { grid-template-columns: 230px 1fr; gap: 12px; padding: 0 16px; }
  .sidenav { display: block; position: sticky; top: 60px; align-self: start; padding: 24px 0; }
  .sidenav a {
    display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 12px; margin-bottom: 4px;
    text-decoration: none; color: var(--ink); font-weight: 500; position: relative;
  }
  .sidenav a svg { width: 22px; height: 22px; color: var(--muted); }
  .sidenav a:hover { background: var(--green-50); }
  .sidenav a.on { background: var(--green-800); color: #fff; }
  .sidenav a.on svg { color: var(--amber); }
  .sidenav .dot { position: static; margin-left: auto; }
  .tabbar { display: none; }
  main#view { padding: 28px 8px 60px; }
}

/* ---------- Page bits ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 28px; }
.page-head p { color: var(--muted); font-size: 15px; margin-top: 2px; }
.eyebrow { font-weight: 600; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--green-700); }
.section-title { font-family: 'Inter', sans-serif; font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 26px 0 10px; }

.card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 18px; }
.card + .card { margin-top: 12px; }
.grid-2 { display: grid; gap: 12px; }
@media (min-width: 700px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

.hero-card { background: var(--green-800); color: #fff; border-radius: 20px; padding: 20px; position: relative; overflow: hidden; }
.hero-card::after { content: ""; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px; border-radius: 50%; background: rgba(232, 163, 61, .18); }
.hero-card .eyebrow { color: var(--amber); }
.hero-card h2 { font-size: 24px; margin: 6px 0 4px; }
.hero-card p { color: rgba(255, 255, 255, .8); font-size: 15px; }
.hero-card .btn { margin-top: 16px; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: #fff; border-radius: 14px; padding: 12px; box-shadow: var(--shadow-sm); }
.stat b { display: block; font-family: 'Fraunces', serif; font-size: 24px; color: var(--green-800); line-height: 1.1; }
.stat span { font-size: 12.5px; color: var(--muted); font-weight: 500; }
@media (min-width: 700px) { .stats { grid-template-columns: repeat(6, 1fr); } }

.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quick a { background: #fff; border-radius: 14px; padding: 14px; box-shadow: var(--shadow-sm); text-decoration: none; color: var(--ink); font-weight: 600; font-size: 15px; display: flex; gap: 10px; align-items: center; }
.quick a svg { color: var(--green-700); flex: none; }

/* Pills */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--green-50); color: var(--green-800); white-space: nowrap; }
.pill.draft { background: #eeeeea; color: #555; }
.pill.submitted { background: var(--blue-50); color: var(--blue); }
.pill.approved { background: var(--green-100); color: var(--green-800); }
.pill.returned { background: var(--red-50); color: var(--red); }
.pill.open { background: var(--amber-50); color: #8a5a10; }
.pill.req { background: var(--blue-50); color: var(--blue); }

/* Month / week switcher */
.switcher { display: flex; align-items: center; gap: 8px; background: #fff; border-radius: 14px; box-shadow: var(--shadow-sm); padding: 6px; margin-bottom: 14px; }
.switcher .label { flex: 1; text-align: center; font-weight: 700; font-size: 16px; }
.switcher .label small { display: block; font-weight: 500; font-size: 12.5px; color: var(--muted); }
.switcher .icon-btn { border: 0; background: var(--green-50); }

/* Shift / entry cards */
.list { display: grid; gap: 10px; }
.item { background: #fff; border-radius: 14px; box-shadow: var(--shadow-sm); padding: 14px; display: flex; gap: 14px; align-items: flex-start; }
.item.clickable { cursor: pointer; transition: box-shadow .2s; border: 0; width: 100%; text-align: left; font: inherit; }
.item.clickable:hover { box-shadow: var(--shadow-md); }
.datebox { width: 52px; flex: none; text-align: center; background: var(--green-50); border-radius: 12px; padding: 6px 0; }
.datebox b { display: block; font-family: 'Fraunces', serif; font-size: 22px; line-height: 1.1; color: var(--green-800); }
.datebox span { font-size: 11.5px; font-weight: 700; text-transform: uppercase; color: var(--muted); letter-spacing: .04em; }
.datebox.today { background: var(--green-800); }
.datebox.today b, .datebox.today span { color: #fff; }
.item .body { flex: 1; min-width: 0; }
.item .t1 { font-weight: 700; font-size: 16px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.item .t2 { color: var(--muted); font-size: 14px; margin-top: 2px; }
.item .t3 { font-size: 14px; margin-top: 6px; color: var(--ink); }
.item .tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.item .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.item .right { text-align: right; flex: none; }
.item .right b { font-family: 'Fraunces', serif; font-size: 22px; color: var(--green-800); display: block; line-height: 1; }
.item .right span { font-size: 12px; color: var(--muted); }

.day-group { margin-bottom: 16px; }
.day-group h3 { font-family: 'Inter', sans-serif; font-size: 14px; font-weight: 700; color: var(--muted); margin: 0 0 8px 2px; display: flex; gap: 8px; align-items: center; }
.day-group h3.today { color: var(--green-800); }
.day-empty { font-size: 14px; color: var(--muted); padding: 10px 14px; border: 1.5px dashed var(--line); border-radius: 12px; }

.empty { text-align: center; padding: 36px 20px; color: var(--muted); background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.empty svg { color: var(--green-700); margin-bottom: 8px; }
.empty b { display: block; color: var(--ink); font-size: 17px; margin-bottom: 4px; }

/* Timesheet table (desktop) */
.sheet-wrap { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow-x: auto; display: none; }
table.sheet { width: 100%; border-collapse: collapse; font-size: 14px; }
.sheet th { text-align: left; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 12px 10px; border-bottom: 1px solid var(--line); background: var(--green-50); white-space: nowrap; }
.sheet td { padding: 11px 10px; border-bottom: 1px solid #f0eee9; vertical-align: top; }
.sheet td.n, .sheet th.n { text-align: right; font-variant-numeric: tabular-nums; }
.sheet tbody tr { cursor: pointer; }
.sheet tbody tr:hover { background: #fcfbf8; }
.sheet tfoot td { font-weight: 700; background: var(--green-50); border-bottom: 0; }
.sheet .note-cell { color: var(--muted); max-width: 260px; }
@media (min-width: 1000px) {
  .sheet-wrap { display: block; }
  .entry-cards { display: none; }
}

.sticky-actions { position: sticky; bottom: calc(var(--tabbar) + var(--safe-b) + 12px); z-index: 20; display: flex; gap: 10px; margin-top: 16px; }
.sticky-actions .btn { flex: 1; box-shadow: var(--shadow-md); }
@media (min-width: 900px) { .sticky-actions { bottom: 16px; justify-content: flex-end; } .sticky-actions .btn { flex: 0 0 auto; } }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }

/* Profile */
.profile-head { display: flex; gap: 16px; align-items: center; margin-bottom: 18px; }
.profile-head h2 { font-size: 22px; }
.profile-head p { color: var(--muted); font-size: 14px; }
fieldset { border: 0; }
fieldset legend { font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 12px; }
.form-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 18px; margin-bottom: 14px; }

/* Team list */
.person { display: flex; align-items: center; gap: 12px; }
.person .who { flex: 1; min-width: 0; }
.person .who b { display: block; font-size: 15.5px; }
.person .who span { font-size: 13.5px; color: var(--muted); }

/* ---------- Bottom sheet / modal ---------- */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(10, 30, 25, .45); z-index: 80; opacity: 0; transition: opacity .2s; }
.sheet-backdrop.show { opacity: 1; }
.modal {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 90; background: var(--cream);
  border-radius: 22px 22px 0 0; max-height: 92vh; max-height: 92dvh; display: flex; flex-direction: column;
  transform: translateY(100%); transition: transform .28s var(--ease); box-shadow: var(--shadow-md);
}
.modal.show { transform: none; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 16px 12px; border-bottom: 1px solid var(--line); }
.modal-head h2 { flex: 1; font-size: 21px; }
.modal-head::before { content: ""; position: absolute; top: 7px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 2px; background: #d5d2ca; }
.modal-body { padding: 16px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.modal-foot { padding: 12px 16px calc(12px + var(--safe-b)); border-top: 1px solid var(--line); display: flex; gap: 10px; background: #fff; }
.modal-foot .btn { flex: 1; }
@media (min-width: 700px) {
  .modal { left: 50%; right: auto; bottom: auto; top: 50%; width: 560px; border-radius: 22px; transform: translate(-50%, -46%); opacity: 0; transition: transform .22s var(--ease), opacity .22s; max-height: 88vh; }
  .modal.show { transform: translate(-50%, -50%); opacity: 1; }
  .modal-head::before { display: none; }
  .modal-foot { border-radius: 0 0 22px 22px; }
}
.calc { font-size: 13.5px; color: var(--green-800); background: var(--green-50); border-radius: 8px; padding: 8px 12px; margin: -4px 0 14px; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar) + var(--safe-b) + 16px); transform: translate(-50%, 20px);
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 14.5px; font-weight: 500;
  z-index: 100; opacity: 0; transition: opacity .2s, transform .2s var(--ease); max-width: calc(100% - 32px); pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 900px) { .toast { bottom: 24px; } }

.spinner { width: 28px; height: 28px; border: 3px solid var(--green-100); border-top-color: var(--green-700); border-radius: 50%; animation: spin .8s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
.hero-card .muted { color: rgba(255, 255, 255, .6); font-size: .7em; }


/* ---------- Rota warnings, tab strip, bell ---------- */
.seg.scroll { display: flex; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.seg.scroll::-webkit-scrollbar { display: none; }
.seg.scroll button { flex: 0 0 auto; padding: 0 14px; white-space: nowrap; }

.bell { position: relative; }
.badge-dot {
  position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700;
  display: grid; place-items: center; border: 2px solid var(--cream);
}
.alert { border-radius: 10px; padding: 8px 12px; font-size: 13.5px; font-weight: 500; display: flex; gap: 8px; align-items: flex-start; }
.alert + .alert { margin-top: 6px; }
.alert.bad { background: var(--red-50); color: var(--red); }
.alert.warn { background: var(--amber-50); color: #6d4a10; }
.alert.good { background: var(--green-50); color: var(--green-800); }
.alerts { margin: 0 0 10px; }
.day-group .alerts { margin: 0 0 8px; }
.cover-bar { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); margin: 0 0 8px 2px; }
.cover-bar b { color: var(--ink); }
.pill.charge { background: var(--green-800); color: #fff; }
.pill.bad { background: var(--red-50); color: var(--red); }
.pill.warn { background: var(--amber-50); color: #6d4a10; }
.notif { display: flex; gap: 12px; align-items: flex-start; }
.notif.unread { border-left: 3px solid var(--amber); }
.notif .when { font-size: 12.5px; color: var(--muted); }
.tick-row { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid #f0eee9; font-size: 14.5px; }
.tick-row:last-child { border-bottom: 0; }
.tick-row .state { font-weight: 600; white-space: nowrap; }
.state.ok { color: var(--green-800); }
.state.due { color: #8a5a10; }
.state.bad { color: var(--red); }
.state.missing { color: var(--muted); }
.item .tags .pill { white-space: normal; text-align: left; }
