/* =========================================================
   ReclaimTime — Application Styles
   Philosophy: Clear, restrained, readable, timeless
   ========================================================= */

/* -----------------------------
   1. Design Tokens
   ----------------------------- */

:root {
  /* Typography */
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont,
               "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --text-primary: #0f172a;   /* slate-900 */
  --text-secondary: #475569; /* slate-600 */
  --text-muted: #64748b;     /* slate-500 */

  /* Backgrounds */
  --bg-page: #f8fafc;        /* slate-50 */
  --bg-surface: #ffffff;
  --bg-subtle: #f1f5f9;      /* slate-100 */

  /* Accents */
  --accent: #2563eb;         /* blue-600 */
  --accent-soft: #dbeafe;    /* blue-100 */

  /* Borders */
  --border: #e5e7eb;         /* gray-200 */

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-card: 16px;              /* iOS-style card corners (mobile entries, sheets) */
  --radius-sheet: 24px 24px 0 0;    /* bottom sheets — rounded top corners only */
  --radius-fab: 50%;                /* floating action button */

  /* Spacing */
  --space-xxs: 2px;
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 40px;

  /* Elevation (mobile-native shadow language) */
  --shadow-card: 0 1px 3px rgba(15, 23, 42, 0.04), 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-fab: 0 4px 12px rgba(15, 23, 42, 0.18), 0 2px 4px rgba(15, 23, 42, 0.08);
  --shadow-sheet: 0 -4px 20px rgba(15, 23, 42, 0.08);

  /* Type scale (hero-first mobile numbers) */
  --text-hero: 3rem;                /* 48px — captured hours */
  --text-value: 2rem;               /* 32px — dollar value */
  --text-caption: 0.875rem;         /* 14px — subtle labels */

  /* Layout */
  --content-width: 1200px;

  /* ========== Semantic Color Tokens (UI Refactor Phase 1) ========== */

  /* Success (green spectrum) */
  --color-success-bg: #d1fae5;
  --color-success-bg-alt: #a7f3d0;
  --color-success-border: #6ee7b7;
  --color-success: #059669;
  --color-success-dark: #047857;
  --color-success-text: #065f46;

  /* Warning (yellow/amber spectrum) */
  --color-warning-bg: #fef3c7;
  --color-warning-bg-alt: #fde68a;
  --color-warning-border: #fbbf24;
  --color-warning: #f59e0b;
  --color-warning-text: #92400e;
  --color-warning-text-darker: #78350f;

  /* Info (blue spectrum) */
  --color-info-bg: #eff6ff;
  --color-info-bg-alt: #dbeafe;
  --color-info-border: #93c5fd;
  --color-info: #3b82f6;
  --color-info-text: #1e40af;

  /* Danger (red spectrum) */
  --color-danger-bg: #fef2f2;
  --color-danger-bg-alt: #fca5a5;
  --color-danger: #dc2626;
  --color-danger-dark: #991b1b;
  --color-danger-text: #7f1d1d;

  /* Neutral & Accents */
  --color-muted: #64748b;
  --color-danger-accent: #ea580c; /* Orange - for "canceled" states */

  /* ========== Utility Tokens ========== */

  /* Gaps (for layout utilities) */
  --gap-sm: 0.5rem;
  --gap-md: 1rem;
  --gap-lg: 1.5rem;
}

/* -----------------------------
   2. Base Reset
   ----------------------------- */

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

html {
  font-size: 16px;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--text-primary);
  background: var(--bg-page);
  line-height: 1.5;
}

/* -----------------------------
   3. Page Layout
   ----------------------------- */

.page {
  min-height: 100vh;
  display: flex;
  justify-content: center;
}

.container {
  width: 100%;
  max-width: var(--content-width);
  padding: var(--space-lg);
}

/* Mobile spacing */
@media (max-width: 640px) {
  .container {
    padding: var(--space-md);
  }
}

/* -----------------------------
   4. Typography
   ----------------------------- */

h1, h2, h3 {
  margin: 0 0 var(--space-sm) 0;
  font-weight: 600;
  letter-spacing: -0.01em;
}

h1 {
  font-size: 1.6rem;
}

h2 {
  font-size: 1.25rem;
}

h3 {
  font-size: 1.1rem;
}

p {
  margin: 0 0 var(--space-md) 0;
  color: var(--text-secondary);
}

.small {
  font-size: 0.875rem;
  color: var(--text-muted);
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* -----------------------------
   5. Surfaces & Cards
   ----------------------------- */

.surface {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.card {
  padding: var(--space-lg);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

/* Summary header layout */
.summary-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-md);
}

.summary-actions {
  display: flex;
  gap: var(--space-sm);
  flex-shrink: 0;
}

/* Entries header - compact layout (Option 4) */
.entries-header-compact {
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border);
}

.entries-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-sm);
  gap: var(--space-md);
}

