/* ─── App Shell ─────────────────────────────────── */
.app-shell {
  min-height: 100vh;
  background: var(--charcoal);
  color: var(--cream);
  font-family: var(--ff-body);
}

.app-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 2rem;
  border-bottom: 1px solid rgba(217,119,6,0.15);
  max-width: 100%;
}

.app-nav-brand {
  font-family: var(--ff-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--amber);
  text-decoration: none;
}

.app-nav-links {
  display: flex;
  gap: 1.5rem;
  list-style: none;
}

.app-nav-links a {
  font-size: 0.875rem;
  color: var(--cream-dim);
  text-decoration: none;
  transition: color 0.2s;
}

.app-nav-links a:hover { color: var(--amber); }

/* ─── Container ─────────────────────────────────── */
.app-container {
  max-width: 680px;
  margin: 0 auto;
  padding: 3rem 2rem;
}

.page-title {
  font-size: 2rem;
}

/* ─── AI Input Card ─────────────────────────────── */
.ai-input-card {
  background: var(--charcoal-light);
  border: 1px solid rgba(217,119,6,0.2);
  border-radius: 12px;
  padding: 2rem;
  margin-bottom: 2rem;
}

.ai-input-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 0.75rem;
}

.ai-input-row {
  display: flex;
  gap: 0.75rem;
}

.ai-text-input {
  flex: 1;
  background: var(--charcoal);
  border: 1px solid var(--charcoal-lighter);
  border-radius: 8px;
  padding: 0.875rem 1rem;
  color: var(--cream);
  font-family: var(--ff-body);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

.ai-text-input::placeholder { color: var(--text-muted); }
.ai-text-input:focus { border-color: var(--amber); }

.ai-submit-btn {
  background: var(--amber);
  color: var(--charcoal);
  border: none;
  border-radius: 8px;
  padding: 0.875rem 1.25rem;
  font-family: var(--ff-body);
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  white-space: nowrap;
}

.ai-submit-btn:hover { background: #f59e0b; transform: translateY(-1px); }
.ai-submit-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.ai-hint {
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ─── Repeat Last Entry ──────────────────────────── */
.repeat-last-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.75rem;
}

.repeat-last-btn {
  background: var(--amber);
  color: var(--charcoal);
  border: none;
  border-radius: 8px;
  padding: 0.875rem 1.25rem;
  font-family: var(--ff-body);
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  white-space: nowrap;
}

.repeat-last-btn:hover { background: #f59e0b; transform: translateY(-1px); }
.repeat-last-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.repeat-last-status {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-style: italic;
}

/* ─── Pre-fill Form ──────────────────────────────── */
.prefill-card {
  background: var(--charcoal-light);
  border: 1px solid rgba(217,119,6,0.3);
  border-radius: 12px;
  padding: 2rem;
  margin-bottom: 2rem;
}

.prefill-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.prefill-badge {
  background: var(--amber-dim);
  color: var(--amber);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.25rem 0.625rem;
  border-radius: 4px;
}

.confidence-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.25rem 0.625rem;
  border-radius: 4px;
  border: 1px solid transparent;
}

.confidence-badge.is-high {
  background: rgba(16,185,129,0.12);
  color: #6ee7b7;
  border-color: rgba(16,185,129,0.35);
}

.confidence-badge.is-medium {
  background: var(--amber-dim);
  color: var(--amber);
  border-color: rgba(217,119,6,0.35);
}

.confidence-badge.is-low {
  background: rgba(239,68,68,0.12);
  color: #fca5a5;
  border-color: rgba(239,68,68,0.4);
}

#prefill-section.is-low-confidence .prefill-card {
  border-color: rgba(239,68,68,0.4);
}

.ai-edit-prompt {
  color: var(--cream-dim);
  font-size: 0.85rem;
  margin: -0.5rem 0 1.5rem 0;
  font-style: italic;
}

.prefill-title {
  font-family: var(--ff-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--cream);
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--cream-dim);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  background: var(--charcoal);
  border: 1px solid var(--charcoal-lighter);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  color: var(--cream);
  font-family: var(--ff-body);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--amber);
}

