/* main.css — Macaron mobile-first PWA styles */

/* ══════════════════════════════════════════════
   CSS CUSTOM PROPERTIES
═══════════════════════════════════════════════ */
:root {
  --navy:       #1B2B4F;
  --copper:     #B87333;
  --copper-dark:#9A6229;
  --cream:      #F5F3F0;
  --charcoal:   #3A3A3A;
  --white:      #FFFFFF;
  --gray:       #8A8A8A;
  --light-gray: #E8E6E3;
  --green:      #2E7D32;
  --amber:      #F57C00;
  --red:        #C62828;
  --radius:     12px;
  --shadow:     0 2px 8px rgba(0,0,0,0.12);

  /* Layout */
  --topbar-h:   56px;
  --bottomnav-h:64px;
  --capture-btn-size: 56px;
}

/* ══════════════════════════════════════════════
   RESET & BASE
═══════════════════════════════════════════════ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  height: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI',
               Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--charcoal);
  background: var(--cream);
  min-height: 100%;
  /* iOS safe area */
  padding-bottom: env(safe-area-inset-bottom);
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font: inherit;
}

input, select, textarea {
  font: inherit;
  font-size: 16px; /* prevent iOS zoom */
  color: inherit;
}

img { display: block; max-width: 100%; }

/* ══════════════════════════════════════════════
   LAYOUT WRAPPER
═══════════════════════════════════════════════ */
#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ══════════════════════════════════════════════
   TOP BAR
═══════════════════════════════════════════════ */
#topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-h);
  background: var(--navy);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  padding-top: env(safe-area-inset-top);
  z-index: 100;
  box-shadow: var(--shadow);
}

.topbar-brand {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--white);
}

.topbar-brand span {
  color: var(--copper);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

#topbar-user-name {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.75);
}

/* ══════════════════════════════════════════════
   OFFLINE BANNER
═══════════════════════════════════════════════ */
#offline-banner {
  position: fixed;
  top: var(--topbar-h);
  left: 0;
  right: 0;
  background: var(--amber);
  color: var(--white);
  font-size: 0.82rem;
  font-weight: 500;
  text-align: center;
  padding: 6px 16px;
  z-index: 99;
  transform: translateY(-100%);
  transition: transform 0.25s ease;
}

#offline-banner.visible {
  transform: translateY(0);
}

/* ══════════════════════════════════════════════
   SCREENS
═══════════════════════════════════════════════ */
.screen {
  display: none;
  position: fixed;
  inset: 0;
  padding-top: calc(var(--topbar-h) + env(safe-area-inset-top));
  padding-bottom: calc(var(--bottomnav-h) + env(safe-area-inset-bottom));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--cream);
}

.screen.active {
  display: block;
}

/* Login screen — no topbar offset needed */
#screen-login {
  padding-top: 0;
  padding-bottom: 0;
  display: none;
  align-items: center;
  justify-content: center;
}

#screen-login.active {
  display: flex;
  flex-direction: column;
}

/* ══════════════════════════════════════════════
   LOGIN SCREEN
═══════════════════════════════════════════════ */
.login-wrap {
  width: 100%;
  max-width: 380px;
  margin: auto;
  padding: 32px 24px;
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: 0.04em;
}

.login-logo h1 span {
  color: var(--copper);
}

.login-logo p {
  font-size: 0.85rem;
  color: var(--gray);
  margin-top: 4px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--charcoal);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid var(--light-gray);
  border-radius: var(--radius);
  background: var(--white);
  font-size: 16px;
  transition: border-color 0.15s;
  min-height: 48px;
}

.form-input:focus {
  outline: none;
  border-color: var(--copper);
}

.form-input.input-error {
  border-color: var(--red);
}

.field-error {
  font-size: 0.78rem;
  color: var(--red);
  margin-top: 4px;
}

#login-error {
  background: #fdecea;
  color: var(--red);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.85rem;
  margin-bottom: 16px;
}

