/* ============================================================
   Dumpling Drop — staff portal theme
   Warm, modern, red-on-cream. Design tokens up top; all the
   original component class names are preserved below.
   ============================================================ */
:root {
  --brand: #c1272d;
  --brand-dark: #9e1b21;
  --brand-soft: #fbeae9;
  --bg: #f7f1ec;
  --surface: #ffffff;
  --surface-2: #fbf7f3;
  --ink: #2a211e;
  --ink-2: #7c6f68;
  --line: #ece2da;
  --line-strong: #ddcfc4;
  --ok-bg: #e8f4e4; --ok-fg: #266b2f; --ok-bd: #c2e3ba;
  --warn-bg: #fdf3d4; --warn-fg: #7a5712; --warn-bd: #efdb98;
  --err-bg: #fbe4e1; --err-fg: #98271f; --err-bd: #f1c3bd;
  --info-bg: #eef2f7; --info-fg: #3a4a5e; --info-bd: #d4dce6;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(42,33,30,.05), 0 1px 3px rgba(42,33,30,.06);
  --shadow-md: 0 4px 16px rgba(42,33,30,.07), 0 2px 6px rgba(42,33,30,.05);
  --shadow-lg: 0 14px 40px rgba(42,33,30,.13);
  --font: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
}
* { box-sizing: border-box; }
body {
  font-family: var(--font);
  margin: 0; background: var(--bg); color: var(--ink);
  font-size: 15px; line-height: 1.55;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3, .brand-text {
  font-family: var(--font-display); font-optical-sizing: auto;
}

/* ---------- Top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 24px; flex-wrap: wrap;
  background: linear-gradient(180deg, #c92c31 0%, var(--brand) 100%);
  color: #fff; box-shadow: 0 2px 12px rgba(158,27,33,.28);
  position: sticky; top: 0; z-index: 40;
}
.topbar .brand {
  color: #fff; font-weight: 800; text-decoration: none; font-size: 18px;
  display: inline-flex; align-items: center; gap: 11px; letter-spacing: -.01em;
}
.topbar .brand-logo {
  height: 38px; width: auto; display: block; background: #fff;
  padding: 4px 7px; border-radius: 9px; box-shadow: 0 2px 6px rgba(0,0,0,.12);
}
.topbar .brand-text { font-size: 15px; font-weight: 600; opacity: .92; }
.topbar nav { margin-left: auto; display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.topbar nav a.nav-link {
  color: rgba(255,255,255,.85); text-decoration: none;
  padding: 7px 13px; border-radius: 999px;
  font-size: 14px; font-weight: 500; line-height: 1.4;
  transition: background .15s, color .15s;
}
.topbar nav a.nav-link:hover { color: #fff; background: rgba(255,255,255,.16); }
.topbar nav a.nav-link.active {
  color: var(--brand); background: #fff; font-weight: 600;
  box-shadow: 0 2px 8px rgba(0,0,0,.14);
}

.user-menu { position: relative; margin-left: 6px; }
.user-menu summary { list-style: none; cursor: pointer; }
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary::marker { content: ""; }
.user-trigger { display: inline-flex; align-items: center; justify-content: center; }
.user-trigger .avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: #fff; color: var(--brand); font-weight: 700; font-size: 13px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid rgba(255,255,255,.5);
  transition: border-color .15s, transform .05s; user-select: none;
}
.user-menu[open] .user-trigger .avatar { border-color: #fff; }
.user-trigger:hover .avatar { border-color: #fff; }
.user-dropdown {
  position: absolute; right: 0; top: calc(100% + 10px);
  min-width: 210px; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow-lg); padding: 6px; z-index: 50;
}
.user-dropdown-name {
  padding: 9px 12px; font-size: 13px; color: var(--ink-2);
  border-bottom: 1px solid var(--line); margin-bottom: 4px;
}
.user-dropdown-item {
  display: block; padding: 9px 12px; color: var(--ink);
  text-decoration: none; font-size: 14px; border-radius: 7px;
}
.user-dropdown-item:hover { background: var(--brand-soft); color: var(--brand); }

/* ---------- Page header + controls ---------- */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin: 0 0 16px;
}
.page-header h1 { margin: 0; }

