/* ---------- Design Tokens ---------- */
:root {
  --teal-50:  #f0fdfa;
  --teal-100: #ccfbf1;
  --teal-200: #99f6e4;
  --teal-500: #14b8a6;
  --teal-600: #0d9488;
  --teal-700: #0f766e;
  --teal-800: #115e59;

  --slate-50:  #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;

  --green-50:  #ecfdf5;
  --green-500: #10b981;
  --green-600: #059669;
  --green-700: #047857;

  --amber-50:  #fffbeb;
  --amber-500: #f59e0b;
  --amber-700: #b45309;

  --red-50:  #fef2f2;
  --red-500: #ef4444;
  --red-600: #dc2626;
  --red-700: #b91c1c;

  --blue-50: #eff6ff;
  --blue-600: #2563eb;
  --blue-700: #1d4ed8;

  --bg:          var(--slate-50);
  --surface:     #ffffff;
  --text:        var(--slate-900);
  --text-muted:  var(--slate-500);
  --border:      var(--slate-200);
  --primary:     var(--teal-600);
  --primary-hover: var(--teal-700);

  --radius-sm: 8px;
  --radius:    12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow:    0 2px 8px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.10);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.14);

  --safe-top:    env(safe-area-inset-top, 0);
  --safe-bottom: env(safe-area-inset-bottom, 0);

  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: contain;
}
#app { min-height: 100vh; }
button { font-family: inherit; }
input, textarea { font-family: inherit; }
a { color: var(--primary); text-decoration: none; }
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }

/* ---------- Shared ---------- */
.icon { width: 1.25em; height: 1.25em; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.icon-lg { width: 1.75em; height: 1.75em; }
.icon-xl { width: 2.5em; height: 2.5em; }

.page { min-height: 100vh; display: flex; flex-direction: column; padding-bottom: calc(96px + var(--safe-bottom)); }
.page.full { padding-bottom: var(--safe-bottom); }

.app-header {
  background: linear-gradient(135deg, var(--teal-700) 0%, var(--teal-600) 100%);
  color: white;
  padding: calc(20px + var(--safe-top)) 20px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow);
}
.app-header h1 { font-size: 20px; margin: 0; }
.app-header .subtitle { font-size: 13px; opacity: 0.85; margin-top: 2px; }
.header-main { flex: 1; min-width: 0; }
.header-btn {
  width: 42px; height: 42px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.16);
  border: 1px solid rgba(255,255,255,0.22);
  color: white;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.15s;
}
.header-btn:hover { background: rgba(255,255,255,0.26); }
.header-btn:active { transform: scale(0.95); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  padding: 14px 20px;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: transform 0.12s, background 0.15s, box-shadow 0.15s;
  min-height: 48px;
}
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 8px rgba(13, 148, 136, 0.25);
}
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-success { background: var(--green-600); color: white; box-shadow: 0 2px 8px rgba(5, 150, 105, 0.25); }
.btn-success:hover:not(:disabled) { background: var(--green-700); }
.btn-ghost { background: var(--slate-100); color: var(--slate-700); }
.btn-ghost:hover:not(:disabled) { background: var(--slate-200); }
.btn-danger { background: var(--red-500); color: white; }
.btn-block { width: 100%; }

.bottom-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  padding: 14px 16px calc(14px + var(--safe-bottom));
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.06);
  z-index: 50;
  display: flex;
  gap: 12px;
  align-items: center;
}

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}
.card-body { padding: 16px; }

/* ---------- States ---------- */
.state {
  padding: 60px 24px;
  text-align: center;
  color: var(--text-muted);
}
.state .state-icon {
  width: 56px; height: 56px;
  margin: 0 auto 16px;
  background: var(--teal-50);
  color: var(--teal-700);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.state p { margin: 4px 0; }

.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--slate-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  margin: 12px 16px;
}
.alert-error { background: var(--red-50); color: var(--red-700); border: 1px solid #fecaca; }
.alert-info  { background: var(--teal-50); color: var(--teal-800); border: 1px solid var(--teal-200); }

/* ---------- Toast ---------- */
.toast-host {
  position: fixed;
  left: 0; right: 0; bottom: calc(20px + var(--safe-bottom));
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none;
  z-index: 9999;
}
.toast {
  background: var(--slate-800);
  color: white;
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  max-width: calc(100% - 32px);
  animation: toast-in 0.2s ease-out;
}
.toast.toast-success { background: var(--green-600); }
.toast.toast-error { background: var(--red-600); }
@keyframes toast-in {
  from { transform: translateY(16px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 9998;
  padding: 20px;
  animation: fade-in 0.15s;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}
.modal h3 { margin-bottom: 8px; font-size: 18px; }
.modal p { color: var(--text-muted); margin: 0 0 16px; }
.modal-input {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 16px;
  margin-bottom: 16px;
}
.modal-input:focus { outline: none; border-color: var(--primary); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ---------- Login ---------- */
.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 24px;
  background:
    radial-gradient(ellipse at top, var(--teal-600) 0%, var(--teal-800) 70%);
  position: relative;
}
.login-page::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(255,255,255,0.06) 0, transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(255,255,255,0.05) 0, transparent 35%);
  pointer-events: none;
}
.login-hero {
  color: white;
  text-align: center;
  margin-bottom: 32px;
  z-index: 1;
}
.login-logo {
  width: 72px; height: 72px;
  background: white;
  color: var(--teal-700);
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
}
.login-hero h1 { font-size: 26px; margin-bottom: 4px; }
.login-hero p  { margin: 0; opacity: 0.85; font-size: 15px; }
.login-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  z-index: 1;
}
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--slate-700);
  margin-bottom: 6px;
}
.form-group input {
  width: 100%;
  padding: 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 16px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--teal-100);
}

