/* ============================================================
   Bar Calendar — design system
   Layers on top of vendored Bootstrap 5. No external assets.
   ============================================================ */

:root {
  --brand-50: #eff6ff;
  --brand-100: #dbeafe;
  --brand-500: #3b82f6;
  --brand-600: #2563eb;
  --brand-700: #1d4ed8;
  --accent: #f59e0b;
  --ink: #1a2033;
  --ink-soft: #5b6376;
  --line: #e7eaf1;
  --surface: #ffffff;
  --canvas: #f5f7fb;
  --sidebar-from: #152247;
  --sidebar-to: #0b1229;
  --sidebar-ink: #a6b2d1;
  --sidebar-ink-dim: #6b7799;
  --radius: 14px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-md: 0 4px 16px rgba(16, 24, 40, .08);
  --shadow-lg: 0 20px 50px rgba(16, 12, 42, .35);
}

html { font-size: 15px; }

body {
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, "Inter", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5 { font-weight: 700; letter-spacing: -0.01em; }

a { color: var(--brand-600); text-decoration: none; }
a:hover { color: var(--brand-700); }

/* ---------- Buttons ---------- */
/* background-clip stops the fill painting underneath the border — without it,
   rounded corners on high-DPI/mobile screens render a second inner arc. */
.btn, .form-control, .form-select, .stat-pill, .hours-chip, .week-day, .card,
.shift-row, .settings-card, .seg-btn, .segmented, .dropdown-menu, .alert {
  background-clip: padding-box;
}

.btn {
  border-radius: 0;
  font-weight: 600;
  padding: .45rem 1rem;
  box-shadow: none;
  /* One clean focus ring; avoids the doubled-corner look from stacked rings on touch */
  --bs-btn-focus-box-shadow: 0 0 0 3px rgba(59, 130, 246, .25);
}
.btn:focus:not(:focus-visible) { box-shadow: none; }
.btn-sm { border-radius: 0; padding: .25rem .65rem; }
.btn-lg { border-radius: 0; padding: .65rem 1.25rem; }

/* Native date/time inputs draw their own inner chrome on mobile — flatten it */
input[type="date"].form-control, input[type="time"].form-control {
  -webkit-appearance: none;
  appearance: none;
  background-color: var(--surface);
}

.btn-primary {
  --bs-btn-bg: var(--brand-600);
  --bs-btn-border-color: var(--brand-600);
  --bs-btn-hover-bg: var(--brand-700);
  --bs-btn-hover-border-color: var(--brand-700);
  --bs-btn-active-bg: var(--brand-700);
  --bs-btn-active-border-color: var(--brand-700);
}

.btn-outline-primary {
  --bs-btn-color: var(--brand-600);
  --bs-btn-border-color: #cdd2f4;
  --bs-btn-hover-bg: var(--brand-50);
  --bs-btn-hover-color: var(--brand-700);
  --bs-btn-hover-border-color: var(--brand-500);
  --bs-btn-active-bg: var(--brand-100);
  --bs-btn-active-color: var(--brand-700);
  --bs-btn-active-border-color: var(--brand-500);
}

/* ---------- Forms ---------- */
.form-control, .form-select {
  border-radius: 9px;
  border-color: #d9dbe8;
}
.form-control:focus, .form-select:focus {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 .2rem rgba(59, 130, 246, .15);
}

/* ============================================================
   App shell (signed-in): sidebar + topbar
   ============================================================ */
.app-shell { display: flex; min-height: 100vh; }

.app-sidebar {
  width: 264px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--sidebar-from), var(--sidebar-to));
  color: var(--sidebar-ink);
  display: flex;
  flex-direction: column;
  border: 0;
}

/* Desktop: pin the sidebar to the viewport so the bottom Settings link is always
   visible without scrolling the page; the nav scrolls internally if it overflows. */
@media (min-width: 992px) {
  .app-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, .15) transparent;
  }
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: 1.35rem 1.4rem 1.1rem;
  color: #fff;
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: -.01em;
}
.sidebar-brand:hover { color: #fff; }
.sidebar-brand .brand-mark {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand-500), #60a5fa);
  box-shadow: 0 4px 12px rgba(37, 99, 235, .45);
  color: #fff;
}

.sidebar-section {
  margin: 1.15rem 1.4rem .35rem;
  font-size: .66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--sidebar-ink-dim);
}

