/* TravisOS Mobile - Design System */
:root {
  /* Colors */
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-card: #1e293b;
  --bg-card-hover: #253349;
  --bg-input: #0f172a;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border: #334155;
  --accent: #3b82f6;
  --accent-hover: #2563eb;

  /* Urgency colors */
  --urgency-critical: #ef4444;
  --urgency-high: #f59e0b;
  --urgency-medium: #3b82f6;
  --urgency-low: #6b7280;
  --urgency-none: #374151;

  /* Status colors */
  --status-pending: #f59e0b;
  --status-in-progress: #3b82f6;
  --status-waiting: #8b5cf6;
  --status-resolved: #22c55e;
  --status-expired: #6b7280;
  --status-cancelled: #6b7280;

  /* Business tag colors */
  --biz-sentinel_room: #8b5cf6;
  --biz-marinello: #a855f7;
  --biz-cocktail_co: #d946ef;
  --biz-ice_foundry: #06b6d4;
  --biz-trekka: #3b82f6;
  --biz-starfleet: #f59e0b;
  --biz-real_estate: #22c55e;
  --biz-beacon_point: #ef4444;
  --biz-personal: #6b7280;
  --biz-unassigned: #374151;

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

  /* Safe areas */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --nav-height: 64px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', system-ui, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* App Shell */
#app {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  min-height: 52px;
  flex-shrink: 0;
}

.app-header h1 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.header-actions {
  display: flex;
  gap: var(--space-sm);
}

/* Screen Content */
.screen-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(var(--nav-height) + var(--safe-bottom));
}

/* Bottom Nav */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding-bottom: var(--safe-bottom);
  z-index: 100;
  height: calc(var(--nav-height) + var(--safe-bottom));
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-sm) 0;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.nav-item.active { color: var(--accent); }
.nav-item svg { width: 22px; height: 22px; margin-bottom: 2px; }

