/* ==========================================================================
   Staff area — login + request dashboard
   ========================================================================== */

.staff-body { background: var(--color-offwhite); }

/* ---------- Login ---------- */
.staff-login-wrap {
  min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: var(--space-5);
}
.staff-login-card {
  width: 100%; max-width: 380px; background: #fff; border: 1px solid var(--color-border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-md); padding: var(--space-7) var(--space-6);
}
.staff-login-card h1 { font-size: var(--fs-xl); text-align: center; margin-bottom: var(--space-2); }

/* ---------- Sticky header + countdown banner as one unit ----------
   Both pieces used to be independently `position: sticky; top: 0`, which
   made them fight for the exact same spot instead of stacking — the banner
   never actually followed the scroll below the topbar. Wrapping both in one
   sticky container fixes that with no offset math, regardless of how tall
   the topbar renders (it wraps on narrow screens). */
.sticky-header-group { position: sticky; top: 0; z-index: 50; }

.grace-countdown-banner {
  background: #c0392b; color: #fff;
  text-align: center; font-weight: 800; letter-spacing: 0.02em;
  font-size: clamp(1rem, 2.2vw, 1.35rem); padding: var(--space-3) var(--space-4);
  text-transform: uppercase;
}
.grace-countdown-banner #graceCountdownText { font-size: 1.15em; }

/* Shown right under the sticky header while a countdown is running — points
   at Download Backup (CSV) so it isn't missed, plus the Web3Forms fallback. */