.form-textarea { resize: vertical; min-height: 80px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.form-checkbox {
  width: 18px;
  height: 18px;
  accent-color: var(--amber);
  cursor: pointer;
}

.form-checkbox-label {
  font-size: 0.875rem;
  color: var(--cream-dim);
  cursor: pointer;
}

.save-btn {
  background: var(--amber);
  color: var(--charcoal);
  border: none;
  border-radius: 8px;
  padding: 0.875rem 2rem;
  font-family: var(--ff-body);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  width: 100%;
}

.save-btn:hover { background: #f59e0b; transform: translateY(-1px); }

.success-msg {
  background: rgba(16,185,129,0.1);
  border: 1px solid rgba(16,185,129,0.3);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  color: #6ee7b7;
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.error-msg {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  color: #fca5a5;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

/* ─── Recent Entries ─────────────────────────────── */
.recent-header {
  font-family: var(--ff-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--cream-dim);
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.8rem;
}

.entry-list { display: flex; flex-direction: column; gap: 0.5rem; }

.entry-row {
  background: var(--charcoal-light);
  border: 1px solid rgba(237,232,223,0.06);
  border-radius: 8px;
  padding: 0.875rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.entry-info { display: flex; flex-direction: column; gap: 0.2rem; }

.entry-project {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--cream);
}

.entry-client {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.entry-desc {
  font-size: 0.8rem;
  color: var(--cream-dim);
  margin-top: 0.25rem;
}

.entry-right {
  text-align: right;
  flex-shrink: 0;
}

.entry-hours {
  font-family: var(--ff-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--amber);
}

.entry-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* ─── Loading Spinner ────────────────────────────── */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: var(--charcoal);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Parse error ────────────────────────────────── */
.parse-error {
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.2);
  border-radius: 8px;
  padding: 1rem;
  color: #fca5a5;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

/* ─── FAB ───────────────────────────────────────────── */
.fab {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 100;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--amber);
  color: var(--charcoal);
  border: none;
  border-radius: 50px;
  padding: 0.875rem 1.25rem 0.875rem 1rem;
  font-family: var(--ff-body);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(217,119,6,0.45);
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
}

.fab:hover { background: #f59e0b; transform: translateY(-2px); box-shadow: 0 6px 28px rgba(217,119,6,0.55); }
.fab:active { transform: translateY(0); }

.fab-icon {
  font-size: 1.4rem;
  line-height: 1;
  margin-top: -1px;
}

/* ─── Mobile (≤768px) — /time-entry responsive layout ─── */
@media (max-width: 768px) {
  /* iOS zoom guard — inputs <16px trigger page zoom on focus */
  input, select, textarea, button { font-size: 16px; }

  /* Tighten nav + container so no horizontal scroll at 375px */
  .app-nav { padding: 1rem 1.25rem; }
  .app-container { padding: 1.5rem 1.25rem; }

  /* H1 was inline-sized (2rem); scale down for mobile via the new class */
  .page-title { font-size: 1.6rem; }

  /* Stack Hours + Date (was 1fr 1fr grid) */
  .form-row {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  /* Tap targets ≥44px — form fields */
  .form-input, .form-select, .form-textarea {
    padding: 1rem;
    font-size: 1rem;
  }
  .form-checkbox { width: 22px; height: 22px; }

  /* Tap targets — primary action buttons */
  .repeat-last-btn {
    padding: 1rem 1.5rem;
    font-size: 1rem;
  }
  .ai-submit-btn {
    padding: 1rem 1.4rem;
    font-size: 1rem;
  }
  .save-btn {
    padding: 1.1rem 1.5rem;
    font-size: 1rem;
  }

  /* AI parse input + button share a row on desktop — stack on mobile so
     the text input isn't cramped to ~120px */
  .ai-input-row { flex-direction: column; }

  /* Card padding was 2rem on desktop; 1.25rem reads cleaner on a phone */
  .ai-input-card, .prefill-card { padding: 1.25rem; }
}

/* Hide FAB label on very small screens to keep it compact */
@media (max-width: 360px) {
  .fab-label { display: none; }
  .fab { padding: 1rem; border-radius: 50%; }
}

/* ─── Quick-entry modal ──────────────────────────────── */
.quick-modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(28,25,23,0.75);
  z-index: 200;
}

.quick-modal-backdrop.is-open { display: block; }

.quick-modal {
  display: none;
  position: fixed;
  z-index: 201;
  background: var(--charcoal-light);
  border: 1px solid rgba(217,119,6,0.25);
  border-radius: 16px;
  padding: 1.75rem;
  width: min(480px, calc(100vw - 2rem));

  /* Desktop: centered */
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.quick-modal.is-open { display: block; }

/* Mobile: bottom sheet feel */
@media (max-width: 600px) {
  .quick-modal {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    transform: none;
    padding: 1.5rem 1.25rem calc(1.5rem + env(safe-area-inset-bottom));
  }
}

.quick-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.quick-modal-title {
  font-family: var(--ff-display);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--cream);
}

.quick-modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 0.25rem;
  transition: color 0.2s;
}

.quick-modal-close:hover { color: var(--cream); }

/* ─── Tour / Onboarding Walkthrough ─────────────────────────── */
.tour-root {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
}

.tour-spotlight {
  position: absolute;
  border-radius: 12px;
  box-shadow: 0 0 0 9999px rgba(11, 15, 20, 0.72);
  background: transparent;
  pointer-events: auto;
  transition: top 0.25s ease, left 0.25s ease, width 0.25s ease, height 0.25s ease;
}

.tour-tooltip {
  position: absolute;
  background: var(--charcoal-light);
  color: var(--cream);
  border: 1px solid rgba(217, 119, 6, 0.35);
  border-radius: 12px;
  padding: 1.25rem 1.25rem 1rem;
  width: min(320px, calc(100vw - 32px));
  max-width: 320px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
  pointer-events: auto;
  font-family: var(--ff-body);
  z-index: 10000;
  opacity: 0;
  animation: tour-fade-in 220ms ease-out forwards;
}

@keyframes tour-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.tour-tooltip-title {
  font-family: var(--ff-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--cream);
  margin-bottom: 0.5rem;
  line-height: 1.25;
}

.tour-tooltip-body {
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--cream-dim);
  margin-bottom: 0.85rem;
}

.tour-tooltip-progress {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.85rem;
}

.tour-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(237, 232, 223, 0.2);
  transition: background 0.2s ease;
}

.tour-dot.is-active {
  background: var(--amber);
}

.tour-tooltip-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.tour-skip,
.tour-prev,
.tour-next {
  font-family: var(--ff-body);
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 8px;
  padding: 0.55rem 1rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
  line-height: 1;
}

.tour-skip {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
  margin-right: auto;
}

.tour-skip:hover { color: var(--cream); }

.tour-prev {
  background: transparent;
  color: var(--cream-dim);
  border-color: rgba(237, 232, 223, 0.15);
}

.tour-prev:hover { color: var(--cream); border-color: rgba(237, 232, 223, 0.3); }

.tour-prev:disabled { opacity: 0.4; cursor: default; }

.tour-next {
  background: var(--amber);
  color: var(--charcoal);
  border-color: var(--amber);
}

.tour-next:hover { background: #f59e0b; border-color: #f59e0b; }

/* Mobile: bottom sheet, ignores tt-position variants */
@media (max-width: 640px) {
  .tour-tooltip.tt-sheet {
    left: 16px;
    right: 16px;
    bottom: 16px;
    top: auto;
    max-width: none;
    width: auto;
    border-radius: 16px;
    padding-bottom: calc(1rem + env(safe-area-inset-bottom));
  }
}

/* ─── Walkthrough (shareable sales demo) ───────────── */
.walkthrough-shell { background: var(--charcoal); }

.walkthrough-nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.walkthrough-nav-title {
  font-family: var(--ff-display);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--cream-dim);
  letter-spacing: 0.02em;
  flex: 1;
  text-align: center;
}

.walkthrough-nav-cta {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--amber);
  text-decoration: none;
  transition: color 0.2s;
}
.walkthrough-nav-cta:hover { color: var(--cream); }

.walkthrough-container {
  max-width: 1180px;
  padding: 3rem 2rem 5rem;
}

.walkthrough-intro {
  text-align: center;
  margin-bottom: 3rem;
}

.walkthrough-eyebrow {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 0.75rem;
}

.walkthrough-headline {
  font-family: var(--ff-display);
  font-size: clamp(1.8rem, 3.5vw, 2.6rem);
  font-weight: 700;
  color: var(--cream);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 auto 0.75rem;
  max-width: 720px;
}

.walkthrough-sub {
  color: var(--cream-dim);
  font-size: 0.95rem;
  max-width: 620px;
  margin: 0 auto;
}

.walkthrough-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(280px, 1fr));
  gap: 2rem;
  margin-bottom: 2.5rem;
}

