/* =====================================================================
   ClaimFlow – design system
   Hand-authored component layer. Tailwind utilities (assets/css/tailwind.css)
   load first as the utility layer; this file is the theme + component layer.
   ===================================================================== */

:root {
  --bg: #f5f6fb;
  --bg-soft: #eef0f8;
  --surface: #ffffff;
  --surface-2: #fafbfe;
  --surface-3: #f1f3fa;
  --border: #e5e8f2;
  --border-strong: #d6dbe9;
  --text: #182035;
  --text-2: #4a5470;
  --muted: #858da6;
  --primary: #4f46e5;
  --primary-2: #7c6cf5;
  --primary-soft: #eeedff;
  --accent: #0ea5e9;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --purple: #8b5cf6;
  --teal: #14b8a6;
  --shadow-sm: 0 1px 2px rgba(20, 28, 55, .05), 0 2px 8px rgba(20, 28, 55, .04);
  --shadow: 0 4px 14px rgba(22, 30, 62, .07), 0 14px 34px rgba(22, 30, 62, .06);
  --shadow-lg: 0 22px 60px rgba(18, 24, 55, .18);
  --radius: 14px;
  --radius-sm: 9px;
  --sidebar-w: 256px;
  --sidebar-collapsed: 78px;
  --font: "Inter", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --transition: .22s cubic-bezier(.4, 0, .2, 1);
}

