/* =============================================================================
 * File: https://billing.domain.com/assets/css/app.css
 * -----------------------------------------------------------------------------
 * Kritarth — Design System & UI Shell
 * Theme: royal/navy blue fintech. Light + Dark via [data-theme].
 * Fonts: Sora (display/numbers) + Plus Jakarta Sans (UI/body).
 * ===========================================================================*/

/* -----------------------------------------------------------------------------
 | Design tokens
 * ---------------------------------------------------------------------------*/
:root,
[data-theme="light"] {
  --bg:            #EFF3FA;
  --bg-grad:       radial-gradient(1200px 620px at 100% -12%, #E4EDFD 0%, rgba(228,237,253,0) 60%);
  --surface:       #FFFFFF;
  --surface-2:     #F5F8FE;
  --surface-3:     #EDF2FB;
  --border:        #E5EBF5;
  --border-strong: #D6DEEE;
  --text:          #131A2B;
  --text-2:        #3B4358;
  --muted:         #727B92;

  --brand:         #2B4ACB;
  --brand-2:       #3B5BE0;
  --brand-ink:     #1B2E8F;
  --brand-soft:    #E9EEFF;
  --brand-soft-2:  #DBE4FF;
  --on-brand:      #FFFFFF;
  --grad-brand:    linear-gradient(135deg, #3D5EE6 0%, #2740C4 100%);
  --grad-sidebar:  linear-gradient(135deg, #28409E 0%, #1B2E8F 100%);

  --green:  #13B074;  --green-soft:  #DCF5EB;
  --red:    #F0455C;  --red-soft:    #FBE2E7;
  --orange: #F7913B;  --orange-soft: #FCEAD7;
  --teal:   #10B5B0;  --teal-soft:   #D4F4F2;
  --violet: #7A5BF0;  --violet-soft: #EAE4FE;
  --pink:   #E458A4;  --pink-soft:   #FBE3F0;
  --amber:  #F4B740;

  --shadow-sm:    0 1px 2px rgba(20,30,60,.06), 0 1px 3px rgba(20,30,60,.05);
  --shadow:       0 6px 20px rgba(28,45,90,.08);
  --shadow-md:    0 14px 34px rgba(28,45,90,.10);
  --shadow-lg:    0 26px 64px rgba(20,35,80,.16);
  --shadow-brand: 0 14px 28px rgba(39,64,196,.32);
  --ring:         rgba(59,91,224,.30);
}

[data-theme="dark"] {
  --bg:            #080C18;
  --bg-grad:       radial-gradient(1100px 580px at 100% -12%, #16224180 0%, rgba(22,34,65,0) 55%);
  --surface:       #111829;
  --surface-2:     #0D1322;
  --surface-3:     #18213600;
  --surface-3:     #172033;
  --border:        #212B41;
  --border-strong: #2C3852;
  --text:          #E9EDF8;
  --text-2:        #B8C1D7;
  --muted:         #7E89A3;

  --brand:         #5A78F2;
  --brand-2:       #6D88F6;
  --brand-ink:     #AABAFF;
  --brand-soft:    rgba(72,104,233,.18);
  --brand-soft-2:  rgba(72,104,233,.28);
  --on-brand:      #FFFFFF;
  --grad-brand:    linear-gradient(135deg, #4D6BEF 0%, #2C46CE 100%);
  --grad-sidebar:  linear-gradient(135deg, #0E1526 0%, #0B1120 100%);

  --green:  #22C58A;  --green-soft:  rgba(34,197,138,.16);
  --red:    #FB5C72;  --red-soft:    rgba(251,92,114,.16);
  --orange: #FBA251;  --orange-soft: rgba(251,162,81,.16);
  --teal:   #22C7C1;  --teal-soft:   rgba(34,199,193,.16);
  --violet: #9A80FF;  --violet-soft: rgba(154,128,255,.16);
  --pink:   #F06FB6;  --pink-soft:   rgba(240,111,182,.16);
  --amber:  #F6C25A;

  --shadow-sm:    0 1px 2px rgba(0,0,0,.40);
  --shadow:       0 8px 24px rgba(0,0,0,.45);
  --shadow-md:    0 16px 36px rgba(0,0,0,.50);
  --shadow-lg:    0 28px 66px rgba(0,0,0,.60);
  --shadow-brand: 0 16px 32px rgba(44,70,206,.48);
  --ring:         rgba(109,136,246,.45);
}

/* -----------------------------------------------------------------------------
 | Reset & base
 * ---------------------------------------------------------------------------*/
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; overflow-x: hidden; }

body {
  font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv11", "ss01";
}

h1, h2, h3, h4, h5 { font-family: "Sora", "Plus Jakarta Sans", sans-serif; font-weight: 700; line-height: 1.2; color: var(--text); }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
img { max-width: 100%; display: block; }
input, select, textarea { font-family: inherit; font-size: 14px; }
.num { font-family: "Sora", sans-serif; font-feature-settings: "tnum"; font-variant-numeric: tabular-nums; }

::selection { background: var(--brand-soft-2); color: var(--brand-ink); }

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; border: 3px solid var(--bg); }
*::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* Lucide icons sizing */
[data-lucide], .lucide { width: 20px; height: 20px; stroke-width: 2; flex: none; }

/* =============================================================================
 | App layout
 * ===========================================================================*/
.app { display: flex; min-height: 100vh; }

.main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  margin-left: 264px;
  transition: margin-left .28s cubic-bezier(.4,0,.2,1);
}
.app.is-collapsed .main { margin-left: 86px; }

.content {
  flex: 1 1 auto;
  padding: 26px 30px 40px;
  max-width: 1500px;
  width: 100%;
  margin: 0 auto;
}

/* =============================================================================
 | Sidebar
 * ===========================================================================*/
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 264px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 60;
  transition: width .28s cubic-bezier(.4,0,.2,1), transform .28s cubic-bezier(.4,0,.2,1);
}
.app.is-collapsed .sidebar { width: 86px; }

.sidebar__brand {
  display: flex; align-items: center; gap: 12px;
  height: 72px; padding: 0 20px; flex: none;
  border-bottom: 1px solid var(--border);
}
.brand-logo {
  width: 40px; height: 40px; border-radius: 12px; flex: none;
  display: grid; place-items: center;
  background: var(--grad-brand);
  color: #fff; box-shadow: var(--shadow-brand);
}
.brand-logo i { width: 22px; height: 22px; }
.sidebar__brand-text { display: flex; flex-direction: column; line-height: 1.1; overflow: hidden; }
.sidebar__brand-text b { font-family: "Sora", sans-serif; font-size: 19px; font-weight: 800; letter-spacing: -.02em; }
.sidebar__brand-text span { font-size: 10.5px; color: var(--muted); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.app.is-collapsed .sidebar__brand-text { display: none; }

.sidebar__nav { flex: 1 1 auto; overflow-y: auto; padding: 14px 14px 8px; }
.nav-section { margin: 16px 0 6px; padding: 0 12px; }
.nav-section:first-child { margin-top: 4px; }
.nav-section__label { font-size: 10.5px; font-weight: 700; letter-spacing: .10em; text-transform: uppercase; color: var(--muted); }
.app.is-collapsed .nav-section__label { text-align: center; font-size: 0; }
.app.is-collapsed .nav-section__label::after { content: "•"; font-size: 12px; }

.nav-link {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; margin: 3px 0;
  border-radius: 12px;
  color: var(--text-2);
  font-weight: 600; font-size: 13.5px;
  transition: background .16s, color .16s, transform .16s;
  white-space: nowrap;
}
.nav-link__icon { display: grid; place-items: center; color: var(--muted); transition: color .16s; }
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link:hover .nav-link__icon { color: var(--brand); }
.nav-link.is-active {
  background: var(--grad-brand);
  color: #fff;
  box-shadow: var(--shadow-brand);
}
.nav-link.is-active .nav-link__icon { color: #fff; }
.nav-link__text { flex: 1 1 auto; }
.nav-badge {
  font-size: 11px; font-weight: 700; line-height: 1;
  padding: 4px 8px; border-radius: 99px;
  background: var(--brand-soft); color: var(--brand);
}
.nav-link.is-active .nav-badge { background: rgba(255,255,255,.22); color: #fff; }
.nav-badge--new { background: var(--red); color: #fff; }

.app.is-collapsed .nav-link { justify-content: center; padding: 11px; }
.app.is-collapsed .nav-link__text, .app.is-collapsed .nav-badge { display: none; }
.app.is-collapsed .nav-link.is-active::after {
  content: ""; position: absolute; right: -14px; top: 50%; transform: translateY(-50%);
  width: 4px; height: 22px; border-radius: 4px 0 0 4px; background: var(--brand);
}

.sidebar__promo { margin: 8px 14px 16px; flex: none; }
.app.is-collapsed .sidebar__promo { display: none; }
.promo-card {
  border-radius: 16px; padding: 16px;
  background: var(--grad-brand); color: #fff;
  position: relative; overflow: hidden;
  box-shadow: var(--shadow-brand);
}
.promo-card::after {
  content: ""; position: absolute; right: -28px; top: -28px;
  width: 100px; height: 100px; border-radius: 50%;
  background: rgba(255,255,255,.14);
}
.promo-card h5 { color: #fff; font-size: 13.5px; margin-bottom: 4px; }
.promo-card p { font-size: 11.5px; color: rgba(255,255,255,.82); margin-bottom: 12px; }
.promo-card .btn { background: #fff; color: var(--brand-ink); box-shadow: none; }

/* App overlay (mobile) */
.app__overlay {
  position: fixed; inset: 0; z-index: 55;
  background: rgba(8,12,24,.5); backdrop-filter: blur(2px);
  opacity: 0; visibility: hidden; transition: opacity .25s;
}

/* =============================================================================
 | Topbar
 * ===========================================================================*/
.topbar {
  position: sticky; top: 0; z-index: 40;
  height: 72px; flex: none;
  display: flex; align-items: center; gap: 14px;
  padding: 0 30px;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar__title { font-size: 21px; font-weight: 700; letter-spacing: -.02em; min-width: 0; flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar__search {
  position: relative; margin-left: 10px;
  flex: 0 1 360px; display: flex; align-items: center;
}
.topbar__search i { position: absolute; left: 14px; color: var(--muted); width: 18px; height: 18px; }
.topbar__search input {
  width: 100%; height: 42px; padding: 0 16px 0 42px;
  border-radius: 99px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
  transition: border-color .16s, box-shadow .16s;
}
.topbar__search input::placeholder { color: var(--muted); }
.topbar__search input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--ring); }

.topbar__actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.icon-btn {
  position: relative;
  width: 42px; height: 42px; border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface); color: var(--text-2);
  display: grid; place-items: center;
  transition: background .16s, color .16s, border-color .16s, transform .12s;
}
.icon-btn:hover { color: var(--brand); border-color: var(--brand-soft-2); background: var(--surface-2); }
.icon-btn:active { transform: scale(.95); }
.icon-btn__dot {
  position: absolute; top: -5px; right: -5px;
  min-width: 18px; height: 18px; padding: 0 4px;
  border-radius: 99px; border: 2px solid var(--surface);
  background: var(--orange); color: #fff;
  font-size: 10px; font-weight: 800; line-height: 14px; text-align: center;
}
.icon-btn__dot--green { background: var(--green); }
.icon-btn__dot--brand { background: var(--brand); }

/* Theme toggle icon swap */
.theme-toggle .theme-icon-light { display: none; }
[data-theme="dark"] .theme-toggle .theme-icon-light { display: block; }
[data-theme="dark"] .theme-toggle .theme-icon-dark { display: none; }

/* User chip */
.user-chip {
  display: flex; align-items: center; gap: 10px;
  height: 46px; padding: 4px 10px 4px 5px; border-radius: 99px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); transition: border-color .16s, background .16s;
}
.user-chip:hover { border-color: var(--brand-soft-2); background: var(--surface-2); }
.user-chip__avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--grad-brand); color: #fff; font-weight: 700;
  font-family: "Sora", sans-serif;
}
.user-chip__meta { display: flex; flex-direction: column; line-height: 1.15; text-align: left; }
.user-chip__name { font-size: 13px; font-weight: 700; }
.user-chip__role { font-size: 11px; color: var(--muted); }
.user-chip i { width: 16px; height: 16px; color: var(--muted); }

/* New invoice button shorthand */
.new-invoice-btn span { font-weight: 700; }

/* =============================================================================
 | Buttons
 * ===========================================================================*/
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px; border: 1px solid transparent;
  border-radius: 12px; font-weight: 700; font-size: 13.5px; color: var(--text);
  background: var(--surface); transition: transform .12s, box-shadow .16s, background .16s, border-color .16s, color .16s;
  white-space: nowrap;
}
.btn i { width: 18px; height: 18px; }
.btn:active { transform: translateY(1px); }
.btn--pill { border-radius: 99px; }
.btn--sm { height: 36px; padding: 0 14px; font-size: 13px; }
.btn--lg { height: 50px; padding: 0 24px; font-size: 15px; }
.btn--block { width: 100%; }
.btn--primary { background: var(--grad-brand); color: #fff; box-shadow: var(--shadow-brand); }
.btn--primary:hover { box-shadow: 0 18px 34px rgba(39,64,196,.42); transform: translateY(-1px); }
.btn--outline { background: transparent; border-color: var(--brand); color: var(--brand); }
.btn--outline:hover { background: var(--brand-soft); }
.btn--ghost { background: var(--surface-2); color: var(--text-2); border-color: var(--border); }
.btn--ghost:hover { color: var(--brand); border-color: var(--brand-soft-2); }
.btn--danger { background: var(--red); color: #fff; }

/* =============================================================================
 | Badges & status pills
 * ===========================================================================*/
.badge-soft {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: 99px; font-size: 12px; font-weight: 700;
  background: var(--surface-2); color: var(--text-2);
}
.badge-soft--brand { background: var(--brand-soft); color: var(--brand); }
.badge-soft--green { background: var(--green-soft); color: var(--green); }
.badge-soft--red { background: var(--red-soft); color: var(--red); }
.badge-soft--orange { background: var(--orange-soft); color: var(--orange); }

.status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 13px; border-radius: 99px; font-size: 12px; font-weight: 700;
}
.status-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-pill--paid { background: var(--green-soft); color: var(--green); }
.status-pill--pending { background: var(--red-soft); color: var(--red); }
.status-pill--partial { background: var(--orange-soft); color: var(--orange); }
.status-pill--draft { background: var(--surface-3); color: var(--muted); }

.trend { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; font-size: 12.5px; }
.trend i { width: 15px; height: 15px; }
.trend--up { color: var(--green); }
.trend--down { color: var(--red); }

/* =============================================================================
 | Dropdown
 * ===========================================================================*/
.dropdown { position: relative; }
.dropdown__menu {
  position: absolute; top: calc(100% + 10px); right: 0; z-index: 80;
  min-width: 240px; padding: 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: var(--shadow-lg);
  opacity: 0; visibility: hidden; transform: translateY(-8px) scale(.98);
  transform-origin: top right; transition: opacity .18s, transform .18s, visibility .18s;
}
.dropdown.open .dropdown__menu { opacity: 1; visibility: visible; transform: translateY(0) scale(1); }
.dropdown__head { padding: 10px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.dropdown__head b { font-size: 14px; }
.dropdown__head span { display: block; font-size: 12px; color: var(--muted); }
.dropdown__item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: 10px;
  color: var(--text-2); font-weight: 600; font-size: 13.5px; transition: background .14s, color .14s;
}
.dropdown__item i { width: 18px; height: 18px; color: var(--muted); }
.dropdown__item:hover { background: var(--surface-2); color: var(--brand); }
.dropdown__item:hover i { color: var(--brand); }
.dropdown__item--danger:hover { background: var(--red-soft); color: var(--red); }
.dropdown__item--danger:hover i { color: var(--red); }
.dropdown__sep { height: 1px; background: var(--border); margin: 6px 4px; }

.notif {
  display: flex; gap: 11px; padding: 10px 12px; border-radius: 10px; transition: background .14s;
}
.notif:hover { background: var(--surface-2); }
.notif__dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 6px; flex: none; background: var(--brand); }
.notif__dot--green { background: var(--green); }
.notif__dot--orange { background: var(--orange); }
.notif p { font-size: 13px; font-weight: 600; }
.notif span { font-size: 11.5px; color: var(--muted); }

/* =============================================================================
 | Cards & panels
 * ===========================================================================*/
.card, .panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
}
.panel { padding: 22px; }
.panel__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.panel__title { font-size: 16px; font-weight: 700; }
.panel__sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head__title { font-size: 22px; }
.page-head__sub { font-size: 13px; color: var(--muted); margin-top: 3px; }

.toggle-group { display: inline-flex; padding: 4px; gap: 2px; background: var(--surface-2); border-radius: 99px; border: 1px solid var(--border); }
.toggle-group button { border: none; background: transparent; padding: 7px 16px; border-radius: 99px; font-weight: 700; font-size: 12.5px; color: var(--muted); }
.toggle-group button.is-active { background: var(--surface); color: var(--brand); box-shadow: var(--shadow-sm); }

/* =============================================================================
 | Dashboard — stat cards
 * ===========================================================================*/
.grid { display: grid; gap: 22px; }
.stat-grid { grid-template-columns: repeat(4, 1fr); }
.dash-grid { grid-template-columns: 2fr 1fr; align-items: start; }
.dash-grid-2 { grid-template-columns: 1.4fr 1fr; align-items: start; }

.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; padding: 20px; box-shadow: var(--shadow);
  position: relative; overflow: hidden;
  transition: transform .2s, box-shadow .2s;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.stat-card__top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.stat-card__icon {
  width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand);
}
.stat-card__icon i { width: 22px; height: 22px; }
.stat-card__value { font-family: "Sora", sans-serif; font-size: 27px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-card__label { font-size: 13px; color: var(--muted); font-weight: 600; margin-top: 2px; }
.stat-card__foot { display: flex; align-items: center; gap: 6px; margin-top: 12px; font-size: 12px; color: var(--muted); }
.stat-card__spark { height: 46px; margin: 12px -4px -4px; }

.stat-card--brand  .stat-card__icon { background: var(--brand-soft); color: var(--brand); }
.stat-card--green  .stat-card__icon { background: var(--green-soft); color: var(--green); }
.stat-card--red    .stat-card__icon { background: var(--red-soft); color: var(--red); }
.stat-card--orange .stat-card__icon { background: var(--orange-soft); color: var(--orange); }
.stat-card--violet .stat-card__icon { background: var(--violet-soft); color: var(--violet); }
.stat-card--teal   .stat-card__icon { background: var(--teal-soft); color: var(--teal); }

/* Revenue hero */
.revenue-amount { font-family: "Sora", sans-serif; font-size: 34px; font-weight: 800; letter-spacing: -.03em; }
.revenue-chart { height: 280px; margin-top: 6px; }

/* =============================================================================
 | Metric tiles (gradient + conic ring)
 * ===========================================================================*/
.tile-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.metric-tile {
  border-radius: 18px; padding: 16px; color: #fff; position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between; min-height: 122px;
}
.metric-tile::after { content: ""; position: absolute; right: -30px; bottom: -30px; width: 90px; height: 90px; border-radius: 50%; background: rgba(255,255,255,.12); }
.metric-tile--violet { background: linear-gradient(140deg, #8B5CF6, #6D28D9); }
.metric-tile--teal   { background: linear-gradient(140deg, #14B8A6, #0E7490); }
.metric-tile--orange { background: linear-gradient(140deg, #FB923C, #EA580C); }
.metric-tile--blue   { background: linear-gradient(140deg, #4D6BEF, #2740C4); }
.ring {
  width: 52px; height: 52px; position: relative; align-self: flex-end;
  display: grid; place-items: center; flex: none;
}
.ring::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(#fff calc(var(--p,0) * 1%), rgba(255,255,255,.30) 0);
  -webkit-mask: radial-gradient(farthest-side, #0000 calc(100% - 6px), #000 calc(100% - 6px));
          mask: radial-gradient(farthest-side, #0000 calc(100% - 6px), #000 calc(100% - 6px));
}
.ring span {
  position: relative; z-index: 1; font-size: 12px; font-weight: 800;
  font-family: "Sora", sans-serif; color: #fff;
}
.metric-tile__label { font-size: 12.5px; font-weight: 700; opacity: .92; }
.metric-tile__value { font-family: "Sora", sans-serif; font-size: 17px; font-weight: 800; }

/* legend list */
.legend-row { display: flex; align-items: center; justify-content: space-between; padding: 9px 0; border-bottom: 1px dashed var(--border); }
.legend-row:last-child { border-bottom: 0; }
.legend-row__left { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; }
.legend-dot { width: 10px; height: 10px; border-radius: 4px; flex: none; }
.legend-row__val { font-family: "Sora", sans-serif; font-weight: 700; font-size: 13.5px; }

/* product / activity rows */
.row-item { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.row-item:last-child { border-bottom: 0; }
.row-item__avatar { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); color: var(--brand); font-weight: 700; flex: none; }
.row-item__body { flex: 1 1 auto; min-width: 0; }
.row-item__title { font-size: 13.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-item__sub { font-size: 12px; color: var(--muted); }
.row-item__meta { text-align: right; font-family: "Sora", sans-serif; font-weight: 700; font-size: 13.5px; }

/* =============================================================================
 | Tables
 * ===========================================================================*/
.table-wrap { overflow-x: auto; border-radius: 16px; }
.ktable { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.ktable th {
  text-align: left; font-weight: 700; color: var(--muted); font-size: 12px;
  text-transform: uppercase; letter-spacing: .04em; padding: 14px 16px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.ktable td { padding: 14px 16px; border-bottom: 1px solid var(--border); color: var(--text-2); }
.ktable tbody tr { transition: background .14s; }
.ktable tbody tr:hover { background: var(--surface-2); }
.ktable tbody tr:last-child td { border-bottom: 0; }

/* =============================================================================
 | Forms
 * ===========================================================================*/
.field { margin-bottom: 16px; }
.field__label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 7px; color: var(--text-2); }
.input, .select, .textarea {
  width: 100%; height: 46px; padding: 0 15px;
  border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
  transition: border-color .16s, box-shadow .16s;
}
.textarea { height: auto; padding: 12px 15px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--ring); }
.input::placeholder { color: var(--muted); }
.input-group { position: relative; display: flex; align-items: center; }
.input-group .input { padding-right: 46px; }
.input-group__btn {
  position: absolute; right: 6px; width: 34px; height: 34px; border-radius: 9px; border: none;
  background: transparent; color: var(--muted); display: grid; place-items: center;
}
.input-group__btn:hover { color: var(--brand); background: var(--surface-2); }
.input-group__btn i { width: 18px; height: 18px; }

.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer; user-select: none; }
.check input { width: 17px; height: 17px; accent-color: var(--brand); }

.alert { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; font-size: 13px; font-weight: 600; margin-bottom: 16px; }
.alert i { width: 18px; height: 18px; flex: none; }
.alert--error { background: var(--red-soft); color: var(--red); }
.alert--success { background: var(--green-soft); color: var(--green); }

/* =============================================================================
 | Auth / login
 * ===========================================================================*/
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth__brand {
  position: relative; overflow: hidden; padding: 56px;
  background: var(--grad-sidebar); color: #fff;
  display: flex; flex-direction: column;
}
.auth__brand::before {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.10) 1.4px, transparent 1.4px);
  background-size: 26px 26px; opacity: .5;
}
.auth__brand::after {
  content: ""; position: absolute; width: 460px; height: 460px; border-radius: 50%;
  right: -160px; bottom: -180px; background: radial-gradient(circle, rgba(109,136,246,.55), transparent 70%);
  filter: blur(8px);
}
.auth__brand-inner { position: relative; z-index: 2; display: flex; flex-direction: column; height: 100%; }
.auth__logo { display: flex; align-items: center; gap: 12px; }
.auth__logo .brand-logo { background: rgba(255,255,255,.16); box-shadow: none; backdrop-filter: blur(6px); }
.auth__logo b { font-family: "Sora", sans-serif; font-size: 22px; font-weight: 800; }
.auth__hero { margin-top: auto; }
.auth__hero h1 { color: #fff; font-size: 40px; line-height: 1.12; letter-spacing: -.03em; margin-bottom: 16px; }
.auth__hero h1 span { background: linear-gradient(90deg,#A9C0FF,#E9EEFF); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth__hero p { color: rgba(255,255,255,.8); font-size: 15px; max-width: 440px; }
.auth__features { margin-top: 28px; display: flex; flex-direction: column; gap: 14px; }
.auth__feature { display: flex; align-items: center; gap: 12px; font-size: 14px; font-weight: 600; }
.auth__feature i { width: 20px; height: 20px; }
.auth__feature .tick { width: 28px; height: 28px; border-radius: 9px; background: rgba(255,255,255,.16); display: grid; place-items: center; flex: none; }

.auth__panel { display: grid; place-items: center; padding: 40px 24px; position: relative; }
.auth-card { width: 100%; max-width: 412px; }
.auth-card h2 { font-size: 27px; letter-spacing: -.02em; margin-bottom: 6px; }
.auth-card__sub { color: var(--muted); font-size: 14px; margin-bottom: 26px; }
.auth-card__logo { display: none; align-items: center; gap: 10px; margin-bottom: 24px; }
.auth-foot { margin-top: 22px; text-align: center; font-size: 12.5px; color: var(--muted); }
.demo-hint { margin-top: 18px; padding: 12px 14px; border-radius: 12px; background: var(--brand-soft); color: var(--brand-ink); font-size: 12.5px; font-weight: 600; text-align: center; }
.demo-hint b { font-family: "Sora", sans-serif; }
.auth__theme { position: absolute; top: 20px; right: 20px; z-index: 3; }

/* =============================================================================
 | Footer
 * ===========================================================================*/
.footer {
  flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px 30px; margin-top: auto;
  border-top: 1px solid var(--border); color: var(--muted); font-size: 12.5px; font-weight: 600;
}
.footer__heart { color: var(--red); }

/* =============================================================================
 | SPA loader + toasts
 * ===========================================================================*/
.spa-loader {
  position: fixed; top: 0; left: 0; height: 3px; width: 0;
  background: var(--grad-brand); z-index: 200;
  box-shadow: 0 0 10px var(--brand); transition: width .2s ease, opacity .3s;
  opacity: 0;
}
.spa-loader.active { opacity: 1; }

.toast-wrap { position: fixed; right: 20px; bottom: 20px; z-index: 300; display: flex; flex-direction: column; gap: 10px; }
.toast {
  display: flex; align-items: center; gap: 10px; min-width: 240px; max-width: 360px;
  padding: 13px 15px; border-radius: 13px; background: var(--surface);
  border: 1px solid var(--border); box-shadow: var(--shadow-lg); color: var(--text);
  font-size: 13.5px; font-weight: 600;
  animation: toastIn .3s cubic-bezier(.2,.8,.2,1);
}
.toast i { width: 18px; height: 18px; flex: none; }
.toast--success { border-left: 3px solid var(--green); }
.toast--success i { color: var(--green); }
.toast--error { border-left: 3px solid var(--red); }
.toast--error i { color: var(--red); }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* =============================================================================
 | Empty state
 * ===========================================================================*/
.empty-state {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 70px 24px; gap: 8px;
  background: var(--surface); border: 1px dashed var(--border-strong); border-radius: 20px;
}
.empty-state__icon {
  width: 78px; height: 78px; border-radius: 22px; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand); margin-bottom: 10px;
}
.empty-state__icon i { width: 36px; height: 36px; }
.empty-state__title { font-size: 19px; }
.empty-state__text { color: var(--muted); font-size: 14px; max-width: 420px; margin-bottom: 6px; }

/* =============================================================================
 | Animations (staggered page-load reveal)
 * ===========================================================================*/
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
.reveal > * { animation: fadeUp .5s cubic-bezier(.2,.7,.2,1) backwards; }
.reveal > *:nth-child(1) { animation-delay: .02s; }
.reveal > *:nth-child(2) { animation-delay: .07s; }
.reveal > *:nth-child(3) { animation-delay: .12s; }
.reveal > *:nth-child(4) { animation-delay: .17s; }
.reveal > *:nth-child(5) { animation-delay: .22s; }
.reveal > *:nth-child(6) { animation-delay: .27s; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* =============================================================================
 | Utilities
 * ===========================================================================*/
.mt-0{margin-top:0}.mt-1{margin-top:8px}.mt-2{margin-top:16px}.mt-3{margin-top:22px}.mt-4{margin-top:30px}
.mb-0{margin-bottom:0}.mb-2{margin-bottom:16px}.mb-3{margin-bottom:22px}
.flex{display:flex}.items-center{align-items:center}.justify-between{justify-content:space-between}.gap-2{gap:8px}.gap-3{gap:12px}.flex-1{flex:1 1 auto}.flex-wrap{flex-wrap:wrap}
.text-muted{color:var(--muted)}.text-sm{font-size:12.5px}.fw-700{font-weight:700}.text-right{text-align:right}
.w-100{width:100%}.hide{display:none}

/* =============================================================================
 | Responsive
 * ===========================================================================*/
@media (max-width: 1200px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-grid, .dash-grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 992px) {
  .main { margin-left: 0 !important; }
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .app.sidebar-open .sidebar { transform: translateX(0); }
  .app.sidebar-open .app__overlay { opacity: 1; visibility: visible; }
  .topbar { padding: 0 18px; }
  .content { padding: 20px 18px 32px; }
  .topbar__search { display: none; }
  .auth { grid-template-columns: 1fr; }
  .auth__brand { display: none; }
  .auth-card__logo { display: flex; }
}
@media (max-width: 640px) {
  .content { padding: 16px 14px 30px; }
  .grid { gap: 14px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .stat-card { padding: 15px; }
  .stat-card__top { margin-bottom: 12px; }
  .stat-card__icon { width: 38px; height: 38px; border-radius: 12px; }
  .stat-card__icon i { width: 18px; height: 18px; }
  .stat-card__value { font-size: clamp(17px, 5vw, 23px); letter-spacing: -.03em; }
  .stat-card__label { font-size: 12px; }
  .stat-card__spark { height: 34px; }
  .trend { font-size: 11px; }
  .tile-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .metric-tile { min-height: 116px; padding: 14px; }
  .panel { padding: 16px; border-radius: 16px; }
  .panel__head { margin-bottom: 14px; }
  .revenue-amount { font-size: 25px; }
  .page-head { margin-bottom: 16px; }
  .page-head__title { font-size: 19px; }
  .topbar { height: 62px; padding: 0 14px; gap: 8px; }
  .topbar__title { font-size: 18px; }
  .icon-btn { width: 40px; height: 40px; }
  .user-chip { height: 42px; padding: 4px; }
  .user-chip__meta { display: none; }
  .user-chip > i[data-lucide], .user-chip > .lucide { display: none; }
  .new-invoice-btn span { display: none; }
  .new-invoice-btn { width: 42px; padding: 0; }
  .ktable th, .ktable td { padding: 11px 12px; }
  .dropdown__menu { min-width: 220px; }
  .footer { flex-direction: column; text-align: center; gap: 4px; padding: 16px; }
}
@media (max-width: 430px) {
  .stat-grid { grid-template-columns: 1fr; }
  .stat-card__value { font-size: 24px; }
}