/* ── Reset & Base ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0f1923;
  --bg2:       #17212b;
  --surface:   #1e2d3d;
  --card:      #243447;
  --border:    rgba(255,255,255,0.08);
  --accent:    #4a90d9;
  --accent2:   #64b5f6;
  --accent-glow: rgba(74,144,217,0.15);
  --text:      #e8edf2;
  --text2:     #8fa3b8;
  --text3:     #5a7a96;
  --green:     #3db88a;
  --green-bg:  rgba(61,184,138,0.1);
  --amber:     #f0a030;
  --amber-bg:  rgba(240,160,48,0.1);
  --red:       #e05555;
  --red-bg:    rgba(224,85,85,0.1);
  --radius:    10px;
  --radius-lg: 14px;
  --sidebar-w: 240px;
  --topbar-h:  56px;
  --shadow:    0 2px 12px rgba(0,0,0,0.3);
}

html { font-size: 15px; }
body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

/* ── Layout ───────────────────────────────────────────────────────── */
.layout-authenticated { display: flex; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  transition: transform 0.25s ease;
}

.main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Sidebar ──────────────────────────────────────────────────────── */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--border);
}
.logo-icon { font-size: 22px; }
.logo-text  { font-size: 17px; font-weight: 700; color: var(--text); letter-spacing: -0.3px; }

.sidebar-nav {
  flex: 1;
  padding: 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: var(--text2);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.nav-link svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; flex-shrink: 0; }
.nav-link:hover { background: var(--surface); color: var(--text); }
.nav-link.active { background: var(--accent-glow); color: var(--accent2); }
.nav-link.active svg { stroke: var(--accent2); }

.sidebar-footer {
  padding: 12px 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 4px;
}
.user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.user-name { font-size: 13px; font-weight: 600; color: var(--text); }
.user-role { font-size: 11px; color: var(--text3); }

/* ── Language switcher ────────────────────────────────────────────── */
.lang-buttons {
  display: flex;
  gap: 4px;
}
.lang-btn {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text2);
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}
.lang-btn:hover { background: var(--card); color: var(--text); }
.lang-btn.active { background: var(--accent-glow); border-color: var(--accent); color: var(--accent2); }

.logout-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius);
  color: var(--red);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s;
}
.logout-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }
.logout-btn:hover { background: var(--red-bg); }

/* ── Topbar ───────────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  position: sticky; top: 0; z-index: 100;
}
.sidebar-toggle {
  display: none;
  background: none; border: none; cursor: pointer;
  color: var(--text2); padding: 4px;
}
.sidebar-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; }
.topbar-title { font-size: 16px; font-weight: 700; color: var(--text); flex: 1; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }

/* ── Main content ─────────────────────────────────────────────────── */
.main-content {
  flex: 1;
  padding: 20px;
  max-width: 1280px;
}

/* ── Cards & Grid ─────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
}

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }

/* ── Stat cards ───────────────────────────────────────────────────── */
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
}
.stat-label { font-size: 11px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 6px; }
.stat-value { font-size: 26px; font-weight: 700; color: var(--text); letter-spacing: -0.5px; }
.stat-sub { font-size: 12px; color: var(--text3); margin-top: 4px; }
.stat-value.green { color: var(--green); }
.stat-value.amber { color: var(--amber); }
.stat-value.red   { color: var(--red); }