.nav-badge {
  position: absolute;
  top: 4px;
  right: calc(50% - 18px);
  background: var(--urgency-critical);
  color: white;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* Decision Card */
.decision-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: var(--space-lg);
  margin: var(--space-sm) var(--space-lg);
  cursor: pointer;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.decision-card:hover { background: var(--bg-card-hover); }
.decision-card:active { background: var(--bg-card-hover); }

.decision-card.overdue {
  border-left: 3px solid var(--urgency-critical);
}

.card-top {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.biz-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.urgency-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.urgency-dot.critical { background: var(--urgency-critical); animation: pulse 2s infinite; }
.urgency-dot.high { background: var(--urgency-high); }
.urgency-dot.medium { background: var(--urgency-medium); }
.urgency-dot.low { background: var(--urgency-low); }
.urgency-dot.none { background: var(--urgency-none); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.card-time {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.card-time.overdue { color: var(--urgency-critical); font-weight: 600; }

.card-summary {
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}

.card-action {
  font-size: 12px;
  color: var(--text-secondary);
}

.card-action::before {
  content: '\2192 ';
  color: var(--accent);
}

.card-meta {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
  font-size: 11px;
  color: var(--text-muted);
}

.status-pill {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 3px;
  font-weight: 500;
}

.status-pill.pending { background: rgba(245,158,11,0.15); color: var(--status-pending); }
.status-pill.in_progress { background: rgba(59,130,246,0.15); color: var(--status-in-progress); }
.status-pill.waiting { background: rgba(139,92,246,0.15); color: var(--status-waiting); }
.status-pill.resolved { background: rgba(34,197,94,0.15); color: var(--status-resolved); }

/* Section headers */
.section-header {
  padding: var(--space-md) var(--space-lg) var(--space-xs);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

/* Filter bar */
.filter-bar {
  display: flex;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex-shrink: 0;
}

.filter-bar::-webkit-scrollbar { display: none; }

.filter-chip {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: all 0.15s;
}

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

/* Search bar */
.search-bar {
  padding: var(--space-sm) var(--space-lg);
}

.search-input {
  width: 100%;
  padding: 10px 14px 10px 36px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}

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

.search-wrapper {
  position: relative;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 16px;
  height: 16px;
}

/* Detail screen */
.detail-header {
  padding: var(--space-lg);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}

.detail-back {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--accent);
  font-size: 14px;
  cursor: pointer;
  margin-bottom: var(--space-md);
  background: none;
  border: none;
  -webkit-tap-highlight-color: transparent;
}

.detail-summary {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: var(--space-md);
}

.detail-meta-row {
  display: flex;
  gap: var(--space-lg);
  flex-wrap: wrap;
}

.detail-meta-item {
  font-size: 13px;
  color: var(--text-secondary);
}

.detail-meta-item strong {
  color: var(--text-primary);
  font-weight: 500;
}

/* Action buttons */
.action-bar {
  display: flex;
  gap: var(--space-sm);
  padding: var(--space-lg);
  flex-wrap: wrap;
}

.action-btn {
  flex: 1;
  min-width: 0;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.15s;
  text-align: center;
}

.action-btn:active { opacity: 0.7; }

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

.action-btn.secondary {
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.action-btn.danger {
  background: rgba(239,68,68,0.1);
  color: var(--urgency-critical);
  border: 1px solid rgba(239,68,68,0.3);
}

.action-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Approval badge */
.approval-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--urgency-critical);
}

/* Timeline */
.timeline {
  padding: var(--space-lg);
}

.timeline-item {
  display: flex;
  gap: var(--space-md);
  padding-bottom: var(--space-lg);
  position: relative;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 14px;
  bottom: 0;
  width: 1px;
  background: var(--border);
}

.timeline-item:last-child::before { display: none; }

.timeline-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  margin-top: 4px;
}

.timeline-content {
  flex: 1;
}

.timeline-text {
  font-size: 13px;
  color: var(--text-primary);
}

.timeline-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Login screen */
.login-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: var(--space-2xl);
}

.login-title {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: var(--space-xs);
  letter-spacing: -0.03em;
}

.login-subtitle {
  color: var(--text-secondary);
  margin-bottom: var(--space-2xl);
  font-size: 14px;
}

.login-form {
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.login-form input {
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 15px;
  outline: none;
}

.login-form input:focus { border-color: var(--accent); }

.login-btn {
  padding: 14px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  margin-top: var(--space-sm);
}

.login-error {
  color: var(--urgency-critical);
  font-size: 13px;
  text-align: center;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: var(--space-2xl) var(--space-lg);
  color: var(--text-muted);
}

.empty-state svg { width: 48px; height: 48px; margin-bottom: var(--space-md); opacity: 0.3; }
.empty-state p { font-size: 14px; }

/* Loading */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl);
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Utility: business tag color */
.biz-sentinel_room { background: rgba(139,92,246,0.15); color: var(--biz-sentinel_room); }
.biz-marinello { background: rgba(168,85,247,0.15); color: var(--biz-marinello); }
.biz-cocktail_co { background: rgba(217,70,239,0.15); color: var(--biz-cocktail_co); }
.biz-ice_foundry { background: rgba(6,182,212,0.15); color: var(--biz-ice_foundry); }
.biz-trekka { background: rgba(59,130,246,0.15); color: var(--biz-trekka); }
.biz-starfleet { background: rgba(245,158,11,0.15); color: var(--biz-starfleet); }
.biz-real_estate { background: rgba(34,197,94,0.15); color: var(--biz-real_estate); }
.biz-beacon_point { background: rgba(239,68,68,0.15); color: var(--biz-beacon_point); }
.biz-personal { background: rgba(107,114,128,0.15); color: var(--biz-personal); }
.biz-unassigned { background: rgba(55,65,81,0.15); color: var(--biz-unassigned); }

/* Capture screen */
.capture-form {
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: var(--space-sm);
}

.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  outline: none;
}

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

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

.capture-type-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-sm);
}

.capture-type-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: var(--space-md);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-secondary);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s;
}

.capture-type-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(59,130,246,0.08);
}

.capture-type-btn svg { width: 24px; height: 24px; }