@media (max-width: 900px) {
  .walkthrough-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

.walkthrough-frame {
  border: 1px solid rgba(217,119,6,0.15);
  border-radius: 12px;
  background: var(--charcoal-light);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.walkthrough-step-num {
  display: inline-flex;
  align-self: flex-start;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--amber);
  background: rgba(217,119,6,0.1);
  border: 1px solid rgba(217,119,6,0.25);
  padding: 0.3rem 0.75rem;
  border-radius: 100px;
}

.walkthrough-caption {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
  padding-top: 0.25rem;
}

/* Compact the in-app form components so they fit inside a 360px frame */
.walkthrough-frame .ai-input-card,
.walkthrough-frame .prefill-card {
  padding: 1rem;
  margin-bottom: 0;
  font-size: 0.875rem;
}

.walkthrough-frame .ai-input-card { border-color: rgba(217,119,6,0.18); }
.walkthrough-frame .prefill-card { border-color: rgba(217,119,6,0.25); }

.walkthrough-frame .ai-text-input,
.walkthrough-frame .form-input,
.walkthrough-frame .form-textarea,
.walkthrough-frame .form-select {
  padding: 0.6rem 0.75rem;
  font-size: 0.85rem;
}

.walkthrough-frame .form-textarea { min-height: 56px; }

.walkthrough-frame .prefill-header { margin-bottom: 1rem; gap: 0.4rem; }
.walkthrough-frame .prefill-title { font-size: 1rem; }
.walkthrough-frame .form-group { margin-bottom: 0.85rem; }
.walkthrough-frame .form-label { font-size: 0.7rem; margin-bottom: 0.3rem; }
.walkthrough-frame .form-row { gap: 0.75rem; }
.walkthrough-frame .save-btn { padding: 0.7rem 1rem; font-size: 0.85rem; }

.walkthrough-actions {
  display: flex;
  justify-content: center;
  margin-bottom: 3rem;
}

.walkthrough-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--charcoal);
  background: var(--amber);
  padding: 0.55rem 1.1rem;
  border-radius: 6px;
  text-decoration: none;
  transition: background 0.2s ease, transform 0.15s ease;
  box-shadow: 0 2px 12px rgba(217,119,6,0.3);
}
.walkthrough-cta:hover {
  background: #B45309;
  transform: translateY(-1px);
}