/* ══════════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  min-height: 48px;
  transition: background 0.15s, opacity 0.15s;
  cursor: pointer;
}

.btn-primary {
  background: var(--copper);
  color: var(--white);
  width: 100%;
}

.btn-primary:hover  { background: var(--copper-dark); }
.btn-primary:active { opacity: 0.85; }
.btn-primary.btn-loading { opacity: 0.7; }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-secondary {
  background: var(--navy);
  color: var(--white);
}

.btn-secondary:hover { opacity: 0.85; }

.btn-ghost {
  background: transparent;
  color: var(--navy);
  padding: 10px 16px;
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--navy);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 10px 16px 10px 12px;
  border-radius: 8px;
  transition: background 0.15s;
}

.btn-back:hover { background: var(--light-gray); }

.btn-danger {
  background: var(--red);
  color: var(--white);
}

/* Spinner on button */
.spinner-sm {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* ══════════════════════════════════════════════
   HOME SCREEN
═══════════════════════════════════════════════ */
.home-wrap {
  padding: 16px;
}

/* Month summary card */
.month-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
}

.month-card-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gray);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 16px;
}

.month-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

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

.month-stat-label {
  font-size: 0.75rem;
  color: var(--gray);
  margin-bottom: 4px;
}

.month-stat-value {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--navy);
}

/* Recent activity */
.section-header {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gray);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}

.activity-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: transform 0.1s;
}

.activity-card:active { transform: scale(0.98); }

.activity-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.activity-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
}

.activity-info { min-width: 0; }

.activity-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--charcoal);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.activity-date {
  font-size: 0.75rem;
  color: var(--gray);
  margin-top: 2px;
}

.activity-status { flex-shrink: 0; }

.empty-text {
  text-align: center;
  color: var(--gray);
  font-size: 0.9rem;
  padding: 24px 0;
}

/* ══════════════════════════════════════════════
   BOTTOM NAVIGATION
═══════════════════════════════════════════════ */
#bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottomnav-h);
  background: var(--white);
  border-top: 1px solid var(--light-gray);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 100;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 12px;
  min-width: 48px;
  min-height: 48px;
  justify-content: center;
  color: var(--gray);
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  position: relative;
  cursor: pointer;
  border: none;
  background: none;
  transition: color 0.15s;
}

.nav-item.active { color: var(--copper); }

.nav-item.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 2.5px;
  background: var(--copper);
  border-radius: 2px;
}

.nav-icon {
  font-size: 1.3rem;
  line-height: 1;
}

/* Big + capture button in center */
.nav-capture-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 24px; /* lifts button above nav bar */
}

#nav-capture-btn {
  width:  var(--capture-btn-size);
  height: var(--capture-btn-size);
  border-radius: 50%;
  background: var(--copper);
  color: var(--white);
  font-size: 1.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(184,115,51,0.45);
  transition: background 0.15s, transform 0.1s;
  border: none;
  cursor: pointer;
}

#nav-capture-btn:hover  { background: var(--copper-dark); }
#nav-capture-btn:active { transform: scale(0.93); }

.nav-capture-label {
  font-size: 0.62rem;
  font-weight: 500;
  color: var(--copper);
  margin-top: 2px;
}

/* ══════════════════════════════════════════════
   CAPTURE MODAL — BOTTOM SHEET
═══════════════════════════════════════════════ */
#capture-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
}

#capture-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.45);
  animation: fadeIn 0.2s ease;
}

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

#capture-sheet {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--white);
  border-radius: 20px 20px 0 0;
  max-height: 92vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
  padding-bottom: env(safe-area-inset-bottom);
}

#capture-sheet.sheet-open {
  transform: translateY(0);
}

#capture-handle {
  width: 40px;
  height: 4px;
  background: var(--light-gray);
  border-radius: 2px;
  margin: 12px auto 4px;
  cursor: grab;
}

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

.capture-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--navy);
}

.capture-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--light-gray);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: var(--gray);
  border: none;
  cursor: pointer;
}

/* Step containers */
.capture-step {
  padding: 20px;
}

/* Step 1: type buttons */
.capture-type-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 8px;
}

