/* ===== Design Tokens ===== */
:root {
  --bg-primary: #0a0e1a;
  --bg-secondary: #0f1525;
  --bg-card: #131929;
  --bg-elevated: #1a2035;
  --border-color: rgba(255,255,255,0.08);
  --accent-primary: #00c9c8;
  --accent-secondary: #7b5cf5;
  --text-primary: #e8edf5;
  --text-secondary: #8892a4;
  --text-muted: #4a5568;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --sidebar-w: 240px;
  --header-h: 60px;
  --radius: 10px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body { font-family: 'Inter', system-ui, sans-serif; background: var(--bg-primary); color: var(--text-primary); min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--accent-primary); text-decoration: none; }
a:hover { opacity: .85; }

/* ===== Layout ===== */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); background: var(--bg-secondary); border-right: 1px solid var(--border-color); display: flex; flex-direction: column; position: fixed; top: 0; left: 0; height: 100vh; overflow-y: auto; z-index: 100; transition: transform .3s; }
.main-wrap { margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-height: 100vh; flex: 1; }
.topbar { height: var(--header-h); background: var(--bg-secondary); border-bottom: 1px solid var(--border-color); display: flex; align-items: center; padding: 0 1.5rem; gap: 1rem; position: sticky; top: 0; z-index: 50; }
.page-content { padding: 2rem 1.75rem; flex: 1; }

/* ===== Sidebar ===== */
.sidebar-brand { padding: 1.25rem 1.25rem 1rem; display: flex; align-items: center; gap: .75rem; border-bottom: 1px solid var(--border-color); }
.sidebar-brand-icon { width: 36px; height: 36px; background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary)); border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; flex-shrink: 0; }
.sidebar-brand-text { font-weight: 700; font-size: .95rem; color: var(--text-primary); line-height: 1.2; }
.sidebar-brand-sub { font-size: .72rem; color: var(--text-muted); font-weight: 400; }
.sidebar-section { padding: 1.25rem 1rem .5rem; }
.sidebar-section-label { font-size: .68rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-muted); margin-bottom: .5rem; padding: 0 .25rem; }
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar-nav a { display: flex; align-items: center; gap: .65rem; padding: .6rem .75rem; border-radius: 8px; color: var(--text-secondary); font-size: .88rem; font-weight: 500; transition: background .15s, color .15s; }
.sidebar-nav a:hover, .sidebar-nav a.active { background: rgba(0,201,200,.1); color: var(--accent-primary); }
.sidebar-nav a svg { width: 17px; height: 17px; flex-shrink: 0; }
.sidebar-footer { margin-top: auto; padding: 1rem; border-top: 1px solid var(--border-color); }
.sidebar-user { display: flex; align-items: center; gap: .65rem; }
.sidebar-avatar { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg,var(--accent-primary),var(--accent-secondary)); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem; color: #000; flex-shrink: 0; }
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: .85rem; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: .72rem; color: var(--text-muted); }

/* ===== Topbar ===== */
.hamburger { display: none; background: none; border: none; cursor: pointer; padding: .35rem; color: var(--text-primary); }
.hamburger span { display: block; width: 22px; height: 2px; background: currentColor; margin: 4px 0; border-radius: 2px; transition: .25s; }
.topbar-title { font-weight: 700; font-size: 1rem; flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: .75rem; margin-left: auto; }

/* ===== Plan badge ===== */
.plan-badge { font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: .2rem .6rem; border-radius: 20px; }
.plan-badge.basic { background: rgba(74,85,104,.25); color: #8892a4; }
.plan-badge.pro { background: rgba(123,92,245,.2); color: #a78bfa; }
.plan-badge.enterprise { background: rgba(0,201,200,.15); color: var(--accent-primary); }

/* ===== Cards ===== */
.card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius); }
.card-body { padding: 1.5rem; }

/* ===== Stats grid ===== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(160px,1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius); padding: 1.25rem; }
.stat-label { font-size: .75rem; color: var(--text-secondary); margin-bottom: .4rem; font-weight: 500; }
.stat-value { font-size: 2rem; font-weight: 800; line-height: 1; color: var(--text-primary); }
.stat-value.accent { color: var(--accent-primary); }
.stat-value.warning { color: var(--warning); }
.stat-value.danger { color: var(--danger); }
.stat-value.success { color: var(--success); }
.stat-sub { font-size: .75rem; color: var(--text-muted); margin-top: .3rem; }

/* ===== Tables ===== */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border-color); }
table { width: 100%; border-collapse: collapse; }
th { background: var(--bg-elevated); text-align: left; padding: .75rem 1rem; font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); border-bottom: 1px solid var(--border-color); }
td { padding: .75rem 1rem; font-size: .88rem; color: var(--text-secondary); border-bottom: 1px solid var(--border-color); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,.02); }
td a { color: var(--text-primary); font-weight: 500; }
td a:hover { color: var(--accent-primary); }

