/* ==========================================================================
   Embedded Handwriting / Human Signature Fonts (Offline Job-Site Ready)
   ========================================================================== */
@font-face {
  font-family: 'Mr Dafoe';
  src: url('/static/fonts/MrDafoe-Regular.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Alex Brush';
  src: url('/static/fonts/AlexBrush-Regular.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --primary: #0a4d7d;
  --primary-hover: #073a5f;
  --primary-light: #e8f2f9;
  --accent: #f26522;
  --accent-hover: #d85416;
  --dark: #1e293b;
  --gray-bg: #f8fafc;
  --card-bg: #ffffff;
  --border: #e2e8f0;
  --border-focus: #3b82f6;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --success: #10b981;
  --warning: #f59e0b;
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.05);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.04);

  --bg-hover: #f1f5f9;
  --border-hover: #cbd5e1;
  --text-muted-dark: #475569;
  --danger-bg: #fee2e2;
  --danger-text: #dc2626;
  --danger-border: #fca5a5;
  --success-bg: #ecfdf5;
  --success-text: #047857;
  --success-border: #a7f3d0;
  --info-bg: #f0f9ff;
  --info-text: #0369a1;
  --info-border: #bae6fd;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --primary: #60a5fa;
  --primary-hover: #93c5fd;
  --primary-light: #1e3a8a;
  --accent: #f97316;
  --accent-hover: #fdba74;
  --dark: #f8fafc;
  --gray-bg: #0f172a;
  --card-bg: #1e293b;
  --border: #334155;
  --border-focus: #60a5fa;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  
  --bg-hover: #334155;
  --border-hover: #475569;
  --text-muted-dark: #cbd5e1;
  
  --danger-bg: #7f1d1d;
  --danger-text: #fca5a5;
  --danger-border: #991b1b;
  
  --success-bg: #064e3b;
  --success-text: #6ee7b7;
  --success-border: #065f46;
  
  --info-bg: #082f49;
  --info-text: #7dd3fc;
  --info-border: #0c4a6e;
}

/* Visually Hidden Utility for Accessible Screen Readers */
.visually-hidden:where(:not(:focus-within, :active)) {
  position: absolute !important;
  clip-path: inset(50%) !important;
  overflow: hidden !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  border: 0 !important;
  white-space: nowrap !important;
}

/* Accessible Skip-to-Content Link */
.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 999999;
  background: var(--primary);
  color: white;
  padding: 10px 16px;
  border-radius: 6px;
  font-weight: 600;
  text-decoration: none;
  box-shadow: var(--shadow-lg);
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  overscroll-behavior-y: none;
}

body {
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--gray-bg);
  color: var(--text-main);
  line-height: 1.5;
  padding-bottom: 90px;
  overscroll-behavior-y: none;
  -webkit-overflow-scrolling: touch;
}

input, button, select, textarea {
  font: inherit;
}

/* Modern Balanced Typography */
.nav-title h1, .card-title, .modal-header h3 {
  text-wrap: balance;
}

/* Navbar */
.navbar {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
  padding-top: env(safe-area-inset-top, 0px);
}

.navbar.navbar-hidden-scroll {
  transform: translateY(-100%);
}

.navbar-container {
  width: 100%;
  padding: 8px 24px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.navbar-header-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 44px;
  flex-wrap: nowrap;
}

.navbar-quick-status {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  flex-shrink: 0;
}