.entries-title-group {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.entries-title-group h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.entries-date-range {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.entries-controls {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-shrink: 0;
}

.view-mode-select {
  display: flex;
  gap: 2px;
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.view-select-btn {
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 500;
  border-radius: calc(var(--radius-sm) - 2px);
  background: transparent;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.15s;
  border: none;
}

.view-select-btn:hover {
  color: var(--text-primary);
}

.view-select-btn.active {
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.button-compact {
  padding: 6px 12px;
  font-size: 0.85rem;
}

.entries-nav-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  justify-content: center;
}

.nav-link {
  font-size: 0.875rem;
  color: var(--accent);
  text-decoration: none;
  padding: 4px 8px;
  transition: all 0.15s;
}

.nav-link:hover {
  text-decoration: underline;
}

.nav-link-today {
  font-weight: 500;
  padding: 4px 12px;
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
}

.nav-link-disabled {
  color: var(--text-muted);
  opacity: 0.4;
  cursor: not-allowed;
  text-decoration: none;
}

/* Mobile summary and entries layout */
@media (max-width: 640px) {
  .card {
    padding: var(--space-md);
  }

  .summary-header {
    flex-direction: column;
    align-items: stretch;
  }

  .summary-actions {
    margin-top: var(--space-md);
  }

  .summary-actions .button {
    width: 100%;
    text-align: center;
    justify-content: center;
  }

  /* Compact entries header mobile */
  .entries-title-row {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-sm);
  }

  .entries-title-group {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .entries-title-group h3 {
    font-size: 1rem;
  }

  .entries-date-range {
    font-size: 0.85rem;
  }

  .entries-controls {
    width: 100%;
    justify-content: space-between;
  }

  .view-mode-select {
    flex: 1;
  }

  .view-select-btn {
    flex: 1;
    text-align: center;
    padding: 10px 12px;
  }

  .button-compact {
    flex-shrink: 0;
    padding: 10px 16px;
  }

  .entries-nav-row {
    gap: var(--space-sm);
  }

  .nav-link {
    flex: 1;
    text-align: center;
    padding: 10px 12px;
  }

  .nav-link-today {
    padding: 10px 12px;
  }
}

.card + .card {
  margin-top: var(--space-lg);
}

/* -----------------------------
   6. Top Navigation
   ----------------------------- */

.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md) 0;
  margin-bottom: var(--space-lg);
  border-bottom: 1px solid var(--border);
}

.brand-name {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  flex-shrink: 0;
}

/* Main navigation */
.main-nav {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  min-width: 0;
  flex-shrink: 0;
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s;
  padding: var(--space-xs) 0;
  border-bottom: 2px solid transparent;
}

.nav-link:hover {
  color: var(--text-primary);
}

.nav-link.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Account dropdown */
.account-dropdown {
  position: relative;
}

.account-button {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.account-button:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.account-name {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dropdown-icon {
  transition: transform 0.2s;
}

.account-button:hover .dropdown-icon {
  transform: translateY(1px);
}

.account-menu {
  position: absolute;
  top: calc(100% + var(--space-xs));
  right: 0;
  min-width: 180px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  padding: var(--space-xs);
  z-index: 100;
}

.account-menu-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  border: none;
  background: none;
  color: var(--text-primary);
  font-size: 0.9rem;
  text-decoration: none;
  text-align: left;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}

.account-menu-item:hover {
  background: var(--bg-subtle);
}

.account-menu-item svg {
  flex-shrink: 0;
  color: var(--text-muted);
}

.account-menu-logout {
  margin-top: var(--space-xs);
  padding-top: var(--space-md);
  padding-bottom: var(--space-sm);
  border-top: 1px solid var(--border);
}

.account-menu-logout:hover {
  background: #fef2f2;
  color: #dc2626;
}

.account-menu-logout:hover svg {
  color: #dc2626;
}

/* Mobile navigation adjustments */
@media (max-width: 640px) {
  .main-nav {
    gap: var(--space-md);
  }

  .account-name {
    max-width: 100px;
  }
}

/* -----------------------------
   7. Flash Messages
   ----------------------------- */

.flash-notice,
.flash-alert {
  position: relative;
  padding: var(--space-md);
  padding-right: calc(var(--space-md) + 32px);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-md);
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

.flash-notice {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent);
}

.flash-alert {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.flash-close {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  background: none;
  border: none;
  color: currentColor;
  cursor: pointer;
  padding: var(--space-xs);
  line-height: 1;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.flash-close:hover {
  opacity: 1;
}

/* -----------------------------
   8. Toolbar / Filters
   ----------------------------- */

.toolbar {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}

.toolbar-group {
  display: flex;
  gap: var(--space-sm);
}

/* View mode toggle (Week / Month) */
.view-mode-toggle {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.toggle-btn {
  padding: 8px 16px;
  font-size: 0.875rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.15s;
  font-family: inherit;
}

.toggle-btn:hover {
  background: var(--bg-subtle);
  border-color: var(--accent);
}

.toggle-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  font-weight: 500;
}

/* Date navigation */
.date-navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-xl);
  gap: var(--space-md);
}

.current-range {
  text-align: center;
}

.current-range h2 {
  margin: 0;
}

.today-link {
  display: block;
  margin-top: var(--space-xs);
  font-size: 0.85rem;
  color: var(--accent);
}

.nav-btn {
  padding: 8px 16px;
  font-size: 0.875rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.15s;
  white-space: nowrap;
}

.nav-btn:hover {
  background: var(--bg-subtle);
  border-color: var(--accent);
}

.nav-btn.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* Mobile date navigation */
@media (max-width: 640px) {
  .view-mode-toggle .toggle-btn {
    flex: 1;
    padding: 12px 16px; /* Larger touch target */
    text-align: center;
  }

  .date-navigation {
    gap: var(--space-sm);
  }

  .current-range h2 {
    font-size: 1.1rem;
  }

  .nav-btn {
    padding: 12px 20px; /* Larger touch target */
    flex-shrink: 0;
  }
}

/* -----------------------------
   9. Buttons
   ----------------------------- */

button, .button {
  font-family: inherit;
  font-size: 0.875rem;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  display: inline-block;
}

button:hover, .button:hover {
  background: var(--bg-subtle);
}

button.primary, .button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  font-weight: 500;
}