html[data-theme="dark"] {
  --bg: #0d1120;
  --bg-soft: #11162a;
  --surface: #171d31;
  --surface-2: #1c2339;
  --surface-3: #222b43;
  --border: #2a3350;
  --border-strong: #374260;
  --text: #eef1fb;
  --text-2: #b6bfd8;
  --muted: #8590b0;
  --primary: #8b83ff;
  --primary-2: #a99fff;
  --primary-soft: #2a2854;
  --accent: #38bdf8;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 10px 30px rgba(0, 0, 0, .28);
  --shadow-lg: 0 22px 60px rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg); color: var(--text); font-family: var(--font);
  font-size: 14px; line-height: 1.55; -webkit-font-smoothing: antialiased;
  transition: background var(--transition), color var(--transition);
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-2); }
h1, h2, h3, h4, h5 { margin: 0; font-weight: 700; letter-spacing: -.02em; color: var(--text); }
p { margin: 0 0 12px; }
small { font-size: 12px; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; }
::selection { background: var(--primary); color: #fff; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.icon { width: 18px; height: 18px; flex: 0 0 auto; }
.icon--sm { width: 15px; height: 15px; }
.icon--lg { width: 22px; height: 22px; }

/* -------------------------------- layout -------------------------------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w); position: fixed; inset: 0 auto 0 0;
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; z-index: 40;
  transition: width var(--transition), transform var(--transition), background var(--transition);
}
.sidebar__brand { display: flex; align-items: center; gap: 11px; padding: 20px 20px 16px; min-height: 76px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px; flex: 0 0 auto;
  background: linear-gradient(140deg, var(--primary) 0%, #8b5cf6 55%, #0ea5e9 100%);
  display: grid; place-items: center; color: #fff; box-shadow: 0 7px 18px rgba(79, 70, 229, .35);
}
.brand-mark svg { width: 21px; height: 21px; }
.brand-text { font-size: 19px; font-weight: 800; letter-spacing: -.04em; white-space: nowrap; }
.brand-text small { display: block; font-size: 9.5px; letter-spacing: .13em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-top: -2px; }
.sidebar__scroll { flex: 1; overflow-y: auto; padding: 6px 12px 20px; scrollbar-width: thin; }
.nav-label { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 700; padding: 18px 12px 8px; white-space: nowrap; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin: 2px 0;
  border-radius: 10px; color: var(--text-2); font-weight: 600; font-size: 13.5px;
  transition: background var(--transition), color var(--transition), transform var(--transition);
  white-space: nowrap; position: relative;
}
.nav-item .icon { width: 18px; height: 18px; opacity: .85; }
.nav-item:hover { background: var(--surface-3); color: var(--text); transform: translateX(2px); }
.nav-item.is-active { background: var(--primary-soft); color: var(--primary); }
.nav-item.is-active:before { content: ''; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--primary); }
.nav-item__badge { margin-left: auto; background: var(--danger); color: #fff; font-size: 10px; font-weight: 800; border-radius: 99px; min-width: 19px; height: 19px; display: grid; place-items: center; padding: 0 5px; }
.nav-item__text { overflow: hidden; text-overflow: ellipsis; }
.sidebar__footer { padding: 14px; border-top: 1px solid var(--border); }
.sidebar__help { background: linear-gradient(145deg, var(--primary-soft), var(--surface-3)); border: 1px solid var(--border); border-radius: 12px; padding: 13px; }
.sidebar__help b { display: block; font-size: 12.5px; margin-bottom: 3px; }
.sidebar__help p { font-size: 11.5px; color: var(--muted); margin: 0 0 9px; }
.sidebar__driver { display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--muted); padding: 10px 12px 0; }
.sidebar__driver .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px rgba(16, 185, 129, .15); }

.main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); transition: margin-left var(--transition); }
.topbar {
  height: 70px; position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px;
  padding: 0 26px; background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(14px); border-bottom: 1px solid var(--border);
}
.content { padding: 26px 26px 60px; max-width: 1600px; margin: 0 auto; }
.content--narrow { max-width: 1100px; }

.sidebar--collapsed { width: var(--sidebar-collapsed); flex-basis: var(--sidebar-collapsed); }
.sidebar--collapsed .nav-item__text, .sidebar--collapsed .brand-text,
.sidebar--collapsed .nav-label, .sidebar--collapsed .sidebar__footer,
.sidebar--collapsed .sidebar__driver span, .sidebar--collapsed .nav-item__badge { display: none; }
.sidebar--collapsed .nav-label { padding: 8px 0; height: 1px; overflow: hidden; }
.sidebar--collapsed .nav-item { justify-content: center; padding: 12px 0; }
.sidebar--collapsed .nav-item.is-active:before { left: -12px; }
.sidebar--collapsed .sidebar__brand { justify-content: center; padding: 20px 0 16px; }
.sidebar--collapsed + .main { margin-left: var(--sidebar-collapsed); }

/* ------------------------------- topbar --------------------------------- */
.icon-btn {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-2); display: inline-grid; place-items: center;
  cursor: pointer; transition: all var(--transition); position: relative; flex: 0 0 auto;
}
.icon-btn:hover { background: var(--surface-3); color: var(--primary); border-color: var(--border-strong); transform: translateY(-1px); }
.icon-btn .ping { position: absolute; top: 6px; right: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); border: 2px solid var(--surface); }
.icon-btn__count { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 99px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 800; display: grid; place-items: center; border: 2px solid var(--surface); }
.search-wrap { position: relative; flex: 1; max-width: 420px; }
.search-wrap .icon { position: absolute; left: 13px; top: 11px; color: var(--muted); width: 16px; height: 16px; }
.search-input {
  width: 100%; height: 38px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); padding: 0 62px 0 38px; font-size: 13px;
  font-family: var(--font); transition: all var(--transition);
}
.search-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); background: var(--surface); }
.search-kbd { position: absolute; right: 10px; top: 8px; font-size: 10px; color: var(--muted); border: 1px solid var(--border); border-radius: 5px; padding: 2px 6px; background: var(--surface); }
.search-results {
  position: absolute; top: 46px; left: 0; right: 0; background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg);
  padding: 6px; z-index: 60; max-height: 380px; overflow-y: auto;
}
.search-result { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 9px; color: var(--text); }
.search-result:hover { background: var(--surface-3); }
.search-result__icon { width: 32px; height: 32px; border-radius: 9px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; flex: 0 0 auto; }
.search-result b { display: block; font-size: 13px; }
.search-result small { color: var(--muted); display: block; font-size: 11px; }
.search-result__tag { margin-left: auto; font-size: 10px; color: var(--muted); background: var(--surface-3); padding: 3px 7px; border-radius: 6px; }

