/* ============================================================
   Claims Internal Dashboard — #0A0A0A + #F5A623
   Full-width layout, top nav, modal claim detail
   ============================================================ */

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

:root {
  --bg-body: #0A0A0A;
  --bg-card: #141414;
  --bg-card-hover: #1a1a1a;
  --bg-input: #1a1a1a;
  --bg-hover: #1e1e1e;
  --bg-topbar: #111111;
  --bg-modal: #161616;
  --border: #222222;
  --border-light: #2a2a2a;
  --text: #f0f0f0;
  --text-secondary: #c0c0c0;
  --text-muted: #808080;
  --text-dim: #555555;
  --brand: #F5A623;
  --brand-light: #f7b84a;
  --brand-dim: #b37a1a;
  --brand-bg: rgba(245, 166, 35, 0.08);
  --brand-bg-strong: rgba(245, 166, 35, 0.15);
  --green: #34d399;
  --green-bg: rgba(52, 211, 153, 0.12);
  --yellow: #F5A623;
  --yellow-bg: rgba(245, 166, 35, 0.12);
  --red: #f87171;
  --red-bg: rgba(248, 113, 113, 0.12);
  --cyan: #22d3ee;
  --cyan-bg: rgba(34, 211, 238, 0.12);
  --purple: #a78bfa;
  --purple-bg: rgba(167, 139, 250, 0.12);
  --blue: #60a5fa;
  --blue-bg: rgba(96, 165, 250, 0.12);
  --orange: #fb923c;
  --orange-bg: rgba(251, 146, 60, 0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg: 0 16px 48px rgba(0,0,0,0.6);
  --transition: 150ms ease;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

body {
  font-family: var(--font);
  background: var(--bg-body);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-light); }

/* ---- Login Screen ---- */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0A0A0A;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 44px 36px;
  box-shadow: var(--shadow-lg);
}

.login-logo {
  font-size: 22px;
  font-weight: 800;
  color: var(--brand);
  text-align: center;
  margin-bottom: 4px;
  letter-spacing: -0.3px;
}

.login-subtitle {
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  margin-bottom: 36px;
}

/* ---- Form Elements ---- */
.form-group { margin-bottom: 18px; }

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

.form-group input,
.form-group select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  color: var(--text);
  font-size: 14px;
  font-family: var(--font);
  transition: all var(--transition);
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-bg);
  background: var(--bg-hover);
}

.form-group input::placeholder { color: var(--text-dim); }
.form-group select option { background: var(--bg-card); color: var(--text); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--transition);
  background: var(--bg-card);
  color: var(--text-muted);
}

.btn:hover { background: var(--bg-hover); border-color: var(--border-light); color: var(--text); }

.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #0A0A0A;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(245, 166, 35, 0.3);
}

.btn-primary:hover { background: var(--brand-light); border-color: var(--brand-light); box-shadow: 0 2px 8px rgba(245, 166, 35, 0.35); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary { background: var(--bg-card); border-color: var(--border); color: var(--text-muted); }
.btn-secondary:hover { background: var(--bg-hover); color: var(--text); }

.btn-full { width: 100%; justify-content: center; padding: 12px; font-size: 14px; }
.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-text { background: none; border: none; color: var(--text-muted); font-size: 13px; cursor: pointer; padding: 4px 0; font-weight: 500; }
.btn-text:hover { color: var(--brand); }

/* ---- Alerts ---- */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 20px; font-weight: 500; }
.alert-error { background: var(--red-bg); border: 1px solid rgba(248, 113, 113, 0.25); color: var(--red); }

/* ---- App Layout ---- */
.app-wrapper { display: flex; flex-direction: column; min-height: 100vh; }

/* ---- Top Navigation Bar ---- */
.topbar {
  background: var(--bg-topbar);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  height: 56px;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-left { display: flex; align-items: center; }

.topbar-brand {
  font-size: 16px;
  font-weight: 800;
  color: var(--brand);
  letter-spacing: -0.3px;
  margin-right: 40px;
}

.topbar-nav { display: flex; gap: 4px; flex: 1; }

.nav-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  transition: all var(--transition);
}

.nav-tab:hover { background: var(--bg-hover); color: var(--text); }
.nav-tab.active { background: var(--brand-bg-strong); color: var(--brand); }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-left: auto;
}