/* ---------- Vehicle Select ---------- */
.date-picker-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.date-nav {
  width: 44px; height: 44px;
  border: none;
  background: var(--slate-100);
  color: var(--slate-700);
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}
.date-nav:active { background: var(--slate-200); }
.date-input {
  padding: 12px 16px;
  border: 2px solid var(--primary);
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  min-width: 180px;
  background: white;
  color: var(--slate-900);
}
.date-label {
  text-align: center;
  padding: 0 16px 10px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 13px;
}

.section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 16px 20px 8px;
}

.vehicle-list { padding: 0 16px 16px; display: flex; flex-direction: column; gap: 10px; }
.vehicle-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 2px solid transparent;
  border-radius: var(--radius);
  padding: 14px 16px;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: var(--shadow-sm);
  width: 100%;
}
.vehicle-card:hover:not(:disabled) { border-color: var(--teal-200); }
.vehicle-card:active:not(:disabled) { transform: scale(0.99); }
.vehicle-card.selected {
  background: var(--teal-50);
  border-color: var(--primary);
}
.vehicle-card.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.vehicle-avatar {
  width: 48px; height: 48px;
  border-radius: 12px;
  background: var(--teal-50);
  color: var(--teal-700);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.vehicle-card.selected .vehicle-avatar { background: var(--primary); color: white; }
.vehicle-info { flex: 1; min-width: 0; }
.vehicle-plate { font-size: 17px; font-weight: 700; color: var(--slate-900); }
.vehicle-count { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge-success { background: var(--green-50); color: var(--green-700); }
.badge-warning { background: var(--amber-50); color: var(--amber-700); }
.badge-info    { background: var(--teal-50); color: var(--teal-800); }
.badge-danger  { background: var(--red-50); color: var(--red-700); }

/* ---------- Tours list ---------- */
.stats-bar {
  display: flex;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.stat {
  flex: 1;
  padding: 18px 16px;
  text-align: center;
}
.stat + .stat { border-left: 1px solid var(--border); }
.stat-value {
  display: block;
  font-size: 28px;
  font-weight: 700;
  color: var(--amber-500);
  line-height: 1;
}
.stat.done .stat-value { color: var(--green-600); }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 6px; text-transform: uppercase; letter-spacing: 0.04em; }

.tours-list { padding: 12px 16px 0; display: flex; flex-direction: column; gap: 10px; }
.tour-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  gap: 12px;
  align-items: center;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.15s;
  border: 1px solid var(--border);
  position: relative;
}
.tour-card:hover { box-shadow: var(--shadow); }
.tour-card:active { transform: scale(0.99); }
.tour-card.completed { opacity: 0.6; }
.tour-card.dragging { opacity: 0.4; border: 2px dashed var(--primary); }

.drag-handle {
  color: var(--slate-300);
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  padding: 4px 2px;
  display: flex; flex-direction: column; gap: 3px;
}
.drag-handle span {
  width: 4px; height: 4px; border-radius: 50%;
  background: currentColor;
  display: block;
}

.tour-time {
  width: 56px; height: 56px;
  border-radius: var(--radius);
  background: var(--amber-50);
  color: var(--amber-700);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
  flex-shrink: 0;
}
.tour-card.completed .tour-time {
  background: var(--green-50);
  color: var(--green-600);
}
.tour-info { flex: 1; min-width: 0; }
.tour-customer { font-size: 13px; font-weight: 600; color: var(--primary); margin-bottom: 2px; }
.tour-address { font-size: 15px; font-weight: 600; color: var(--slate-900); }
.tour-meta { display: flex; align-items: center; gap: 6px; margin-top: 4px; flex-wrap: wrap; }
.tour-city { font-size: 13px; color: var(--text-muted); }
.tour-arrow { color: var(--slate-300); }

/* ---------- Tour Detail ---------- */
.detail-card {
  background: var(--surface);
  border-radius: var(--radius);
  margin: 16px;
  padding: 18px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}
.detail-customer { font-size: 20px; font-weight: 700; color: var(--slate-900); margin-bottom: 6px; }
.info-row {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--slate-100);
}
.info-row:last-of-type { border-bottom: none; }
.info-label {
  width: 92px;
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding-top: 2px;
}
.info-value { flex: 1; color: var(--slate-900); }
.phone-link { font-weight: 600; }

