/* ═══════════════════════════════════════════════════════════════
   RepairScope — Design System
   Production-grade B2B SaaS styling
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ── CSS Custom Properties ── */
:root {
  --primary: #1B2A4A;
  --primary-light: #2a3d66;
  --accent: #2563EB;
  --accent-hover: #1d4ed8;
  --accent-light: #dbeafe;
  --success: #16A34A;
  --success-light: #dcfce7;
  --warning: #D97706;
  --warning-light: #fef3c7;
  --danger: #DC2626;
  --danger-light: #fee2e2;
  --bg: #F8FAFC;
  --surface: #FFFFFF;
  --border: #E2E8F0;
  --border-hover: #CBD5E1;
  --text: #0F172A;
  --text-secondary: #64748B;
  --text-muted: #94A3B8;
  --radius: 8px;
  --radius-sm: 4px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --transition: 150ms ease;
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-hover); }
img { max-width: 100%; display: block; }

/* ── Typography ── */
h1, h2, h3, h4, h5, h6 { font-weight: 600; line-height: 1.3; color: var(--text); }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }
.text-muted { color: var(--text-secondary); }
.text-small { font-size: 0.85rem; }
.text-money { font-weight: 600; color: var(--success); font-size: 1.1em; }
.text-money-lg { font-weight: 600; color: var(--success); font-size: 1.6rem; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-danger { color: var(--danger); }

/* ── Layout ── */
.page-wrapper { display: flex; flex-direction: column; min-height: 100vh; }
.page-content {
  flex: 1;
  padding: 24px 32px;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-header h1 { margin: 0; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }

/* ── Top Navigation Bar ── */
.navbar {
  background: var(--primary);
  color: #fff;
  padding: 0 32px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-md);
}
.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.15rem;
  color: #fff;
  text-decoration: none;
  letter-spacing: -0.3px;
}
.navbar-brand img { height: 28px; width: auto; }
.navbar-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
}
.navbar-nav a {
  color: rgba(255,255,255,0.75);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition);
  text-decoration: none;
}
.navbar-nav a:hover, .navbar-nav a.active {
  color: #fff;
  background: rgba(255,255,255,0.12);
}
.navbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}
.navbar-user {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.3;
}
.navbar-user-name { font-weight: 600; font-size: 0.88rem; color: #fff; }
.navbar-user-shop { font-size: 0.75rem; color: rgba(255,255,255,0.6); }
.navbar-logout {
  color: rgba(255,255,255,0.6) !important;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.navbar-logout:hover { color: #fff !important; background: rgba(255,255,255,0.1); }
.navbar-toggle {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px;
}

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

/* ── Stat Cards ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
}
.stat-card .stat-label {
  font-size: 0.82rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
  margin-bottom: 6px;
}
.stat-card .stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}
.stat-card .stat-value.money { color: var(--success); }
.stat-card .stat-sub {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition);
  text-decoration: none;
  line-height: 1.4;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn-navy { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-navy:hover:not(:disabled) { background: var(--primary-light); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--bg); border-color: var(--border-hover); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover:not(:disabled) { background: #15803d; }
.btn-sm { padding: 6px 12px; font-size: 0.82rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-block { width: 100%; display: flex; }
.btn-icon {
  padding: 8px;
  border-radius: var(--radius-sm);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition);
}
.btn-icon:hover { color: var(--text); background: var(--bg); }

/* ── Forms ── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text);
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-family: var(--font);
  color: var(--text);
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.form-input::placeholder { color: var(--text-muted); }
.form-input[readonly] { background: var(--bg); color: var(--text-secondary); cursor: not-allowed; }
.form-textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-hint { font-size: 0.78rem; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: 0.78rem; color: var(--danger); margin-top: 4px; }

/* ── Tables ── */
.table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
thead { background: var(--bg); position: sticky; top: 0; z-index: 1; }
th {
  text-align: left;
  padding: 12px 16px;
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f1f5f9; }
.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ── Badges / Status Pills ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
  white-space: nowrap;
}
.badge-gray { background: #f1f5f9; color: #475569; }
.badge-blue { background: var(--accent-light); color: #1e40af; }
.badge-green { background: var(--success-light); color: #166534; }
.badge-yellow { background: var(--warning-light); color: #92400e; }
.badge-red { background: var(--danger-light); color: #991b1b; }
.badge-navy { background: #e0e7ff; color: var(--primary); }
.badge-purple { background: #f3e8ff; color: #7c3aed; }
.badge-teal { background: #ccfbf1; color: #0f766e; }

/* ── Pagination ── */
.pagination { display: flex; align-items: center; gap: 4px; }
.pagination button, .pagination a {
  padding: 6px 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--text);
  text-decoration: none;
  transition: all var(--transition);
  font-family: var(--font);
}
.pagination button:hover:not(:disabled), .pagination a:hover { background: var(--bg); border-color: var(--border-hover); }
.pagination button.active, .pagination a.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Filters Bar ── */
.filters-bar { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.filters-bar .form-group { margin-bottom: 0; flex: 1; min-width: 160px; }
.filters-bar .form-input, .filters-bar .form-select { padding: 8px 12px; font-size: 0.85rem; }
.filters-bar .form-label { font-size: 0.78rem; }

/* ── Toast Notifications ── */
.toast-container {
  position: fixed;
  top: 68px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 0.88rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toastIn 0.3s ease;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 420px;
}
.toast-success { background: var(--success); color: #fff; }
.toast-error { background: var(--danger); color: #fff; }
.toast-info { background: var(--accent); color: #fff; }
.toast-warning { background: var(--warning); color: #fff; }
.toast.removing { animation: toastOut 0.3s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateX(100%); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(100%); } }

/* ── Auth Pages ── */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
  padding: 20px;
}
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 40px 36px;
  width: 100%;
  max-width: 420px;
}
.auth-logo { text-align: center; margin-bottom: 32px; }
.auth-logo img { height: 40px; margin: 0 auto 12px; }
.auth-logo h1 { font-size: 1.5rem; color: var(--primary); }
.auth-logo p { color: var(--text-secondary); font-size: 0.88rem; margin-top: 4px; }
.auth-error {
  background: var(--danger-light);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 16px;
  border: 1px solid #fca5a5;
}
.auth-success {
  background: var(--success-light);
  color: #166534;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 16px;
  border: 1px solid #86efac;
}
.auth-links { text-align: center; margin-top: 20px; font-size: 0.85rem; }

/* ── Upload / Drop Zone ── */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 32px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--surface);
}
.drop-zone:hover, .drop-zone.dragover { border-color: var(--accent); background: var(--accent-light); }
.drop-zone-icon { font-size: 3rem; margin-bottom: 12px; color: var(--text-muted); }
.drop-zone-text { font-size: 1rem; color: var(--text-secondary); margin-bottom: 8px; }
.drop-zone-hint { font-size: 0.82rem; color: var(--text-muted); }
.drop-zone .file-selected {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px;
  background: var(--success-light);
  border-radius: var(--radius);
  margin-top: 16px;
  font-size: 0.88rem;
  color: #166534;
}

/* ── Processing Steps ── */
.processing-steps { display: flex; flex-direction: column; gap: 12px; padding: 24px 0; }
.processing-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  transition: all 0.3s ease;
}
.processing-step.pending { color: var(--text-muted); }
.processing-step.active { color: var(--accent); font-weight: 500; }
.processing-step.done { color: var(--success); }
.processing-step .step-icon {
  width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; flex-shrink: 0;
}
.processing-step.pending .step-icon { border: 2px solid var(--border); }
.processing-step.active .step-icon { border: 2px solid var(--accent); animation: pulse 1.5s infinite; }
.processing-step.done .step-icon { background: var(--success); color: #fff; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

/* ── Spinner ── */
.spinner { width: 20px; height: 20px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; }
.spinner-lg { width: 40px; height: 40px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; padding: 60px 20px; color: var(--text-secondary);
}

/* ── Skeleton Loading ── */
.skeleton {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}
.skeleton-text { height: 14px; margin-bottom: 8px; }
.skeleton-title { height: 24px; width: 60%; margin-bottom: 16px; }
.skeleton-card { height: 100px; }
@keyframes skeleton-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ── Empty States ── */
.empty-state { text-align: center; padding: 60px 24px; }
.empty-state-icon { font-size: 3.5rem; margin-bottom: 16px; }
.empty-state h3 { font-size: 1.15rem; margin-bottom: 8px; }
.empty-state p {
  color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 24px;
  max-width: 400px; margin-left: auto; margin-right: auto;
}

/* ── Checkbox ── */
.checkbox-wrapper { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.checkbox-wrapper input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }

/* ── Tabs ── */
.tabs { display: flex; border-bottom: 2px solid var(--border); gap: 0; margin-bottom: 20px; }
.tab {
  padding: 10px 20px; font-size: 0.88rem; font-weight: 500; color: var(--text-secondary);
  border-bottom: 2px solid transparent; margin-bottom: -2px; cursor: pointer;
  transition: all var(--transition); background: none; border-left: none;
  border-right: none; border-top: none; font-family: var(--font);
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── Collapsible ── */
.collapsible-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; cursor: pointer; background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--radius);
  font-weight: 600; font-size: 0.9rem; transition: all var(--transition); user-select: none;
}
.collapsible-header:hover { background: #eef2f7; }
.collapsible-body {
  display: none; padding: 16px; border: 1px solid var(--border);
  border-top: none; border-radius: 0 0 var(--radius) var(--radius); background: var(--surface);
}
.collapsible-body.open { display: block; }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 20px; animation: fadeIn 0.2s ease;
}
.modal {
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); width: 100%; max-width: 540px;
  max-height: 90vh; overflow-y: auto; animation: modalIn 0.2s ease;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 1.1rem; }
.modal-close {
  background: none; border: none; font-size: 1.5rem;
  cursor: pointer; color: var(--text-muted); padding: 4px; line-height: 1;
}
.modal-body { padding: 24px; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 12px;
  padding: 16px 24px; border-top: 1px solid var(--border);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: scale(0.95) translateY(10px); } to { opacity: 1; transform: scale(1) translateY(0); } }

/* ── Charts ── */
.chart-container {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm);
}
.chart-container canvas { width: 100% !important; }
.charts-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 16px; margin-bottom: 24px;
}

/* ── Activity Feed ── */
.activity-feed { list-style: none; padding: 0; }
.activity-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 0.85rem;
}
.activity-item:last-child { border-bottom: none; }
.activity-time { flex-shrink: 0; color: var(--text-muted); font-size: 0.78rem; min-width: 140px; }
.activity-user { font-weight: 600; color: var(--text); }

/* ── Section Panels ── */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.panel-header {
  padding: 16px 20px; background: var(--bg);
  border-bottom: 1px solid var(--border); font-weight: 600; font-size: 0.95rem;
}
.panel-body { padding: 20px; }

/* ── Two-Column Detail Layout ── */
.detail-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }

/* ── Claim Header Card ── */
.claim-header {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 12px 32px; padding: 20px 24px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 16px;
}
.claim-label { font-size: 0.78rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.3px; }
.claim-value { font-size: 0.95rem; font-weight: 500; margin-top: 2px; }

/* ── Summary Bar ── */
.summary-bar {
  display: flex; align-items: center; gap: 20px;
  padding: 14px 24px; background: var(--primary); color: #fff;
  border-radius: var(--radius); margin-bottom: 16px; flex-wrap: wrap;
}
.summary-bar .summary-item { font-size: 0.9rem; }
.summary-bar .summary-item strong { font-weight: 700; }
.summary-bar select {
  background: rgba(255,255,255,0.15); color: #fff;
  border: 1px solid rgba(255,255,255,0.3); padding: 4px 10px;
  border-radius: var(--radius-sm); font-size: 0.85rem;
  font-family: var(--font); cursor: pointer;
}
.summary-bar select option { color: var(--text); background: var(--surface); }

/* ── Notes Section ── */
.notes-section { margin-top: 24px; }
.notes-section label {
  font-size: 0.85rem; font-weight: 500;
  color: var(--text-secondary); display: block; margin-bottom: 6px;
}

/* ── Raw Text Viewer ── */
.raw-text-viewer {
  background: #1e293b; color: #e2e8f0; padding: 16px;
  border-radius: var(--radius); font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 0.8rem; line-height: 1.6; max-height: 400px;
  overflow: auto; white-space: pre-wrap; word-break: break-word;
}

/* ── Responsive ── */
@media (max-width: 1024px) {
  .detail-layout { grid-template-columns: 1fr; }
  .charts-grid { grid-template-columns: 1fr; }
  .page-content { padding: 20px; }
}
@media (max-width: 768px) {
  .navbar { padding: 0 16px; }
  .navbar-nav {
    display: none; flex-direction: column; position: absolute;
    top: 56px; left: 0; right: 0; background: var(--primary);
    padding: 8px; box-shadow: var(--shadow-lg);
  }
  .navbar-nav.open { display: flex; }
  .navbar-nav a { padding: 12px 16px; }
  .navbar-toggle { display: block; }
  .navbar-user { display: none; }
  .page-content { padding: 16px; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .claim-header { grid-template-columns: 1fr; }
  .summary-bar { flex-direction: column; align-items: flex-start; gap: 8px; }
  .filters-bar { flex-direction: column; }
  .filters-bar .form-group { min-width: 100%; }
  .btn-lg { padding: 12px 20px; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .auth-card { padding: 28px 20px; }
  h1 { font-size: 1.4rem; }
}

/* ── Print ── */
@media print {
  .navbar, .toast-container, .btn { display: none !important; }
  .page-content { padding: 0; max-width: 100%; }
  body { background: #fff; }
}

/* ── Utility ── */
.hidden { display: none !important; }
.w-full { width: 100%; }
.overflow-hidden { overflow: hidden; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }
.cursor-pointer { cursor: pointer; }
.font-mono { font-family: 'Consolas', 'Monaco', 'Courier New', monospace; }
.strikethrough { text-decoration: line-through; opacity: 0.5; }

/* ═══════════════════════════════════════════════════════════════
   Analysis Detail — Premium Redesign
   Inspired by Linear, Stripe, Notion, Superhuman
   ═══════════════════════════════════════════════════════════════ */

/* ── Tabular numbers for all money/data ── */
.ad-hero, .ad-op, .ad-totals, .ad-tier-meta { font-feature-settings: "tnum" 1; }

/* ── Action Buttons ── */
.ad-actions { display: flex; align-items: center; gap: 12px; }
.ad-btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px; border-radius: 10px; font-size: 0.88rem; font-weight: 500;
  font-family: var(--font); cursor: pointer; border: none;
  background: var(--primary); color: #fff; transition: all 150ms ease;
}
.ad-btn-primary:hover { background: var(--primary-light); }
.ad-btn-secondary {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px; border-radius: 10px; font-size: 0.88rem; font-weight: 500;
  font-family: var(--font); cursor: pointer;
  background: #fff; color: var(--primary); border: 1px solid var(--primary);
  transition: all 150ms ease;
}
.ad-btn-secondary:hover { background: #f0f4f8; }
.ad-btn-link {
  font-size: 0.88rem; font-weight: 500; color: var(--primary);
  text-decoration: none; padding: 10px 4px; transition: opacity 150ms ease;
}
.ad-btn-link:hover { opacity: 0.7; }

/* ── Hero Card ── */
.ad-hero {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid var(--border); border-radius: 12px;
  padding: 40px 32px; margin-bottom: 24px; text-align: center;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.ad-hero-dual {
  display: flex; justify-content: center; align-items: flex-start; gap: 48px;
}
.ad-hero-primary { text-align: center; }
.ad-hero-secondary { text-align: center; }
.ad-hero-amount {
  font-size: 3.5rem; font-weight: 700; color: var(--success);
  line-height: 1.1; letter-spacing: -1.5px;
  font-variant-numeric: tabular-nums;
}
.ad-hero-amount-sm {
  font-size: 2rem; font-weight: 600; color: var(--text-muted);
  line-height: 1.1; letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums; margin-top: 8px;
}
.ad-hero-label {
  font-size: 0.88rem; color: var(--text-secondary); margin-top: 6px; font-weight: 500;
}
.ad-hero-hint {
  font-size: 0.72rem; color: var(--text-muted); margin-top: 2px; font-weight: 400;
}
.ad-hero-divider {
  width: 64px; height: 1px; background: var(--border); margin: 24px auto;
}
.ad-hero-stats {
  display: flex; justify-content: center; gap: 28px; flex-wrap: wrap;
}
.ad-hero-stat {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.88rem; color: var(--text-secondary); line-height: 1.35;
}
.ad-hero-stat strong { font-weight: 600; color: var(--text); }
.ad-hero-stat svg { color: var(--success); flex-shrink: 0; }

/* ── Info Strip ── */
.ad-info-strip {
  display: grid; grid-template-columns: repeat(3, 1fr);
  padding: 0; margin-bottom: 32px;
}
.ad-info-field {
  padding: 20px 24px;
  border-right: 1px solid var(--border);
}
.ad-info-field:nth-child(3n) { border-right: none; }
.ad-info-field:nth-child(n+4) { border-top: 1px solid var(--border); }
.ad-info-label {
  font-size: 0.72rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--text-muted); margin-bottom: 4px;
}
.ad-info-value {
  font-size: 1rem; font-weight: 500; color: var(--text); line-height: 1.5;
}
.ad-info-input {
  font-size: 1rem; font-weight: 500; color: var(--text); line-height: 1.5;
  border: none; background: transparent; padding: 0; width: 100%;
  font-family: var(--font); outline: none;
  border-bottom: 1px dashed transparent; transition: border-color 150ms ease;
}
.ad-info-input:hover { border-bottom-color: var(--border-hover); }
.ad-info-input:focus { border-bottom-color: var(--accent); }
.ad-info-input::placeholder { color: var(--text-muted); }

/* ── Tier Sections ── */
.ad-tier {
  margin-bottom: 20px; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--border); box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.ad-tier.collapsed .ad-tier-body { display: none; }
.ad-tier.collapsed .ad-tier-chevron { transform: rotate(-90deg); }

.ad-tier-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; cursor: pointer; user-select: none;
  transition: background 150ms ease;
}
.ad-tier-head:hover { filter: brightness(0.98); }
.ad-tier-high { background: rgba(22,163,74,0.04); }
.ad-tier-med  { background: rgba(217,119,6,0.04); }
.ad-tier-low  { background: rgba(220,38,38,0.04); }
.ad-tier-left { display: flex; align-items: center; gap: 12px; }
.ad-tier-title { font-size: 1.05rem; font-weight: 600; color: var(--text); }
.ad-tier-right { display: flex; align-items: center; gap: 16px; }
.ad-tier-meta {
  font-size: 0.88rem; color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}
.ad-tier-meta strong { color: var(--success); font-weight: 600; }
.ad-tier-chevron {
  color: var(--text-muted); transition: transform 200ms ease; flex-shrink: 0;
}
.ad-tier-body { background: var(--surface); }

/* ── Approval Pills ── */
.ad-pill {
  display: inline-flex; align-items: center; padding: 3px 10px;
  border-radius: 100px; font-size: 0.68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px; color: #fff; white-space: nowrap;
}
.ad-pill-lg { padding: 5px 14px; font-size: 0.72rem; }
.ad-pill-high { background: #16A34A; }
.ad-pill-med  { background: #D97706; }
.ad-pill-low  { background: #DC2626; }

/* ── Operation Rows ── */
.ad-op {
  display: grid;
  grid-template-columns: 36px 1fr auto auto auto auto;
  align-items: center; gap: 16px;
  padding: 16px 24px; min-height: 72px;
  border-bottom: 1px solid #f1f5f9;
  transition: background 150ms ease;
}
.ad-op:last-child { border-bottom: none; }
.ad-op:hover { background: #f8fafc; }
.ad-op-excluded { opacity: 0.45; }
.ad-op-excluded .ad-op-name { text-decoration: line-through; }
.ad-op-excluded .ad-op-amount { color: var(--text-muted); }

.ad-op-main { min-width: 0; }
.ad-op-name {
  font-size: 0.95rem; font-weight: 500; color: var(--text); line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.ad-op-ref {
  font-size: 0.78rem; color: var(--text-muted); margin-top: 3px; line-height: 1.35;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 420px;
}
.ad-op-calc {
  font-size: 0.82rem; color: var(--text-secondary);
  font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right;
}
.ad-op-amount {
  font-size: 1.05rem; font-weight: 600; color: var(--success);
  font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right;
  min-width: 80px;
}

/* ── Custom Checkboxes ── */
.ad-op-check, .ad-op-approved {
  display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer;
}
.ad-op-check input, .ad-op-approved input { position: absolute; opacity: 0; width: 0; height: 0; }
.ad-check-box {
  width: 20px; height: 20px; border: 2px solid var(--border-hover);
  border-radius: 5px; display: flex; align-items: center; justify-content: center;
  transition: all 150ms ease; flex-shrink: 0;
}
.ad-op-check input:checked + .ad-check-box,
.ad-op-approved input:checked + .ad-check-box {
  background: var(--primary); border-color: var(--primary);
}
.ad-op-check input:checked + .ad-check-box::after,
.ad-op-approved input:checked + .ad-check-box::after {
  content: ''; display: block; width: 6px; height: 10px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
  margin-top: -2px;
}
.ad-approved-label {
  font-size: 0.62rem; color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 0.3px; font-weight: 500; white-space: nowrap;
}

/* ── Totals Bar ── */
.ad-totals {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px; margin-top: 24px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  font-size: 0.95rem; gap: 24px; position: sticky; bottom: 0; z-index: 10;
}
.ad-totals-item { white-space: nowrap; }
.ad-totals-status { margin-left: auto; }
.ad-totals-status select {
  padding: 6px 28px 6px 14px; border: 1px solid var(--border);
  border-radius: 100px; font-size: 0.85rem; font-family: var(--font);
  font-weight: 500; cursor: pointer; background: var(--surface);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%2364748B' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.ad-totals-status select:focus { border-color: var(--accent); outline: none; }

/* ── Responsive ── */
@media (max-width: 1024px) {
  .ad-info-strip { grid-template-columns: repeat(2, 1fr); }
  .ad-info-field:nth-child(3n) { border-right: 1px solid var(--border); }
  .ad-info-field:nth-child(2n) { border-right: none; }
  .ad-info-field:nth-child(n+3) { border-top: 1px solid var(--border); }
}
@media (max-width: 768px) {
  .ad-actions { flex-wrap: wrap; gap: 8px; }
  .ad-hero { padding: 28px 20px; }
  .ad-hero-dual { flex-direction: column; gap: 16px; }
  .ad-hero-amount { font-size: 2.5rem; }
  .ad-hero-amount-sm { font-size: 1.5rem; margin-top: 0; }
  .ad-hero-stats { gap: 16px; }
  .ad-info-strip { grid-template-columns: 1fr; }
  .ad-info-field { border-right: none !important; }
  .ad-info-field + .ad-info-field { border-top: 1px solid var(--border); }
  .ad-tier-head { flex-direction: column; align-items: flex-start; gap: 8px; padding: 16px; }
  .ad-tier-right { width: 100%; justify-content: space-between; }
  .ad-op {
    grid-template-columns: 28px 1fr;
    grid-template-rows: auto auto auto;
    gap: 6px 12px; padding: 16px;
  }
  .ad-op-check { grid-row: 1 / 3; }
  .ad-op-main { grid-column: 2; }
  .ad-op-calc { grid-column: 2; font-size: 0.78rem; }
  .ad-op-amount { grid-column: 2; text-align: left; }
  .ad-pill { grid-column: 2; justify-self: start; }
  .ad-op-approved { grid-column: 2; flex-direction: row; gap: 6px; justify-self: start; }
  .ad-totals { flex-wrap: wrap; gap: 12px; position: static; }
  .ad-totals-status { margin-left: 0; }
}