.topbar-user { color: var(--text-muted); font-size: 13px; font-weight: 500; }
.topbar-logout { color: var(--red); font-size: 12px; font-weight: 600; }
.topbar-logout:hover { color: #fca5a5; }

/* ---- Content ---- */
.content {
  flex: 1;
  padding: 32px;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
}

/* ---- Pages ---- */
.page { display: none; }
.page.active { display: block; }

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
}

.page-header h1 {
  font-size: 26px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.3px;
}

.page-subtitle { color: var(--text-dim); font-size: 13px; margin-top: 4px; }
.page-actions { display: flex; gap: 10px; align-items: center; }
.last-updated { font-size: 11px; color: var(--text-dim); }

/* ---- Loading ---- */
.loading-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  color: var(--text-muted);
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-bottom: 14px;
}

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

/* ---- Metric Cards ---- */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: all var(--transition);
}

.metric-card:hover { border-color: var(--border-light); transform: translateY(-1px); box-shadow: var(--shadow-md); }

.metric-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.metric-icon svg { width: 20px; height: 20px; }
.icon-total { background: var(--brand-bg-strong); color: var(--brand); }
.icon-pending { background: var(--blue-bg); color: var(--blue); }
.icon-estimates { background: var(--purple-bg); color: var(--purple); }
.icon-progress { background: var(--orange-bg); color: var(--orange); }
.icon-complete { background: var(--green-bg); color: var(--green); }
.icon-money { background: var(--yellow-bg); color: var(--yellow); }

.metric-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }

.metric-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.metric-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.5px;
  line-height: 1.1;
}

/* ---- Pipeline ---- */
.progress-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}

.progress-section h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.pipeline-bars { display: flex; flex-direction: column; gap: 14px; }

.pipeline-item { display: flex; flex-direction: column; gap: 6px; }

.pipeline-header {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.pipeline-track {
  height: 8px;
  background: var(--bg-hover);
  border-radius: 4px;
  overflow: hidden;
}

.pipeline-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s ease;
}

.fill-blue { background: var(--blue); }
.fill-yellow { background: var(--yellow); }
.fill-purple { background: var(--purple); }
.fill-brand { background: var(--brand); }
.fill-green { background: var(--green); }

/* ---- Charts ---- */
.charts-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.charts-grid-3col {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.chart-card h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 18px;
}

/* ---- Recent Claims Section ---- */
.recent-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}

.recent-section h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.recent-list { display: flex; flex-direction: column; gap: 2px; }

.recent-item {
  display: grid;
  grid-template-columns: 140px 1fr 160px 140px 120px;
  gap: 16px;
  align-items: center;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
  font-size: 13px;
}

.recent-item:hover { background: var(--bg-hover); }
.recent-item .claim-num { color: var(--brand); font-weight: 700; }
.recent-item .name { color: var(--text); }
.recent-item .carrier { color: var(--text-muted); }
.recent-item .date { color: var(--text-dim); font-size: 12px; }

/* ---- Filters ---- */
.filters-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}

.filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 12px;
}

.filters-grid .form-group { margin-bottom: 0; }

/* ---- Table ---- */
.table-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

table { width: 100%; border-collapse: collapse; }

thead tr { background: #161616; border-bottom: 2px solid var(--border); }

th {
  text-align: left;
  padding: 14px 16px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--brand); }
th.sort-asc .sort-icon::after { content: ' ▲'; color: var(--brand); font-size: 10px; }
th.sort-desc .sort-icon::after { content: ' ▼'; color: var(--brand); font-size: 10px; }

td {
  padding: 14px 16px;
  font-size: 13px;
  border-top: 1px solid var(--border);
  white-space: nowrap;
  color: var(--text-secondary);
}