.segmented {
  display: inline-flex; padding: 3px; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 999px; gap: 0;
}
.segmented .seg {
  padding: 6px 15px; font-size: 14px; font-weight: 500;
  color: var(--ink-2); text-decoration: none; border-radius: 999px;
  line-height: 1.4; transition: background .15s, color .15s;
}
.segmented .seg:hover { color: var(--ink); }
.segmented .seg.seg-active {
  background: #fff; color: var(--brand); font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.period-nav {
  display: inline-flex; align-items: stretch; gap: 0;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  overflow: hidden; background: var(--surface); margin: 0 0 12px;
}
.period-nav .navbtn {
  padding: 8px 15px; font-size: 14px; font-weight: 500;
  color: var(--brand); text-decoration: none; line-height: 1.4;
  border-left: 1px solid var(--line); background: var(--surface);
  transition: background .12s;
}
.period-nav .navbtn:first-child { border-left: 0; }
.period-nav .navbtn:hover { background: var(--brand-soft); }
.period-nav .navbtn-current { background: var(--surface-2); font-weight: 600; }
.period-nav .navbtn[aria-disabled="true"] { color: var(--ink-2); cursor: default; }
.period-nav .navbtn[aria-disabled="true"]:hover { background: var(--surface-2); }

.sep { color: var(--line-strong); margin: 0 4px; }

/* ---------- Layout + cards ---------- */
main { max-width: 1000px; margin: 30px auto; padding: 0 18px; }
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-md);
  padding: 24px 26px; margin-bottom: 20px;
}
.card.narrow {
  max-width: 380px; margin: 64px auto; box-shadow: var(--shadow-lg);
  padding: 30px 30px 34px;
}
h1 { margin-top: 0; font-size: 25px; font-weight: 600; letter-spacing: -.01em; }
h2 { margin-top: 26px; font-size: 19px; font-weight: 600; letter-spacing: -.005em; }
h3 { font-size: 15px; font-weight: 600; }
.muted { color: var(--ink-2); font-size: 14px; }

/* ---------- Flash + banners ---------- */
.flash { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 14px; font-size: 14px; }
.flash-error { background: var(--err-bg); color: var(--err-fg); border: 1px solid var(--err-bd); }
.flash-info  { background: var(--info-bg); color: var(--info-fg); border: 1px solid var(--info-bd); }

.banner {
  margin-top: 12px; padding: 12px 16px; border-radius: var(--radius-sm);
  background: var(--ok-bg); color: var(--ok-fg); border: 1px solid var(--ok-bd);
}
.banner.ok { background: var(--ok-bg); color: var(--ok-fg); border-color: var(--ok-bd); }
.banner.info { background: var(--info-bg); color: var(--info-fg); border-color: var(--info-bd); }
.banner.warn { background: var(--warn-bg); color: var(--warn-fg); border-color: var(--warn-bd); }
.banner.error { background: var(--err-bg); color: var(--err-fg); border-color: var(--err-bd); }

/* Multi-position checkboxes (staff row + add-staff form) */
.pos-checks { display: flex; flex-direction: column; gap: 3px; }
.pos-check {
  display: inline-flex; align-items: center; gap: 6px; margin: 0;
  font-size: 13px; font-weight: 500; color: var(--ink); white-space: nowrap;
}
.pos-check input { width: auto; display: inline; padding: 0; margin: 0; }

/* Manager notices */
.notices-card { border-left: 4px solid var(--brand); }
.notice { padding: 10px 0; border-bottom: 1px solid var(--line); }
.notice:last-child { border-bottom: 0; }
.notice-body { margin: 0 0 2px; white-space: pre-wrap; }
.notice-meta { margin: 0; font-size: 12px; }

/* ---------- Forms ---------- */
label { display: block; margin: 10px 0; font-size: 13px; font-weight: 500; color: var(--ink-2); }
label input, label select, input, select, textarea {
  display: block; width: 100%; padding: 10px 12px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  font-size: 14px; font-family: inherit; background: #fff; color: var(--ink);
  transition: border-color .12s, box-shadow .12s;
}
label input:focus, label select:focus, input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(193,39,45,.15);
}
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.row label { flex: 1 1 140px; }
.row button { flex: 0 0 auto; }