/* ── Balance card ─────────────────────────────────────────────────── */
.balance-card {
  background: linear-gradient(135deg, #163354, #1a4a7a);
  border: 1px solid rgba(100,181,246,0.15);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  position: relative;
  overflow: hidden;
}
.balance-card::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 160px; height: 160px;
  border-radius: 50%;
  background: rgba(100,181,246,0.05);
}
.balance-label { font-size: 12px; color: var(--accent2); opacity: 0.8; margin-bottom: 6px; }
.balance-amount { font-size: 38px; font-weight: 800; color: #fff; letter-spacing: -1px; }
.balance-row { display: flex; gap: 12px; margin-top: 16px; }
.balance-mini {
  flex: 1;
  background: rgba(255,255,255,0.07);
  border-radius: 8px;
  padding: 10px 12px;
}
.bm-label { font-size: 10px; color: rgba(255,255,255,0.45); margin-bottom: 3px; }
.bm-val   { font-size: 15px; font-weight: 700; color: #fff; }
.bm-val.g { color: var(--green); }
.bm-val.a { color: var(--amber); }

/* ── Quick action buttons ─────────────────────────────────────────── */
.qa-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.qa-btn {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 8px 12px;
  text-align: center;
  text-decoration: none;
  transition: background 0.15s, transform 0.1s;
  cursor: pointer; display: block;
}
.qa-btn:hover { background: var(--surface); transform: translateY(-1px); }
.qa-btn:active { transform: scale(0.98); }
.qa-icon { font-size: 24px; margin-bottom: 6px; }
.qa-label { font-size: 12px; color: var(--text2); font-weight: 500; }

/* ── Tables ───────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; }
thead { background: var(--surface); }
th {
  padding: 11px 14px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text3);
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
td {
  padding: 11px 14px;
  font-size: 13px;
  color: var(--text);
  border-top: 1px solid var(--border);
}
tr:hover td { background: rgba(255,255,255,0.02); }
.td-muted { color: var(--text2); }

/* ── Badges / Status ──────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.badge-green   { background: var(--green-bg);  color: var(--green); }
.badge-amber   { background: var(--amber-bg);  color: var(--amber); }
.badge-red     { background: var(--red-bg);    color: var(--red); }
.badge-blue    { background: var(--accent-glow); color: var(--accent2); }
.badge-gray    { background: rgba(255,255,255,0.06); color: var(--text2); }

/* ── Forms ────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--text2); margin-bottom: 5px; }
.form-input, .form-select, .form-textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 12px;
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--accent); }
.form-input::placeholder { color: var(--text3); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

.form-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-bottom: 14px;
}
.form-section-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 600; color: var(--text);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.step-num {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: #fff; font-weight: 700; flex-shrink: 0;
}
.step-num.done { background: var(--green); }
.step-num.inactive { background: var(--surface); color: var(--text3); }

/* ── Buttons ──────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px; border-radius: var(--radius);
  font-size: 13px; font-weight: 600;
  border: none; cursor: pointer; text-decoration: none;
  transition: opacity 0.15s, transform 0.1s;
  white-space: nowrap;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.5; }

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #3a7bc8; }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { background: #2ea070; }
.btn-danger  { background: var(--red); color: #fff; }
.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text2);
}
.btn-outline:hover { background: var(--surface); color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-full { width: 100%; justify-content: center; padding: 11px; font-size: 14px; }

/* ── Reminder & timeline items ────────────────────────────────────── */
.reminder-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card);
  margin-bottom: 8px;
  transition: background 0.15s;
  text-decoration: none; color: inherit;
}
.reminder-item:hover { background: var(--surface); }
.dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.dot-red   { background: var(--red); }
.dot-amber { background: var(--amber); }
.dot-green { background: var(--green); }
.dot-blue  { background: var(--accent2); }