/* Subtle rule between the everyday links and the manager/admin groups. */
.sidebar-divider {
  margin: 1rem 1.4rem .1rem;
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, .09);
  opacity: 1;
}
.sidebar-divider + .sidebar-section { margin-top: .9rem; }
.sidebar-nav { list-style: none; margin: 0; padding: 0 .8rem; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .55rem .7rem;
  margin-bottom: 2px;
  border-radius: 9px;
  color: var(--sidebar-ink);
  font-weight: 500;
  font-size: .95rem;
  transition: background .12s ease, color .12s ease;
}
.sidebar-nav a svg { flex-shrink: 0; opacity: .8; }
.sidebar-nav a:hover { background: rgba(255, 255, 255, .06); color: #e9e8f6; }
.sidebar-nav a.active {
  background: rgba(59, 130, 246, .18);
  color: #fff;
  /* left border removed by request */
}
.sidebar-nav a.active svg { opacity: 1; }

.sidebar-bottom {
  margin: auto .8rem 0;
  padding: .6rem 0 0;
  border-top: 1px solid rgba(255, 255, 255, .07);
}

/* ---------- Collapse to an icon rail (desktop only; phones use the offcanvas) ---------- */
.sidebar-collapse-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin-right: .9rem;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--sidebar-ink-dim);
  transition: background .12s ease, color .12s ease;
}
.sidebar-collapse-btn svg { flex-shrink: 0; opacity: .85; }
.sidebar-collapse-btn:hover { background: rgba(255, 255, 255, .06); color: #e9e8f6; }

@media (min-width: 992px) {
  .app-sidebar { transition: width .15s ease; }

  .app-sidebar.collapsed { width: 74px; }
  .app-sidebar.collapsed .sidebar-head { justify-content: center; }
  .app-sidebar.collapsed .sidebar-brand { display: none; }
  .app-sidebar.collapsed .sidebar-collapse-btn { margin: 1.1rem 0 .9rem; }
  .app-sidebar.collapsed .sidebar-section { display: none; }
  .app-sidebar.collapsed .sidebar-divider { margin: .8rem .8rem .1rem; }
  /* font-size 0 hides the label text nodes; the SVGs keep their attribute size. */
  .app-sidebar.collapsed .sidebar-nav a { font-size: 0; gap: 0; justify-content: center; padding: .6rem; }
}

.sidebar-bottom { margin-bottom: 1rem; }

/* ---------- Contextual settings quick links in the topbar ---------- */
.topbar-quick {
  display: flex;
  align-items: center;
  gap: .55rem;
  margin-left: 1.1rem;
  font-size: .85rem;
  white-space: nowrap;
}
.topbar-quick-label { color: var(--bs-secondary-color, #6c757d); font-weight: 600; }
.topbar-quick a { color: inherit; opacity: .8; text-decoration: none; border-bottom: 1px dotted currentColor; }
.topbar-quick a:hover { opacity: 1; color: var(--brand-500, #2563eb); }

/* ---------- Topbar ---------- */
.app-content { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.app-topbar {
  height: 64px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1.6rem;
  position: sticky;
  top: 0;
  z-index: 1020;
}

.topbar-company {
  display: flex;
  align-items: center;
  gap: .55rem;
  font-weight: 600;
  color: var(--ink);
}
.topbar-company svg { color: var(--brand-600); }
.topbar-company .form-select {
  font-weight: 600;
  border: 1px solid var(--line);
  background-color: var(--canvas);
  min-width: 190px;
}

.user-menu .dropdown-toggle {
  display: flex;
  align-items: center;
  gap: .6rem;
  background: none;
  border: 0;
  color: var(--ink);
  font-weight: 600;
}
.user-menu .dropdown-toggle::after { color: var(--ink-soft); }
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand-500), #60a5fa);
  color: #fff;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .02em;
}
.dropdown-menu {
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  padding: .4rem;
}
.dropdown-item { border-radius: 8px; padding: .45rem .75rem; font-weight: 500; }
.dropdown-item:hover { background: var(--brand-50); color: var(--brand-700); }

/* ---------- Main content ---------- */
.app-main { padding: 1.8rem 1.9rem 2.5rem; max-width: 1280px; width: 100%; }
/* Data-dense pages (appointment book, shift builder, schedule) opt out of the reading-width
   cap via ViewData["FullWidth"] — forms and settings keep the comfortable 1280px. */
.app-main-full { max-width: none; }

.app-main h1 {
  font-size: 1.45rem;
  margin-bottom: .25rem;
}
.app-main h1 small { font-size: .95rem; font-weight: 500; color: var(--ink-soft) !important; }

/* Cards + tables read as panels */
.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-header { background: transparent; border-bottom: 1px solid var(--line); font-weight: 600; }

.app-main .table {
  --bs-table-bg: var(--surface);
  --bs-table-striped-bg: #fafbfe;
  border: 1px solid var(--line);
  border-radius: 12px;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.app-main .table thead th {
  background: #f8f9fd;
  color: var(--ink-soft);
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  border-bottom: 1px solid var(--line);
  padding: .65rem .85rem;
}
.app-main .table td { padding: .7rem .85rem; border-bottom: 1px solid #f0f1f7; }
.app-main .table tbody tr:last-child td { border-bottom: 0; }

.badge { font-weight: 600; border-radius: 6px; padding: .34em .6em; }

.alert { border-radius: 12px; border: 0; box-shadow: var(--shadow-sm); }

/* ============================================================
   Auth pages (login / register / password)
   ============================================================ */
.auth-body {
  min-height: 100vh;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1rem;
  background:
    radial-gradient(900px 500px at 15% -10%, rgba(59, 130, 246, .35), transparent 60%),
    radial-gradient(800px 500px at 110% 15%, rgba(245, 158, 11, .16), transparent 55%),
    linear-gradient(160deg, #171232 0%, #0e0b20 70%);
}

.auth-wrap { width: 100%; max-width: 480px; }
.auth-wrap.auth-wide { max-width: 620px; }

.auth-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .65rem;
  color: #fff;
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}
.auth-brand:hover { color: #fff; }
.auth-brand .brand-mark {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--brand-500), #60a5fa);
  box-shadow: 0 6px 18px rgba(37, 99, 235, .5);
  color: #fff;
}

.auth-card {
  background: var(--surface);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  padding: 2.1rem 2.2rem 2.2rem;
}
.auth-card h1 { font-size: 1.35rem; margin-bottom: .3rem; }
.auth-card .auth-sub { color: var(--ink-soft); font-size: .92rem; margin-bottom: 1.5rem; }

.auth-card .form-floating > .form-control,
.auth-card .form-floating > .form-select { border-radius: 10px; }

.auth-divider {
  display: flex;
  align-items: center;
  gap: .8rem;
  color: var(--ink-soft);
  font-size: .8rem;
  margin: 1.25rem 0;
}
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.auth-foot { text-align: center; color: rgba(255, 255, 255, .45); font-size: .8rem; margin-top: 1.4rem; }

.auth-section-label {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--brand-600);
  margin: 1.1rem 0 .6rem;
}

/* ============================================================
   Public (anonymous) pages — landing
   ============================================================ */
.public-nav {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: .8rem 0;
}
.public-nav .navbar-brand {
  display: flex; align-items: center; gap: .6rem;
  font-weight: 700; color: var(--ink); font-size: 1.1rem;
}
.public-nav .brand-mark {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--brand-500), #60a5fa);
  color: #fff;
}

.hero {
  padding: 5rem 0 3.5rem;
  text-align: center;
}
.hero h1 {
  font-size: 2.6rem;
  letter-spacing: -.03em;
  max-width: 640px;
  margin: 0 auto .9rem;
}
.hero h1 .accent {
  background: linear-gradient(90deg, var(--brand-500), #60a5fa);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero p { color: var(--ink-soft); font-size: 1.1rem; max-width: 540px; margin: 0 auto 1.8rem; }

.feature-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  height: 100%;
}
.feature-card .icon {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border-radius: 11px;
  background: var(--brand-50);
  color: var(--brand-600);
  margin-bottom: .9rem;
}
.feature-card h5 { font-size: 1rem; margin-bottom: .35rem; }
.feature-card p { color: var(--ink-soft); font-size: .9rem; margin: 0; }

/* ============================================================
   Schedule page — modern facelift
   ============================================================ */

/* ---- Stat pills (summary bar + per-day) ---- */
.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .3rem .8rem;
  border-radius: 999px;
  font-size: .82rem;
  font-weight: 600;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink-soft);
}
.stat-pill.stat-danger { background: #fdecec; border-color: #f7c5c5; color: #a32d2d; }
.stat-pill.stat-success { background: #e5f6ef; border-color: #b6e6d2; color: #0f6e56; }
.stat-pill.stat-brand { background: var(--brand-50); border-color: #d5d9fb; color: var(--brand-700); }
.stat-pill.stat-event { background: #fbf3ff; border-color: #eddcf9; color: #7b3aa5; }

.hours-chip {
  padding: .25rem .75rem;
  border-radius: 999px;
  font-size: .8rem;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink-soft);
}
.hours-chip strong { color: var(--ink); font-weight: 700; margin-left: .15rem; }

/* Admin person filter: click a name to see only their week */
button.person-pill { cursor: pointer; }
button.person-pill:hover { border-color: var(--brand-500); color: var(--brand-700); }
.person-pill-active {
  background: var(--brand-600) !important;
  border-color: var(--brand-600) !important;
  color: #fff !important;
}
.person-pill-active strong { color: #fff !important; }

/* ---- Segmented filter control ---- */
.segmented {
  display: inline-flex;
  background: #e9eaf3;
  border-radius: 0;
  padding: 3px;
  gap: 2px;
}
.seg-btn {
  border: 0;
  background: transparent;
  border-radius: 0;
  padding: .3rem 1rem;
  font-size: .84rem;
  font-weight: 600;
  color: var(--ink-soft);
  transition: all .15s ease;
}
.seg-btn:hover { color: var(--ink); }
.seg-btn.active {
  background: var(--surface);
  color: var(--brand-700);
  box-shadow: 0 1px 3px rgba(16, 24, 40, .12);
}

/* ---- Week strip (mini calendar) ---- */
.week-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(56px, 1fr));
  gap: 8px;
  margin: .75rem 0 1.25rem;
}

/* ---------- Schedule polish: sticky nav, chip popup affordance, on-now, job key ---------- */
@media (min-width: 992px) {
  /* The week strip pins under the topbar while scrolling; day headers stay in their cards
     (pinning them read as broken — a floating band covering the shifts beneath it). */
  body.sched-sticky .week-strip {
    position: sticky;
    top: 64px;
    z-index: 1015;
    background: var(--canvas);
    padding: .4rem 0;
    margin: .35rem 0 .9rem;
  }
}

/* A chip with actions behaves like a button: pointer, hover ring, caret. */
.person-chip.chip-act { cursor: pointer; }
.person-chip.chip-act:hover, .person-chip.chip-act:focus-visible { box-shadow: 0 0 0 2px rgba(59, 130, 246, .3); }

.badge.on-now {
  background: #16a34a;
  color: #fff;
  animation: onNowPulse 2.2s ease-in-out infinite;
}
@keyframes onNowPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, .45); }
  50% { box-shadow: 0 0 0 5px rgba(22, 163, 74, 0); }
}

/* List view stays one clear column, top to bottom — day cards just cap at a readable
   width on huge monitors (Grid and Staff views still use the whole screen). */
#dayCards .day-card { max-width: 1900px; }
body.sched-sticky .week-strip { max-width: 1900px; }

/* Suggested-pick chip on open slots: dashed amber = a proposal, not a decision. */
.suggest-chip {
  border: 1.5px dashed var(--accent);
  background: #fffbeb;
  color: #92400e;
  border-radius: 999px;
  padding: .15rem .65rem;
  font-size: .8rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background .12s ease;
}
.suggest-chip:hover { background: #fef3c7; }
.suggest-chip:disabled { opacity: .5; }

/* Empty days shrink to a slim strip instead of a full card. */
.day-empty .day-head { padding: .45rem 1.1rem; }
.day-empty .card-body { padding: .3rem 1.1rem .45rem; }
.day-empty .empty-day { padding: 0; font-size: .85rem; }

/* Shared job-color key chips (Shift Builder + Schedule). */
.bld-legend { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .5rem; font-size: .82rem; }
.bld-legend-label { font-weight: 700; color: var(--ink-soft); margin-right: .15rem; }
.bld-key { display: inline-flex; align-items: center; gap: .4rem; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: .12rem .65rem .12rem .5rem; color: inherit; font-size: .82rem; }
button.bld-key:hover { border-color: var(--brand-500); }
.bld-key.active { border-color: var(--brand-500); box-shadow: 0 0 0 2px rgba(59, 130, 246, .15); font-weight: 600; }
.bld-key-bar { width: 4px; height: 14px; border-radius: 2px; display: inline-block; }
.bld-key[data-anyone] { cursor: default; }
.week-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: .55rem .25rem .5rem;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.week-day:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--brand-500); color: var(--ink); }
.week-day .wd-name { font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-soft); }
.week-day .wd-num { font-size: 1.25rem; font-weight: 700; line-height: 1.2; }
.week-day .wd-dots { display: flex; gap: 3px; height: 6px; margin-top: 2px; }
.week-day .dot { width: 6px; height: 6px; border-radius: 50%; }
.dot-open { background: #e24b4a; }
.dot-mine { background: var(--brand-500); }
.dot-event { background: #b06fd8; }
.week-day.is-past { opacity: .5; }
.week-day.is-today {
  background: linear-gradient(135deg, var(--brand-600), #3b82f6);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 6px 16px rgba(79, 70, 229, .35);
}
.week-day.is-today .wd-name { color: rgba(255, 255, 255, .75); }
.week-day.is-today:hover { color: #fff; }

/* ---- Day cards ---- */
.day-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  scroll-margin-top: 80px;
}
.day-card.is-today { border-color: #c7cbf7; box-shadow: 0 6px 22px rgba(79, 70, 229, .12); }
.day-head {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .8rem 1.1rem;
  background: linear-gradient(180deg, #fbfbfe, #f6f7fc);
  border-bottom: 1px solid var(--line);
}
.day-card.is-today .day-head { background: linear-gradient(180deg, #f2f3ff, #ecedfd); }
.day-date { display: flex; align-items: center; gap: .6rem; }
.day-num {
  font-size: 1.7rem;
  font-weight: 800;
  line-height: 1;
  color: var(--ink);
  letter-spacing: -.02em;
  min-width: 2.1rem;
  text-align: center;
}
.day-card.is-today .day-num { color: var(--brand-600); }
.day-meta { display: flex; flex-direction: column; line-height: 1.15; }
.day-name { font-weight: 700; font-size: .95rem; }
.day-sub { font-size: .72rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .08em; }
.off-chip {
  font-size: .75rem;
  padding: .2rem .6rem;
  border-radius: 999px;
  background: #fdf1e3;
  border: 1px solid #f5ddbb;
  color: #854f0b;
}

/* ---- Shift tiles ---- */
.day-card .card-body { padding: .8rem .9rem; display: flex; flex-direction: column; gap: 8px; }
.shift-row {
  border: 1px solid var(--line);
  border-left: 4px solid transparent;
  border-radius: 0;
  padding: .55rem .8rem .55rem .7rem;
  background: var(--surface);
  transition: transform .12s ease, box-shadow .12s ease;
}

/* Buttons inside the shift listing get friendly rounded corners (global .btn is square). */
.day-card .btn, .shift-row .btn, .shift-actions .btn {
  border-radius: 8px;
}
.shift-row:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.sr-open { border-left-color: #e24b4a; background: #fffafa; }
.sr-filled { border-left-color: #1d9e75; }
.sr-mine { border-left-color: var(--brand-500); background: #f8f8ff; }
.sr-offered { border-left-color: var(--accent); background: #fffaf0; }
.sr-cancelled { border-left-color: #b4b2a9; background: #fafafa; }
.event-tile { border-left: 4px solid #b06fd8; background: #fdf9ff; }

.shift-label { font-weight: 700; font-size: .95rem; }
/* Time leads each row, bold and dark — same reading order as "Coming up" on My Schedule. */
.shift-time {
  color: var(--ink);
  font-weight: 700;
  font-size: .9rem;
  font-variant-numeric: tabular-nums;
}
/* Desktop: fixed columns so rows line up; released on mobile (see media query below). */
@media (min-width: 768px) {
  .day-card .shift-time { min-width: 10rem; }
  .day-card .shift-label { min-width: 11rem; }
}

/* Job badges — soft category colors */
.job-badge {
  font-size: .7rem;
  font-weight: 700;
  padding: .22rem .6rem;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: .05em;
}
/* Job badge colors come from each job's owner-chosen color (Job.BadgeStyle inline style).
   jb-0 = neutral "any job"; jb-event = special-event marker. */
.jb-0 { background: #f1efe8; color: #5f5e5a; }
.jb-event { background: #f3e6fb; color: #7b3aa5; }

/* Quick-pick color swatches on Settings → Jobs */
.color-dot {
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .15);
  padding: 0;
  cursor: pointer;
}
.color-dot:hover { box-shadow: 0 0 0 2px rgba(0, 0, 0, .35); }

/* Manager controls appear on hover (always visible on touch devices) */
@media (hover: hover) {
  .shift-actions { opacity: 0; transition: opacity .15s ease; }
  .shift-row:hover .shift-actions, .shift-actions:focus-within { opacity: 1; }
}

.avatar-sm {
  width: 30px; height: 30px;
  flex-shrink: 0;
  border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand-500), #60a5fa);
  color: #fff;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .02em;
  box-shadow: 0 2px 6px rgba(37, 99, 235, .3);
}
.avatar-empty {
  background: transparent;
  border: 1.5px dashed #c9cad8;
  color: #9a99ad;
  box-shadow: none;
}

.empty-day {
  text-align: center;
  color: #a3a2b8;
  font-size: .85rem;
  padding: 1rem 0;
}

.day-past { opacity: .55; transition: opacity .15s ease; }
.day-past:hover { opacity: 1; }

/* Hidden on screen, shown when printing (e.g. company name on the printed schedule) */
.print-only { display: none; }

/* ---------- Ajax feedback: toasts + button spinners ---------- */
#toastArea {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  transform: translateX(-50%);
  z-index: 1090;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  align-items: center;
  width: min(92vw, 26rem);
  pointer-events: none;
}
.toast-pop {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .25s ease, transform .25s ease;
  background: #1f2937;
  color: #fff;
  padding: .6rem 1.1rem;
  border-radius: 8px;
  font-size: .9rem;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
  text-align: center;
  max-width: 100%;
}
.toast-pop.show { opacity: 1; transform: none; }
.toast-success { background: #166534; }
.toast-danger { background: #b91c1c; }
.toast-warning { background: #92400e; }

/* ---------- Schedule calendar views ---------- */

/* The view switcher reuses the segmented look; entries are links */
a.seg-btn { text-decoration: none; color: var(--ink-soft); display: inline-block; }
a.seg-btn:hover { color: var(--ink); }
.view-switch .seg-btn { padding: .3rem .7rem; }

/* Week grid: seven equal columns of compact cards */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  align-items: stretch;
}
.cal-cell {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 6px;
  min-height: 9rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: var(--shadow-sm);
}
.cal-cell.is-today { border-color: var(--brand-500); box-shadow: 0 0 0 1px var(--brand-500); }
.cal-day-head {
  display: flex;
  align-items: baseline;
  gap: .35rem;
  padding: 2px 4px;
  text-decoration: none;
  color: var(--ink);
  border-radius: 6px;
}
.cal-day-head:hover { background: var(--brand-50); color: var(--brand-700); }
.cal-dow { font-size: .72rem; font-weight: 700; text-transform: uppercase; color: var(--ink-soft); }
.cal-num { font-size: 1.05rem; font-weight: 800; }
.cal-open-pill {
  margin-left: auto;
  font-size: .62rem;
  font-weight: 700;
  color: #b91c1c;
  background: #fdecec;
  border-radius: 999px;
  padding: .08rem .45rem;
}
.cal-note {
  font-size: .68rem;
  color: #7a6320;
  background: #fdf6e3;
  border-radius: 6px;
  padding: 2px 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cal-empty { color: #c6c5d2; text-align: center; margin-top: 1rem; }
.cal-entry {
  display: block;
  text-decoration: none;
  border-left: 3px solid transparent;
  border-radius: 6px;
  background: #f6f6fa;
  padding: 3px 6px;
  font-size: .74rem;
  line-height: 1.25;
  color: var(--ink);
  overflow: hidden;
}
.cal-entry:hover { filter: brightness(.97); color: var(--ink); }
.cal-entry .ce-time { font-weight: 700; font-size: .68rem; display: block; color: var(--ink-soft); }
.cal-entry .ce-label { font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-entry .ce-who { display: block; font-size: .66rem; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ce-open { border-left-color: #e24b4a; background: #fdf1f1; }
.ce-open .ce-who { color: #b91c1c; font-weight: 700; }
.ce-filled { border-left-color: #1d9e75; background: #eefaf4; }
.ce-mine { border-left-color: var(--brand-500); background: var(--brand-50); }
.ce-offered { border-left-color: var(--accent); background: #fdf6e7; }
.ce-event { border-left-color: #b06fd8; background: #f7effc; }

/* Staff view: person × day matrix */
.staff-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.staff-table { margin-bottom: 0; min-width: 900px; }
.staff-table th, .staff-table td { vertical-align: top; }
.staff-table thead th { text-align: center; }
.staff-table th.is-today, .staff-table td.is-today { background: var(--brand-50); }
.staff-name-col { min-width: 12rem; }
.staff-day-link { text-decoration: none; color: var(--ink); font-weight: 700; }
.staff-day-link:hover { color: var(--brand-700); }
.staff-day-num { font-size: 1rem; }
.staff-table .cal-entry { margin-bottom: 4px; }
.staff-table .ce-job { display: flex; align-items: center; gap: 4px; font-size: .68rem; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.staff-table .ce-job .jobdot { width: 7px; height: 7px; box-shadow: 0 0 0 1px rgba(255,255,255,.7); }
.staff-open-row td { border-bottom: 2px solid var(--line); background: var(--surface); }
.staff-table .min-w-0 { min-width: 0; }
.staff-person { max-width: 100%; }
.staff-person .text-truncate { max-width: 11rem; }

/* Job-type dots (staff view, builder, key) */
.jobdot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex-shrink: 0; }

/* Staff view on a real screen: the week label, day header and open-slot row pin under
   the topbar so a name far down the list can still be dragged onto a slot. */
@media (min-width: 768px) {
  .staff-wrap { overflow: visible; }
  .app-main .staff-table { overflow: visible; } /* an overflow:hidden table would trap the sticky rows inside itself */
  body.staff-sticky .week-nav {
    position: sticky; z-index: 1012;
    background: var(--canvas);
    margin-top: 0; padding: .5rem 0;
  }
  body.staff-sticky .staff-table thead th { position: sticky; z-index: 1011; background: var(--surface); box-shadow: inset 0 -1px 0 var(--line); }
  body.staff-sticky .staff-table thead th.is-today { background: var(--brand-50); }
  body.staff-sticky .staff-table .staff-open-row td { position: sticky; z-index: 1011; box-shadow: inset 0 -2px 0 var(--line); }
  body.staff-sticky .staff-table .staff-open-row td.is-today { background: var(--brand-50); }
}
@media (max-width: 767.98px) {
  .staff-wrap { overflow-x: auto; }
}

/* Drag a name onto an open slot */
.staff-dnd .staff-person[draggable="true"] { cursor: grab; }
.staff-dnd .staff-person[draggable="true"]:active { cursor: grabbing; }
.staff-dnd.is-dragging .staff-slot { outline: 2px dashed var(--brand-500); outline-offset: 1px; }
.staff-dnd.is-dragging .staff-slot.slot-no { opacity: .35; outline-color: var(--line); }
.staff-dnd .staff-slot.slot-over { background: var(--brand-100) !important; outline-style: solid; transform: scale(1.03); }
.staff-dnd .staff-slot.slot-busy { opacity: .5; pointer-events: none; }

@media (max-width: 767.98px) {
  /* Grid becomes a horizontally swipeable strip of day columns */
  .cal-grid {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    gap: 8px;
    padding-bottom: 6px;
  }
  .cal-cell { flex: 0 0 72vw; scroll-snap-align: start; }
  .view-switch { overflow-x: auto; max-width: 100%; }
  .view-switch .seg-btn { padding: .35rem .55rem; font-size: .78rem; white-space: nowrap; }
}

/* Weekly availability grid (My Schedule) */
.avail-row {
  display: flex;
  align-items: center;
  gap: .45rem;
  margin-bottom: .35rem;
}
.avail-day { width: 2.4rem; font-weight: 700; font-size: .85rem; color: var(--ink-soft); }
.avail-mode { max-width: 9.5rem; }
.avail-time { max-width: 7rem; }

/* Announcements: banner above the schedule + pinned day notes */
.announce-bar {
  display: flex;
  align-items: center;
  gap: .6rem;
  background: var(--brand-50);
  border: 1px solid var(--brand-100);
  color: var(--brand-700);
  border-radius: 10px;
  padding: .55rem .9rem;
  font-weight: 600;
  margin-bottom: .4rem;
}
.day-note {
  background: #fdf6e3;
  border: 1px dashed #e3cf8f;
  color: #7a6320;
  border-radius: 8px;
  padding: .4rem .7rem;
  font-size: .88rem;
  margin: .35rem 0;
}

/* Count bubble on the "regulars" person icon (Settings → Shifts) */
.regulars-count {
  display: inline-block;
  min-width: 1.1em;
  padding: 0 .25em;
  margin-left: .15rem;
  border-radius: 999px;
  background: var(--brand-500);
  color: #fff;
  font-size: .62rem;
  font-weight: 700;
  line-height: 1.5;
  vertical-align: top;
}

.btn-spinner {
  display: inline-block;
  width: 1em;
  height: 1em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: btnspin .6s linear infinite;
  vertical-align: -.125em;
}
@keyframes btnspin { to { transform: rotate(360deg); } }

/* ---------- Responsive ---------- */
@media (max-width: 991.98px) {
  .app-main { padding: 1.2rem 1rem 2rem; }

  /* Phone topbar goes navy like the sidebar, and the company name truncates with
     an ellipsis instead of fighting the icons for space. */
  .app-topbar {
    padding: 0 1rem;
    gap: .6rem;
    background: linear-gradient(180deg, var(--sidebar-from), var(--sidebar-from));
    border-bottom: 0;
  }
  .app-topbar > .btn { color: #fff; }             /* hamburger */
  .topbar-company { color: #fff; min-width: 0; flex-shrink: 1; overflow: hidden; }
  .topbar-company svg { color: #9db1e8; flex-shrink: 0; }
  .topbar-company span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar-company .form-select {
    min-width: 0;
    max-width: 46vw;
    background-color: rgba(255, 255, 255, .1);
    color: #fff;
    border-color: rgba(255, 255, 255, .25);
  }
  .topbar-company .form-select option { color: var(--ink); }
  .app-topbar .help-btn { border-color: rgba(255, 255, 255, .28); color: #cfd8f5; }
  .app-topbar .help-btn:hover { background: rgba(255, 255, 255, .1); color: #fff; }
  .user-menu .dropdown-toggle { color: #fff; }
  .user-menu .dropdown-toggle::after { color: #cfd8f5; }
}

/* Phone: the schedule header stacks — full-width view tabs, then even button rows */
@media (max-width: 767.98px) {
  .app-main h1 small.print-only { display: none; }
  .sched-head { flex-direction: column; align-items: stretch; gap: .6rem; }
  .sched-head .sched-tools { justify-content: flex-start; }
  .sched-head .view-switch { width: 100%; display: flex; }
  .sched-head .view-switch .seg-btn { flex: 1; text-align: center; }
  .sched-head .sched-tools > .btn, .sched-head .sched-tools > a.btn:not(.d-none) { flex: 1; white-space: nowrap; }

  /* Phones are for looking and signing up. Managing (assign dropdowns, cancel slot,
     restore, per-person unassign ✕) stays on the desktop where there's room —
     except the compact ＋ Assign button, which opens the bottom sheet below. */
  .shift-row .shift-actions { display: none !important; }
  .day-card .chip-x { display: none !important; }

  /* Every shift row stacks the same way on a phone — four fixed lines, nothing truncated:
       line 1 — shift name (wraps freely) · action button pinned right
       line 2 — the bold time (full width, from the rule further below)
       line 3 — job + status badges
       then  — one full-width chip per person working it */
  .shift-row { row-gap: .45rem; }
  .shift-row > * { order: 4; }
  /* flex-basis AUTO is the load-bearing part: the name claims its natural width first
     and wraps at word boundaries — basis 0 let buttons crush it into a letter-column. */
  .shift-row > .shift-label { order: 1; flex: 1 1 auto; min-width: 0; }
  .shift-row > form, .shift-row > .mob-assign { order: 2; }
  .shift-row > form:first-of-type { margin-left: auto; }
  .shift-row > .text-muted { order: 6; flex: 1 1 100%; }   /* "Backup: …" note gets its own line */
  .shift-row > .job-badge, .shift-row > .badge { order: 6; }
  .shift-row > .person-chip { order: 7; flex: 1 1 100%; flex-wrap: wrap; }
}

/* Bottom sheet for mobile tap-to-assign */
.mob-sheet-back {
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 30, .45);
  z-index: 1930;
}
.mob-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1940;
  background: var(--surface);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -12px 32px rgba(16, 24, 40, .25);
  padding: .9rem 1rem calc(1rem + env(safe-area-inset-bottom));
  max-height: 70vh;
  display: flex;
  flex-direction: column;
}
.mob-sheet-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .4rem; }
.mob-sheet-list { overflow-y: auto; }
.mob-sheet-row {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: .7rem .3rem;
  font-weight: 600;
  font-size: 1rem;
  color: var(--ink);
}
.mob-sheet-row:active { background: var(--brand-50); }
.mob-sheet-other { opacity: .55; }
.mob-sheet-divider {
  font-size: .7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-soft);
  padding: .6rem .3rem .2rem;
}

/* Phone layout for the schedule + My Schedule pages */
@media (max-width: 767.98px) {
  .app-main h1 { font-size: 1.2rem; }
  .app-main h1 small { display: block; font-size: .8rem; margin-top: .1rem; }

  /* Week strip becomes a swipeable row that sticks under the topbar, so day
     jumping stays available while scrolling a long schedule */
  .week-strip {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
    position: sticky;
    top: 64px;
    z-index: 1010;
    background: var(--canvas);
    box-shadow: 0 6px 8px -8px rgba(0, 0, 0, .25);
    margin-left: -1rem;
    margin-right: -1rem;
    padding-left: 1rem;
    padding-right: 1rem;
  }
  .week-strip::-webkit-scrollbar { display: none; }
  .week-day { flex: 1 0 60px; }
  .day-card { scroll-margin-top: 128px; } /* anchors land below topbar + strip */

  /* Shift tiles: label/badge line, then time on its own line, actions last */
  .shift-row { padding: .6rem .75rem .6rem .65rem; row-gap: 6px; }
  .shift-row .avatar-sm { width: 26px; height: 26px; }
  .day-card .shift-time { flex-basis: 100%; order: 5; margin-top: -4px; }
  .shift-row .badge, .shift-row .job-badge { font-size: .64rem; }

  /* Manager + signup controls: always visible, full-width, comfy tap targets */
  .shift-actions {
    opacity: 1 !important;
    flex-basis: 100%;
    order: 10;
    margin-left: 0 !important;
    margin-top: 2px;
  }
  .shift-actions form:first-child { flex: 1; display: flex; gap: .35rem; }
  .shift-actions select { width: 100% !important; flex: 1; }

  /* Comfortable thumb targets on the row actions */
  .shift-actions .btn, .shift-row form .btn-sm { padding: .45rem .8rem; min-height: 38px; }
  .shift-actions select { min-height: 38px; }
  .person-chip { padding: .3rem .55rem .3rem .3rem; }

  /* Filters stretch edge to edge so each target is big */
  .segmented { display: flex; width: 100%; }
  .seg-btn { flex: 1; padding: .5rem 0; }

  /* Day header: slightly smaller numeral, pills wrap under */
  .day-num { font-size: 1.35rem; min-width: 1.7rem; }
  .day-head { padding: .65rem .8rem; flex-wrap: wrap; }

  /* Tighter vertical rhythm between the control rows */
  .app-main .mt-3 { margin-top: .5rem !important; }
  .app-main .mb-2 { margin-bottom: .4rem !important; }

  /* My Schedule hero stacks */
  .next-hero { flex-direction: column; align-items: stretch; gap: .5rem; padding: 1rem 1.1rem; }
  .next-hero-label {
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, .25);
    padding: 0 0 .45rem;
  }
  .next-hero-what { font-size: 1.05rem; }

  /* Timeline: date becomes a small heading above the tiles */
  .tl-day { flex-direction: column; gap: .35rem; margin-bottom: 1.1rem; }
  .tl-date { flex-direction: row; align-items: baseline; gap: .45rem; width: auto; padding-top: 0; }


  /* Add-shift form fields stretch */
  .card form.row .col-auto { flex: 1 1 46%; }
  .card form.row .col-auto:last-child { flex: 0 0 100%; }
  .card form.row .col-auto .form-select, .card form.row .col-auto .form-control { width: 100%; }
}

/* ---------- My Schedule ---------- */
.next-hero {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.1rem 1.4rem;
  margin-bottom: 1rem;
  border-radius: 16px;
  background: linear-gradient(120deg, var(--brand-600), #3b82f6 60%, #60a5fa);
  color: #fff;
  box-shadow: 0 10px 30px rgba(79, 70, 229, .3);
}
.next-hero-label {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: rgba(255, 255, 255, .75);
  writing-mode: initial;
  flex-shrink: 0;
  border-right: 1px solid rgba(255, 255, 255, .25);
  padding-right: 1.25rem;
}
.next-hero-main { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.next-hero-when { font-size: .85rem; color: rgba(255, 255, 255, .8); font-weight: 600; }
.next-hero-what { font-size: 1.25rem; font-weight: 800; letter-spacing: -.01em; }
.next-hero-where { font-size: .85rem; color: rgba(255, 255, 255, .8); }

.tl-day { display: flex; gap: 1rem; margin-bottom: 1rem; }
.tl-date {
  flex-shrink: 0;
  width: 90px;
  display: flex;
  flex-direction: column;
  padding-top: .45rem;
  line-height: 1.25;
}
.tl-dayword { font-weight: 700; font-size: .92rem; }
.tl-sub { font-size: .75rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .06em; }
.tl-items { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }

/* ---------- Metric cards (reports) ---------- */
.metric-card {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  height: 100%;
  padding: 1.15rem 1.3rem;
  background: var(--surface);
  background-clip: padding-box;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.metric-icon {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--brand-50);
  color: var(--brand-600);
  margin-bottom: .5rem;
}
.metric-value { font-size: 1.75rem; font-weight: 800; line-height: 1.1; letter-spacing: -.02em; }
.metric-label { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-soft); }
.metric-sub { font-size: .82rem; color: var(--ink-soft); }
.metric-good .metric-icon { background: #e1f5ee; color: #0f6e56; }
.metric-good .metric-value { color: #0f6e56; }
.metric-warn .metric-icon { background: #faeeda; color: #854f0b; }
.metric-warn .metric-value { color: #854f0b; }
.metric-bad .metric-icon { background: #fcebeb; color: #a32d2d; }
.metric-bad .metric-value { color: #a32d2d; }

.stat-pill.stat-warn { background: #faeeda; border-color: #f5ddbb; color: #854f0b; }

/* ---------- Color key legend ---------- */
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  font-size: .85rem;
  color: var(--ink-soft);
}
.legend-swatch {
  width: 6px;
  height: 18px;
  display: inline-block;
  flex-shrink: 0;
}

/* ---------- Person chips (multi-person shifts) ---------- */
.person-chip {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .2rem .6rem .2rem .25rem;
  border: 1px solid var(--line);
  background: var(--surface);
  background-clip: padding-box;
  font-size: .85rem;
}
.person-chip .avatar-sm { width: 24px; height: 24px; font-size: .6rem; }
.person-chip.chip-mine { border-color: var(--brand-500); background: var(--brand-50); font-weight: 600; }
.person-chip .btn-sm { padding: .1rem .45rem; font-size: .74rem; }
.person-chip .chip-x { width: 26px; height: 26px; color: #a32d2d; }

/* ---------- Icon buttons: borderless ghosts, site-wide ---------- */
.icon-btn {
  width: 34px;
  height: 34px;
  padding: 0 !important;
  display: inline-grid;
  place-items: center;
  vertical-align: middle;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
.icon-btn:hover {
  background: #e9eaf3 !important;
  /* keep the variant's own color instead of Bootstrap's filled-hover white */
  color: var(--bs-btn-color, var(--ink)) !important;
}
.icon-btn:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 1px; }

@media (max-width: 767.98px) {
  .desktop-only { display: none !important; }
}
.shifts-table thead th {
  background: #f8f9fd;
  color: var(--ink-soft);
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.app-main .card .shifts-table {
  border: 0;
  box-shadow: none;
  border-radius: 0;
}

/* ---------- Settings hub ---------- */
.settings-card {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  height: 100%;
  padding: 1.25rem 1.3rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  color: var(--ink);
  text-decoration: none;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.settings-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--brand-500);
  color: var(--ink);
}
.settings-icon {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border-radius: 11px;
  background: var(--brand-50);
  color: var(--brand-600);
  margin-bottom: .35rem;
}
.settings-title { font-weight: 700; font-size: 1.02rem; }
.settings-desc { font-size: .85rem; color: var(--ink-soft); }

/* Settings: a left column of sections (alphabetical) next to the page, instead of a tab strip */
.settings-layout { display: grid; grid-template-columns: 11.5rem minmax(0, 1fr); gap: 1.4rem; align-items: start; }
.settings-body { min-width: 0; }
.settings-nav {
  position: sticky;
  top: calc(64px + 1.2rem);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: .5rem;
}
.settings-nav-head { padding: .25rem .35rem .45rem; border-bottom: 1px solid var(--line); margin-bottom: .35rem; }
.settings-nav-home {
  display: flex; align-items: center; gap: .45rem;
  font-weight: 800; font-size: .95rem; color: var(--ink); text-decoration: none;
  padding: .3rem .4rem; border-radius: 8px;
}
.settings-nav-home:hover, .settings-nav-home.active { background: var(--brand-50); color: var(--brand-700); }
.settings-nav-list { list-style: none; margin: 0; padding: 0; }
.settings-nav-list a {
  display: block;
  padding: .42rem .7rem;
  font-size: .88rem;
  font-weight: 600;
  color: var(--ink-soft);
  text-decoration: none;
  border-radius: 8px;
}
.settings-nav-list a:hover { color: var(--ink); background: #f4f5f9; }
.settings-nav-list a.active { color: var(--brand-700); background: var(--brand-50); }
.settings-nav-jump { display: none; }

/* Grouped sections: the group you're in starts open, the rest fold away. */
.settings-group { margin: 0; }
.settings-group summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  list-style: none;
  cursor: pointer;
  padding: .42rem .45rem .3rem;
  font-size: .68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--ink-soft);
  border-radius: 8px;
  user-select: none;
}
.settings-group summary::-webkit-details-marker { display: none; }
.settings-group summary:hover { color: var(--ink); background: #f4f5f9; }
.settings-group summary svg { opacity: .55; transition: transform .12s ease; }
.settings-group[open] > summary svg { transform: rotate(180deg); }
.settings-group .settings-nav-list { padding: 0 0 .25rem; }
.settings-group .settings-nav-list a { padding-left: .95rem; }

/* Category headings on the Settings hub cards */
.settings-cat {
  margin: 1.6rem 0 .2rem;
  font-size: .78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--ink-soft);
}
.settings-cat:first-of-type { margin-top: .8rem; }

/* Phone / narrow: the list becomes one "jump to" dropdown above the page */
@media (max-width: 991.98px) {
  .settings-layout { display: block; }
  .settings-nav { position: static; padding: .5rem .6rem; margin-bottom: 1rem; display: flex; align-items: center; gap: .6rem; }
  .settings-nav-head { border: 0; margin: 0; padding: 0; }
  .settings-nav-list, .settings-group { display: none; }
  .settings-nav-jump { display: block; flex: 1; margin: 0; }
}

/* ---------- Print (post-behind-the-bar schedule) ---------- */
@media print {
  /* Chrome that has no business on paper */
  .app-sidebar, .app-topbar, .no-print, form, .btn, .alert, .btn-close,
  .help-btn, .help-panel, .offcanvas, .dropdown-menu, #toastArea, .announce-bar,
  .shift-actions, .week-strip, .segmented, .stat-pill {
    display: none !important;
  }
  .print-only { display: inline !important; }

  body { background: #fff; color: #000; font-size: 11pt; }
  .app-main { padding: 0; max-width: 100%; }
  a { color: #000; text-decoration: none; }

  /* Keep the owner-picked job colors and status stripes on paper */
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }

  /* Day cards: one clean block per day that never splits across pages */
  .card, .day-card { box-shadow: none; border: 1px solid #999; break-inside: avoid; border-radius: 6px; }
  .card-header.bg-primary { background: #eee !important; color: #000 !important; }
  .day-card .card-header { background: #f2f2f2 !important; color: #000 !important; border-bottom: 1px solid #999; padding: .35rem .7rem; }
  .day-card .card-body { padding: .4rem .6rem; gap: 4px; }
  .day-past { opacity: 1; }

  /* Shift rows: compact single lines, black text, thin colored status edge */
  .shift-row {
    border: 0;
    border-bottom: 1px solid #ddd;
    border-left: 4px solid transparent;
    border-radius: 0;
    padding: .18rem .3rem .18rem .5rem;
    background: #fff !important;
    transition: none;
  }
  .shift-row:hover { transform: none; box-shadow: none; }
  .shift-row:last-child { border-bottom: 0; }
  .sr-open { border-left-color: #e24b4a; }
  .sr-filled { border-left-color: #1d9e75; }
  .sr-mine { border-left-color: #2563eb; }
  .sr-offered { border-left-color: #d97706; }
  .shift-label, .shift-time { font-size: 10pt; color: #000; }
  .person-chip { border: 0; background: transparent !important; padding: 0 .2rem; font-size: 10pt; }
  .person-chip .btn, .person-chip form { display: none !important; }
  .avatar-sm { display: none !important; }
  .job-badge { border: 1px solid #999; font-size: 7.5pt; padding: .08rem .35rem; }
  .badge { border: 1px solid #999; color: #000 !important; background: #fff !important; font-size: 7.5pt; }
  .badge.bg-success { background: #e8f6ef !important; }
  .badge.bg-danger, .badge.bg-warning { background: #fdeeee !important; }

  /* Page setup */
  @page { margin: 12mm; }
  h1 { font-size: 15pt; margin-bottom: 2pt; }
  h1 .print-only { font-size: 11pt; }
}

/* ---------- Per-page help panel ---------- */
/* Billing/trial nudge in the topbar (admins only) */
.trial-chip {
    display: inline-block;
    white-space: nowrap;
    font-size: .8rem;
    font-weight: 700;
    color: var(--brand-700);
    background: var(--brand-50);
    border: 1px solid var(--brand-100);
    border-radius: 999px;
    padding: .3rem .8rem;
    text-decoration: none;
    flex-shrink: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}
.trial-chip:hover { background: var(--brand-100); color: var(--brand-700); }
.trial-chip-danger { color: #b42318; background: #fef3f2; border-color: #fecdca; }
.trial-chip-danger:hover { background: #fee4e2; color: #b42318; }
@media (max-width: 640px) {
    .trial-chip { font-size: .72rem; padding: .25rem .6rem; }
}

/* Notifications page */
.notif-unread { background: var(--brand-50); }
.notif-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--brand-600);
    flex-shrink: 0;
    margin-top: .45rem;
}
.min-w-0 { min-width: 0; }

/* Notification bell: same round button as help, plus the unread count bubble */
.bell-btn { position: relative; }
.bell-badge {
    position: absolute;
    top: -4px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: .66rem;
    font-weight: 800;
    line-height: 18px;
    text-align: center;
}

.help-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border, #e2e4f0);
    background: transparent;
    color: var(--text-muted, #5a628a);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.help-btn:hover {
    color: var(--primary, #2563eb);
    border-color: var(--primary, #2563eb);
    background: rgba(79, 70, 229, .06);
}
.help-panel {
    width: 420px;
    max-width: 92vw;
}
.help-panel .offcanvas-title {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-weight: 700;
}
.help-panel .offcanvas-body {
    font-size: .95rem;
    line-height: 1.65;
}
.help-panel h6 {
    font-weight: 700;
    margin: 1.2rem 0 .45rem;
    padding-top: .9rem;
    border-top: 1px solid #eef0f7;
}
.help-panel h6:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}
.help-panel ol, .help-panel ul {
    padding-left: 1.25rem;
    margin-bottom: .8rem;
}
.help-panel li {
    margin-bottom: .45rem;
}
.help-tip {
    background: #f4f6ff;
    border-left: 3px solid var(--primary, #2563eb);
    border-radius: .4rem;
    padding: .6rem .8rem;
    margin: .8rem 0;
    font-size: .92rem;
}

.sidebar-brand img {
    filter: drop-shadow(0 0 6px rgba(255, 255, 255, .35));
}

/* ---------- My Schedule: "Coming up" day cards ---------- */
.up-day {
    overflow: hidden;
}
.up-day-head {
    display: flex;
    align-items: baseline;
    gap: .55rem;
    padding: .75rem 1rem .55rem;
    border-bottom: 1px solid #eef0f7;
}
.up-dayword {
    font-weight: 800;
    font-size: 1.02rem;
}
.up-today .up-dayword {
    color: var(--brand-600, #2563eb);
}
.up-today {
    border-color: var(--brand-300, #a5b4fc);
}
.up-date {
    color: #7a8099;
    font-weight: 600;
    font-size: .88rem;
}
.up-item {
    display: flex;
    align-items: center;
    gap: .9rem;
    padding: .65rem 1rem .65rem .75rem;
    flex-wrap: wrap;
}
.up-item + .up-item {
    border-top: 1px solid #f3f4fa;
}
.up-item::before {
    content: "";
    width: 5px;
    border-radius: 3px;
    align-self: stretch;
    background: var(--up-color, var(--brand-500, #3b82f6));
    flex-shrink: 0;
}
.up-when {
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    min-width: 9rem;
}
.up-body {
    display: flex;
    flex-direction: column;
    gap: .1rem;
    min-width: 0;
}
.up-label {
    font-weight: 700;
}
.up-meta {
    color: #7a8099;
    font-size: .86rem;
    display: flex;
    align-items: center;
    gap: .4rem;
    flex-wrap: wrap;
}
@media (max-width: 576px) {
    .up-when { min-width: 100%; }
}

/* Uploaded profile photos reuse the round avatar footprint */
.avatar-img {
    object-fit: cover;
    display: block;
}
.avatar-lg {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    font-size: 1.6rem;
}

/* Shared type-ahead picker (Preferences avoid list, Announcements recipients) */
    .avoid-results {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        z-index: 1200;
        background: var(--surface);
        border: 1px solid var(--line);
        border-radius: 0 0 10px 10px;
        box-shadow: 0 10px 24px rgba(16, 24, 40, .14);
        overflow: hidden;
    }
    .avoid-result {
        display: block;
        width: 100%;
        text-align: left;
        background: none;
        border: 0;
        padding: .55rem .8rem;
        font-weight: 600;
    }
    .avoid-result:hover, .avoid-result.active { background: var(--brand-50); }
    .avoid-chip {
        display: inline-flex;
        align-items: center;
        gap: .4rem;
        background: var(--brand-50);
        color: var(--brand-700);
        border: 1px solid var(--brand-100);
        border-radius: 999px;
        padding: .3rem .5rem .3rem .8rem;
        font-weight: 700;
        font-size: .88rem;
    }
    .avoid-x {
        border: 0;
        background: none;
        color: var(--brand-700);
        font-size: .8rem;
        line-height: 1;
        padding: 2px 4px;
        border-radius: 50%;
    }
    .avoid-x:hover { background: var(--brand-100); }

/* ---- Shift tasks: clipboard button on schedule rows + the checklist popup ---- */
.task-btn {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    border: 1px solid var(--line, #dfe3ee);
    background: var(--surface, #fff);
    color: var(--ink-soft, #6b7280);
    border-radius: 999px;
    padding: 2px 7px;
    font-size: .74rem;
    font-weight: 800;
    line-height: 1.2;
    cursor: pointer;
}
.task-btn:hover { border-color: var(--brand-500, #2563eb); color: var(--brand-700, #1d4ed8); }
.task-btn-has { border-color: var(--brand-200, #bfdbfe); background: var(--brand-50, #eff6ff); color: var(--brand-700, #1d4ed8); }
.task-btn-done { border-color: #cde7d2; background: #f0f9f1; color: #1f7a33; }
.task-count { font-variant-numeric: tabular-nums; }

.task-back { position: fixed; inset: 0; background: rgba(16, 24, 40, .35); z-index: 1940; }
.task-pop {
    position: fixed;
    z-index: 1950;
    left: 50%; top: 50%;
    transform: translate(-50%, -50%);
    width: min(440px, calc(100vw - 24px));
    max-height: min(80vh, 640px);
    display: flex;
    flex-direction: column;
    background: var(--surface, #fff);
    border: 1px solid var(--line, #dfe3ee);
    border-radius: 14px;
    box-shadow: 0 18px 48px rgba(16, 24, 40, .22);
    padding: .9rem 1rem 1rem;
}
.task-pop-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .6rem; margin-bottom: .6rem; }
.task-pop-kicker { font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-soft, #6b7280); }
.task-pop-body { overflow-y: auto; min-height: 2rem; }
.task-item { display: flex; align-items: flex-start; gap: .55rem; padding: .4rem .2rem; border-bottom: 1px solid var(--line, #eef0f5); }
.task-item:last-child { border-bottom: 0; }
.task-item input { margin-top: .2rem; flex: none; width: 1.1rem; height: 1.1rem; }
.task-item-text { flex: 1; min-width: 0; }
.task-item.is-done .task-item-text { text-decoration: line-through; color: var(--ink-soft, #6b7280); }
.task-item-meta { display: block; font-size: .72rem; color: var(--ink-soft, #6b7280); }
.task-item-empty { color: var(--ink-soft, #6b7280); font-size: .9rem; padding: .3rem .2rem; }
.task-pop-edit { margin-top: .6rem; }
.task-pop-foot { margin-top: .7rem; padding-top: .6rem; border-top: 1px solid var(--line, #eef0f5); }
@media (max-width: 767.98px) {
    .task-pop { left: 0; right: 0; top: auto; bottom: 0; transform: none; width: 100%; max-height: 85vh; border-radius: 16px 16px 0 0; }
}
.next-hero-tasks { display: inline-block; margin-top: .45rem; font-size: .85rem; font-weight: 700; color: #fff; background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.35); border-radius: 999px; padding: .2rem .7rem; text-decoration: none; }
.next-hero-tasks:hover { background: rgba(255,255,255,.26); color: #fff; }

/* Small centered status toast (builder, employees, menus) */
.bld-toast {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
  background: #1a2033; color: #fff; border-radius: 999px; padding: .5rem 1.1rem;
  font-weight: 600; font-size: .9rem; opacity: 0; pointer-events: none;
  transition: opacity .2s ease; z-index: 2000; max-width: 90vw;
}
.bld-toast.show { opacity: 1; }