button.primary:hover, .button.primary:hover {
  background: #1d4ed8; /* blue-700 */
}

button.button-secondary, .button.button-secondary {
  background: #f1f5f9; /* slate-100 */
  border-color: #cbd5e1; /* slate-300 */
  color: #475569; /* slate-600 */
}

button.button-secondary:hover, .button.button-secondary:hover {
  background: #e2e8f0; /* slate-200 */
  border-color: #94a3b8; /* slate-400 */
  color: #334155; /* slate-700 */
}

/* Mobile button optimizations */
@media (max-width: 640px) {
  button, .button {
    padding: 12px 16px; /* Larger touch target (44px min) */
    font-size: 0.9rem;
  }

  .edit-link {
    padding: 8px 12px; /* Ensure minimum 44px touch target */
    display: inline-block;
    margin: -8px -12px; /* Negative margin to maintain visual spacing */
  }
}

/* -----------------------------
   10. Tables (Core UI)
   ----------------------------- */

/* -----------------------------
   Mobile entries: card list (< 768px)
   Desktop entries: table (768px+)
   ----------------------------- */

.entries-cards {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  padding: 0 var(--space-md) var(--space-md);
}

.table-wrap {
  display: none;
  overflow-x: auto;
}

@media (min-width: 768px) {
  .entries-cards { display: none; }
  .table-wrap { display: block; }
}

.entry-card {
  display: block;
  width: 100%;
  text-align: left;
  text-decoration: none;
  color: inherit;
  font: inherit;
  background: var(--bg-surface);
  padding: var(--space-md);
  border: 1px solid var(--border);
  border-left: 3px solid transparent;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  min-height: 72px;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.entry-card:active { transform: scale(0.99); }
.entry-card:hover { box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08); }

.entry-card--needs-review { border-left-color: var(--color-warning); }

.entry-card--empty {
  border-left: 3px solid transparent;
  color: var(--text-muted);
  text-align: center;
  min-height: auto;
  padding: var(--space-lg);
}

.entry-card__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-sm);
  margin-bottom: var(--space-xs);
}

.entry-card__client {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-primary);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry-card__badge {
  color: var(--color-warning);
  margin-left: var(--space-xxs);
  font-size: 0.9em;
}

.entry-card__hours {
  font-weight: 600;
  font-size: 1.125rem;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.entry-card__description {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  line-height: 1.4;
  margin-bottom: var(--space-xxs);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.entry-card__timestamp {
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

thead {
  background: var(--bg-subtle);
}

th, td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Sortable table headers */
.sortable-header {
  color: var(--text-secondary);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: color 0.15s;
  user-select: none;
}

.sortable-header:hover {
  color: var(--accent);
  text-decoration: none;
}

.sortable-header.active {
  color: var(--accent);
  font-weight: 700;
}

tbody tr:hover {
  background: var(--bg-subtle);
}

tbody tr td:last-child {
  text-align: right;
}

.edit-link {
  color: var(--accent);
  font-size: 0.875rem;
  text-decoration: none;
}

.edit-link:hover {
  text-decoration: underline;
}

/* Mobile table optimizations */
@media (max-width: 640px) {
  th, td {
    padding: 12px 8px;
    font-size: 0.85rem;
  }

  table {
    font-size: 0.85rem;
  }

  /* Make Edit column sticky on mobile so it's always visible */
  th:last-child,
  td:last-child {
    position: sticky;
    right: 0;
    background: var(--bg-surface);
    box-shadow: -2px 0 4px rgba(0, 0, 0, 0.05);
  }

  thead th:last-child {
    background: var(--bg-subtle);
  }

  tbody tr:hover td:last-child {
    background: var(--bg-subtle);
  }

  /* Reduce timestamp column on mobile */
  th:nth-child(4),
  td:nth-child(4) {
    font-size: 0.75rem;
  }
}

/* -----------------------------
   11. Badges / Status
   ----------------------------- */

.badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 0.75rem;
  border-radius: 999px;
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-weight: 500;
}

.badge.accent {
  background: var(--accent-soft);
  color: var(--accent);
}

/* -----------------------------
   12. Forms
   ----------------------------- */

input, select, textarea {
  font-family: inherit;
  font-size: 0.9rem;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-primary);
  width: 100%;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
}

label {
  display: block;
  margin-bottom: var(--space-xs);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
}

/* -----------------------------
   13. Edit Modal
   ----------------------------- */

.edit-modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.5);
  z-index: 1000;
}