.topbar__spacer { flex: 1; }
.topbar__title { font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dropdown { position: relative; }
.dropdown__panel {
  position: absolute; right: 0; top: 48px; width: 340px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg);
  z-index: 70; overflow: hidden; animation: pop .18s ease both;
}
.dropdown__panel--sm { width: 230px; }
.dropdown__head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.dropdown__head b { font-size: 13.5px; }
.dropdown__body { max-height: 340px; overflow-y: auto; }
.dropdown__foot { padding: 10px 14px; border-top: 1px solid var(--border); text-align: center; font-size: 12px; }
.notif-item { display: flex; gap: 11px; padding: 12px 15px; border-bottom: 1px solid var(--border); color: var(--text); transition: background var(--transition); }
.notif-item:hover { background: var(--surface-2); }
.notif-item.is-unread { background: color-mix(in srgb, var(--primary-soft) 45%, var(--surface)); }
.notif-item__icon { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex: 0 0 auto; }
.notif-item__body { min-width: 0; flex: 1; }
.notif-item__body b { font-size: 12.5px; display: block; }
.notif-item__body p { font-size: 11.5px; color: var(--text-2); margin: 2px 0 3px; line-height: 1.4; }
.notif-item__body small { color: var(--muted); font-size: 10.5px; }
.profile-trigger { display: flex; align-items: center; gap: 10px; padding: 4px 8px 4px 4px; border-radius: 10px; border: 1px solid transparent; background: transparent; cursor: pointer; color: var(--text); font-family: var(--font); }
.profile-trigger:hover { background: var(--surface-3); border-color: var(--border); }
.profile-trigger__name { text-align: left; line-height: 1.2; }
.profile-trigger__name b { display: block; font-size: 12.5px; }
.profile-trigger__name small { color: var(--muted); font-size: 10.5px; }
.menu-item { display: flex; align-items: center; gap: 10px; padding: 9px 14px; font-size: 13px; color: var(--text-2); width: 100%; border: 0; background: none; cursor: pointer; text-align: left; font-family: var(--font); }
.menu-item:hover { background: var(--surface-3); color: var(--text); }
.menu-item--danger { color: var(--danger); }
.menu-sep { height: 1px; background: var(--border); margin: 5px 0; }