.product-tag {
  display: inline-block;
  background: var(--teal-50);
  color: var(--teal-800);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 13px;
  margin: 2px 4px 2px 0;
}

.status-strip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
}
.status-strip.pending   { background: var(--amber-50); color: var(--amber-700); }
.status-strip.started   { background: var(--teal-50); color: var(--teal-800); }
.status-strip.completed { background: var(--green-50); color: var(--green-700); }

.nav-card {
  margin: 0 16px 16px;
  padding: 18px;
  background: var(--surface);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  transition: transform 0.12s;
}
.nav-card:hover { border-color: var(--teal-200); }
.nav-card:active { transform: scale(0.99); }
.nav-icon {
  width: 48px; height: 48px;
  background: var(--teal-50);
  color: var(--teal-700);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
}
.nav-text-main { font-weight: 600; color: var(--slate-900); }
.nav-text-sub { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* Action tiles */
.action-list { margin: 0 16px 16px; display: flex; flex-direction: column; gap: 10px; }
.action-tile {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--slate-300);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  text-align: left;
  box-shadow: var(--shadow-sm);
  transition: transform 0.12s;
  width: 100%;
  color: var(--slate-900);
}
.action-tile:active { transform: scale(0.99); }
.action-tile.deliver  { border-left-color: var(--green-500); }
.action-tile.pickup   { border-left-color: var(--red-500); }
.action-tile.swap     { border-left-color: var(--blue-600); }
.action-tile.problem  { border-left-color: var(--amber-500); }
.tile-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.action-tile.deliver .tile-icon  { background: var(--green-50); color: var(--green-700); }
.action-tile.pickup .tile-icon   { background: var(--red-50); color: var(--red-700); }
.action-tile.swap .tile-icon     { background: var(--blue-50); color: var(--blue-700); }
.action-tile.problem .tile-icon  { background: var(--amber-50); color: var(--amber-700); }
.tile-body { flex: 1; min-width: 0; }
.tile-title { font-weight: 600; font-size: 15px; color: var(--slate-900); }
.tile-desc  { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.tile-thumbs { display: flex; gap: 4px; flex-shrink: 0; }
.tile-thumb {
  width: 38px; height: 38px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.photos-section { margin: 0 16px 16px; }
.photos-section h3 { font-size: 14px; color: var(--text-muted); margin-bottom: 10px; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.photos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px;
}
.photo-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--slate-100);
}
.photo-item img { width: 100%; height: 100%; object-fit: cover; }
.photo-type-label {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 4px 6px;
  background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
  color: white;
  font-size: 11px;
  text-align: center;
}

/* ---------- Location Select ---------- */
.location-page .app-header { background: linear-gradient(135deg, var(--teal-700) 0%, var(--green-600) 100%); }
.location-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px 16px;
}
.location-tile {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}
.location-tile:hover { border-color: var(--teal-200); }
.location-tile:active { transform: scale(0.99); }
.location-tile.selected {
  border-color: var(--primary);
  background: var(--teal-50);
  box-shadow: 0 0 0 4px var(--teal-100);
}
.location-pin {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--teal-50);
  color: var(--teal-700);
  display: inline-flex;
  align-items: center; justify-content: center;
  margin-bottom: 14px;
}
.location-tile.selected .location-pin { background: var(--primary); color: white; }
.location-name { font-size: 20px; font-weight: 700; color: var(--slate-900); margin-bottom: 4px; }
.location-address { font-size: 14px; color: var(--text-muted); }