.capture-type-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px 12px;
  background: var(--cream);
  border: 2px solid var(--light-gray);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  min-height: 100px;
}

.capture-type-btn:active,
.capture-type-btn.selected {
  border-color: var(--copper);
  background: #fdf5ef;
}

.capture-type-icon { font-size: 2rem; }

.capture-type-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--navy);
}

/* Step 2: source buttons */
.capture-source-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

.capture-source-btn {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--cream);
  border: 1.5px solid var(--light-gray);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
  color: var(--charcoal);
  transition: border-color 0.15s;
  min-height: 64px;
}

.capture-source-btn:hover  { border-color: var(--copper); }
.capture-source-btn:active { background: #fdf5ef; }
.capture-source-icon { font-size: 1.5rem; }

/* Step 3: details form */
#capture-thumbnail {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  border-radius: 10px;
  margin-bottom: 12px;
}

.ocr-notice {
  font-size: 0.82rem;
  color: var(--gray);
  margin-bottom: 12px;
  min-height: 1.2em;
}

.ocr-notice-warn  { color: var(--amber); }
.ocr-notice-error { color: var(--red); }
.ocr-notice-ok    { color: var(--green); }

.capture-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.capture-actions .btn {
  flex: 1;
}

/* ══════════════════════════════════════════════
   LIST SCREEN
═══════════════════════════════════════════════ */
.list-wrap {
  padding: 0 0 16px;
}

.list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  gap: 10px;
}

.list-toolbar-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--navy);
}

#filter-toggle-btn {
  padding: 8px 14px;
  background: var(--white);
  border: 1.5px solid var(--light-gray);
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--charcoal);
  cursor: pointer;
  transition: border-color 0.15s;
  min-height: 36px;
}

#filter-toggle-btn:hover { border-color: var(--copper); }

/* Filter panel */
#filter-panel {
  background: var(--white);
  border-bottom: 1px solid var(--light-gray);
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.25s ease;
  padding: 0 16px;
}

#filter-panel.filter-panel-open {
  max-height: 400px;
  padding: 16px;
}

.filter-section-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gray);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.filter-type-chip,
.filter-status-chip {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1.5px solid var(--light-gray);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  background: var(--white);
  color: var(--charcoal);
  transition: border-color 0.12s, background 0.12s;
  min-height: 36px;
}

.filter-type-chip.chip-active,
.filter-status-chip.chip-active {
  background: var(--navy);
  color: var(--white);
  border-color: var(--navy);
}

.filter-date-row {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.filter-date-row input {
  flex: 1;
  padding: 10px 12px;
  border: 1.5px solid var(--light-gray);
  border-radius: 8px;
  font-size: 14px;
  min-height: 44px;
}

/* Admin toggle */
#all-users-wrapper {
  padding: 0 16px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

#all-users-wrapper label {
  font-size: 0.85rem;
  color: var(--charcoal);
  cursor: pointer;
}

/* List cards */
#captures-list {
  padding: 0 16px;
}

.list-card {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  margin-bottom: 10px;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.2s ease;
}

.list-card.swiped {
  transform: translateX(-80px);
}

.list-card-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.list-card-icon { font-size: 1.4rem; flex-shrink: 0; }

.list-card-info { min-width: 0; }

.list-card-title {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--charcoal);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-card-sub {
  font-size: 0.75rem;
  color: var(--gray);
  margin-top: 2px;
}

.list-card-right { flex-shrink: 0; }

/* Swipe-delete button */
.swipe-delete-btn {
  position: absolute;
  right: -80px;
  top: 0;
  bottom: 0;
  width: 80px;
  background: var(--red);
  color: var(--white);
  font-size: 0.82rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: right 0.2s ease;
}

.list-card.swiped .swipe-delete-btn { right: 0; }

/* Empty state */
#list-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--gray);
}

#list-empty p {
  margin-bottom: 16px;
  font-size: 0.95rem;
}

/* Pull-to-refresh */
#pull-refresh-indicator {
  text-align: center;
  padding: 10px;
  color: var(--copper);
  font-size: 0.82rem;
  font-weight: 500;
  transform: translateY(-40px);
  transition: transform 0.25s;
}