.ri-info { flex: 1; min-width: 0; }
.ri-name { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ri-sub  { font-size: 11px; color: var(--text2); margin-top: 1px; }
.ri-badge { flex-shrink: 0; }

/* Timeline */
.tl-item { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.tl-item:last-child { border-bottom: none; }
.tl-dot-col { display: flex; flex-direction: column; align-items: center; }
.tl-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }
.tl-line { width: 1px; background: var(--border); flex: 1; margin-top: 5px; min-height: 16px; }
.tl-action { font-size: 13px; color: var(--text); }
.tl-time   { font-size: 11px; color: var(--text3); margin-top: 2px; }

/* ── Alert messages ───────────────────────────────────────────────── */
.messages { margin-bottom: 16px; }
.alert {
  display: flex; justify-content: space-between; align-items: center;
  padding: 11px 14px; border-radius: var(--radius); font-size: 13px; margin-bottom: 8px;
}
.alert button { background: none; border: none; cursor: pointer; color: inherit; font-size: 16px; }
.alert-success { background: var(--green-bg); color: var(--green); border: 1px solid rgba(61,184,138,0.2); }
.alert-error, .alert-danger { background: var(--red-bg); color: var(--red); border: 1px solid rgba(224,85,85,0.2); }
.alert-warning { background: var(--amber-bg); color: var(--amber); border: 1px solid rgba(240,160,48,0.2); }
.alert-info { background: var(--accent-glow); color: var(--accent2); border: 1px solid rgba(74,144,217,0.2); }

/* ── Found card (insurance form) ──────────────────────────────────── */
.found-card {
  background: var(--green-bg);
  border: 1px solid rgba(61,184,138,0.25);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-top: 10px;
}
.found-label { font-size: 11px; color: var(--green); margin-bottom: 4px; font-weight: 600; }
.found-name  { font-size: 15px; color: var(--text); font-weight: 700; }
.found-phone { font-size: 12px; color: var(--text2); }
.bounty-banner {
  background: var(--amber-bg);
  border: 1px solid rgba(240,160,48,0.25);
  border-radius: var(--radius);
  padding: 10px 14px;
  display: flex; align-items: center; gap: 10px;
  margin-top: 10px;
}
.bounty-text { font-size: 12px; color: var(--amber); font-weight: 500; }

/* ── Search bar ───────────────────────────────────────────────────── */
.search-bar {
  display: flex; align-items: center; gap: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  margin-bottom: 14px;
}
.search-bar svg { width: 16px; height: 16px; fill: none; stroke: var(--text3); stroke-width: 2; flex-shrink: 0; }
.search-bar input { background: none; border: none; outline: none; color: var(--text); font-size: 14px; width: 100%; }
.search-bar input::placeholder { color: var(--text3); }

/* ── Pagination ───────────────────────────────────────────────────── */
.pagination { display: flex; gap: 4px; align-items: center; margin-top: 16px; justify-content: center; }
.page-btn {
  min-width: 32px; height: 32px; border-radius: 6px;
  background: var(--card); border: 1px solid var(--border);
  color: var(--text2); font-size: 13px; font-weight: 500;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  text-decoration: none; transition: all 0.15s;
}
.page-btn:hover { background: var(--surface); color: var(--text); }
.page-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Login page ───────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
}
.login-card {
  width: 100%; max-width: 380px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
}
.login-logo { text-align: center; margin-bottom: 24px; }
.login-logo-icon { font-size: 40px; }
.login-logo-text { font-size: 22px; font-weight: 800; color: var(--text); margin-top: 6px; }
.login-sub { font-size: 13px; color: var(--text3); margin-top: 4px; }
.login-lang { display: flex; gap: 6px; justify-content: center; margin-top: 20px; }

/* ── Empty state ──────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text2); }
.empty-icon  { font-size: 44px; margin-bottom: 12px; }
.empty-title { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.empty-text  { font-size: 13px; color: var(--text3); }

/* ── Section header ───────────────────────────────────────────────── */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.section-title { font-size: 13px; font-weight: 700; color: var(--text2); text-transform: uppercase; letter-spacing: 0.06em; }

/* ── Profile avatar ───────────────────────────────────────────────── */
.avatar {
  border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; flex-shrink: 0;
}
.avatar-sm { width: 32px; height: 32px; font-size: 12px; }
.avatar-md { width: 40px; height: 40px; font-size: 15px; }
.avatar-lg { width: 56px; height: 56px; font-size: 20px; }

/* ── Responsive ───────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,0.4); }
  .main-wrapper { margin-left: 0; }
  .sidebar-toggle { display: flex; }
  .grid-4 { grid-template-columns: repeat(2,1fr); }
  .qa-grid { grid-template-columns: repeat(2,1fr); }
  .form-row { grid-template-columns: 1fr; }
  .form-row-3 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .grid-2, .grid-3, .balance-row { grid-template-columns: 1fr; flex-direction: column; }
  .balance-row { display: flex; flex-direction: column; }
  .main-content { padding: 14px; }
}