/* ---------- Buttons ---------- */
button, .button {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 9px 17px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font-size: 14px; font-weight: 600; line-height: 1.4; font-family: inherit;
  cursor: pointer; background: var(--surface-2); color: var(--ink);
  border-color: var(--line-strong); text-decoration: none;
  transition: background .12s, border-color .12s, color .12s, box-shadow .12s, transform .04s;
}
button:hover, .button:hover { background: #f1e9e2; }
button:active, .button:active { transform: translateY(1px); }
button.primary, .button.primary {
  background: var(--brand); color: #fff; border-color: transparent;
  box-shadow: 0 2px 8px rgba(193,39,45,.28);
}
button.primary:hover, .button.primary:hover { background: var(--brand-dark); }
button.danger { background: #fff; color: var(--brand); border-color: var(--brand); }
button.danger:hover { background: var(--brand-soft); }
button:disabled, button[disabled], input:disabled, input[disabled] { opacity: .5; cursor: not-allowed; }
button.ghost { background: #fff; border: 1px solid var(--line-strong); color: var(--ink); }
button.ghost:hover { background: var(--surface-2); }
button.link {
  background: none; border: 0; color: var(--brand); text-decoration: underline;
  padding: 0; font-weight: 600; box-shadow: none;
}
button.link:hover { background: none; color: var(--brand-dark); }
button.btn-sm { padding: 4px 10px; font-size: 12px; }
.invoiced-yes { display: inline-flex; align-items: center; }
.big { font-size: 22px; padding: 18px 28px; min-width: 220px; }
.huge {
  display: block; width: 100%; min-height: 76px;
  font-size: 26px; font-weight: 800;
  padding: 20px 28px; margin: 6px 0 4px; letter-spacing: .3px;
  box-shadow: 0 6px 18px rgba(193,39,45,.30);
}
.clock-card { padding: 20px 20px 22px; }
.clock-card .big-banner { font-size: 18px; padding: 14px 16px; margin: 0 0 12px; text-align: center; }
.clock-card .banner-hint { margin: 8px 0 0; font-size: 14px; font-weight: 400; opacity: .85; }
@media (max-width: 480px) {
  .huge { font-size: 24px; min-height: 76px; }
  .clock-card .big-banner { font-size: 17px; }
}

/* ---------- Tables ---------- */
table.grid { width: 100%; border-collapse: collapse; margin-top: 10px; }
table.grid th, table.grid td {
  border-bottom: 1px solid var(--line); padding: 11px 12px; text-align: left; font-size: 14px;
}
table.grid th {
  background: transparent; color: var(--ink-2); font-weight: 600;
  font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
  border-bottom: 1.5px solid var(--line-strong);
}
table.grid tbody tr { transition: background .1s; }
table.grid tbody tr:hover { background: var(--surface-2); }
table.grid tbody tr:last-child td { border-bottom: 0; }

.dots span { display: inline-block; opacity: .2; animation: dot-blink 1.2s infinite; }
.dots span:nth-child(2) { animation-delay: .2s; }
.dots span:nth-child(3) { animation-delay: .4s; }
@keyframes dot-blink { 0%,80%,100% { opacity: .2; } 40% { opacity: 1; } }

ul.recent-requests { padding-left: 20px; margin: 8px 0; }
ul.recent-requests li { margin-bottom: 6px; }

/* ---------- Badges ---------- */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; line-height: 1.5;
  background: var(--surface-2); color: var(--ink); text-transform: capitalize;
  border: 1px solid var(--line-strong);
}
.badge-pending { background: var(--warn-bg); color: var(--warn-fg); border-color: var(--warn-bd); }
.badge-done { background: var(--ok-bg); color: var(--ok-fg); border-color: var(--ok-bd); }
.badge-dismissed { background: var(--surface-2); color: var(--ink-2); border-color: var(--line-strong); }
.badge-expired { background: var(--err-bg); color: var(--err-fg); border-color: var(--err-bd); }
.badge-expiring { background: var(--warn-bg); color: var(--warn-fg); border-color: var(--warn-bd); }
.badge-ok { background: var(--ok-bg); color: var(--ok-fg); border-color: var(--ok-bd); }

/* ---------- Calendar (week) ---------- */
table.grid.cal { table-layout: fixed; }
table.grid.cal th.cal-emp { width: 130px; }
table.grid.cal th.cal-day { width: auto; font-weight: 600; }
table.grid.cal td.cal-cell { vertical-align: top; min-height: 48px; padding: 6px 8px; font-size: 13px; }
table.grid.cal td.cal-cell-empty { background: var(--surface-2); }
table.grid.cal td.cal-cell-filled { background: var(--brand-soft); }
table.grid.cal .cal-shift { line-height: 1.3; margin-bottom: 2px; }
table.grid.cal .cal-time { font-weight: 600; }
table.grid.cal .cal-site { color: var(--ink-2); margin-left: 2px; }
table.grid.cal .cal-role { color: var(--brand); font-weight: 600; margin-left: 4px; }
@media (max-width: 700px) {
  table.grid.cal { font-size: 12px; }
  table.grid.cal th.cal-emp { width: 80px; }
  table.grid.cal td.cal-cell { padding: 4px 5px; }
}

/* ---------- Calendar (month) ---------- */
table.grid.month-cal { table-layout: fixed; }
table.grid.month-cal th { text-align: center; font-weight: 600; }
table.grid.month-cal td.month-cell {
  vertical-align: top; height: 92px; padding: 5px 6px; font-size: 12px;
  border: 1px solid var(--line); background: #fff;
}
table.grid.month-cal td.month-cell-other { background: var(--surface-2); color: var(--line-strong); }
table.grid.month-cal td.month-cell-today { background: var(--brand-soft); }
.month-day-num { font-weight: 700; font-size: 13px; margin-bottom: 3px; }
.month-shift {
  background: var(--brand-soft); border-radius: 5px; padding: 1px 5px; margin-bottom: 2px;
  font-size: 11px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.month-shift .month-time { font-weight: 600; margin-right: 3px; }
.month-shift .month-who { color: var(--ink-2); }
@media (max-width: 700px) {
  table.grid.month-cal td.month-cell { height: 60px; padding: 3px 4px; font-size: 11px; }
  .month-shift { font-size: 10px; }
}

/* Pending fix-request count badge on the Timesheets nav link */
.nav-badge {
  display: inline-block; min-width: 18px; padding: 0 6px;
  margin-left: 4px; border-radius: 999px;
  background: #fff; color: var(--brand); font-size: 12px; font-weight: 700;
  line-height: 18px; text-align: center; vertical-align: middle;
}

/* Prominent location picker above the big Clock In button (/me) */
.jobsite-pick { display: block; margin: 0 0 14px; }
.jobsite-pick-label { display: block; font-size: 16px; font-weight: 600; margin-bottom: 6px; color: var(--ink); }
.jobsite-pick select { width: 100%; padding: 13px; font-size: 16px; }

/* "Add hours" proposed-shift fields inside the request form */
.add-hours-fields { flex: 1 1 100%; display: flex; flex-wrap: wrap; gap: 12px; }
.add-hours-fields label { flex: 1 1 140px; }
.add-hours-fields[hidden] { display: none; }

/* ---------- Mobile pass (employee dashboard) ---------- */
@media (max-width: 540px) {
  main { margin: 16px auto; }
  .card { padding: 18px 18px; }
  .row.stack-mobile { flex-direction: column; align-items: stretch; }
  .row.stack-mobile label { flex: 1 1 auto; width: 100%; }
  .row.stack-mobile button { width: 100%; }
  .add-hours-fields { flex-direction: column; }
  label input, label select, label textarea, input, select, textarea { font-size: 16px; }
  table.grid.responsive thead { display: none; }
  table.grid.responsive, table.grid.responsive tbody,
  table.grid.responsive tr, table.grid.responsive td { display: block; width: 100%; }
  table.grid.responsive tr {
    border: 1px solid var(--line); border-radius: var(--radius-sm);
    margin-bottom: 10px; padding: 8px 14px; background: #fff;
  }
  table.grid.responsive td {
    border: none; padding: 5px 0; font-size: 15px;
    display: flex; justify-content: space-between; gap: 12px;
  }
  table.grid.responsive td::before { content: attr(data-label); font-weight: 600; color: var(--ink-2); }
  table.grid.responsive td.row-actions { justify-content: flex-end; }
  table.grid.responsive td.row-actions::before { content: ""; }
}