.edit-modal-overlay.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.edit-modal-content {
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  width: 90%;
  max-width: 500px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.edit-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-lg);
}

.edit-modal-header h3 {
  margin: 0;
}

.edit-modal-close {
  background: none;
  border: none;
  padding: var(--space-xs);
  cursor: pointer;
  color: var(--text-muted);
}

.edit-modal-close:hover {
  color: var(--text-primary);
}

.edit-form-group {
  margin-bottom: var(--space-md);
}

.edit-form-group label {
  display: block;
  margin-bottom: var(--space-xs);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.edit-form-group input[type="text"],
.edit-form-group input[type="number"],
.edit-form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  color: var(--text-primary);
  font-family: var(--font-sans);
}

.edit-form-group textarea {
  resize: vertical;
  min-height: 72px;
}

.edit-form-group input:focus,
.edit-form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.edit-form-actions {
  display: flex;
  gap: var(--space-sm);
  justify-content: flex-start;
  align-items: center;
  margin-top: var(--space-md);
}

.edit-form-actions form {
  width: 100%;
}

.edit-form-right-actions {
  display: flex;
  gap: var(--space-sm);
  justify-content: flex-end;
  margin-top: var(--space-lg);
}

.edit-btn-cancel {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  cursor: pointer;
}

.edit-btn-cancel:hover {
  background: var(--bg-subtle);
}

.edit-btn-save {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #ffffff;
  font-weight: 500;
  font-size: 0.875rem;
  cursor: pointer;
}

.edit-btn-save:hover {
  background: #1d4ed8;
}

.edit-btn-delete {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid #dc2626;
  background: #dc2626;
  color: #ffffff;
  font-weight: 500;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
}

.edit-btn-delete:hover {
  background: #b91c1c;
  border-color: #b91c1c;
}

/* Mobile modal optimizations */
@media (max-width: 640px) {
  .edit-modal-overlay {
    padding: var(--space-md);
  }

  .edit-modal-content {
    width: 100%;
    max-width: 100%;
    max-height: 90vh;
    overflow-y: auto;
  }

  .edit-form-group label {
    font-size: 0.9rem;
  }

  .edit-form-group input,
  .edit-form-group textarea {
    padding: 14px 12px; /* Larger touch target */
    font-size: 1rem; /* Prevents zoom on iOS */
  }

  .edit-form-actions {
    flex-direction: column;
    gap: var(--space-sm);
  }

  .edit-form-right-actions {
    width: 100%;
    flex-direction: column-reverse;
  }

  .edit-btn-cancel,
  .edit-btn-save,
  .edit-btn-delete {
    width: 100%;
    padding: 14px 16px; /* Larger touch target */
    text-align: center;
    font-size: 1rem;
  }

  .edit-modal-close {
    padding: var(--space-sm); /* Larger touch target */
  }
}

/* -----------------------------
   14. CSV Preview
   ----------------------------- */

.csv-preview-card {
  margin-top: var(--space-lg);
}

.csv-preview-header {
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}