.btn-toggle-navbar {
  background: var(--bg-hover);
  border: 1px solid var(--border);
  color: var(--primary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 6px;
  transition: all 0.15s ease;
  user-select: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.btn-toggle-navbar:hover {
  background: var(--primary-light);
  border-color: #93c5fd;
}

.navbar-toggle-icon {
  font-size: 0.7rem;
  line-height: 1;
}

.navbar-toggle-label {
  letter-spacing: 0.2px;
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-badge {
  background: var(--primary);
  color: white;
  font-weight: 800;
  font-size: 1.25rem;
  padding: 4px 10px;
  border-radius: 6px;
  letter-spacing: 0.5px;
}

.logo-badge span {
  color: var(--accent);
}

.nav-title h1 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-main);
}

.nav-title p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.collapsible-nav-body.collapsed {
  display: none !important;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
}

.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-accent {
  background: var(--accent);
  color: white;
}
.btn-accent:hover {
  background: var(--accent-hover);
}

.btn-outline {
  background: var(--card-bg);
  color: var(--text-main);
  border-color: var(--border);
}
.btn-outline:hover {
  background: var(--bg-hover);
  border-color: var(--border-hover);
}

.btn-secondary {
  background: var(--bg-hover);
  color: var(--text-main);
}
.btn-secondary:hover {
  background: #e2e8f0;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 0.775rem;
}

/* Layout */
.container {
  width: 100%;
  margin: 24px 0;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Cards */
.card {
  background: var(--card-bg);
  border-radius: 10px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 20px 24px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 10px;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Week Ending Date Bar */
.week-ending-bar {
  background: var(--gray-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.week-ending-control {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  width: 100%;
}

.week-ending-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.88rem;
  color: var(--primary);
  font-weight: 700;
  margin: 0;
  white-space: nowrap;
}

.week-ending-picker-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

.btn-week-nav {
  padding: 6px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: 6px;
  white-space: nowrap;
  background: var(--card-bg);
  border: 1px solid var(--border);
  color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease-in-out;
}

.btn-week-nav:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary-hover);
}

.week-ending-input {
  max-width: 200px;
  font-weight: 600;
  background: var(--card-bg);
  text-align: center;
}

/* Grid Forms */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-control {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
  background: var(--card-bg);
  color: var(--text-main);
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}

.form-control:focus,
.form-control:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 1px;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-control:user-invalid {
  border-color: #ef4444;
  outline-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

/* Form Dropdown (Select) & Option Contrast - Prevents White-on-White Highlighting on PC */
select,
select.form-control {
  color-scheme: light;
  background-color: var(--card-bg);
  color: var(--text-main);
}

:root[data-theme="dark"] select,
:root[data-theme="dark"] select.form-control {
  color-scheme: dark;
  background-color: var(--card-bg);
  color: var(--text-main);
}

select option,
select optgroup {
  background-color: #ffffff;
  color: #0f172a;
}

:root[data-theme="dark"] select option,
:root[data-theme="dark"] select optgroup {
  background-color: #1e293b;
  color: #f1f5f9;
}

select option:checked,
select option:hover,
select option:focus {
  background-color: #0a4d7d !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}

:root[data-theme="dark"] select option:checked,
:root[data-theme="dark"] select option:hover,
:root[data-theme="dark"] select option:focus {
  background-color: #2563eb !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}

/* Global Text Selection Contrast */
::selection {
  background-color: #0a4d7d;
  color: #ffffff;
}

:root[data-theme="dark"] ::selection {
  background-color: #2563eb;
  color: #ffffff;
}

/* Timesheet Table */
.table-responsive {
  overflow-x: auto;
  margin: -4px -4px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.timesheet-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  background: var(--card-bg);
}

.timesheet-table th {
  background: var(--gray-bg);
  color: var(--text-muted-dark);
  font-weight: 700;
  padding: 10px 8px;
  text-align: left;
  border-bottom: 2px solid var(--border);
  font-size: 0.775rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.timesheet-table td {
  padding: 8px 6px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

.timesheet-table tr:hover td {
  background-color: #fafbfd;
}

.timesheet-table tr.weekend td {
  background-color: #fafafa;
}

.day-cell {
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.day-badge {
  background: var(--primary-light);
  color: var(--primary);
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 0.75rem;
}

.timesheet-table input.form-control,
.timesheet-table select.form-control {
  padding: 6px 8px;
  font-size: 0.85rem;
}

.num-input {
  text-align: right;
  width: 70px;
  color-scheme: light dark;
}

/* Custom Themed Stepper for Hours Inputs */
.hours-stepper {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 72px;
  vertical-align: middle;
}

.hours-stepper .num-input {
  width: 100% !important;
  padding-right: 17px !important;
  text-align: right;
  -moz-appearance: textfield;
  appearance: textfield;
}

.hours-stepper .num-input::-webkit-outer-spin-button,
.hours-stepper .num-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.hours-stepper-btns {
  position: absolute;
  right: 1px;
  top: 1px;
  bottom: 1px;
  width: 16px;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
  background: var(--primary-light);
  border-top-right-radius: 4px;
  border-bottom-right-radius: 4px;
  overflow: hidden;
  opacity: 0.85;
  transition: opacity 0.15s ease, border-color 0.15s ease;
}

.hours-stepper:hover .hours-stepper-btns,
.hours-stepper:focus-within .hours-stepper-btns {
  opacity: 1;
  border-left-color: var(--primary);
}

.hours-stepper-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  color: var(--primary);
  cursor: pointer;
  line-height: 1;
  user-select: none;
  transition: background-color 0.1s ease, color 0.1s ease;
}

.hours-stepper-btn:hover {
  background: var(--primary);
  color: #ffffff;
}

.hours-stepper-btn:active {
  background: var(--accent);
  color: #ffffff;
}

.hours-stepper-btn svg {
  display: block;
  pointer-events: none;
}

.date-input,
.timesheet-table td.col-date input,
.date-input[readonly] {
  width: 75px;
  text-align: center;
  background-color: var(--bg-hover) !important;
  color: var(--text-muted-dark) !important;
  border-color: var(--border) !important;
  cursor: not-allowed !important;
  user-select: none;
  font-weight: 600;
}

.date-input[readonly]:focus,
.timesheet-table td.col-date input:focus {
  outline: none !important;
  box-shadow: none !important;
  border-color: var(--border) !important;
}

.initial-input {
  width: 55px;
  text-align: center;
  text-transform: uppercase;
}

.time-input {
  width: 105px;
}

.break-select {
  width: 85px;
}

.total-pill {
  font-weight: 700;
  padding: 6px 10px;
  background: #e0f2fe;
  color: #0369a1;
  border-radius: 6px;
  text-align: center;
  display: inline-block;
  min-width: 50px;
}

.row-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.row-actions .copy-actions-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.row-actions .btn-icon {
  padding: 4px 6px;
  font-size: 0.8rem;
  line-height: 1;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.row-actions .btn-icon:hover {
  background: var(--bg-hover);
  border-color: #94a3b8;
  transform: translateY(-1px);
}

.row-actions .btn-clear-day {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 4px 7px;
  font-size: 0.775rem;
  font-weight: 600;
  color: var(--text-muted);
  border: 1px solid var(--border);
  background: var(--card-bg);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.row-actions .btn-clear-day .clear-icon {
  font-size: 0.825rem;
  font-weight: 700;
  line-height: 1;
}

.row-actions .btn-clear-day:hover,
.row-actions .btn-danger-hover:hover {
  background: #fee2e2;
  color: #dc2626;
  border-color: #fca5a5;
  transform: translateY(-1px);
}

:root[data-theme="dark"] .row-actions .btn-clear-day:hover,
:root[data-theme="dark"] .row-actions .btn-danger-hover:hover {
  background: rgba(220, 38, 38, 0.2);
  color: #f87171;
  border-color: #ef4444;
}

/* Legend and Activity Codes */
.activity-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  padding: 12px;
  background: var(--gray-bg);
  border-radius: 6px;
  border: 1px solid var(--border);
}

.legend-item {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.legend-code {
  font-weight: 700;
  background: #e2e8f0;
  padding: 2px 5px;
  border-radius: 4px;
  color: #334155;
}

/* Signatures Section */
.signature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

.sig-box {
  background: var(--gray-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sig-canvas-container {
  background: var(--card-bg);
  border: 2px dashed #cbd5e1;
  border-radius: 6px;
  height: 120px;
  position: relative;
  cursor: crosshair;
}

.sig-canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.sig-placeholder {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #94a3b8;
  font-size: 0.85rem;
  pointer-events: none;
}

.sig-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Sticky Bottom Bar (Hours Footer) */
.bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--card-bg);
  border-top: 1px solid var(--border);
  padding: 6px 24px 12px 24px;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.08);
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all 0.22s ease-in-out;
}

.bottom-bar-header {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  position: relative;
}

.btn-toggle-bottom-bar {
  background: var(--gray-bg);
  border: 1px solid var(--border);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  padding: 3px 12px;
  border-radius: 12px;
  transition: all 0.15s ease;
}

.btn-toggle-bottom-bar:hover {
  color: var(--primary);
  border-color: #94a3b8;
  background: var(--bg-hover);
}

.toggle-bar-handle {
  width: 24px;
  height: 3px;
  background: #cbd5e1;
  border-radius: 2px;
  display: inline-block;
}

.btn-toggle-bottom-bar:hover .toggle-bar-handle {
  background: var(--primary);
}

.bottom-bar-mini-pill {
  display: none;
  align-items: center;
  gap: 10px;
  width: 100%;
  justify-content: center;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 6px 14px;
  border-radius: 8px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  color: var(--primary);
  user-select: none;
  transition: background-color 0.15s ease;
}

.bottom-bar-mini-pill:hover {
  background: #e0f2fe;
}

.mini-pill-total {
  font-weight: 700;
  color: var(--primary);
}

.mini-pill-sub {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.mini-pill-tap-hint {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  margin-left: 6px;
  text-transform: uppercase;
}

.bottom-bar-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  width: 100%;
}

.bottom-bar.minimized {
  padding: 6px 16px;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.06);
}

.bottom-bar.minimized .bottom-bar-body {
  display: none !important;
}

.bottom-bar.minimized .btn-toggle-bottom-bar {
  display: none;
}

.bottom-bar.minimized .bottom-bar-mini-pill {
  display: flex;
}

.bottom-bar-mobile-dock {
  display: none;
}

.totals-summary {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.summary-stat {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--primary);
}

.stat-value.highlight {
  color: var(--accent);
}

/* Modal & Native Dialogs */
.modal, dialog.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 100000 !important;
  align-items: center;
  justify-content: center;
  padding: 20px;
  border: none;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-width: 100vw;
  max-height: 100vh;
  max-height: 100dvh;
  box-sizing: border-box;
}

dialog.modal::backdrop {
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(2px);
}

.modal.active,
dialog.modal:modal,
dialog.modal[open],
dialog.modal.active {
  display: flex;
}

.modal-content {
  background: var(--card-bg);
  border-radius: 12px;
  width: 100%;
  max-width: 1000px;
  height: 90vh;
  height: 90dvh;
  max-height: 90vh;
  max-height: 90dvh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
  overflow: hidden;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-body {
  flex: 1;
  background: #334155;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.modal-body iframe,
.modal-body object,
.modal-body embed {
  width: 100%;
  height: 100%;
  border: none;
  flex: 1;
}

.pdf-fallback-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  color: #f8fafc;
  height: 100%;
  gap: 16px;
}

.pdf-fallback-container p {
  max-width: 480px;
  line-height: 1.6;
  color: #cbd5e1;
  margin: 0;
}

/* Toast Notification & Modern Popover */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  background: #1e293b;
  color: white;
  padding: 12px 20px;
  border-radius: 6px;
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  z-index: 200000 !important;
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}

.toast.show,
.toast:popover-open,
.toast:where(:popover-open, .\:popover-open) {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

[popover].toast {
  border: none;
  margin: 0;
  inset: auto 20px auto auto;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: white;
  font-size: 0.725rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 9999px;
  margin-left: 4px;
}

/* History Modal */
.history-modal-body {
  background: var(--gray-bg);
  padding: 0 !important;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex: 1 1 0%;
  min-height: 0;
  height: 100%;
}

.history-container {
  display: grid;
  grid-template-columns: 320px 1fr;
  flex: 1 1 0%;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.history-list-pane {
  border-right: 1px solid var(--border);
  background: var(--card-bg);
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  overflow-y: auto;
}

.history-list-header {
  padding: 12px 16px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: var(--gray-bg);
  position: sticky;
  top: 0;
  z-index: 2;
}

.history-items-list {
  display: flex;
  flex-direction: column;
}

.history-item {
  padding: 14px 16px;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
  position: relative;
  border-left: 4px solid transparent;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.history-item:hover {
  background-color: #f1f7fc;
  border-left-color: #93c5fd;
}

.history-item.active {
  background-color: #e8f2f9;
  border-left-color: var(--primary);
}

.history-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.history-item-date {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-main);
}

.history-item-hours {
  font-weight: 700;
  font-size: 0.8rem;
  background: #e0f2fe;
  color: #0369a1;
  padding: 2px 8px;
  border-radius: 9999px;
}

.history-item-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.775rem;
  color: var(--text-muted);
}

.history-item-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}

.history-overview-pane {
  padding: 24px;
  overflow-y: auto;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--gray-bg);
}

@keyframes badgePulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.4); background: #16a34a; }
  100% { transform: scale(1); }
}

.badge-pulse {
  animation: badgePulse 0.6s ease-in-out;
}

.history-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  text-align: center;
  padding: 40px;
}

.overview-card {
  background: var(--card-bg);
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.overview-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 14px;
}

.overview-title h4 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--primary);
}

