/* FreightGuard — global styles */

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

:root {
  --bg-primary: #0b0f1a;
  --bg-card: #111827;
  --bg-elevated: #1a2235;
  --border: #1e2d47;
  --text-primary: #e8edf5;
  --text-secondary: #8896b3;
  --text-muted: #4a5f7a;
  --accent: #f59e0b;
  --accent-dim: #92640a;
  --green: #22c55e;
  --green-dim: #14532d;
  --yellow: #eab308;
  --yellow-dim: #713f12;
  --red: #ef4444;
  --red-dim: #7f1d1d;
  --font-mono: 'IBM Plex Mono', monospace;
  --font-sans: 'IBM Plex Sans', system-ui, sans-serif;
}

html { scroll-behavior: smooth; }
body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Navbar ── */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 60px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: rgba(11, 15, 26, 0.95);
  backdrop-filter: blur(10px);
  z-index: 100;
}
.nav-brand { display: flex; align-items: center; gap: 10px; }
.brand-icon {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  background: var(--accent); color: #000;
  font-family: var(--font-mono); font-weight: 700; font-size: 14px;
  border-radius: 4px;
}
.brand-name { font-family: var(--font-mono); font-weight: 600; font-size: 16px; color: var(--text-primary); }
.nav-links { display: flex; gap: 32px; }
.nav-links a { color: var(--text-secondary); text-decoration: none; font-size: 14px; font-weight: 500; transition: color 0.2s; }
.nav-links a:hover { color: var(--accent); }
.nav-cta {
  background: var(--accent); color: #000;
  padding: 8px 18px; border-radius: 4px;
  font-weight: 600; font-size: 14px; text-decoration: none;
  transition: opacity 0.2s;
}
.nav-cta:hover { opacity: 0.85; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 20px; border-radius: 4px;
  font-weight: 600; font-size: 14px; cursor: pointer;
  border: none; text-decoration: none; transition: opacity 0.2s;
}
.btn:hover { opacity: 0.85; }
.btn-primary { background: var(--accent); color: #000; }
.btn-secondary { background: var(--bg-elevated); color: var(--text-primary); border: 1px solid var(--border); }
.btn-danger { background: var(--red-dim); color: var(--red); }
.btn-sm { padding: 6px 14px; font-size: 13px; }

/* ── Hero ── */
.hero {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 80px;
  padding: 100px 60px 80px;
  min-height: 640px;
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--bg-card); border: 1px solid var(--border);
  padding: 6px 14px; border-radius: 100px;
  font-size: 13px; color: var(--accent); margin-bottom: 24px;
}
.hero h1 {
  font-size: 3.5rem; font-weight: 700; line-height: 1.1;
  margin-bottom: 20px;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.hero h1 .accent { -webkit-text-fill-color: var(--accent); }
.hero-sub {
  font-size: 1.2rem; color: var(--text-secondary); margin-bottom: 40px;
  max-width: 540px; line-height: 1.7;
}
.hero-actions { display: flex; gap: 16px; flex-wrap: wrap; }
.hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: 60px; padding-top: 40px; border-top: 1px solid var(--border); }
.stat-value { font-size: 2rem; font-weight: 700; color: var(--accent); font-family: var(--font-mono); }
.stat-label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.hero-visual { background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.audit-preview-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.audit-preview-header h3 { font-size: 14px; font-weight: 600; }
.audit-flag { background: var(--red-dim); border: 1px solid var(--red-dim); border-radius: 4px; padding: 8px 12px; display: flex; align-items: center; gap: 10px; }
.flag-icon { font-size: 16px; }
.flag-text { font-size: 13px; }
.flag-amount { font-weight: 700; color: var(--red); font-family: var(--font-mono); }
.flag-reason { font-size: 12px; color: var(--text-muted); }
.recover-badge { background: var(--green-dim); border: 1px solid var(--green); border-radius: 4px; padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; }
.recover-label { font-size: 13px; color: var(--green); }
.recover-value { font-size: 1.5rem; font-weight: 700; color: var(--green); font-family: var(--font-mono); }

/* ── Sections ── */
.section { padding: 80px 60px; }
.section-dark { background: var(--bg-card); }
.section-header { text-align: center; margin-bottom: 60px; }
.section-header h2 { font-size: 2.5rem; font-weight: 700; margin-bottom: 16px; }
.section-header p { font-size: 1.1rem; color: var(--text-secondary); max-width: 600px; margin: 0 auto; }

/* ── Feature Grid ── */
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.feature-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 8px; padding: 32px; transition: border-color 0.2s;
}
.feature-card:hover { border-color: var(--accent); }
.feature-icon { font-size: 2rem; margin-bottom: 16px; }
.feature-card h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: 10px; }
.feature-card p { font-size: 14px; color: var(--text-secondary); line-height: 1.6; }