/* ===== Status badges ===== */
.badge { display: inline-flex; align-items: center; gap: .3rem; font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: .25rem .65rem; border-radius: 20px; white-space: nowrap; }
.badge.received { background: rgba(59,130,246,.15); color: #60a5fa; }
.badge.under_review, .badge.fraud_check { background: rgba(245,158,11,.15); color: #fbbf24; }
.badge.approved { background: rgba(34,197,94,.15); color: #4ade80; }
.badge.settled { background: rgba(0,201,200,.15); color: var(--accent-primary); }
.badge.declined, .badge.rejected { background: rgba(239,68,68,.15); color: #f87171; }
.badge.closed { background: rgba(74,85,104,.2); color: #8892a4; }
.badge.pending { background: rgba(245,158,11,.12); color: #fbbf24; }
.badge.active { background: rgba(34,197,94,.12); color: #4ade80; }
.badge.suspended { background: rgba(239,68,68,.12); color: #f87171; }
.badge.basic { background: rgba(74,85,104,.2); color: #8892a4; }
.badge.pro { background: rgba(123,92,245,.15); color: #a78bfa; }
.badge.enterprise { background: rgba(0,201,200,.12); color: var(--accent-primary); }
.badge.low { background: rgba(34,197,94,.12); color: #4ade80; }
.badge.medium { background: rgba(59,130,246,.12); color: #60a5fa; }
.badge.high { background: rgba(245,158,11,.15); color: #fbbf24; }
.badge.critical { background: rgba(239,68,68,.15); color: #f87171; }

/* ===== Fraud score bar ===== */
.fraud-bar { display: flex; align-items: center; gap: .5rem; }
.fraud-bar-track { flex: 1; height: 6px; background: var(--bg-elevated); border-radius: 3px; overflow: hidden; }
.fraud-bar-fill { height: 100%; border-radius: 3px; }
.fraud-bar-fill.low { background: var(--success); }
.fraud-bar-fill.med { background: var(--warning); }
.fraud-bar-fill.high { background: var(--danger); }

/* ===== Buttons ===== */
.btn { display: inline-flex; align-items: center; gap: .45rem; padding: .55rem 1.1rem; border-radius: 8px; font-size: .88rem; font-weight: 600; cursor: pointer; border: none; transition: opacity .15s, transform .1s; white-space: nowrap; text-decoration: none; }
.btn:hover { opacity: .88; transform: translateY(-1px); }
.btn-primary { background: var(--accent-primary); color: #000; }
.btn-secondary { background: var(--bg-elevated); color: var(--text-primary); border: 1px solid var(--border-color); }
.btn-danger { background: rgba(239,68,68,.15); color: #f87171; border: 1px solid rgba(239,68,68,.3); }
.btn-success { background: rgba(34,197,94,.15); color: #4ade80; border: 1px solid rgba(34,197,94,.3); }
.btn-sm { padding: .35rem .75rem; font-size: .8rem; }

/* ===== Forms ===== */
.form-group { margin-bottom: 1.25rem; }
label { display: block; font-size: .83rem; font-weight: 600; color: var(--text-secondary); margin-bottom: .4rem; }
input, select, textarea { width: 100%; background: var(--bg-elevated); border: 1px solid var(--border-color); border-radius: 8px; color: var(--text-primary); font-size: .9rem; padding: .65rem .85rem; font-family: inherit; transition: border-color .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent-primary); }
textarea { resize: vertical; min-height: 90px; }
select option { background: var(--bg-secondary); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-error { background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.3); color: #f87171; padding: .75rem 1rem; border-radius: 8px; font-size: .88rem; margin-bottom: 1.25rem; }
.form-success { background: rgba(34,197,94,.1); border: 1px solid rgba(34,197,94,.3); color: #4ade80; padding: .75rem 1rem; border-radius: 8px; font-size: .88rem; margin-bottom: 1.25rem; }

/* ===== Page header ===== */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.75rem; flex-wrap: wrap; gap: 1rem; }
.page-header h1 { font-size: 1.5rem; font-weight: 800; }
.page-sub { font-size: .85rem; color: var(--text-muted); margin-top: .2rem; }

/* ===== Filter bar ===== */
.filter-bar { display: flex; gap: .75rem; flex-wrap: wrap; margin-bottom: 1.5rem; align-items: center; }
.filter-bar input, .filter-bar select { width: auto; min-width: 140px; }

/* ===== Claim detail layout ===== */
.detail-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 1.5rem; }
.detail-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; }
.detail-field label { font-size: .75rem; color: var(--text-muted); margin-bottom: .2rem; }
.detail-field .val { font-size: .95rem; color: var(--text-primary); font-weight: 500; }

/* ===== Activity feed ===== */
.activity-feed { display: flex; flex-direction: column; gap: .75rem; }
.activity-item { display: flex; gap: .75rem; align-items: flex-start; font-size: .85rem; }
.activity-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-primary); margin-top: .35rem; flex-shrink: 0; }
.activity-time { font-size: .75rem; color: var(--text-muted); }

/* ===== Auth pages ===== */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg-primary); padding: 2rem; }
.auth-card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 16px; padding: 2.5rem; width: 100%; max-width: 420px; }
.auth-logo { text-align: center; margin-bottom: 2rem; }
.auth-logo-icon { width: 52px; height: 52px; background: linear-gradient(135deg,var(--accent-primary),var(--accent-secondary)); border-radius: 13px; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; margin: 0 auto 1rem; }
.auth-title { font-size: 1.5rem; font-weight: 800; text-align: center; margin-bottom: .4rem; }
.auth-sub { text-align: center; font-size: .88rem; color: var(--text-secondary); margin-bottom: 2rem; }

/* ===== Overlay sidebar for mobile ===== */
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.65); z-index: 99; }
@media(max-width:768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .main-wrap { margin-left: 0; }
  .hamburger { display: block; }
  .stats-grid { grid-template-columns: repeat(2,1fr); }
  .detail-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .page-content { padding: 1.25rem 1rem; }
}