.avatar { width: 34px; height: 34px; border-radius: 10px; background: var(--avatar-bg, var(--primary)); color: #fff; display: inline-grid; place-items: center; font-size: 12px; font-weight: 800; letter-spacing: .02em; flex: 0 0 auto; }
.avatar--sm { width: 28px; height: 28px; border-radius: 8px; font-size: 10.5px; }
.avatar--lg { width: 46px; height: 46px; border-radius: 13px; font-size: 16px; }

/* ------------------------------ page head -------------------------------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 25px; letter-spacing: -.035em; }
.page-head p { color: var(--muted); font-size: 13px; margin: 5px 0 0; }
.page-head__actions { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }
.eyebrow { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--primary); font-weight: 800; margin-bottom: 6px; }

/* -------------------------------- cards --------------------------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); transition: box-shadow var(--transition), transform var(--transition), background var(--transition); }
.card:hover { box-shadow: var(--shadow); }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.card__head h3 { font-size: 15px; }
.card__head p { color: var(--muted); font-size: 12px; margin: 3px 0 0; }
.card__body { padding: 20px; }
.card__body--tight { padding: 0; }
.card__foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.grid { display: grid; gap: 16px; }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid--main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.stack { display: flex; flex-direction: column; gap: 16px; }

.stat { position: relative; overflow: hidden; padding: 18px 20px; }
.stat:before { content: ''; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%; background: var(--stat-soft, var(--primary-soft)); opacity: .55; }
.stat__top { display: flex; align-items: center; justify-content: space-between; position: relative; }
.stat__icon { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--stat-soft, var(--primary-soft)); color: var(--stat-color, var(--primary)); }
.stat__label { font-size: 11.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; margin-top: 14px; position: relative; }
.stat__value { font-size: 25px; font-weight: 800; letter-spacing: -.045em; line-height: 1.2; margin-top: 3px; position: relative; }
.stat__meta { font-size: 11.5px; color: var(--muted); margin-top: 7px; position: relative; display: flex; align-items: center; gap: 6px; }
.trend { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; color: var(--success); }
.trend--down { color: var(--danger); }

.hero {
  background: linear-gradient(120deg, #4f46e5 0%, #6d5ce7 48%, #0ea5e9 100%);
  border-radius: 18px; color: #fff; padding: 24px 26px; position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 20px;
  box-shadow: 0 16px 38px rgba(79, 70, 229, .24);
}
.hero:after { content: ''; position: absolute; width: 320px; height: 320px; border-radius: 50%; border: 45px solid rgba(255,255,255,.09); right: -90px; top: -160px; }
.hero:before { content: ''; position: absolute; width: 210px; height: 210px; border-radius: 50%; background: rgba(255,255,255,.07); right: 100px; bottom: -160px; }
.hero h2 { color: #fff; font-size: 22px; letter-spacing: -.03em; }
.hero p { color: rgba(255,255,255,.82); font-size: 13px; margin: 7px 0 0; max-width: 560px; }
.hero__actions { display: flex; gap: 9px; position: relative; z-index: 2; }
.hero .btn--light { background: #fff; color: #3730a3; border-color: #fff; }
.hero .btn--ghost-light { background: rgba(255,255,255,.14); color: #fff; border-color: rgba(255,255,255,.4); }

.chart-box { position: relative; height: 260px; }
.chart-box--sm { height: 210px; }
.chart-box canvas { width: 100% !important; height: 100% !important; }
.chart-fallback { display: flex; align-items: flex-end; gap: 8px; height: 100%; padding-top: 14px; }
.chart-fallback__bar { flex: 1; background: linear-gradient(180deg, var(--primary-2), var(--primary)); border-radius: 6px 6px 0 0; min-height: 4px; position: relative; }
.chart-fallback__bar span { position: absolute; bottom: -22px; left: 0; right: 0; text-align: center; font-size: 9px; color: var(--muted); white-space: nowrap; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 18px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--text-2); }
.chart-legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }

/* ------------------------------- buttons -------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 15px; border-radius: 10px; border: 1px solid transparent;
  background: var(--primary); color: #fff; font-size: 13px; font-weight: 650;
  font-family: var(--font); cursor: pointer; white-space: nowrap;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition), border-color var(--transition), color var(--transition);
}
.btn:hover { color: #fff; transform: translateY(-1px); box-shadow: 0 8px 18px rgba(79, 70, 229, .25); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .6; cursor: not-allowed; transform: none; box-shadow: none; }
.btn--secondary { background: var(--surface); color: var(--text-2); border-color: var(--border-strong); }
.btn--secondary:hover { color: var(--primary); background: var(--surface-3); box-shadow: var(--shadow-sm); }
.btn--ghost { background: transparent; color: var(--text-2); border-color: transparent; }
.btn--ghost:hover { background: var(--surface-3); color: var(--primary); box-shadow: none; }
.btn--danger { background: var(--danger); }
.btn--danger:hover { box-shadow: 0 8px 18px rgba(239, 68, 68, .25); }
.btn--success { background: var(--success); }
.btn--outline-danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.btn--outline-danger:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); color: var(--danger); box-shadow: none; }
.btn--sm { height: 31px; padding: 0 11px; font-size: 12px; border-radius: 8px; }
.btn--xs { height: 27px; padding: 0 9px; font-size: 11px; border-radius: 7px; gap: 5px; }
.btn--block { width: 100%; }
.btn .icon { width: 16px; height: 16px; }
.btn.is-loading { pointer-events: none; opacity: .75; }
.btn.is-loading .icon { animation: spin 1s linear infinite; }
.spinner { width: 15px; height: 15px; border-radius: 50%; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; animation: spin .7s linear infinite; display: inline-block; }
.btn--secondary .spinner { border-color: var(--border-strong); border-top-color: var(--primary); }

.btn-group { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.link-btn { border: 0; background: none; color: var(--primary); cursor: pointer; font: inherit; font-size: 12px; font-weight: 600; padding: 0; }
.link-btn:hover { text-decoration: underline; }
.link-btn--danger { color: var(--danger); }

/* ------------------------------- badges --------------------------------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; font-size: 11px; font-weight: 700; white-space: nowrap; line-height: 1.4; }
.badge__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge--info { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.badge--warning { background: color-mix(in srgb, var(--warning) 16%, transparent); color: #b45309; }
.badge--success { background: color-mix(in srgb, var(--success) 14%, transparent); color: #059669; }
.badge--danger { background: color-mix(in srgb, var(--danger) 13%, transparent); color: #dc2626; }
.badge--purple { background: color-mix(in srgb, var(--purple) 14%, transparent); color: #7c3aed; }
.badge--teal { background: color-mix(in srgb, var(--teal) 14%, transparent); color: #0d9488; }
.badge--neutral { background: var(--surface-3); color: var(--text-2); }
html[data-theme="dark"] .badge--warning { color: #fbbf24; }
html[data-theme="dark"] .badge--success { color: #34d399; }
html[data-theme="dark"] .badge--danger { color: #f87171; }
html[data-theme="dark"] .badge--purple { color: #c4b5fd; }
html[data-theme="dark"] .badge--teal { color: #2dd4bf; }

/* -------------------------------- tables -------------------------------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data thead th {
  text-align: left; font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase;
  color: var(--muted); font-weight: 700; padding: 12px 16px; background: var(--surface-2);
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.data th a { color: inherit; }
table.data th a:hover { color: var(--primary); }
table.data tbody td { padding: 13px 16px; border-bottom: 1px solid var(--border); color: var(--text-2); vertical-align: middle; }
table.data tbody tr { transition: background var(--transition); }
table.data tbody tr:hover { background: var(--surface-2); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data .primary-cell { color: var(--text); font-weight: 650; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data .nowrap { white-space: nowrap; }
table.data td .sub { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.row-actions { display: flex; gap: 5px; justify-content: flex-end; }
.table-scroll { width: 100%; overflow-x: auto; }
.table-empty { padding: 48px 20px; text-align: center; }
.table-empty__icon { width: 58px; height: 58px; border-radius: 16px; background: var(--surface-3); color: var(--muted); display: grid; place-items: center; margin: 0 auto 14px; }
.table-empty h3 { font-size: 15px; margin-bottom: 5px; }
.table-empty p { color: var(--muted); font-size: 12.5px; margin-bottom: 16px; }

.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.pagination__info { color: var(--muted); font-size: 12px; }
.pagination__links { display: flex; gap: 5px; }
.page-link { min-width: 32px; height: 32px; padding: 0 9px; border-radius: 8px; border: 1px solid var(--border); display: inline-grid; place-items: center; font-size: 12px; color: var(--text-2); background: var(--surface); font-weight: 600; }
.page-link:hover { border-color: var(--primary); color: var(--primary); }
.page-link.is-active { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-link.is-disabled { opacity: .4; pointer-events: none; }

/* -------------------------------- forms --------------------------------- */
.field { margin-bottom: 16px; }
.field label, .form-label { display: block; font-size: 12px; font-weight: 650; color: var(--text-2); margin-bottom: 6px; }
.field label .req { color: var(--danger); }
.input, .select, .textarea {
  width: 100%; border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text); border-radius: 10px; padding: 9px 12px; font-size: 13px;
  font-family: var(--font); transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
  min-height: 40px;
}
.textarea { min-height: 100px; resize: vertical; line-height: 1.55; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.input::placeholder, .textarea::placeholder { color: var(--muted); opacity: .8; }
.input.is-invalid, .select.is-invalid { border-color: var(--danger); }
.field__error { color: var(--danger); font-size: 11.5px; margin-top: 5px; display: block; }
.field__hint { color: var(--muted); font-size: 11px; margin-top: 5px; display: block; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.form-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-section { border-top: 1px solid var(--border); padding-top: 20px; margin-top: 8px; }
.form-section h3 { font-size: 13px; margin-bottom: 4px; }
.form-section p { color: var(--muted); font-size: 12px; margin-bottom: 16px; }
.form-actions { display: flex; gap: 9px; justify-content: flex-end; padding-top: 16px; border-top: 1px solid var(--border); margin-top: 20px; flex-wrap: wrap; }

.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; padding: 16px 18px; border-bottom: 1px solid var(--border); background: var(--surface-2); border-radius: var(--radius) var(--radius) 0 0; }
.filter-bar .field { margin: 0; min-width: 145px; flex: 1 1 145px; }
.filter-bar .field--search { flex: 2 1 220px; }
.filter-bar .btn { height: 40px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); }
.file-input { width: 100%; font-size: 12px; color: var(--text-2); }
.file-input::-webkit-file-upload-button { background: var(--surface-3); border: 1px solid var(--border-strong); border-radius: 8px; padding: 7px 12px; margin-right: 10px; cursor: pointer; color: var(--text); font-family: var(--font); font-weight: 600; }