.overview-title p {
  font-size: 0.825rem;
  color: var(--text-muted);
}

.overview-stats-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.overview-stat-pill {
  background: var(--bg-hover);
  border-radius: 6px;
  padding: 6px 12px;
  display: flex;
  flex-direction: column;
}

.overview-stat-pill .label {
  font-size: 0.7rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
}

.overview-stat-pill .val {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--primary);
}

.overview-stat-pill.highlight {
  background: #e0f2fe;
}
.overview-stat-pill.highlight .val {
  color: #0369a1;
}

.overview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.825rem;
  background: var(--card-bg);
}

.overview-table th {
  background: var(--gray-bg);
  padding: 8px 10px;
  border-bottom: 2px solid var(--border);
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: left;
}

.overview-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

@media (max-width: 850px) {
  .history-container {
    grid-template-columns: 1fr;
    grid-template-rows: 240px 1fr;
  }
}

@media (max-width: 768px) {
  .navbar-container {
    padding: 6px 12px;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .navbar-header-row {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 42px;
    flex-wrap: nowrap;
  }
  .logo-group {
    min-width: 0;
    flex-shrink: 1;
    overflow: hidden;
  }
  .nav-title {
    min-width: 0;
    overflow: hidden;
  }
  .nav-title h1 {
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .nav-title p {
    display: none;
  }
  .navbar-quick-status {
    gap: 5px;
    flex-wrap: nowrap;
    flex-shrink: 0;
  }
  .bottom-bar {
    padding: 6px 12px calc(6px + env(safe-area-inset-bottom, 0px)) 12px;
    gap: 0;
  }
  .bottom-bar-header {
    display: none !important;
  }
  .desktop-bottom-actions {
    display: none !important;
  }
  .bottom-bar-body {
    display: none;
    padding: 8px 0 10px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 6px;
    animation: fadeInCard 0.18s ease-out;
  }
  .bottom-bar.show-mobile-breakdown .bottom-bar-body {
    display: block !important;
  }
  .bottom-bar-mobile-dock {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    min-height: 42px;
  }
  .mobile-hours-badge {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 9999px;
    padding: 6px 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: var(--primary);
    font-size: 0.825rem;
    font-weight: 700;
    transition: all 0.15s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
  }
  .mobile-hours-badge:hover,
  .mobile-hours-badge:active {
    background: #e0f2fe;
    border-color: #7dd3fc;
  }
  .bottom-bar.show-mobile-breakdown .mobile-hours-badge {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
  }
  .bottom-bar.show-mobile-breakdown .mobile-hours-badge .m-hours-icon,
  .bottom-bar.show-mobile-breakdown .mobile-hours-badge .m-hours-val {
    color: white;
  }
  .mobile-bottom-actions {
    display: flex;
    align-items: center;
    gap: 6px;
  }
  .mobile-bottom-actions .btn {
    padding: 7px 12px;
    font-size: 0.825rem;
    white-space: nowrap;
  }
  .btn-toggle-navbar {
    min-height: 40px;
    min-width: 68px;
    padding: 8px 14px;
    font-size: 0.85rem;
  }
  .nav-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    max-height: calc(85vh - 70px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 10px 4px 16px 4px;
    border-top: 1px solid var(--border);
    margin-top: 4px;
  }
  .nav-actions button,
  .nav-actions .user-nav-section {
    width: 100%;
  }
  .nav-actions .user-profile-pill {
    width: 100%;
    justify-content: space-between;
  }
}