tbody tr { cursor: pointer; transition: background var(--transition); }
tbody tr:hover { background: var(--brand-bg); }
tbody tr:nth-child(even) { background: #121212; }
tbody tr:nth-child(even):hover { background: var(--brand-bg); }

.empty-state { text-align: center; padding: 60px 20px; color: var(--text-dim); font-size: 14px; }

/* ---- Status Badges ---- */
.status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.status-new, .status-default { background: var(--blue-bg); color: var(--blue); }
.status-inspection, .status-scheduled { background: var(--yellow-bg); color: var(--yellow); }
.status-estimate, .status-submitted { background: var(--purple-bg); color: var(--purple); }
.status-approved, .status-complete, .status-completed, .status-signed { background: var(--green-bg); color: var(--green); }
.status-denied, .status-closed { background: var(--red-bg); color: var(--red); }
.status-progress, .status-started { background: var(--brand-bg-strong); color: var(--brand); }

/* ---- Pagination ---- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 4px;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.pagination-buttons { display: flex; align-items: center; gap: 8px; }

/* ======================== MODAL ======================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal {
  background: var(--bg-modal);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%;
  max-width: 820px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7);
  animation: modalIn 0.2s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px 0;
}

.modal-title-group { display: flex; align-items: center; gap: 12px; }
.modal-title-group h2 { font-size: 20px; font-weight: 800; letter-spacing: -0.3px; }

.modal-close {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.modal-close:hover { background: var(--bg-hover); color: var(--text); border-color: var(--border-light); }

.modal-subtitle {
  padding: 8px 28px 0;
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-dot { color: var(--text-dim); }

/* Modal Tabs */
.modal-tabs {
  display: flex;
  gap: 4px;
  padding: 20px 28px 0;
  border-bottom: 1px solid var(--border);
}

.modal-tab {
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font);
  margin-bottom: -1px;
}

.modal-tab:hover { color: var(--text); }
.modal-tab.active { color: var(--brand); border-bottom-color: var(--brand); }

.modal-body {
  overflow-y: auto;
  flex: 1;
}

.modal-tab-content { display: none; padding: 24px 28px; }
.modal-tab-content.active { display: block; }

.modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.modal-section h4 {
  font-size: 11px;
  font-weight: 700;
  color: var(--brand);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

/* ---- Detail Rows (shared modal + old detail) ---- */
.detail-rows { display: flex; flex-direction: column; gap: 10px; }

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  font-size: 13px;
}

.detail-row .label { color: var(--text-muted); flex-shrink: 0; margin-right: 12px; font-weight: 500; }
.detail-row .value { text-align: right; word-break: break-word; font-weight: 600; color: var(--text); }

.notes-text {
  font-size: 13px;
  line-height: 1.8;
  color: var(--text-secondary);
  white-space: pre-wrap;
  background: var(--bg-input);
  padding: 20px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  min-height: 100px;
}

/* ---- Timeline ---- */
.timeline { position: relative; padding-left: 32px; }

.timeline::before {
  content: '';
  position: absolute;
  left: 9px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--border-light);
  border-radius: 2px;
}

.timeline-item { position: relative; padding-bottom: 28px; }
.timeline-item:last-child { padding-bottom: 0; }

.timeline-item::before {
  content: '';
  position: absolute;
  left: -25px;
  top: 5px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--brand);
  border: 3px solid var(--bg-modal);
  box-shadow: 0 0 0 2px var(--brand-bg);
}

.timeline-item.completed::before { background: var(--green); box-shadow: 0 0 0 2px var(--green-bg); }
.timeline-item.pending::before { background: var(--text-dim); box-shadow: 0 0 0 2px rgba(85, 85, 85, 0.15); }

.timeline-title { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.timeline-date { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.timeline-empty { color: var(--text-dim); font-size: 13px; padding: 20px 0; }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ---- Responsive ---- */
@media (max-width: 1200px) {
  .metrics-grid { grid-template-columns: repeat(3, 1fr); }
  .charts-grid-3col { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  .topbar { padding: 0 16px; }
  .topbar-brand { font-size: 14px; margin-right: 16px; }
  .content { padding: 20px 16px; }
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .charts-grid-2col,
  .charts-grid-3col { grid-template-columns: 1fr; }
  .modal { max-width: 100%; margin: 0; border-radius: 12px; max-height: 90vh; }
  .modal-grid { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; gap: 12px; align-items: flex-start; }
  .table-container { overflow-x: auto; }
  .login-card { margin: 16px; padding: 32px 24px; }
  .recent-item { grid-template-columns: 120px 1fr 100px; }
  .recent-item .carrier,
  .recent-item .date { display: none; }
}
