/* Leo Agent iPhone 16e PWA Design System */
:root {
  --bg-primary: #0B0E14;
  --bg-card: rgba(22, 27, 34, 0.75);
  --bg-card-border: rgba(255, 255, 255, 0.08);
  --text-primary: #F0F6FC;
  --text-secondary: #8B949E;
  --text-muted: #484F58;
  --accent-green: #2EA043;
  --accent-green-glow: rgba(46, 160, 67, 0.35);
  --accent-red: #F85149;
  --accent-blue: #58A6FF;
  --accent-yellow: #D29922;
  --safe-top: env(safe-area-inset-top, 20px);
  --safe-bottom: env(safe-area-inset-bottom, 20px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  padding-top: var(--safe-top);
  padding-bottom: calc(var(--safe-bottom) + 65px);
}

/* Header & Dynamic Island Area */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11, 14, 20, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--bg-card-border);
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-title {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: #fff;
}

.pulse-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--accent-green);
  font-weight: 600;
  text-transform: uppercase;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background: var(--accent-green);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--accent-green);
  animation: pulse 2s infinite ease-in-out;
}

@keyframes pulse {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.3); opacity: 1; box-shadow: 0 0 14px var(--accent-green); }
  100% { transform: scale(0.9); opacity: 0.7; }
}

.mode-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.mode-sandbox {
  background: rgba(88, 166, 255, 0.15);
  color: var(--accent-blue);
  border: 1px solid rgba(88, 166, 255, 0.3);
}

.mode-production {
  background: rgba(248, 81, 73, 0.15);
  color: var(--accent-red);
  border: 1px solid rgba(248, 81, 73, 0.3);
}

/* Filter Chips */
.filter-deck {
  display: flex;
  gap: 8px;
  padding: 14px 20px 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

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

.filter-chip {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 16px;
  border: 1px solid var(--bg-card-border);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.filter-chip.active {
  background: var(--text-primary);
  color: var(--bg-primary);
  border-color: var(--text-primary);
}

/* Screen Containers */
.screen {
  display: none;
  padding: 12px 18px;
}

.screen.active {
  display: block;
}

/* Glassmorphic Job Card */
.job-card {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 20px;
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s, border-color 0.2s;
}

.job-card:active {
  transform: scale(0.985);
}

.card-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.score-badge {
  font-size: 13px;
  font-weight: 800;
  padding: 5px 12px;
  border-radius: 12px;
  letter-spacing: 0.3px;
}

.score-elite {
  background: rgba(46, 160, 67, 0.18);
  color: #3FB950;
  border: 1px solid rgba(46, 160, 67, 0.4);
  box-shadow: 0 0 15px var(--accent-green-glow);
}

.score-good {
  background: rgba(210, 153, 34, 0.15);
  color: var(--accent-yellow);
  border: 1px solid rgba(210, 153, 34, 0.3);
}

.status-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 8px;
  text-transform: uppercase;
}

.tag-pending { background: rgba(88, 166, 255, 0.15); color: var(--accent-blue); }
.tag-submitted { background: rgba(46, 160, 67, 0.15); color: var(--accent-green); }
.tag-rejected { background: rgba(248, 81, 73, 0.15); color: var(--accent-red); }

.job-title {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
  color: #fff;
  margin-bottom: 12px;
}

.metrics-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.metric-pill {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.metric-pill strong {
  color: var(--text-primary);
}

/* Search Preview Simulator */
.preview-box {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 14px;
}

.preview-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.preview-text {
  font-size: 13px;
  line-height: 1.45;
  color: #C9D1D9;
  font-style: italic;
}

/* Card Button Actions */
.card-actions {
  display: flex;
  gap: 8px;
}

.btn {
  flex: 1;
  height: 44px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--accent-green);
  color: #fff;
  box-shadow: 0 4px 20px var(--accent-green-glow);
}

.btn-primary:active {
  transform: scale(0.97);
  background: #278637;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border: 1px solid var(--bg-card-border);
}

.btn-danger {
  background: rgba(248, 81, 73, 0.15);
  color: var(--accent-red);
  border: 1px solid rgba(248, 81, 73, 0.25);
}

/* Proposal Detail Accordion */
.accordion-item {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: 16px;
  margin-bottom: 10px;
  overflow: hidden;
}

.accordion-header {
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
}

.accordion-body {
  padding: 0 16px 14px;
  font-size: 13px;
  line-height: 1.5;
  color: #C9D1D9;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.copy-box {
  position: relative;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--bg-card-border);
  border-radius: 12px;
  padding: 14px;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  user-select: text;
  -webkit-user-select: text;
}

.btn-copy {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: none;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 8px;
  cursor: pointer;
}

/* Fixed Bottom Floating Action Deck on Detail Screen */
.floating-action-deck {
  position: fixed;
  bottom: calc(var(--safe-bottom) + 65px);
  left: 0;
  right: 0;
  padding: 12px 18px;
  background: rgba(11, 14, 20, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--bg-card-border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 90;
}

.deck-main-btn {
  height: 52px;
  border-radius: 16px;
  font-size: 16px;
  font-weight: 800;
}

.deck-secondary-row {
  display: flex;
  gap: 8px;
}

/* Telemetry Screen Styles */
.telemetry-card {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: 20px;
  padding: 18px;
  margin-bottom: 14px;
}

.telemetry-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}

.telemetry-stat {
  background: rgba(255, 255, 255, 0.03);
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.telemetry-stat-label {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 600;
}

.telemetry-stat-value {
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  margin-top: 4px;
}

.audit-log-list {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 11px;
  color: var(--text-secondary);
  max-height: 200px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

.audit-log-item {
  padding: 6px 10px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 6px;
  border-left: 3px solid var(--accent-green);
}

/* Bottom iOS Navigation Bar */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--safe-bottom) + 60px);
  background: rgba(11, 14, 20, 0.95);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border-top: 1px solid var(--bg-card-border);
  display: flex;
  justify-content: space-around;
  align-items: flex-start;
  padding-top: 8px;
  z-index: 100;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  padding: 4px 16px;
  border-radius: 12px;
}

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

.nav-icon {
  font-size: 20px;
}

.nav-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

/* Toast Notification */
.toast {
  position: fixed;
  top: calc(var(--safe-top) + 60px);
  left: 20px;
  right: 20px;
  background: #161B22;
  color: #fff;
  border: 1px solid var(--accent-green);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
  border-radius: 14px;
  padding: 12px 18px;
  font-size: 13px;
  font-weight: 600;
  z-index: 200;
  display: none;
  animation: slideDown 0.3s ease-out;
}

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