#pull-refresh-indicator.ptr-visible {
  transform: translateY(0);
}

/* ══════════════════════════════════════════════
   DETAIL SCREEN
═══════════════════════════════════════════════ */
.detail-wrap {
  padding: 8px 0 24px;
}

.detail-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--navy);
  padding: 8px 16px;
}

.detail-status {
  padding: 4px 16px 16px;
}

.detail-fields {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin: 0 16px;
  overflow: hidden;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 14px 16px;
  border-bottom: 1px solid var(--light-gray);
  gap: 12px;
}

.detail-row:last-child { border-bottom: none; }

.detail-label {
  font-size: 0.82rem;
  color: var(--gray);
  flex-shrink: 0;
  min-width: 90px;
}

.detail-value {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--charcoal);
  text-align: right;
}

/* ══════════════════════════════════════════════
   MILEAGE SCREEN
═══════════════════════════════════════════════ */
.mileage-wrap {
  padding: 16px;
}

.mileage-wrap h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 20px;
}

.mileage-distance-wrap {
  text-align: center;
  margin-bottom: 4px;
}

#mileage-distance {
  width: 100%;
  text-align: center;
  font-size: 3rem;
  font-weight: 700;
  color: var(--navy);
  border: none;
  border-bottom: 2px solid var(--light-gray);
  border-radius: 0;
  background: transparent;
  padding: 8px 0;
  transition: border-color 0.15s;
}

#mileage-distance:focus {
  outline: none;
  border-bottom-color: var(--copper);
}

.mileage-unit {
  font-size: 1rem;
  color: var(--gray);
  text-align: center;
  margin-bottom: 4px;
}

#mileage-reimbursement {
  text-align: center;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--copper);
  margin-bottom: 20px;
  min-height: 1.5em;
}

#mileage-ytd {
  text-align: center;
  font-size: 0.75rem;
  color: var(--gray);
  margin-bottom: 24px;
}

.odometer-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-top: 1px solid var(--light-gray);
  margin-bottom: 12px;
}

.odometer-toggle-label {
  font-size: 0.9rem;
  color: var(--charcoal);
}

/* iOS-style toggle switch */
.toggle-switch {
  position: relative;
  width: 44px;
  height: 26px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-switch-track {
  position: absolute;
  inset: 0;
  background: var(--light-gray);
  border-radius: 13px;
  cursor: pointer;
  transition: background 0.2s;
}

.toggle-switch input:checked + .toggle-switch-track {
  background: var(--copper);
}

.toggle-switch-track::after {
  content: '';
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--white);
  top: 2px;
  left: 2px;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .toggle-switch-track::after {
  transform: translateX(18px);
}

#mileage-odometer-section {
  margin-bottom: 16px;
}

.odo-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ══════════════════════════════════════════════
   SETTINGS SCREEN
═══════════════════════════════════════════════ */
.settings-wrap {
  padding: 16px;
}

.settings-wrap h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 20px;
}

.settings-section {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  overflow: hidden;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--light-gray);
  gap: 12px;
}

.settings-row:last-child { border-bottom: none; }

.settings-row-label {
  font-size: 0.9rem;
  color: var(--charcoal);
  font-weight: 500;
}

.settings-row-sub {
  font-size: 0.75rem;
  color: var(--gray);
  margin-top: 2px;
}