.csv-toggle-icon {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.csv-preview-content {
  margin-top: var(--space-md);
}

.csv-preview {
  background: var(--bg-subtle);
  padding: var(--space-md);
  border-radius: var(--radius-sm);
  font-family: 'Monaco', 'Courier New', monospace;
  font-size: 0.8rem;
  overflow-x: auto;
  white-space: pre;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

/* -----------------------------
   15. Utilities (Minimal)
   ----------------------------- */

.stack > * + * {
  margin-top: var(--space-md);
}

.right {
  text-align: right;
}

.muted {
  color: var(--text-muted);
}

.flex {
  display: flex;
}

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

.gap-sm {
  gap: var(--space-sm);
}

.gap-md {
  gap: var(--space-md);
}

.mt-lg {
  margin-top: var(--space-lg);
}

/* ==========================================
   UI Refactor Phase 1: Semantic Utilities
   ========================================== */

/* ===== Banner Variants ===== */

.banner {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  margin-bottom: var(--space-md);
  font-size: 0.95rem;
  line-height: 1.5;
}

.banner-success {
  background: linear-gradient(135deg, var(--color-success-bg) 0%, var(--color-success-bg-alt) 100%);
  border-color: var(--color-success-border);
  color: var(--color-success-text);
}

.banner-warning {
  background: linear-gradient(135deg, var(--color-warning-bg) 0%, var(--color-warning-bg-alt) 100%);
  border-color: var(--color-warning-border);
  color: var(--color-warning-text-darker);
}

.banner-info {
  background: linear-gradient(135deg, var(--color-info-bg) 0%, var(--color-info-bg-alt) 100%);
  border-color: var(--color-info-border);
  color: var(--color-info-text);
}

.banner-danger {
  background: linear-gradient(135deg, var(--color-danger-bg) 0%, var(--color-danger-bg-alt) 100%);
  border-color: var(--color-danger);
  color: var(--color-danger-text);
}

.banner h3 {
  margin: 0 0 6px 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.banner p {
  margin: 0;
}

.banner a {
  color: inherit;
  text-decoration: underline;
  font-weight: 500;
}

.banner a:hover {
  opacity: 0.8;
}

/* ===== Text Utilities ===== */

.text-success {
  color: var(--color-success);
}

.text-success-dark {
  color: var(--color-success-dark);
}

.text-warning {
  color: var(--color-warning);
}

.text-warning-dark {
  color: var(--color-warning-text);
}

.text-info {
  color: var(--color-info);
}

.text-danger {
  color: var(--color-danger);
}

.text-danger-dark {
  color: var(--color-danger-dark);
}

.text-danger-accent {
  color: var(--color-danger-accent);
}

.text-muted-custom {
  color: var(--color-muted);
}

.text-muted {
  color: var(--text-muted);
}

/* ===== Text Alignment ===== */

.text-right {
  text-align: right;
}

.text-center {
  text-align: center;
}

.text-left {
  text-align: left;
}

/* ===== Margin Utilities ===== */

.m-0 {
  margin: 0;
}

.mb-xs {
  margin-bottom: 4px;
}

.mb-sm {
  margin-bottom: 8px;
}

.mb-md {
  margin-bottom: 12px;
}

.mb-lg {
  margin-bottom: var(--space-lg);
}

.mb-xl {
  margin-bottom: var(--space-xl);
}

.m-auto {
  margin: 0 auto;
}

.mt-xs {
  margin-top: var(--space-xs);
}

.mt-sm {
  margin-top: var(--space-sm);
}

.mt-md {
  margin-top: var(--space-md);
}

.mt-lg {
  margin-top: var(--space-lg);
}

.mt-xl {
  margin-top: var(--space-xl);
}

/* ===== Padding Utilities ===== */

.pt-sm {
  padding-top: var(--space-sm);
}

.pt-md {
  padding-top: var(--space-md);
}

.pt-lg {
  padding-top: var(--space-lg);
}

.pl-lg {
  padding-left: 32px;
}

/* ===== Font Weight Utilities ===== */

.font-medium {
  font-weight: 500;
}

.font-semibold {
  font-weight: 600;
}

.font-bold {
  font-weight: 700;
}

/* ===== Font Size Utilities ===== */

.text-xs {
  font-size: 0.85rem;
}

.text-sm {
  font-size: 0.9rem;
}

.text-base {
  font-size: 0.95rem;
}

.text-lg {
  font-size: 1.1rem;
}

.text-xl {
  font-size: 1.2rem;
}

.text-xxl {
  font-size: 1.6rem;
}

.text-xxs {
  font-size: 0.75rem;
}

.text-uppercase {
  text-transform: uppercase;
}

.tracking-wide {
  letter-spacing: 0.05em;
}

.font-mono {
  font-family: monospace;
}

/* ===== Flex Utilities ===== */

.flex-1 {
  flex: 1;
}

.flex-wrap {
  flex-wrap: wrap;
}

.items-start {
  align-items: flex-start;
}

.min-w-250 {
  min-width: 250px;
}

/* ===== Line Height Utilities ===== */

.leading-normal {
  line-height: 1.5;
}

.leading-relaxed {
  line-height: 1.6;
}

/* ===== Padding Utilities ===== */

.p-lg {
  padding: 40px;
}

/* ===== Layout Utilities ===== */

.row {
  display: flex;
  align-items: center;
}

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

.row-center {
  display: flex;
  justify-content: center;
  align-items: center;
}

.stack-sm > * + * {
  margin-top: var(--gap-sm);
}

/* ===== Inline Code Style ===== */

.inline-code {
  font-family: 'Monaco', 'Courier New', monospace;
  font-size: 0.875em;
  padding: 2px 6px;
  background: var(--bg-subtle);
  border-radius: 4px;
  border: 1px solid var(--border);
  white-space: nowrap;
}

/* ===== Status Dots ===== */

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
}

.status-dot--success {
  background-color: var(--color-success-border);
}

.status-dot--warning {
  background-color: var(--color-warning-border);
}

.status-dot--danger {
  background-color: var(--color-danger);
}

.status-dot--info {
  background-color: var(--color-info-border);
}

/* ===== Button Utilities ===== */

.btn-warning {
  background: linear-gradient(135deg, var(--color-warning) 0%, #d97706 100%);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.95rem;
  transition: all 0.2s;
}

.btn-warning:hover {
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
  transform: scale(1.02);
}

.btn-success {
  background: var(--color-success);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.btn-success:hover {
  background: var(--color-success-dark);
  transform: scale(1.05);
}

.btn-close {
  background: none;
  border: none;
  color: var(--color-warning-text);
  font-size: 24px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  flex-shrink: 0;
  transition: opacity 0.2s;
}

.btn-close:hover {
  opacity: 0.7;
}

/* ===== Perfect Entry Guide ===== */

.perfect-entry-header {
  cursor: pointer;
}

.perfect-entry-content {
  display: none;
  margin-top: var(--space-md);
}

.perfect-entry-example {
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--color-info-text);
  line-height: 1.6;
}

.perfect-entry-format {
  font-size: 1rem;
  color: var(--color-info);
  margin-top: var(--space-md);
  font-weight: 500;
}

.perfect-entry-grid {
  display: grid;
  gap: var(--space-md);
}

.perfect-entry-item {
  padding: var(--space-md);
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
}

.perfect-entry-label {
  font-weight: 600;
  margin-bottom: 4px;
}

.perfect-entry-desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.perfect-entry-why {
  margin-top: var(--space-lg);
  padding: var(--space-md);
  background: var(--color-warning-bg);
  border-left: 4px solid var(--color-warning);
  border-radius: var(--radius-sm);
}

/* ===== Account Page Utilities ===== */

.container-narrow {
  max-width: 700px;
  margin: 0 auto;
}

.grid-2col {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
}

.display-block {
  display: block;
}

.display-inline {
  display: inline;
}

.display-inline-flex {
  display: inline-flex;
}

.items-center {
  align-items: center;
}

.gap-sm {
  gap: var(--gap-sm);
}

.gap-md {
  gap: var(--gap-md);
}

.overflow-auto {
  overflow-x: auto;
}

.w-full {
  width: 100%;
}

.cursor-pointer {
  cursor: pointer;
}

/* Position utilities */
.relative {
  position: relative;
}

.absolute {
  position: absolute;
}

.absolute-left-dollar {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
}

.currency-input-wrapper {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  color: var(--text-primary);
  background: #fff;
}

.currency-input-wrapper:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.currency-input-wrapper span {
  color: var(--color-text-secondary);
  user-select: none;
}

.currency-input-wrapper input {
  border: none;
  outline: none;
  box-shadow: none;
  padding: 0;
  flex: 1;
  background: transparent;
  font-size: 1rem;
  color: var(--text-primary);
  font-family: var(--font-sans);
  min-width: 0;
}

/* Border utilities */
.border-t {
  border-top: 1px solid var(--border);
}

.border-b {
  border-bottom: 1px solid var(--border);
}

.border-danger {
  border-color: var(--color-danger-bg-alt);
}

/* Subscription status badges */
.status-badge {
  margin: 0;
  font-weight: 500;
  font-size: 1.1rem;
  line-height: 1.6;
}

.status-box {
  padding: var(--space-md);
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
}

.status-active {
  color: var(--color-success);
}

.status-canceled {
  color: var(--color-danger-accent);
}

.status-past-due {
  color: var(--color-danger);
}

.status-free-tier {
  color: var(--color-muted);
}

/* Phone display box */
.phone-display {
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: monospace;
}

/* Billing table */
.billing-table {
  width: 100%;
  font-size: 0.875rem;
}

.billing-table th {
  padding: var(--space-sm) 0;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
}

.billing-table th.text-right {
  text-align: right;
}

.billing-table td {
  padding: var(--space-md) 0;
}

/* Danger zone */
.danger-zone-box {
  background: var(--color-danger-bg);
  border: 1px solid var(--color-danger-bg-alt);
  border-radius: var(--radius-sm);
  padding: var(--space-md);
}

.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: var(--gap-sm);
  background: var(--color-danger);
  color: white;
  border-color: var(--color-danger);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  border: none;
  font-family: inherit;
  font-size: inherit;
}

.btn-danger:hover {
  background: var(--color-danger-dark);
  border-color: var(--color-danger-dark);
}

.btn-accent {
  display: inline-flex;
  align-items: center;
  gap: var(--gap-sm);
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  text-decoration: none;
}

.btn-accent:hover {
  opacity: 0.9;
}

/* Inline button utilities */
.btn-inline-flex {
  display: inline-flex;
  align-items: center;
  gap: var(--gap-sm);
}

/* Resize utilities */
.resize-vertical {
  resize: vertical;
}

/* -----------------------------
   Screen-reader-only utility (needed by drawer's a11y title)
   ----------------------------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* -----------------------------
   Hero (headline numbers + status chip)
   ----------------------------- */

.hero {
  padding: var(--space-xl) 0 var(--space-lg);
}
.hero__numbers {
  display: flex;
  flex-direction: column;
  margin-bottom: var(--space-md);
  padding-left: var(--space-md);
}
.hero__hours {
  font-size: var(--text-hero);
  font-weight: 600;
  line-height: 1;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.hero__value {
  font-size: var(--text-value);
  font-weight: 500;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  margin-top: var(--space-xs);
}
.hero__caption {
  font-size: var(--text-caption);
  color: var(--text-muted);
  margin-top: var(--space-xs);
}

.status-chip {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  min-height: 48px;
}
.status-chip__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}
.status-chip--free .status-chip__dot { background: var(--accent); }
.status-chip--over .status-chip__dot { background: var(--color-warning, #f59e0b); }
.status-chip--active .status-chip__dot { background: var(--color-success, #10b981); }
.status-chip--comp .status-chip__dot { background: var(--color-success, #10b981); }
.status-chip--warning .status-chip__dot { background: var(--color-warning, #f59e0b); }

.status-chip__label {
  color: var(--text-primary);
  font-size: 0.9375rem;
}
.status-chip__cta {
  margin-left: auto;
  color: var(--accent);
  font-weight: 500;
  font-size: 0.9375rem;
  text-decoration: none;
  white-space: nowrap;
}
.status-chip__cta::after { content: ' ›'; }

/* Hide top-nav dropdown on mobile — Account controls live in the function drawer */
@media (max-width: 767px) {
  .main-nav { display: none; }
}

/* -----------------------------
   Desktop Sidebar (2026-08-19 Slice 2)
   ----------------------------- */

.sidebar { display: none; }

@media (min-width: 768px) {
  /* Hide top-nav entirely on desktop — sidebar replaces it */
  .top-nav { display: none; }

  /* Reserve the sidebar's 260px at the flex-parent level so the
     centered .container inside .page centers within the REMAINING
     viewport, not the whole viewport (avoids narrow-shifted-column bug) */
  .page {
    padding-left: 260px;
  }

  .sidebar {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 260px;
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    padding: var(--space-lg) var(--space-md);
    z-index: 20;
    overflow-y: auto;
  }
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0 var(--space-sm) var(--space-lg);
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  transition: opacity 0.1s ease;
}
.sidebar__brand:hover { opacity: 0.8; }
.sidebar__logo {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}
.sidebar__wordmark {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.sidebar__section {
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--border);
}
.sidebar__section:last-of-type { border-bottom: none; }

.sidebar__heading {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 var(--space-xs);
  padding: 0 var(--space-sm);
}

.sidebar__link {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  color: var(--text-primary);
  text-decoration: none;
  border-radius: var(--radius-md);
  border-left: 3px solid transparent;
  font-size: 0.9375rem;
  margin: 2px 0;
  transition: background 0.1s ease, color 0.1s ease;
  width: 100%;
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.sidebar__link:hover { background: var(--bg-subtle); }
.sidebar__link--active {
  background: var(--accent-soft);
  border-left-color: var(--accent);
  color: var(--accent);
  font-weight: 500;
}
.sidebar__link-icon {
  display: inline-flex;
  width: 16px;
  color: var(--accent);
  font-weight: 600;
  flex-shrink: 0;
}

.sidebar__footer {
  margin-top: auto;
  padding-top: var(--space-md);
  border-top: 1px solid var(--border);
}

.sidebar__user {
  display: flex;
  flex-direction: column;
  padding: 0 var(--space-md) var(--space-sm);
}
.sidebar__user-name {
  font-weight: 500;
  color: var(--text-primary);
  font-size: 0.9375rem;
}
.sidebar__user-status {
  display: inline-flex;
  align-self: flex-start;
  font-size: 0.6875rem;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  color: var(--text-muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 600;
}
.sidebar__user-status--comp,
.sidebar__user-status--active { background: #dcfce7; color: #166534; }
.sidebar__user-status--past_due { background: #fef3c7; color: #92400e; }

.sidebar__shortcut-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: var(--space-sm) var(--space-md) 0;
  margin: var(--space-md) 0 0;
}
.sidebar__soon {
  font-size: 0.625rem;
  color: var(--text-muted);
  opacity: 0.7;
  margin-left: 4px;
  font-style: italic;
}

/* Inline compact CSV download next to entries-date-range (desktop only;
   mobile drawer covers this) */
.entries-date-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: background 0.1s ease, color 0.1s ease;
  text-decoration: none;
  margin-left: var(--space-xs);
}
.entries-date-download:hover {
  background: var(--bg-subtle);
  color: var(--accent);
}

@media (max-width: 767px) {
  .entries-date-download { display: none; }
}

/* Reserve Today slot in prev/next nav so Prev doesn't shift when Today
   becomes visible on navigation away from current period */
.nav-link--hidden {
  visibility: hidden;
  pointer-events: none;
}

.back-link {
  display: inline-flex;
  align-items: center;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9375rem;
  padding: var(--space-xs) 0;
  transition: color 0.1s ease;
}
.back-link:hover { color: var(--accent); }

/* Slim inline summary line in entries card header */
.entries-summary-line {
  font-size: var(--text-caption);
  color: var(--text-muted);
  padding: var(--space-sm) 0 var(--space-xs);
  border-top: 1px solid var(--border);
  margin-top: var(--space-sm);
}

/* -----------------------------
   Floating Action Button (mobile-only +Add Entry)
   ----------------------------- */

.fab {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 76px);
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: var(--radius-fab);
  background: var(--accent);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-fab);
  z-index: 30;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.fab:hover { transform: scale(1.05); }
.fab:active { transform: scale(0.95); }
.fab svg { display: block; }

@media (min-width: 768px) {
  .fab { display: none; }
}

/* -----------------------------
   Function Drawer (mobile-only bottom sheet)
   ----------------------------- */

.drawer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  pointer-events: none;
}

.drawer[data-state="open"] {
  pointer-events: auto;
}

/* Backdrop when open */
.drawer[data-state="open"]::before {
  content: '';
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  z-index: -1;
  animation: drawer-backdrop-in 0.2s ease forwards;
}

@keyframes drawer-backdrop-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Closed-state handle (always visible at bottom of viewport on mobile) */
.drawer__handle {
  pointer-events: auto;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 44px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  display: flex;
  justify-content: center;
  align-items: center;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  cursor: pointer;
  transition: opacity 0.2s ease;
  touch-action: none;
}

.drawer[data-state="open"] .drawer__handle {
  opacity: 0;
  pointer-events: none;
}

.drawer__handle-bar {
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: var(--text-muted);
}

/* Panel (slides up from bottom) */
.drawer__panel {
  pointer-events: auto;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-surface);
  border-radius: var(--radius-sheet);
  padding: var(--space-md) var(--space-md) calc(env(safe-area-inset-bottom, 0px) + var(--space-xl));
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-sheet);
  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
}

.drawer[data-state="open"] .drawer__panel {
  transform: translateY(0);
}

.drawer__panel-handle {
  display: flex;
  justify-content: center;
  padding-bottom: var(--space-md);
}

.drawer__close {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-md);
  background: transparent;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: var(--space-xs) var(--space-sm);
}
.drawer__close:hover { color: var(--text-primary); }

.drawer__section {
  margin-bottom: var(--space-lg);
}
.drawer__section:last-child {
  margin-bottom: 0;
}

.drawer__heading {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin: 0 0 var(--space-sm);
}

.drawer__list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.drawer__item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-sm);
  color: var(--text-primary);
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: background 0.1s ease;
  min-height: 48px;
  width: 100%;
  background: transparent;
  border: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.drawer__item:hover { background: var(--bg-subtle); }
.drawer__item:active { background: var(--bg-subtle); }

.drawer__item-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  color: var(--accent);
  font-weight: 600;
  flex-shrink: 0;
}

.drawer__list--corrections {
  padding-left: 0;
}

.drawer__correction {
  padding: var(--space-sm);
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-xs);
  font-size: 0.9375rem;
}
.drawer__correction:last-child { margin-bottom: 0; }

.drawer__correction-diff {
  display: block;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
  color: var(--text-primary);
  font-size: 0.875rem;
  margin-bottom: 2px;
}

.drawer__correction-context {
  display: block;
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.drawer__empty {
  color: var(--text-muted);
  font-style: italic;
  padding: var(--space-sm);
  margin: 0;
}

/* Hidden entirely on tablet+ */
@media (min-width: 768px) {
  .drawer { display: none; }
}

/* Prevent body scroll when drawer open */
body.drawer-open {
  overflow: hidden;
}

/* -----------------------------
   Entry Detail Bottom Sheet (mobile)
   ----------------------------- */

.entry-sheet {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  visibility: hidden;
}

.entry-sheet[data-state="open"] {
  visibility: visible;
  pointer-events: auto;
}

.entry-sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.entry-sheet[data-state="open"] .entry-sheet__backdrop { opacity: 1; }

.entry-sheet__panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-surface);
  border-radius: var(--radius-sheet);
  padding: var(--space-md) var(--space-md) calc(env(safe-area-inset-bottom, 0px) + var(--space-xl));
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-sheet);
  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
}
.entry-sheet[data-state="open"] .entry-sheet__panel { transform: translateY(0); }

.entry-sheet__handle {
  display: flex;
  justify-content: center;
  padding-bottom: var(--space-md);
}
.entry-sheet__handle-bar {
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: var(--text-muted);
}

.entry-sheet__close {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-md);
  background: transparent;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: var(--space-xs) var(--space-sm);
}
.entry-sheet__close:hover { color: var(--text-primary); }

.entry-sheet__loading {
  padding: var(--space-lg);
  text-align: center;
  color: var(--text-muted);
}

.entry-sheet__body {
  padding-top: var(--space-xs);
}

.entry-sheet__client {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 var(--space-xxs);
  color: var(--text-primary);
}
.entry-sheet__meta {
  color: var(--text-primary);
  margin: 0 0 var(--space-xxs);
  font-size: 1rem;
}
.entry-sheet__timestamp {
  color: var(--text-muted);
  font-size: var(--text-caption);
  margin: 0 0 var(--space-lg);
}

/* R.T.'s notes panel */
.rt-notes {
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin-bottom: var(--space-lg);
}
.rt-notes__heading {
  font-size: 0.875rem;
  font-weight: 600;
  margin: 0 0 var(--space-md);
  color: var(--text-primary);
}
.rt-notes__block { margin-bottom: var(--space-md); }
.rt-notes__block:last-child { margin-bottom: 0; }

.rt-notes__label {
  font-size: 0.6875rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-xxs);
  font-weight: 600;
}
.rt-notes__quote {
  font-style: italic;
  color: var(--text-primary);
  font-size: 0.9375rem;
}
.rt-notes__logged {
  color: var(--text-primary);
  font-size: 0.9375rem;
}
.rt-notes__fixes {
  list-style: none;
  padding: 0;
  margin: 0;
}
.rt-notes__fixes li {
  padding: 2px 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
  font-size: 0.875rem;
  color: var(--text-primary);
}
.rt-notes__block--clean {
  color: var(--text-muted);
  font-style: italic;
}

.entry-sheet__actions {
  display: flex;
  gap: var(--space-sm);
}
.entry-sheet__actions .entry-sheet__action {
  flex: 1;
  text-align: center;
  min-height: 48px;
}
.entry-sheet__actions form {
  flex: 1;
  margin: 0;
}
.entry-sheet__actions form .entry-sheet__action {
  width: 100%;
}

body.entry-sheet-open {
  overflow: hidden;
}

/* Hide sheet on desktop — table row Edit link is the desktop path */
@media (min-width: 768px) {
  .entry-sheet { display: none; }
}
/*
 * ReclaimTime Application Styles
 *


 */