/* ------------------------------ timeline -------------------------------- */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 22px 36px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li:before { content: ''; position: absolute; left: 11px; top: 26px; bottom: -2px; width: 2px; background: var(--border); }
.timeline li:last-child:before { display: none; }
.timeline__dot { position: absolute; left: 0; top: 2px; width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.timeline__dot .icon { width: 13px; height: 13px; }
.timeline__dot--success { background: color-mix(in srgb, var(--success) 15%, transparent); color: var(--success); }
.timeline__dot--danger { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); }
.timeline__dot--warning { background: color-mix(in srgb, var(--warning) 18%, transparent); color: var(--warning); }
.timeline__title { font-size: 13px; font-weight: 650; color: var(--text); }
.timeline__meta { font-size: 11px; color: var(--muted); margin-top: 3px; }
.timeline p { font-size: 12.5px; color: var(--text-2); margin: 6px 0 0; }

/* ------------------------------- widgets -------------------------------- */
.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.kv__item { min-width: 0; }
.kv__label { font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); font-weight: 700; margin-bottom: 4px; }
.kv__value { font-size: 13.5px; color: var(--text); font-weight: 600; word-break: break-word; }
.kv__value--big { font-size: 22px; font-weight: 800; letter-spacing: -.03em; }
.divider { height: 1px; background: var(--border); margin: 20px 0; }
.progress { height: 7px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress__bar { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--primary), var(--primary-2)); transition: width .6s ease; }
.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-list li { display: flex; align-items: center; gap: 11px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.mini-list li:last-child { border-bottom: 0; }
.mini-list__body { flex: 1; min-width: 0; }
.mini-list__body b { font-size: 12.5px; display: block; }
.mini-list__body small { color: var(--muted); font-size: 11px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tab { padding: 10px 15px; font-size: 12.5px; font-weight: 650; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--primary); border-bottom-color: var(--primary); }

.doc-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.doc-item:last-child { border-bottom: 0; }
.doc-item__icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); color: var(--primary); flex: 0 0 auto; }
.doc-item__body { flex: 1; min-width: 0; }
.doc-item__body b { font-size: 12.5px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-item__body small { color: var(--muted); font-size: 11px; }
.req-item { border: 1px solid var(--border); border-radius: 11px; padding: 13px 14px; margin-bottom: 10px; background: var(--surface-2); }
.req-item__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.req-item__head b { font-size: 13px; }
.req-item p { font-size: 12px; color: var(--text-2); margin: 6px 0 0; }

/* ------------------------------- alerts --------------------------------- */
.alert { display: flex; gap: 11px; align-items: flex-start; padding: 13px 15px; border-radius: 11px; font-size: 12.5px; margin-bottom: 14px; border: 1px solid transparent; }
.alert .icon { margin-top: 1px; }
.alert--info { background: color-mix(in srgb, var(--accent) 10%, transparent); color: var(--text-2); border-color: color-mix(in srgb, var(--accent) 25%, transparent); }
.alert--success { background: color-mix(in srgb, var(--success) 10%, transparent); color: var(--text-2); border-color: color-mix(in srgb, var(--success) 25%, transparent); }
.alert--warning { background: color-mix(in srgb, var(--warning) 12%, transparent); color: var(--text-2); border-color: color-mix(in srgb, var(--warning) 28%, transparent); }
.alert--danger { background: color-mix(in srgb, var(--danger) 10%, transparent); color: var(--text-2); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.alert b { color: var(--text); }

.toast-stack { position: fixed; top: 18px; right: 18px; z-index: 200; display: flex; flex-direction: column; gap: 9px; width: min(360px, calc(100vw - 36px)); }
.toast { display: flex; gap: 11px; align-items: flex-start; background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--primary); border-radius: 11px; box-shadow: var(--shadow-lg); padding: 13px 14px; animation: slideIn .28s ease both; }
.toast--success { border-left-color: var(--success); }
.toast--error { border-left-color: var(--danger); }
.toast--warning { border-left-color: var(--warning); }
.toast--info { border-left-color: var(--accent); }
.toast__icon { color: var(--primary); }
.toast--success .toast__icon { color: var(--success); }
.toast--error .toast__icon { color: var(--danger); }
.toast--warning .toast__icon { color: var(--warning); }
.toast--info .toast__icon { color: var(--accent); }
.toast__body { flex: 1; font-size: 12.5px; color: var(--text); }
.toast__close { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0; }
.toast.is-leaving { animation: slideOut .25s ease both; }

/* -------------------------------- modal --------------------------------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(11, 16, 34, .55); backdrop-filter: blur(3px); z-index: 150; display: grid; place-items: center; padding: 18px; animation: fadeIn .18s ease both; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); width: min(480px, 100%); max-height: 90vh; overflow-y: auto; animation: pop .22s ease both; }
.modal--wide { width: min(620px, 100%); }
.modal__head { padding: 18px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal__head h3 { font-size: 16px; }
.modal__body { padding: 20px; }
.modal__body p { color: var(--text-2); font-size: 13px; }
.modal__foot { padding: 15px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 9px; }

.reveal-box { background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: 11px; padding: 15px; margin-bottom: 14px; }
.reveal-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.reveal-row:last-child { border-bottom: 0; }
.reveal-row code { font-size: 13px; font-weight: 700; color: var(--primary); word-break: break-all; }

/* ---------------------------- guest / auth ------------------------------ */
.guest-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: var(--surface); }
.guest-art { position: relative; overflow: hidden; background: linear-gradient(155deg, #312e81 0%, #4f46e5 48%, #0ea5e9 120%); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.guest-art:before { content: ''; position: absolute; width: 560px; height: 560px; border-radius: 50%; border: 70px solid rgba(255,255,255,.07); right: -230px; top: -220px; }
.guest-art:after { content: ''; position: absolute; width: 360px; height: 360px; border-radius: 50%; background: rgba(255,255,255,.06); left: -140px; bottom: -180px; }
.guest-art__brand { display: flex; align-items: center; gap: 12px; font-size: 22px; font-weight: 800; letter-spacing: -.04em; position: relative; z-index: 2; }
.guest-art__brand .brand-mark { background: rgba(255,255,255,.18); box-shadow: none; }
.guest-art__main { position: relative; z-index: 2; max-width: 480px; }
.guest-art__main h2 { color: #fff; font-size: 38px; line-height: 1.18; letter-spacing: -.045em; }
.guest-art__main p { color: rgba(255,255,255,.82); font-size: 14.5px; margin-top: 16px; line-height: 1.7; }
.guest-art__points { display: flex; flex-direction: column; gap: 13px; margin-top: 30px; }
.guest-art__points div { display: flex; gap: 11px; align-items: center; font-size: 13px; color: rgba(255,255,255,.9); }
.guest-art__points .icon { color: #a5f3fc; }
.guest-art__foot { position: relative; z-index: 2; font-size: 11.5px; color: rgba(255,255,255,.65); }
.guest-form { display: flex; align-items: center; justify-content: center; padding: 40px 28px; background: var(--bg); }
.guest-form__inner { width: min(420px, 100%); }
.guest-form__inner--wide { width: min(780px, 100%); }
.guest-card { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); padding: 30px; }
.guest-card h1 { font-size: 24px; letter-spacing: -.035em; }
.guest-card > p { color: var(--muted); font-size: 13px; margin: 8px 0 24px; }
.guest-links { display: flex; justify-content: space-between; gap: 12px; margin-top: 18px; font-size: 12px; flex-wrap: wrap; }
.guest-theme { position: fixed; top: 18px; right: 18px; z-index: 5; }

.setup-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.setup-table th { text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--border); }
.setup-table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.setup-table code { background: var(--surface-3); padding: 4px 7px; border-radius: 6px; font-weight: 700; color: var(--primary); word-break: break-all; }
.cred-key { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--surface-3); border: 1px dashed var(--border-strong); border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; }

/* ------------------------------- misc ----------------------------------- */
.text-muted { color: var(--muted) !important; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.fw-700 { font-weight: 700; }
.mt-0 { margin-top: 0 !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-12 { margin-bottom: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.gap-8 { gap: 8px; }
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.flex-center { display: flex; align-items: center; gap: 10px; }
.flex-wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.hidden { display: none !important; }
.separator { width: 1px; height: 22px; background: var(--border); }
.status-strip { display: flex; gap: 8px; flex-wrap: wrap; }
.loading-bar { position: fixed; top: 0; left: 0; height: 2px; width: 0; background: linear-gradient(90deg, var(--primary), var(--accent)); z-index: 300; transition: width .25s ease, opacity .3s; box-shadow: 0 0 10px var(--primary); }
.loading-bar.is-done { width: 100%; opacity: 0; }
.skeleton { background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 50%, var(--surface-3) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 6px; }
.system-check { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.system-check:last-child { border-bottom: 0; }
.system-check small { display: block; color: var(--muted); font-size: 11px; }
.chip-list { display: flex; gap: 7px; flex-wrap: wrap; }
.chip { background: var(--surface-3); border: 1px solid var(--border); border-radius: 8px; padding: 5px 10px; font-size: 11.5px; color: var(--text-2); }

/* ----------------------------- animations -------------------------------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pop { from { opacity: 0; transform: translateY(-6px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideIn { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@keyframes slideOut { to { opacity: 0; transform: translateX(24px); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.rise { animation: rise .35s ease both; }
.card--delay-1 { animation-delay: .05s; }
.card--delay-2 { animation-delay: .1s; }
.card--delay-3 { animation-delay: .15s; }

/* ---------------------------- responsiveness ---------------------------- */
@media (max-width: 1280px) {
  .grid--stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1080px) {
  .grid--main { grid-template-columns: minmax(0, 1fr); }
  .grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .guest-shell { grid-template-columns: minmax(0, .8fr) minmax(0, 1fr); }
  .guest-art { padding: 32px; }
  .guest-art__main h2 { font-size: 30px; }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); width: var(--sidebar-w); }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar--collapsed { width: var(--sidebar-w); }
  .sidebar--collapsed .nav-item__text, .sidebar--collapsed .brand-text, .sidebar--collapsed .nav-label,
  .sidebar--collapsed .sidebar__footer, .sidebar--collapsed .sidebar__driver span, .sidebar--collapsed .nav-item__badge { display: initial; }
  .sidebar--collapsed .nav-item { justify-content: flex-start; padding: 10px 12px; }
  .sidebar--collapsed .sidebar__brand { justify-content: flex-start; padding: 20px 20px 16px; }
  .main, .sidebar--collapsed + .main { margin-left: 0; }
  .sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(10, 15, 32, .5); z-index: 35; }
  .sidebar-overlay.is-visible { display: block; }
  .content { padding: 20px 18px 50px; }
  .topbar { padding: 0 18px; }
  .grid--2 { grid-template-columns: minmax(0, 1fr); }
  .form-grid, .form-grid--3, .kv { grid-template-columns: minmax(0, 1fr); }
  .guest-shell { grid-template-columns: minmax(0, 1fr); }
  .guest-art { display: none; }
}
@media (max-width: 640px) {
  .grid--stats, .grid--4, .grid--3 { grid-template-columns: minmax(0, 1fr); }
  .topbar__title, .profile-trigger__name, .profile-trigger > .icon, .separator, .search-kbd { display: none; }
  .profile-trigger { padding: 2px; }
  .avatar { width: 32px; height: 32px; }
  .icon-btn { width: 34px; height: 34px; }
  .search-wrap { flex: 1 1 0; min-width: 0; max-width: none; }
  .search-input { padding-left: 33px; padding-right: 8px; }
  .search-wrap .icon { left: 10px; top: 9px; }
  .page-head h1 { font-size: 21px; }
  .page-head__actions { width: 100%; }
  .page-head__actions .btn { flex: 1 1 auto; }
  .hero { flex-direction: column; align-items: flex-start; padding: 20px; }
  .hero__actions { width: 100%; }
  .hero__actions .btn { flex: 1; }
  .dropdown__panel { width: min(330px, calc(100vw - 28px)); position: fixed; right: 14px; top: 62px; }
  .guest-form { padding: 24px 16px; }
  .guest-card { padding: 22px 18px; }
  .stat__value { font-size: 22px; }
  .content { padding: 16px 13px 44px; }
  .topbar { padding: 0 13px; gap: 8px; }
  .filter-bar { padding: 13px; }
}

@media print {
  .sidebar, .topbar, .page-head__actions, .btn, .toast-stack, .filter-bar,
  .pagination, .modal-backdrop, .loading-bar { display: none !important; }
  .main { margin-left: 0 !important; }
  .content { padding: 0; }
  .card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
  body { background: #fff; color: #000; }
}

/* ------------------------- claim workflow stepper ------------------------ */
.workflow { display: flex; align-items: flex-start; gap: 0; overflow-x: auto; padding: 6px 2px 10px; }
.workflow__step { flex: 1 1 0; min-width: 112px; text-align: center; position: relative; }
.workflow__step:after { content: ''; position: absolute; top: 17px; left: calc(50% + 18px); right: calc(-50% + 18px); height: 2px; background: var(--border); }
.workflow__step:last-child:after { display: none; }
.workflow__step.is-done:after { background: var(--primary); }
.workflow__dot { width: 34px; height: 34px; margin: 0 auto 8px; border-radius: 11px; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); border: 2px solid var(--border); position: relative; z-index: 2; transition: all var(--transition); }
.workflow__step.is-done .workflow__dot { background: var(--primary-soft); color: var(--primary); border-color: color-mix(in srgb, var(--primary) 40%, transparent); }
.workflow__step.is-current .workflow__dot { background: var(--primary); color: #fff; border-color: var(--primary); box-shadow: 0 0 0 5px var(--primary-soft); }
.workflow__step.is-rejected .workflow__dot { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); border-color: var(--danger); }
.workflow__label { font-size: 11px; font-weight: 650; color: var(--muted); line-height: 1.3; }
.workflow__step.is-current .workflow__label { color: var(--primary); }
.workflow__step.is-done .workflow__label { color: var(--text-2); }
.workflow__step small { display: block; font-size: 9.5px; color: var(--muted); margin-top: 2px; }

.claim-hero { display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.claim-ref { font-size: 25px; font-weight: 800; letter-spacing: -.035em; }
.section-title { display: flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 700; margin-bottom: 14px; }
.section-title .icon { color: var(--primary); }
.inline-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { margin: 0; flex: 1 1 150px; }
.status-note { margin-top: 10px; }
.quick-status { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.upload-zone { border: 1.5px dashed var(--border-strong); border-radius: 11px; padding: 16px; background: var(--surface-2); transition: border-color var(--transition), background var(--transition); }
.upload-zone:hover { border-color: var(--primary); background: var(--primary-soft); }
@media (max-width: 700px) { .workflow__step { min-width: 96px; } .claim-ref { font-size: 20px; } }