/* ---------- Photo Capture ---------- */
.capture-page {
  min-height: 100vh;
  background: var(--slate-900);
  color: white;
  display: flex;
  flex-direction: column;
}
.capture-header {
  background: #000;
  color: white;
  padding: calc(14px + var(--safe-top)) 16px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.capture-header h1 { font-size: 18px; flex: 1; }
.capture-counter {
  background: var(--primary);
  color: white;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}
.capture-video-wrap { position: relative; background: #000; }
.capture-video { width: 100%; max-height: 55vh; display: block; object-fit: cover; }
.capture-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 28px;
  padding: 18px;
  background: rgba(0,0,0,0.9);
}
.shutter-btn {
  width: 68px; height: 68px;
  border-radius: 50%;
  background: white;
  border: 4px solid rgba(255,255,255,0.4);
  cursor: pointer;
  padding: 0;
  display: flex; align-items: center; justify-content: center;
}
.shutter-btn:active { transform: scale(0.95); }
.shutter-btn .shutter-inner {
  width: 52px; height: 52px; border-radius: 50%;
  background: white;
  border: 2px solid var(--slate-300);
}
.cam-btn {
  width: 48px; height: 48px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  color: white;
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.cam-btn.recording {
  background: var(--red-500);
  border-color: var(--red-500);
  animation: pulse 1s infinite;
}
@keyframes pulse { 0%,100% { transform: scale(1);} 50% { transform: scale(1.08);} }
.rec-indicator {
  position: absolute; top: 12px; right: 12px;
  background: var(--red-500); color: white;
  padding: 6px 14px; border-radius: 999px;
  font-weight: 700; font-size: 13px;
  display: inline-flex; align-items: center; gap: 6px;
}
.rec-indicator::before {
  content: ""; width: 8px; height: 8px; background: white; border-radius: 50%;
  animation: pulse 1s infinite;
}

.upload-drop {
  margin: 20px;
  background: #1f2937;
  border: 2px dashed #374151;
  border-radius: var(--radius-lg);
  padding: 40px 16px;
  text-align: center;
  color: #cbd5e1;
}
.upload-buttons { display: flex; gap: 12px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.upload-btn {
  background: #0f172a;
  border: 1px solid #334155;
  color: white;
  padding: 20px 22px;
  border-radius: var(--radius);
  cursor: pointer;
  min-width: 130px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}
.upload-btn:hover { background: #1e293b; }

.media-gallery { padding: 16px; background: #111827; }
.media-gallery h3 { color: white; font-size: 13px; margin-bottom: 10px; text-transform: uppercase; letter-spacing: 0.04em; }
.media-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.media-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
}
.media-item img, .media-item video { width: 100%; height: 100%; object-fit: cover; }
.media-badge {
  position: absolute;
  left: 4px; bottom: 4px;
  background: rgba(0,0,0,0.65);
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
}
.media-remove {
  position: absolute;
  top: 4px; right: 4px;
  width: 24px; height: 24px;
  background: rgba(239, 68, 68, 0.92);
  border: none; color: white;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}

.type-picker { padding: 16px; background: var(--slate-50); }
.type-picker h3 { color: var(--text-muted); font-size: 13px; text-transform: uppercase; margin-bottom: 10px; letter-spacing: 0.04em; }
.type-options { display: flex; flex-wrap: wrap; gap: 8px; }
.type-pill {
  background: white;
  border: 2px solid var(--border);
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 14px;
  cursor: pointer;
  color: var(--slate-700);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.type-pill.selected {
  border-color: var(--primary);
  background: var(--teal-50);
  color: var(--teal-800);
}
.notes-section { padding: 0 16px 16px; background: var(--slate-50); }
.notes-section h3 { color: var(--text-muted); font-size: 13px; text-transform: uppercase; margin-bottom: 10px; letter-spacing: 0.04em; }
.notes-section textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  resize: vertical;
  background: white;
}

/* ---------- Signature ---------- */
.sig-trigger {
  width: 100%;
  padding: 18px;
  background: var(--surface);
  border: 2px dashed var(--slate-300);
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--slate-600);
  font-weight: 600;
  font-size: 15px;
}
.sig-trigger:active { background: var(--slate-50); }

.sig-preview-card {
  background: var(--surface);
  border: 2px solid var(--green-500);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
}
.sig-preview-img { width: 100%; height: 80px; object-fit: contain; background: var(--slate-50); }
.sig-preview-label {
  padding: 8px 12px;
  background: var(--green-50);
  color: var(--green-700);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}

.sig-fullscreen {
  position: fixed; inset: 0;
  z-index: 9999;
  background: white;
  display: flex;
  flex-direction: column;
}
.sig-fs-header {
  background: var(--slate-800);
  color: white;
  padding: calc(14px + var(--safe-top)) 16px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.sig-fs-header .sig-title { font-size: 16px; font-weight: 700; }
.sig-fs-btn {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.22);
  color: white;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}
.sig-fs-btn.round { width: 40px; height: 40px; border-radius: 50%; padding: 0; display: flex; align-items: center; justify-content: center; }
.sig-hint { text-align: center; padding: 10px; color: var(--text-muted); font-size: 14px; }
.sig-canvas-area {
  flex: 1;
  margin: 0 16px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  touch-action: none;
  min-height: 0;
  background: white;
}
.sig-canvas-area canvas { display: block; width: 100%; height: 100%; }
.sig-fs-footer {
  display: flex; gap: 10px;
  padding: 16px calc(16px + var(--safe-bottom)) calc(16px + var(--safe-bottom));
  flex-shrink: 0;
  border-top: 1px solid var(--border);
}