/* ── How it works ── */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 40px; }
.step { text-align: center; }
.step-num { width: 40px; height: 40px; background: var(--accent); color: #000; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 16px; margin: 0 auto 16px; }
.step h3 { font-size: 1rem; font-weight: 600; margin-bottom: 8px; }
.step p { font-size: 14px; color: var(--text-secondary); }

/* ── App layout ── */
.app-shell { display: flex; min-height: calc(100vh - 77px); }
.app-sidebar {
  width: 240px; flex-shrink: 0;
  background: var(--bg-card); border-right: 1px solid var(--border);
  padding: 24px 0;
}
.sidebar-section { padding: 0 16px; margin-bottom: 24px; }
.sidebar-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); margin-bottom: 8px; }
.sidebar-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 4px;
  color: var(--text-secondary); text-decoration: none; font-size: 14px;
  transition: background 0.15s, color 0.15s; margin-bottom: 2px;
}
.sidebar-link:hover { background: var(--bg-elevated); color: var(--text-primary); }
.sidebar-link.active { background: var(--bg-elevated); color: var(--accent); font-weight: 600; }
.app-main { flex: 1; overflow: auto; }
.app-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 32px; border-bottom: 1px solid var(--border);
  background: var(--bg-primary);
}
.app-topbar h1 { font-size: 1.25rem; font-weight: 600; }
.page-content { padding: 32px; }

/* ── Cards ── */
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 8px; padding: 24px; margin-bottom: 20px;
}
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.card-title { font-size: 1rem; font-weight: 600; }

/* ── Table ── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { text-align: left; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); padding: 10px 12px; border-bottom: 1px solid var(--border); }
.data-table td { padding: 12px; border-bottom: 1px solid var(--border); font-size: 14px; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg-elevated); }

/* ── Forms ── */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.form-input, .form-select {
  width: 100%; padding: 10px 14px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 4px; color: var(--text-primary); font-size: 14px;
  font-family: var(--font-sans);
  transition: border-color 0.2s;
}
.form-input:focus, .form-select:focus { outline: none; border-color: var(--accent); }
.form-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ── Filters Bar ── */
.filters-bar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 24px; }
.filters-bar .form-input, .filters-bar .form-select { width: auto; min-width: 160px; }

/* ── Badge / Chip ── */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 4px; font-size: 12px; font-weight: 600; }
.badge-green { background: var(--green-dim); color: var(--green); }
.badge-yellow { background: var(--yellow-dim); color: var(--yellow); }
.badge-red { background: var(--red-dim); color: var(--red); }
.badge-muted { background: var(--bg-elevated); color: var(--text-muted); }

/* ── Upload Zone ── */
.upload-zone {
  border: 2px dashed var(--border); border-radius: 8px;
  padding: 60px 40px; text-align: center;
  cursor: pointer; transition: border-color 0.2s, background 0.2s;
  background: var(--bg-card);
}
.upload-zone:hover, .upload-zone.drag-over { border-color: var(--accent); background: var(--bg-elevated); }
.upload-zone input[type=file] { display: none; }
.upload-icon { font-size: 3rem; margin-bottom: 16px; }
.upload-title { font-size: 1.1rem; font-weight: 600; margin-bottom: 8px; }
.upload-hint { font-size: 13px; color: var(--text-muted); }

/* ── Audit Results ── */
.audit-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 28px; }
.audit-metric { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 6px; padding: 20px; text-align: center; }
.audit-metric .value { font-size: 1.75rem; font-weight: 700; font-family: var(--font-mono); }
.audit-metric .label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.audit-metric.green .value { color: var(--green); }
.audit-metric.red .value { color: var(--red); }
.audit-metric.yellow .value { color: var(--yellow); }
.audit-flag-item {
  display: flex; align-items: flex-start; gap: 16px;
  padding: 16px; background: var(--bg-elevated);
  border: 1px solid var(--border); border-radius: 6px; margin-bottom: 12px;
}
.flag-type-badge { flex-shrink: 0; padding: 4px 10px; border-radius: 4px; font-size: 12px; font-weight: 700; }
.flag-body { flex: 1; }
.flag-title { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.flag-desc { font-size: 13px; color: var(--text-secondary); margin-bottom: 8px; }
.flag-footer { display: flex; align-items: center; justify-content: space-between; }
.flag-amount-big { font-size: 1.25rem; font-weight: 700; font-family: var(--font-mono); color: var(--red); }
.flag-actions { display: flex; gap: 8px; }

/* ── Tabs ── */
.tabs { display: flex; gap: 4px; margin-bottom: 24px; border-bottom: 1px solid var(--border); }
.tab-btn {
  padding: 10px 20px; background: none; border: none;
  color: var(--text-muted); font-size: 14px; font-weight: 500; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color 0.2s, border-color 0.2s;
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── Empty state ── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state .icon { font-size: 3rem; margin-bottom: 16px; }
.empty-state p { font-size: 14px; }

/* ── Alert ── */
.alert { padding: 14px 18px; border-radius: 6px; font-size: 14px; margin-bottom: 16px; }
.alert-success { background: var(--green-dim); color: var(--green); border: 1px solid var(--green); }
.alert-error { background: var(--red-dim); color: var(--red); border: 1px solid var(--red); }
.alert-warning { background: var(--yellow-dim); color: var(--yellow); border: 1px solid var(--yellow); }

/* ── Loading spinner ── */
.spinner { display: inline-block; width: 18px; height: 18px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Footer ── */
.footer { padding: 40px 60px; border-top: 1px solid var(--border); text-align: center; font-size: 13px; color: var(--text-muted); }