/* ══════════════════════════════════════════════
   STATUS PILLS
═══════════════════════════════════════════════ */
.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.pill-pending  { background: #E8E6E3; color: var(--gray);    }
.pill-reviewed { background: #E3F0FF; color: #1565C0;        }
.pill-synced   { background: #E8F5E9; color: var(--green);   }
.pill-failed   { background: #FFEBEE; color: var(--red);     }

/* ══════════════════════════════════════════════
   SKELETON LOADING
═══════════════════════════════════════════════ */
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position:  400px 0; }
}

.skeleton-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
}

.skeleton-line {
  height: 14px;
  border-radius: 7px;
  margin-bottom: 10px;
  background: linear-gradient(
    90deg,
    var(--light-gray) 25%,
    #f0eeeb 50%,
    var(--light-gray) 75%
  );
  background-size: 800px 100%;
  animation: shimmer 1.4s infinite;
}

.skeleton-line-short  { width: 40%; }
.skeleton-line-medium { width: 65%; margin-bottom: 0; }

/* ══════════════════════════════════════════════
   TOAST NOTIFICATIONS
═══════════════════════════════════════════════ */
#toast-container {
  position: fixed;
  bottom: calc(var(--bottomnav-h) + 12px + env(safe-area-inset-bottom));
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--white);
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.2s, transform 0.2s;
  max-width: 280px;
  pointer-events: auto;
}

.toast.toast-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast-success { background: var(--green); }
.toast-error   { background: var(--red); }
.toast-warning { background: var(--amber); }
.toast-info    { background: var(--navy); }

/* ══════════════════════════════════════════════
   REVIEW QUEUE SCREEN
═══════════════════════════════════════════════ */
.review-wrap {
  padding: 16px;
}

.review-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.review-header h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--navy);
}

#review-pending-count {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gray);
  background: var(--light-gray);
  padding: 3px 10px;
  border-radius: 20px;
}

/* Filter chips row */
.review-filter-row {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.review-filter-chip {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1.5px solid var(--light-gray);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  background: var(--white);
  color: var(--charcoal);
  transition: border-color 0.12s, background 0.12s;
  min-height: 36px;
}

.review-filter-chip.chip-active {
  background: var(--navy);
  color: var(--white);
  border-color: var(--navy);
}

/* Review cards */
.review-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 14px;
  overflow: hidden;
  transition: opacity 0.25s ease;
}

.review-card-removing {
  opacity: 0;
}

.review-card-top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px 10px;
  cursor: pointer;
}

.review-card-info {
  flex: 1;
  min-width: 0;
}

.review-card-vendor {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--charcoal);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.review-card-meta {
  font-size: 0.8rem;
  color: var(--charcoal);
  margin-top: 2px;
}

.review-card-by {
  font-size: 0.72rem;
  color: var(--gray);
  margin-top: 1px;
}

.review-card-thumb {
  width: 100%;
  max-height: 160px;
  object-fit: cover;
}

/* Review action buttons */
.review-actions {
  display: flex;
  gap: 8px;
  padding: 10px 14px 14px;
  border-top: 1px solid var(--light-gray);
}

.review-btn {
  flex: 1;
  padding: 10px 12px;
  font-size: 0.85rem;
  min-height: 40px;
}

.btn-approve {
  background: var(--copper);
  color: var(--white);
}

.btn-approve:hover  { background: var(--copper-dark); }
.btn-approve:active { opacity: 0.85; }
.btn-approve:disabled { opacity: 0.6; cursor: not-allowed; }

/* Empty state for review queue */
.review-empty {
  text-align: center;
  color: var(--gray);
  font-size: 0.95rem;
  padding: 48px 24px;
}

/* Review nav badge */
.review-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: var(--red);
  color: var(--white);
  font-size: 0.6rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  line-height: 1;
}

/* ══════════════════════════════════════════════
   REVIEW DETAIL SCREEN
═══════════════════════════════════════════════ */
.review-detail-wrap {
  padding-bottom: 80px; /* space for fixed action bar */
}

#review-detail-image {
  width: 100%;
  max-height: 260px;
  object-fit: cover;
}

.review-detail-fields {
  padding: 16px;
}

.review-detail-section-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gray);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
  margin-top: 18px;
}

.review-detail-section-label:first-child {
  margin-top: 0;
}

/* Editable fields in detail */
.detail-editable {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 4px;
}

.detail-editable .form-group {
  margin: 0;
  border-bottom: 1px solid var(--light-gray);
  padding: 0;
}

.detail-editable .form-group:last-child {
  border-bottom: none;
}

.detail-editable label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--gray);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 16px 0;
}

.detail-editable .form-input {
  border: none;
  border-radius: 0;
  padding: 6px 16px 12px;
  box-shadow: none;
  background: transparent;
  min-height: 40px;
}