.walkthrough-live,
.walkthrough-email {
  background: var(--charcoal-light);
  border: 1px solid rgba(217,119,6,0.15);
  border-radius: 12px;
  padding: 1.75rem;
  margin-bottom: 1.5rem;
}

.walkthrough-section-label {
  font-family: var(--ff-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--cream);
  margin-bottom: 0.5rem;
}

.walkthrough-section-help {
  color: var(--cream-dim);
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.walkthrough-live-form {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.walkthrough-live-form .ai-text-input { flex: 1; }

.walkthrough-live-result {
  background: var(--charcoal);
  border: 1px solid var(--charcoal-lighter);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.8rem;
  color: var(--cream-dim);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 220px;
  overflow: auto;
  margin: 0;
}

.walkthrough-snippets {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.walkthrough-snippet {
  background: var(--charcoal);
  border: 1px solid var(--charcoal-lighter);
  border-radius: 8px;
  padding: 0.85rem 1rem;
}

.walkthrough-snippet-label {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 0.35rem;
}

.walkthrough-snippet-body {
  font-size: 0.875rem;
  color: var(--cream);
  line-height: 1.5;
}

.walkthrough-url {
  color: var(--amber);
  word-break: break-all;
}

.walkthrough-copy-btn {
  background: transparent;
  color: var(--cream);
  border: 1px solid rgba(237, 232, 223, 0.2);
  border-radius: 8px;
  padding: 0.55rem 1rem;
  font-family: var(--ff-body);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.walkthrough-copy-btn:hover { border-color: var(--amber); color: var(--amber); }

@media (max-width: 640px) {
  .walkthrough-container { padding: 2rem 1.25rem 4rem; }
  .walkthrough-frame { padding: 0.85rem; }
  .walkthrough-live-form { flex-direction: column; }
  .walkthrough-nav-title { font-size: 0.8rem; }
  .walkthrough-live, .walkthrough-email { padding: 1.25rem; }
}