.backup-guidance-callout { background: #eaf1fb; border-bottom: 1px solid #c7dcf5; padding: var(--space-3) 0; }
.backup-guidance-inner { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.backup-guidance-arrow {
  font-size: 1.4rem; font-weight: 800; color: var(--color-primary); line-height: 1;
  animation: guidanceBounce 1.4s ease-in-out infinite;
}
@keyframes guidanceBounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.backup-guidance-text { flex: 1 1 320px; font-size: var(--fs-sm); color: var(--color-charcoal-soft); }
.backup-guidance-btn { min-height: 36px; padding: 0.4rem 0.9rem; font-size: var(--fs-xs); white-space: nowrap; }
.backup-guidance-note { font-size: var(--fs-xs); color: var(--color-text-muted); margin-top: var(--space-2); }

/* ---------- Dashboard shell ---------- */
.staff-topbar {
  background: var(--color-charcoal); color: #fff;
  padding-block: var(--space-3);
}
.staff-topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; }
.staff-topbar .brand { color: #fff; font-size: var(--fs-md); }
.staff-role-badge {
  font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  background: rgba(255,255,255,0.12); padding: 0.3rem 0.7rem; border-radius: 999px; color: #cfe0f5;
}
.staff-topbar-actions { display: flex; align-items: center; gap: var(--space-3); }

.staff-main { padding-block: var(--space-6) var(--space-9); }

.staff-toolbar {
  display: flex; flex-wrap: wrap; gap: var(--space-4); align-items: center; justify-content: space-between;
  background: #fff; border: 1px solid var(--color-border); border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5); margin-bottom: var(--space-5);
}

/* Website Analytics + Money side by side — there's room, and it puts the
   whole top-line picture (traffic + earnings) on one screen at once. */
.two-panel-row { display: flex; gap: var(--space-5); margin-bottom: var(--space-5); align-items: stretch; }
.two-panel-row > .analytics-panel { flex: 1 1 0; min-width: 0; margin-bottom: 0; }
@media (max-width: 900px) { .two-panel-row { flex-direction: column; } }
.analytics-panel { display: none; flex-direction: column; gap: var(--space-4); align-items: flex-start; }
.analytics-panel.show { display: flex; }
.analytics-stats { display: flex; flex-wrap: wrap; gap: var(--space-7); }
.analytics-num { font-family: var(--font-heading); font-size: var(--fs-2xl); font-weight: 700; color: var(--color-primary); }
.analytics-label { font-size: var(--fs-xs); font-weight: 700; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.04em; margin-top: 2px; }

.staff-view-toggle { display: inline-flex; border: 1px solid var(--color-border); border-radius: var(--radius-sm); overflow: hidden; }
.staff-view-toggle button {
  border: 0; background: #fff; padding: 0.55rem 1rem; font-weight: 700; font-size: var(--fs-sm); color: var(--color-text-muted);
}
.staff-view-toggle button.active { background: var(--color-primary); color: #fff; }
.view-count { margin-left: 4px; opacity: 0.75; }
.view-badge { display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; font-size: var(--fs-xs); }
.view-badge:empty { display: none; }
.view-badge::before { content: ''; width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.view-badge-scheduled::before { background: var(--color-danger); }
.view-badge-requested::before { background: var(--color-accent-dark); }

.filter-row { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.filter-chip {
  border: 1.5px solid var(--color-border); background: #fff; border-radius: 999px;
  padding: 0.45rem 0.9rem; font-size: var(--fs-xs); font-weight: 700; color: var(--color-charcoal-soft);
  text-transform: uppercase; letter-spacing: 0.03em;
}
.filter-chip.active { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.filter-group { display: flex; flex-direction: column; gap: var(--space-2); }
.filter-group-label { font-size: var(--fs-xs); font-weight: 700; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.field-label-edit-btn {
  border: 0; background: none; color: var(--color-text-muted); cursor: pointer; padding: 0 2px;
  font-size: 11px; vertical-align: middle; opacity: 0.6;
}
.field-label-edit-btn:hover { opacity: 1; color: var(--color-primary); }
.field-label-edit-form { display: inline-flex; align-items: center; gap: 4px; text-transform: none; letter-spacing: normal; }
.field-label-input { min-height: 26px; padding: 0.15rem 0.4rem; font-size: var(--fs-xs); font-weight: 400; }

.cm-expense-row { display: flex; gap: var(--space-2); align-items: center; margin-bottom: var(--space-2); }
.cm-expense-row .cm-expense-category { flex: 1.1; min-width: 0; }
.cm-expense-row .cm-expense-amount { flex: 0.8; min-width: 0; }
.cm-expense-row .cm-expense-receipt { flex: 1.3; min-width: 0; font-size: var(--fs-xs); }
.cm-expense-remove {
  flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--color-danger-bg); color: var(--color-danger); font-size: 16px; line-height: 1;
  display: flex; align-items: center; justify-content: center; padding: 0;
}
.cm-expense-remove:hover { background: var(--color-danger); color: #fff; }

.report-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.report-table th {
  text-align: left; font-size: var(--fs-xs); font-weight: 700; color: var(--color-text-muted);
  text-transform: uppercase; letter-spacing: 0.04em; padding: var(--space-2) var(--space-3); border-bottom: 2px solid var(--color-border);
}
.report-table td { padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--color-border); }
.report-table tbody tr:last-child td { border-bottom: 0; }
.report-table td.num, .report-table th.num { text-align: right; }

.job-expenses { font-size: var(--fs-xs); color: var(--color-text-muted); margin-top: var(--space-2); }
.job-expenses a { color: var(--color-primary); }

.updates-unread-badge {
  position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; border-radius: 9px;
  background: var(--color-danger); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px;
  text-align: center; padding: 0 4px; box-shadow: 0 0 0 2px var(--color-charcoal);
}
@keyframes updatesBlink {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(1.18); }
}
.updates-unread-badge.blinking { animation: updatesBlink 1.1s ease-in-out infinite; }

/* Chat-style "What's New" panel — messages feel like a texting thread rather
   than a plain changelog list, per the "make it look neat, get crafty" ask. */
.updates-modal-card { display: flex; flex-direction: column; max-height: 82vh; }
.updates-feed { background: var(--color-offwhite); flex: 1; }
.update-entry { display: flex; margin-bottom: var(--space-3); }
.update-entry:last-child { margin-bottom: 0; }
.update-entry-bubble {
  background: #fff; border: 1px solid var(--color-border); border-radius: var(--radius-md);
  border-top-left-radius: 4px; padding: var(--space-3) var(--space-4); max-width: 100%;
  box-shadow: var(--shadow-sm);
}
.update-entry.unread .update-entry-bubble { border-color: var(--color-primary); background: #f2f7ff; }
.update-entry-message { white-space: pre-wrap; line-height: 1.5; }
.update-entry-date { margin-top: 6px; font-size: var(--fs-xs); color: var(--color-text-muted); }
.update-entry-new {
  display: inline-block; background: var(--color-primary); color: #fff; font-weight: 700;
  font-size: 10px; letter-spacing: 0.04em; padding: 1px 6px; border-radius: 8px; margin-left: 4px;
}
.updates-compose {
  display: flex; gap: var(--space-2); align-items: flex-end; padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--color-border); background: #fff;
  border-bottom-left-radius: var(--radius-lg); border-bottom-right-radius: var(--radius-lg);
}
.updates-compose textarea {
  flex: 1; resize: none; padding: 0.6rem 0.9rem; border: 1px solid var(--color-border);
  border-radius: 999px; font-family: inherit; font-size: var(--fs-sm); line-height: 1.4; max-height: 100px;
}
.updates-compose textarea:focus { outline: none; border-color: var(--color-primary); }
.updates-send-btn {
  flex-shrink: 0; width: 42px; height: 42px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--color-primary); color: #fff; display: flex; align-items: center; justify-content: center;
  transition: filter var(--duration-fast) var(--ease-out);
}
.updates-send-btn:hover { filter: brightness(1.1); }
.updates-send-btn svg { width: 18px; height: 18px; }

.sort-select { min-height: 40px; padding: 0.4rem 2.2rem 0.4rem 0.8rem; font-size: var(--fs-sm); }

.chip-edit-wrap { position: relative; display: inline-flex; }
.chip-delete-btn {
  position: absolute; top: -7px; right: -7px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--color-danger); color: #fff; border: 2px solid #fff; font-size: 12px; line-height: 1;
  display: flex; align-items: center; justify-content: center; padding: 0; cursor: pointer;
  animation: chipDeletePulse 1.4s ease-in-out infinite;
}
@keyframes chipDeletePulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(214,69,55,0.45); }
  50% { transform: scale(1.15); box-shadow: 0 0 0 4px rgba(214,69,55,0); }
}

.new-category-form { display: inline-flex; gap: 6px; align-items: center; }
.new-category-input {
  min-height: 34px; padding: 0.35rem 0.6rem; font-size: var(--fs-xs);
  border: 1.5px solid var(--color-border); border-radius: var(--radius-sm); width: 160px;
}

/* ---------- Request list ---------- */
.request-list { display: grid; gap: var(--space-4); }
.request-card {
  background: #fff; border: 1px solid var(--color-border); border-radius: var(--radius-lg);
  padding: var(--space-5); display: grid; gap: var(--space-3);
  border-left: 4px solid var(--color-border);
}
.request-card[data-status="new"] { border-left-color: var(--color-primary-light); }
.request-card[data-status="contacted"] { border-left-color: var(--color-star); }
.request-card[data-status="quoted"] { border-left-color: #8a5cd6; }
.request-card[data-status="scheduled"] { border-left-color: var(--color-success); }
.request-card[data-status="done"] { border-left-color: var(--color-text-muted); opacity: 0.7; }
.request-card[data-status="cancelled"] { border-left-color: var(--color-danger); opacity: 0.6; }
.request-card[data-status="no_answer"] { border-left-color: var(--color-star); opacity: 0.75; }
.request-card[data-priority="1"] { box-shadow: 0 0 0 2px rgba(217,104,47,0.35); }

.request-card-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-3); }
.request-title { font-family: var(--font-heading); font-weight: 700; font-size: var(--fs-md); color: var(--color-charcoal); }
.request-sub { font-size: var(--fs-sm); color: var(--color-text-muted); }
.request-badges { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.badge {
  display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-xs); font-weight: 700;
  padding: 0.25rem 0.6rem; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.03em;
}
.badge-status-new { background: #eaf1fb; color: var(--color-primary); }
.badge-status-contacted { background: #fdf3e2; color: #a3720c; }
.badge-status-quoted { background: #f1eafc; color: #6a3fb8; }
.badge-status-scheduled { background: var(--color-success-bg); color: var(--color-success); }
.badge-status-done { background: #eef0f2; color: var(--color-text-muted); }
.badge-status-cancelled { background: var(--color-danger-bg); color: var(--color-danger); }
.badge-status-no_answer { background: #fdf3e2; color: #a3720c; }
.badge-priority { background: #fdece2; color: var(--color-accent-dark); }
.badge-category { background: #fff4d6; color: #9a6b00; }
.badge-city { background: #eef0f2; color: var(--color-charcoal-soft); }
.badge-value { background: var(--color-success-bg); color: var(--color-success); }

/* Quick status pills, right on the card */
.quick-status-row { display: flex; flex-wrap: wrap; gap: 6px; }
.quick-status-pill {
  border: 1.5px solid var(--color-border); background: #fff; border-radius: 999px;
  padding: 0.3rem 0.75rem; font-size: var(--fs-xs); font-weight: 700; color: var(--color-charcoal-soft);
  text-transform: uppercase; letter-spacing: 0.02em; transition: all var(--duration-fast) var(--ease-out);
}
.quick-status-pill:hover { border-color: var(--color-primary-light); color: var(--color-primary); }
.quick-status-pill.active { background: var(--color-charcoal); border-color: var(--color-charcoal); color: #fff; cursor: default; }

.request-meta { display: grid; gap: var(--space-2); grid-template-columns: 1fr; font-size: var(--fs-sm); color: var(--color-text); }
@media (min-width: 640px) { .request-meta { grid-template-columns: repeat(2, 1fr); } }
.request-meta div strong { color: var(--color-text-muted); font-weight: 600; margin-right: 4px; }
.request-issue { font-size: var(--fs-sm); color: var(--color-text); background: var(--color-offwhite); border-radius: var(--radius-sm); padding: var(--space-3); }

.meta-link { color: var(--color-primary); font-weight: 600; }
.meta-link:hover { text-decoration: underline; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: var(--radius-sm); border: 1px solid var(--color-border);
  background: #fff; color: var(--color-text-muted); vertical-align: middle;
  transition: all var(--duration-fast) var(--ease-out);
}
.icon-btn svg { width: 14px; height: 14px; }
.icon-btn:hover { border-color: var(--color-primary-light); color: var(--color-primary); }
.icon-btn.copied { border-color: var(--color-success); color: var(--color-success); }

.request-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-2); }
.request-actions .btn { min-height: 40px; padding: 0.5rem 1rem; font-size: var(--fs-sm); }

.btn-danger-outline { background: transparent; border-color: var(--color-danger); color: var(--color-danger); }
.btn-danger-outline:hover { background: var(--color-danger-bg); }
.btn-danger-outline.btn-danger-armed { background: var(--color-danger); color: #fff; }

.empty-state {
  text-align: center; padding: var(--space-9) var(--space-5); color: var(--color-text-muted);
  background: #fff; border: 1px dashed var(--color-border); border-radius: var(--radius-lg);
}

/* ---------- Calendar view ---------- */
.calendar-grid { background: var(--color-border); border: 1px solid var(--color-border); border-radius: var(--radius-md); overflow: hidden; }
.calendar-head-row { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; margin-bottom: 1px; }
.calendar-head { background: var(--color-charcoal); color: #fff; padding: var(--space-2); text-align: center; font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; }
.calendar-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; margin-bottom: 1px; position: relative; }
.calendar-week:last-child { margin-bottom: 0; }
.calendar-cell { background: #fff; min-height: 96px; padding: var(--space-2); transition: background var(--duration-fast) var(--ease-out), outline var(--duration-fast) var(--ease-out); }
.calendar-cell-today { background: #eaf1fb; }
.calendar-cell-today .calendar-date { color: var(--color-primary); font-weight: 800; }
.calendar-cell.empty { background: var(--color-offwhite); }
.calendar-cell.dragover { background: #eaf1fb; outline: 2px dashed var(--color-primary); outline-offset: -2px; }
.calendar-cell-blocked { background: #f1e6fb; }
.calendar-cell-blocked .calendar-date { color: #7b2fd6; font-weight: 800; }
.calendar-blocked-label {
  font-size: 0.65rem; font-weight: 700; color: #7b2fd6; text-transform: uppercase; letter-spacing: 0.02em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.calendar-cell-marking { cursor: pointer; }
.calendar-cell-marking:hover { outline: 2px dashed #7b2fd6; outline-offset: -2px; }
.calendar-cell-range-start { background: #f1e6fb; outline: 2px dashed #7b2fd6; outline-offset: -2px; }
.calendar-cell-range-start .calendar-blocked-label { color: #7b2fd6; }
.calendar-date { font-size: var(--fs-xs); font-weight: 700; color: var(--color-text-muted); }
.calendar-cell-chips { display: flex; flex-direction: column; gap: 4px; }
.calendar-job {
  font-size: 0.7rem; font-weight: 600; padding: 2px 6px; border-radius: 4px; background: #eaf1fb; color: var(--color-primary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: grab;
}
.calendar-job:active { cursor: grabbing; }
.calendar-job.dragging { opacity: 0.4; }
.calendar-job.status-scheduled { background: #eaf1fb; color: var(--color-primary); }
.calendar-job.status-done { background: var(--color-success-bg); color: var(--color-success); }
.calendar-job.requested { background: var(--color-danger-bg); color: var(--color-danger); }
.calendar-job.priority { box-shadow: inset 0 0 0 1.5px var(--color-accent-dark); }

/* A multi-day job draws as one solid bar spanning every day it covers,
   instead of repeating as a separate chip per day — makes it easy to see
   at a glance how far out someone is booked, and who overlaps with whom. */
.calendar-bar {
  position: absolute; z-index: 2; display: flex; align-items: center;
  font-size: 0.7rem; font-weight: 700; padding: 0 6px; border-radius: 4px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: grab; color: #fff;
}
.calendar-bar:active { cursor: grabbing; }
.calendar-bar.dragging { opacity: 0.4; }
.calendar-bar.status-scheduled { background: var(--color-primary); }
.calendar-bar.status-done { background: var(--color-success); }
.calendar-bar.requested { background: var(--color-danger); }
.calendar-bar.priority { box-shadow: inset 0 0 0 1.5px #fff; }

.calendar-trash {
  width: 40px; height: 40px; border-radius: var(--radius-sm); border: 1.5px solid var(--color-border);
  background: #fff; color: var(--color-text-muted); display: flex; align-items: center; justify-content: center;
  transition: all var(--duration-fast) var(--ease-out);
}
.calendar-trash svg { width: 18px; height: 18px; }
.calendar-trash.dragover { border-color: var(--color-danger); background: var(--color-danger-bg); color: var(--color-danger); }
.calendar-trash-confirm {
  display: flex; align-items: center; gap: var(--space-2); font-size: var(--fs-sm);
  background: var(--color-danger-bg); border: 1px solid #f3c9c3; border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
}

.calendar-legend { display: flex; flex-wrap: wrap; gap: var(--space-4); align-items: center; margin-bottom: var(--space-3); font-size: var(--fs-xs); font-weight: 700; color: var(--color-charcoal-soft); text-transform: uppercase; letter-spacing: 0.03em; }
.calendar-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.calendar-legend-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.calendar-legend-dot.requested { background: var(--color-danger); }
.calendar-legend-dot.scheduled { background: var(--color-primary); }
.calendar-legend-dot.done { background: var(--color-success); }
.calendar-legend-dot.blocked { background: #7b2fd6; }

/* ---------- Edit modal ---------- */
.modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(32,36,43,0.55); z-index: 200;
  align-items: flex-start; justify-content: center; padding: var(--space-5); overflow-y: auto;
}
.modal-overlay.open { display: flex; }
.modal-card {
  background: #fff; border-radius: var(--radius-lg); max-width: 640px; width: 100%;
  margin-block: var(--space-7); box-shadow: var(--shadow-lg);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: var(--space-5); border-bottom: 1px solid var(--color-border); }
.modal-head h2 { margin-bottom: 0; font-size: var(--fs-lg); }
.modal-close { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--color-border); background: #fff; display: flex; align-items: center; justify-content: center; }
.modal-body { padding: var(--space-5); display: grid; gap: var(--space-4); max-height: 70vh; overflow-y: auto; }
.modal-footer { padding: var(--space-5); border-top: 1px solid var(--color-border); display: flex; gap: var(--space-3); justify-content: flex-end; flex-wrap: wrap; }

.loading-note { text-align: center; padding: var(--space-6); color: var(--color-text-muted); }

/* Tablet & phone: force the same 2-column request-meta as desktop — the
   shrink-to-fit zoom itself lives in style.css and covers this page too. */
@media (max-width: 1199px) {
  .request-meta { grid-template-columns: repeat(2, 1fr); }
}