.detail-editable .form-input:focus {
  border-color: transparent;
  background: #fdf5ef;
}

/* QB mapping section */
.qb-mapping-section {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.qb-mapping-section .form-group {
  margin: 0;
  border-bottom: 1px solid var(--light-gray);
  padding: 0;
}

.qb-mapping-section .form-group:last-child {
  border-bottom: none;
}

.qb-mapping-section label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--gray);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 16px 0;
}

.qb-mapping-section .form-input {
  border: none;
  border-radius: 0;
  padding: 6px 16px 12px;
  box-shadow: none;
  background: transparent;
  min-height: 40px;
}

/* Fixed bottom action bar for review detail */
.review-detail-action-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  gap: 8px;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  background: var(--white);
  border-top: 1px solid var(--light-gray);
  box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
  z-index: 50;
}

.review-detail-action-bar .btn {
  flex: 1;
  padding: 12px 8px;
  font-size: 0.85rem;
  min-height: 44px;
}

/* ══════════════════════════════════════════════
   REJECT MODAL
═══════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 300;
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: env(safe-area-inset-bottom);
}
.modal-overlay.modal-visible {
  display: flex;
}

.modal-content {
  background: var(--white);
  border-radius: 20px 20px 0 0;
  padding: 28px 24px 24px;
  width: 100%;
  max-width: 520px;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.14);
}

.modal-content h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 16px;
}

.modal-content select,
.modal-content textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--light-gray);
  border-radius: var(--radius);
  font-size: 16px;
  background: var(--cream);
  color: var(--charcoal);
  margin-bottom: 12px;
}

.modal-content select:focus,
.modal-content textarea:focus {
  outline: none;
  border-color: var(--copper);
}

.modal-content textarea {
  resize: vertical;
  min-height: 72px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.modal-actions .btn {
  flex: 1;
}

/* btn-danger already exists in the CSS; ensure it's full width here */
.modal-actions .btn-danger {
  width: 100%;
}

/* ══════════════════════════════════════════════
   QB SETTINGS SECTION
═══════════════════════════════════════════════ */
.qb-settings-section {
  margin-top: 8px;
}

.settings-section-header {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gray);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
  padding: 0 2px;
}

.qb-status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.qb-company-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--navy);
  flex: 1;
}

.qb-token-expiry {
  font-size: 0.72rem;
  color: var(--gray);
}

.qb-sync-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.qb-sync-row .btn {
  flex: 1;
  min-width: 120px;
  padding: 10px 12px;
  font-size: 0.82rem;
  min-height: 40px;
}

/* Category mapping table */
.category-mapping-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}

.category-mapping-table thead tr {
  background: var(--cream);
}

.category-mapping-table th {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--gray);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 10px 16px;
  text-align: left;
  border-bottom: 1px solid var(--light-gray);
}

.mapping-td {
  padding: 8px 16px;
  font-size: 0.85rem;
  color: var(--charcoal);
  border-bottom: 1px solid var(--light-gray);
  vertical-align: middle;
}

.category-mapping-table tbody tr:last-child .mapping-td {
  border-bottom: none;
}

.mapping-input {
  padding: 8px 10px;
  min-height: 36px;
  font-size: 0.85rem;
}

/* Status pill colours for reviewed / synced / failed (Phase 2 additions) */
.pill-reviewed { background: #DBEAFE; color: #1D4ED8; }
.pill-synced   { background: #DCFCE7; color: #15803D; }
.pill-failed   { background: #FEE2E2; color: #B91C1C; }

/* ══════════════════════════════════════════════
   PRINT STYLES
═══════════════════════════════════════════════ */
@media print {
  #topbar,
  #bottom-nav,
  #capture-modal,
  #toast-container,
  #offline-banner { display: none !important; }

  .screen {
    position: static;
    padding: 0;
    overflow: visible;
    display: block;
  }

  body { background: white; }
}

/* ══════════════════════════════════════════════
   UTILITY
═══════════════════════════════════════════════ */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
