/* =========================================================
   FakturaPlus.sk — Design System
   Premium SaaS, mobile-first, light theme
   ========================================================= */

:root {
  /* Palette */
  --ink-900: #0b1020;
  --ink-800: #111936;
  --ink-700: #1f2a44;
  --ink-600: #364156;
  --ink-500: #4b5568;
  --ink-400: #6b7389;
  --ink-300: #9199ad;
  --ink-200: #c8cddc;
  --ink-100: #e4e7f0;
  --ink-50:  #f2f4fa;

  --paper:        #fbfbfd;
  --paper-soft:   #f5f6fb;
  --paper-raised: #ffffff;
  --paper-tint:   #f7f5ff;

  --primary-700: #3b2fb5;
  --primary-600: #4338ca;
  --primary-500: #5b55e6;
  --primary-400: #8b85ff;
  --primary-50:  #eef0ff;
  --accent-500:  #7c3aed;

  --success-700: #067647;
  --success-600: #16a34a;
  --success-50:  #ecfdf3;
  --warning-700: #b54708;
  --warning-600: #d97706;
  --warning-50:  #fff7ed;
  --danger-700:  #b42318;
  --danger-600:  #dc2626;
  --danger-50:   #fef2f2;
  --info-700:    #1849a9;
  --info-600:    #2e6bd3;
  --info-50:     #eff4fd;
  --muted-100:   #f1f2f6;
  --muted-600:   #667085;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(17, 25, 54, 0.04);
  --shadow-sm: 0 1px 2px rgba(17,25,54,.05), 0 1px 3px rgba(17,25,54,.06);
  --shadow-md: 0 6px 16px -4px rgba(17,25,54,.08), 0 2px 4px rgba(17,25,54,.04);
  --shadow-lg: 0 18px 40px -12px rgba(17,25,54,.18), 0 4px 8px rgba(17,25,54,.04);
  --shadow-primary: 0 12px 28px -8px rgba(67,56,202,.35);

  /* Radii */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --r-full: 999px;

  /* Spacing scale (4/8) */
  --sp-1: .25rem;
  --sp-2: .5rem;
  --sp-3: .75rem;
  --sp-4: 1rem;
  --sp-5: 1.25rem;
  --sp-6: 1.5rem;
  --sp-8: 2rem;
  --sp-10: 2.5rem;
  --sp-12: 3rem;

  /* Layout */
  --sidebar-w: 248px;
  --appbar-h: 60px;
  --bottombar-h: 68px;

  /* Type */
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  --font-head: 'Manrope', var(--font-body);
  --font-mono: ui-monospace, 'SFMono-Regular', 'JetBrains Mono', Menlo, Consolas, monospace;
}

/* -------- Transitions ----------------------------------- */
:root {
  --ease: cubic-bezier(.4, 0, .2, 1);
  --dur-fast: .12s;
  --dur: .18s;
  --dur-slow: .25s;
}

/* -------- Keyframes ------------------------------------ */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-16px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(16px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(.92); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
@keyframes countUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes pulse-ring {
  0% { transform: scale(.85); opacity: .6; }
  50% { transform: scale(1); opacity: 1; }
  100% { transform: scale(.85); opacity: .6; }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@keyframes gradient-shift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* -------- Animation utilities -------------------------- */
.animate-in { animation: fadeInUp .5s var(--ease) both; }
.animate-fade { animation: fadeIn .4s var(--ease) both; }
.animate-slide-left { animation: slideInLeft .4s var(--ease) both; }
.animate-slide-right { animation: slideInRight .4s var(--ease) both; }
.animate-scale { animation: scaleIn .35s var(--ease) both; }
.animate-float { animation: float 3s ease-in-out infinite; }

/* Stagger delays for child elements */
.stagger > :nth-child(1) { animation-delay: .04s; }
.stagger > :nth-child(2) { animation-delay: .08s; }
.stagger > :nth-child(3) { animation-delay: .12s; }
.stagger > :nth-child(4) { animation-delay: .16s; }
.stagger > :nth-child(5) { animation-delay: .2s; }
.stagger > :nth-child(6) { animation-delay: .24s; }
.stagger > :nth-child(7) { animation-delay: .28s; }
.stagger > :nth-child(8) { animation-delay: .32s; }

/* Intersection Observer: initially hidden, revealed on scroll */
[data-animate] {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity .6s var(--ease), transform .6s var(--ease);
}
[data-animate].is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* -------- Scrollbar ------------------------------------ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--ink-200);
  border-radius: var(--r-full);
}
::-webkit-scrollbar-thumb:hover { background: var(--ink-300); }
html { scrollbar-width: thin; scrollbar-color: var(--ink-200) transparent; }

/* -------- Selection & Focus Ring ----------------------- */
::selection {
  background: var(--primary-400);
  color: white;
}
:focus-visible {
  outline: 2px solid var(--primary-500);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* -------- Reset + base ---------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink-800);
  background:
    radial-gradient(1200px 600px at 90% -10%, rgba(124,58,237,.06), transparent 60%),
    radial-gradient(900px 500px at -10% 20%, rgba(67,56,202,.05), transparent 60%),
    linear-gradient(180deg, var(--paper) 0%, var(--paper-soft) 100%);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--primary-600); text-decoration: none; }
a:hover { text-decoration: underline; }
h1,h2,h3,h4,h5 { font-family: var(--font-head); color: var(--ink-900); margin: 0 0 .5rem; letter-spacing: -.01em; }
h1 { font-size: 1.875rem; font-weight: 800; letter-spacing: -.02em; }
h2 { font-size: 1.375rem; font-weight: 700; }
h3 { font-size: 1.125rem; font-weight: 700; }
p { margin: 0 0 .5rem; }
small, .small { font-size: .8125rem; color: var(--ink-500); }
hr { border: 0; border-top: 1px solid var(--ink-100); margin: var(--sp-6) 0; }
code { font-family: var(--font-mono); font-size: .85em; background: var(--ink-50); padding: 1px 6px; border-radius: 6px; color: var(--ink-800); }
:focus-visible { outline: 3px solid rgba(91,85,230,.35); outline-offset: 2px; border-radius: 6px; }

/* -------- App shell ------------------------------------- */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky; top: 0;
  height: 100vh;
  padding: var(--sp-5) var(--sp-3) var(--sp-4);
  border-right: 1px solid var(--ink-100);
  background: rgba(255,255,255,.82);
  backdrop-filter: blur(20px);
  display: flex; flex-direction: column; gap: var(--sp-5);
  overflow-y: auto;
  scrollbar-width: thin;
}
.sidebar-brand {
  display: flex; align-items: center; gap: .6rem;
  padding: .4rem .5rem;
  font-family: var(--font-head);
  font-weight: 800; font-size: 1.125rem; letter-spacing: -.02em;
  color: var(--ink-900);
  text-decoration: none;
}
.sidebar-brand:hover { text-decoration: none; }
.sidebar-brand .brand-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--primary-600), var(--accent-500));
  color: #fff; display: grid; place-items: center; font-size: .95rem; font-weight: 800;
  box-shadow: var(--shadow-primary);
  transition: transform var(--dur) var(--ease);
}
.sidebar-brand:hover .brand-mark { transform: scale(1.06); }
.sidebar-section {
  font-size: .68rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-400); padding: var(--sp-1) var(--sp-3) var(--sp-1);
  margin-bottom: -.15rem;
}
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: .75rem;
  padding: .55rem .75rem; border-radius: var(--r-md);
  font-size: .9rem; font-weight: 500; color: var(--ink-600);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), transform var(--dur-fast) var(--ease);
  border: 1px solid transparent;
}
.nav a:hover { background: var(--ink-50); color: var(--ink-900); text-decoration: none; }
.nav a.active {
  background: linear-gradient(180deg, #ffffff, #f9faff);
  color: var(--primary-700);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  border-color: var(--ink-100);
}
.nav a .icon { width: 20px; height: 20px; display: inline-grid; place-items: center; color: currentColor; flex: 0 0 20px; }
.nav a.active .icon { color: var(--primary-600); }
.sidebar-footer { margin-top: auto; display: flex; flex-direction: column; gap: var(--sp-3); }

/* Sidebar user profile */
.sidebar-user {
  display: flex; align-items: center; gap: .65rem;
  padding: .55rem .65rem; border-radius: var(--r-md);
  background: var(--paper-soft); border: 1px solid var(--ink-100);
  cursor: default;
}
.sidebar-user .avatar-sm {
  width: 32px; height: 32px; border-radius: var(--r-sm);
  background: linear-gradient(135deg, #eef0ff, #f5efff);
  color: var(--primary-700); display: grid; place-items: center;
  font-weight: 700; font-size: .75rem; flex: 0 0 32px;
}
.sidebar-user .user-info { min-width: 0; flex: 1; }
.sidebar-user .user-name { font-weight: 600; font-size: .85rem; color: var(--ink-900); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user .user-role { font-size: .7rem; color: var(--ink-500); }

/* Top app bar (desktop & mobile) */
.appbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--appbar-h);
  background: rgba(255,255,255,.8);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--ink-100);
  display: flex; align-items: center; gap: var(--sp-4);
  padding: 0 var(--sp-5);
}
.appbar .search {
  flex: 1; max-width: 480px;
  display: flex; align-items: center; gap: .5rem;
  background: var(--paper-soft); border: 1px solid var(--ink-100);
  border-radius: var(--r-full); padding: .45rem .9rem;
  color: var(--ink-500);
}
.appbar .search input { border: 0; background: transparent; flex: 1; font: inherit; color: var(--ink-800); outline: none; }
.appbar .spacer { flex: 1; }
.appbar-actions { display: flex; align-items: center; gap: .75rem; }
.lang-switch { position: relative; }
.lang-switch summary { list-style: none; min-width: 7.5rem; }
.lang-switch summary::-webkit-details-marker { display: none; }
.lang-menu {
  position: absolute; top: calc(100% + .5rem); right: 0; z-index: 30;
  min-width: 10rem; padding: .5rem; display: grid; gap: .25rem;
  border: 1px solid var(--line); border-radius: 14px; background: #fff;
  box-shadow: 0 18px 40px rgba(15, 23, 42, .12);
}
.lang-menu a {
  color: var(--ink-700); text-decoration: none; padding: .55rem .75rem; border-radius: 10px;
}
.lang-menu a:hover { background: var(--surface-2); }
.icon-btn {
  width: 38px; height: 38px; border-radius: 10px;
  display: grid; place-items: center;
  background: transparent; border: 1px solid transparent;
  color: var(--ink-600); cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.icon-btn:hover { background: var(--ink-50); color: var(--ink-900); }
.logout-form { margin: 0; }
.avatar {
  width: 36px; height: 36px; border-radius: 999px;
  background: linear-gradient(135deg, #eef0ff, #f5efff);
  color: var(--primary-700); display: grid; place-items: center;
  font-weight: 700; font-size: .85rem;
  border: 1px solid var(--ink-100);
}

/* Mobile header */
.appbar-mobile { display: none; }
.bottombar { display: none; }

/* Main content */
.main {
  min-width: 0;
  padding: var(--sp-6) var(--sp-6) var(--sp-12);
  max-width: 1320px;
}

/* Page header */
.page-header {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: var(--sp-4); margin-bottom: var(--sp-6);
}
.eyebrow {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .25rem .6rem; border-radius: var(--r-full);
  background: var(--primary-50); color: var(--primary-700);
  font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
}
.breadcrumbs { color: var(--ink-400); font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; display: flex; align-items: center; gap: .4rem; margin-bottom: .4rem; }
.breadcrumbs .current { color: var(--primary-600); }
.page-title { font-size: clamp(1.5rem, 2.4vw, 2rem); margin: 0; }
.page-sub { color: var(--ink-500); margin-top: .35rem; }

/* Cards */
.card {
  background: var(--paper-raised);
  border: 1px solid var(--ink-100);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.card:hover { box-shadow: var(--shadow-md); }
.card--tint { background: linear-gradient(180deg, #fff, #fbfaff); }
.card--flush { padding: 0; overflow: hidden; }
.card-header {
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--ink-100);
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4);
}
.card-body { padding: var(--sp-5); }
.card-title { font-family: var(--font-head); font-weight: 700; font-size: 1rem; margin: 0; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .625rem 1rem; border-radius: var(--r-full);
  font-family: var(--font-body); font-weight: 600; font-size: .9rem;
  border: 1px solid transparent; cursor: pointer;
  transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur) var(--ease), background var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease);
  text-decoration: none; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--primary-600), var(--accent-500));
  box-shadow: var(--shadow-primary);
}
.btn-primary:hover { filter: brightness(1.04); text-decoration: none; color: #fff; }
.btn-secondary {
  color: var(--ink-800); background: var(--paper-raised); border-color: var(--ink-100);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover { background: var(--ink-50); text-decoration: none; color: var(--ink-900); }
.btn-ghost { color: var(--ink-600); background: transparent; }
.btn-ghost:hover { background: var(--ink-50); color: var(--ink-900); text-decoration: none; }
.btn-danger { color: var(--danger-700); background: var(--danger-50); border-color: #fde4e4; }
.btn-danger:hover { background: #fdd8d8; text-decoration: none; color: var(--danger-700); }
.btn-sm { padding: .4rem .75rem; font-size: .82rem; }
.btn-lg { padding: .85rem 1.3rem; font-size: .95rem; }
.btn-block { width: 100%; }
.btn-icon { padding: .5rem; width: 40px; height: 40px; border-radius: 10px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* Forms */
.field { display: flex; flex-direction: column; gap: .35rem; margin-bottom: var(--sp-4); }
.field > label, .label {
  font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-500);
}
.input, .select, .textarea {
  width: 100%; font: inherit; color: var(--ink-900);
  padding: .7rem .9rem; border-radius: var(--r-md);
  background: var(--paper-raised);
  border: 1px solid var(--ink-100);
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.input:hover, .select:hover, .textarea:hover { border-color: var(--ink-200); }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--primary-500);
  box-shadow: 0 0 0 4px rgba(91,85,230,.14);
  background: #fff;
}
.textarea { resize: vertical; min-height: 90px; }
.helper { color: var(--ink-400); font-size: .78rem; }
.form-error { color: var(--danger-700); font-size: .8rem; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: var(--sp-4); }
.form-row-3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: var(--sp-4); }
.form-section { padding: var(--sp-5) 0; border-top: 1px solid var(--ink-100); }
.form-section:first-child { border-top: 0; padding-top: 0; }
.form-section h3 { margin-bottom: .25rem; }
.form-section .section-desc { color: var(--ink-500); margin-bottom: var(--sp-4); font-size: .9rem; }

/* Inline tag/chip input style */
.input-group { display: flex; align-items: center; gap: 0; }
.input-group .input { border-radius: 0; }
.input-group > :first-child { border-top-left-radius: var(--r-md); border-bottom-left-radius: var(--r-md); }
.input-group > :last-child { border-top-right-radius: var(--r-md); border-bottom-right-radius: var(--r-md); }
.input-prefix {
  padding: .7rem .8rem; background: var(--ink-50); border: 1px solid var(--ink-100);
  border-right: 0; color: var(--ink-500); font-weight: 600;
}

/* Country selector cards */
.country-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--sp-3); }
.country-option { position: relative; }
.country-option input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.country-option .pane {
  padding: var(--sp-4); border-radius: var(--r-md);
  border: 1px solid var(--ink-100); background: var(--paper-raised);
  text-align: center; transition: border-color .15s, background .15s, box-shadow .15s;
  cursor: pointer;
}
.country-option input:checked + .pane {
  border-color: var(--primary-500);
  background: linear-gradient(180deg, #fff, var(--primary-50));
  box-shadow: 0 0 0 4px rgba(91,85,230,.12);
}
.country-option .flag { font-size: 1.6rem; display: block; margin-bottom: .3rem; }
.country-option .label-name { font-weight: 700; font-size: .9rem; color: var(--ink-900); }
.country-option .label-meta { font-size: .72rem; color: var(--ink-500); margin-top: 2px; }

/* Badges / status chips */
.badge {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .22rem .55rem; border-radius: var(--r-full);
  font-size: .72rem; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; white-space: nowrap;
  background: var(--ink-50); color: var(--ink-600);
}
.badge-dot { width: 6px; height: 6px; border-radius: 999px; background: currentColor; }
.badge.draft    { background: var(--ink-50);     color: var(--ink-600); }
.badge.issued   { background: var(--info-50);    color: var(--info-700); }
.badge.sent     { background: var(--primary-50); color: var(--primary-700); }
.badge.paid     { background: var(--success-50); color: var(--success-700); }
.badge.partial  { background: #fef6e6;           color: var(--warning-700); }
.badge.overdue  { background: var(--danger-50);  color: var(--danger-700); }
.badge.cancel   { background: var(--ink-50);     color: var(--ink-500); }
.chip-input {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  align-items: center;
  min-height: 48px;
  padding: .45rem .55rem;
  border: 1px solid var(--ink-200);
  border-radius: var(--r-md);
  background: #fff;
}
.chip-input:focus-within {
  border-color: var(--primary-500);
  box-shadow: 0 0 0 4px rgba(91,85,230,.12);
}
.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
}
.chip-editor {
  flex: 1 1 160px;
  min-width: 140px;
  border: 0 !important;
  box-shadow: none !important;
  padding: .2rem 0 !important;
  background: transparent !important;
}
.chip-badge {
  gap: .45rem;
  text-transform: none;
  letter-spacing: 0;
  font-size: .8rem;
}
.chip-remove {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
}
.invoice-error-list {
  margin: 0;
  padding-left: 1.2rem;
}
.invoice-error-list li + li {
  margin-top: .2rem;
}
.invoice-error-alert {
  border-width: 1px;
  border-radius: var(--r-xl);
  padding: var(--sp-5);
  box-shadow: var(--shadow-md);
}
.invoice-error-head {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--sp-4);
  align-items: start;
}
.invoice-error-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(194, 52, 52, .08);
}

/* KPI cards */
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: var(--sp-4); }
.kpi {
  background: var(--paper-raised); border: 1px solid var(--ink-100); border-radius: var(--r-lg);
  padding: var(--sp-5); box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: .75rem;
  transition: box-shadow var(--dur) var(--ease), transform var(--dur-fast) var(--ease);
}
.kpi:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.kpi-head { display: flex; align-items: center; justify-content: space-between; }
.kpi-icon {
  width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
  background: var(--primary-50); color: var(--primary-700);
}
.kpi-icon.success { background: var(--success-50); color: var(--success-700); }
.kpi-icon.warning { background: var(--warning-50); color: var(--warning-700); }
.kpi-icon.danger  { background: var(--danger-50);  color: var(--danger-700); }
.kpi-icon.ink     { background: var(--ink-50);     color: var(--ink-600); }
.kpi-label { font-size: .72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-500); }
.kpi-value { font-family: var(--font-head); font-weight: 800; font-size: 1.75rem; letter-spacing: -.01em; }
.kpi-trend { font-size: .8rem; color: var(--ink-500); display: flex; align-items: center; gap: .3rem; }
.kpi-trend.up { color: var(--success-700); }
.kpi-trend.down { color: var(--danger-700); }
.kpi.strong { background: linear-gradient(135deg, #1f1b4d, #4338ca); color: #fff; border: 0; }
.kpi.strong .kpi-label, .kpi.strong .kpi-trend { color: rgba(255,255,255,.75); }
.kpi.strong .kpi-icon { background: rgba(255,255,255,.15); color: #fff; }

/* Tables */
.table-wrap { background: var(--paper-raised); border: 1px solid var(--ink-100); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-sm); }
.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th, .table td { padding: .9rem 1rem; text-align: left; font-size: .9rem; vertical-align: middle; }
.table thead th {
  background: var(--paper-soft); color: var(--ink-500);
  font-size: .7rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  border-bottom: 1px solid var(--ink-100);
}
.table tbody tr { border-bottom: 1px solid var(--ink-100); transition: background .15s ease; }
.table tbody tr:last-child { border-bottom: 0; }
.table tbody tr:hover { background: var(--paper-soft); }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table a { color: inherit; }
.table a:hover { color: var(--primary-600); text-decoration: none; }

/* Filter bar */
.filter-bar {
  background: var(--paper-raised);
  border: 1px solid var(--ink-100); border-radius: var(--r-lg);
  padding: .75rem; margin-bottom: var(--sp-4);
  display: flex; flex-wrap: wrap; gap: .5rem; align-items: center;
  box-shadow: var(--shadow-xs);
}
.filter-bar .search-input {
  flex: 1; min-width: 220px;
  display: flex; align-items: center; gap: .5rem;
  background: var(--paper-soft); border: 1px solid transparent;
  padding: .5rem .85rem; border-radius: var(--r-full);
}
.filter-bar .search-input input { border: 0; outline: none; background: transparent; flex: 1; font: inherit; color: var(--ink-800); }
.chip-filter {
  padding: .45rem .8rem; border-radius: var(--r-full);
  background: var(--paper-soft); color: var(--ink-600); font-size: .82rem; font-weight: 500;
  border: 1px solid transparent; cursor: pointer;
  display: inline-flex; align-items: center; gap: .35rem;
}
.chip-filter:hover { background: var(--ink-50); text-decoration: none; color: var(--ink-800); }
.chip-filter.active { background: #fff; color: var(--primary-700); border-color: var(--primary-500); box-shadow: 0 0 0 3px rgba(91,85,230,.12); }

/* Mobile invoice cards */
.list-cards { display: grid; gap: var(--sp-3); }
.list-card {
  background: var(--paper-raised); border: 1px solid var(--ink-100);
  border-left: 4px solid var(--ink-100);
  border-radius: var(--r-md); padding: var(--sp-4);
  box-shadow: var(--shadow-xs); color: inherit;
  transition: box-shadow var(--dur) var(--ease), transform var(--dur-fast) var(--ease), border-color var(--dur) var(--ease);
}
.list-card:hover { text-decoration: none; color: inherit; box-shadow: var(--shadow-md); transform: translateY(-1px); }
.list-card.st-draft    { border-left-color: var(--ink-300); }
.list-card.st-issued   { border-left-color: var(--info-600); }
.list-card.st-sent     { border-left-color: var(--primary-500); }
.list-card.st-paid     { border-left-color: var(--success-600); }
.list-card.st-partial  { border-left-color: var(--warning-600); }
.list-card.st-overdue  { border-left-color: var(--danger-600); }
.list-card .top { display: flex; justify-content: space-between; gap: var(--sp-3); align-items: flex-start; }
.list-card .bottom { display: flex; justify-content: space-between; gap: var(--sp-3); align-items: baseline; margin-top: var(--sp-3); }
.list-card .id { font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-400); }
.list-card .name { font-weight: 700; color: var(--ink-900); }
.list-card .amount { font-family: var(--font-head); font-weight: 800; font-size: 1.1rem; }

/* Avatar initials */
.initials {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--primary-50); color: var(--primary-700);
  display: inline-grid; place-items: center; font-weight: 700; font-size: .8rem; flex: 0 0 36px;
}
.initials.a2 { background: #eefcf3; color: var(--success-700); }
.initials.a3 { background: #fff1e6; color: var(--warning-700); }
.initials.a4 { background: #fde8ea; color: var(--danger-700); }

/* Empty state */
.empty {
  padding: var(--sp-10) var(--sp-6); text-align: center;
  border: 1px dashed var(--ink-200); border-radius: var(--r-lg);
  background: #fbfbff;
}
.empty .ill {
  width: 72px; height: 72px; margin: 0 auto var(--sp-4);
  border-radius: 20px;
  background: linear-gradient(135deg, var(--primary-50), #f3efff);
  display: grid; place-items: center;
  color: var(--primary-600);
}
.empty h3 { margin: 0 0 .35rem; }
.empty p { color: var(--ink-500); max-width: 420px; margin: 0 auto var(--sp-4); }

/* Toast */
.toast {
  position: fixed; bottom: 28px; right: 28px; z-index: 80;
  background: rgba(17,25,54,.96); color: #fff;
  padding: .75rem 1rem; border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  display: flex; gap: .5rem; align-items: center; max-width: 360px; font-size: .9rem;
}
.alert {
  padding: .85rem 1rem; border-radius: var(--r-md);
  display: flex; gap: .6rem; align-items: flex-start;
  border: 1px solid var(--ink-100); background: var(--paper-raised);
  margin-bottom: var(--sp-4);
}
.alert.info    { background: var(--info-50);    border-color: #d6e2f9; color: var(--info-700); }
.alert.success { background: var(--success-50); border-color: #caeddb; color: var(--success-700); }
.alert.warning { background: var(--warning-50); border-color: #fadfbf; color: var(--warning-700); }
.alert.danger  { background: var(--danger-50);  border-color: #fad0d0; color: var(--danger-700); }

/* Skeleton */
.skeleton {
  background: linear-gradient(90deg, #eef0f7 0%, #f6f7fb 50%, #eef0f7 100%);
  background-size: 200% 100%;
  animation: sk 1.2s infinite ease-in-out;
  border-radius: 6px; height: 1rem;
}
@keyframes sk { 0% { background-position: 0 0; } 100% { background-position: -200% 0; } }

/* Document look (invoice detail / preview) */
.doc {
  background: #fff; border: 1px solid var(--ink-100); border-radius: var(--r-lg);
  overflow: hidden; box-shadow: var(--shadow-md);
}
.doc-stripe { height: 6px; background: linear-gradient(90deg, var(--primary-600), var(--accent-500)); }
.doc-body { padding: clamp(1.25rem, 3vw, 2.5rem); display: grid; gap: var(--sp-8); }
.doc-meta { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-6); }
.doc .amount-total { font-family: var(--font-head); font-weight: 800; font-size: clamp(1.75rem, 3vw, 2.4rem); color: var(--primary-700); letter-spacing: -.02em; }
.doc-table { width: 100%; border-collapse: collapse; }
.doc-table th { text-align: left; padding: .6rem 0; font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-500); border-bottom: 1px solid var(--ink-100); }
.doc-table td { padding: .9rem 0; border-bottom: 1px solid var(--ink-50); font-size: .92rem; }
.doc-table th.num, .doc-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.totals { width: 320px; max-width: 100%; margin-left: auto; display: grid; gap: .5rem; }
.totals .row { display: flex; justify-content: space-between; font-size: .92rem; color: var(--ink-600); }
.totals .row.total { border-top: 1px solid var(--ink-100); padding-top: .75rem; margin-top: .35rem; align-items: baseline; }
.totals .row.total .label-lg { font-family: var(--font-head); font-weight: 700; color: var(--ink-900); }

/* Timeline */
.timeline { display: grid; gap: var(--sp-4); position: relative; }
.timeline::before { content: ""; position: absolute; left: 11px; top: 6px; bottom: 6px; width: 2px; background: var(--ink-100); border-radius: 2px; }
.timeline-item { display: grid; grid-template-columns: 24px 1fr; gap: var(--sp-3); align-items: flex-start; }
.timeline-item .dot {
  width: 24px; height: 24px; border-radius: 999px;
  background: #fff; border: 2px solid var(--primary-500);
  display: grid; place-items: center; z-index: 1;
}
.timeline-item .dot::after { content: ""; width: 8px; height: 8px; border-radius: 999px; background: var(--primary-500); }
.timeline-item.muted .dot { border-color: var(--ink-200); }
.timeline-item.muted .dot::after { background: var(--ink-200); }
.timeline-item.warn .dot { border-color: var(--danger-600); }
.timeline-item.warn .dot::after { background: var(--danger-600); }
.timeline-item .what { font-weight: 600; }
.timeline-item .when { font-size: .78rem; color: var(--ink-500); }
.timeline-item .detail { font-size: .85rem; color: var(--ink-500); margin-top: 2px; }

/* Invoice create item rows */
.items-table { width: 100%; border-collapse: separate; border-spacing: 0 .5rem; }
.items-table thead th { font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-500); font-weight: 700; padding: 0 .75rem .5rem; text-align: left; }
.items-table thead th.num { text-align: right; }
.items-table tbody td {
  background: var(--paper-soft); padding: .55rem .75rem;
  border-top: 1px solid var(--ink-100); border-bottom: 1px solid var(--ink-100); vertical-align: middle;
}
.items-table tbody td:first-child { border-left: 1px solid var(--ink-100); border-top-left-radius: var(--r-md); border-bottom-left-radius: var(--r-md); }
.items-table tbody td:last-child  { border-right: 1px solid var(--ink-100); border-top-right-radius: var(--r-md); border-bottom-right-radius: var(--r-md); }
.items-table .cell-input { width: 100%; border: 0; background: transparent; padding: .45rem 0; font: inherit; color: var(--ink-900); outline: none; }
.items-table .cell-input:focus { color: var(--primary-700); }
.items-table .num .cell-input { text-align: right; font-variant-numeric: tabular-nums; }
.add-row-btn {
  width: 100%; padding: .85rem; border-radius: var(--r-md);
  border: 1.5px dashed var(--ink-200); background: transparent;
  color: var(--ink-500); font-weight: 600; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: .4rem;
  transition: background .15s ease, color .15s ease;
}
.add-row-btn:hover { background: var(--paper-soft); color: var(--primary-600); }

/* Utility */
.stack-md > * + * { margin-top: var(--sp-4); }
.stack-lg > * + * { margin-top: var(--sp-6); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: var(--sp-6); align-items: flex-start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: var(--sp-4); }
.flex { display: flex; gap: var(--sp-3); align-items: center; }
.flex-col { display: flex; flex-direction: column; }
.muted { color: var(--ink-500); }
.mono { font-family: var(--font-mono); }
.num { font-variant-numeric: tabular-nums; }
.w-full { width: 100%; }
.mt-0 { margin-top: 0; }
.mt-2 { margin-top: var(--sp-2); }
.mt-3 { margin-top: var(--sp-3); }
.mt-4 { margin-top: var(--sp-4); }
.mt-5 { margin-top: var(--sp-5); }
.mt-6 { margin-top: var(--sp-6); }
.mb-0 { margin-bottom: 0; }
.mb-3 { margin-bottom: var(--sp-3); }
.mb-4 { margin-bottom: var(--sp-4); }
.mb-6 { margin-bottom: var(--sp-6); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.hide-mobile { display: initial; }
.show-mobile { display: none; }

/* Sticky summary column */
.summary-sticky { position: sticky; top: calc(var(--appbar-h) + 16px); }
.collapsible-panel.is-collapsed { display: none; }
.contact-card { padding: var(--sp-4); background: var(--paper-soft); border-color: var(--ink-100); }
.hide-input { display: none !important; }

.expense-edit-layout { align-items: start; }
.expense-dropzone {
  border: 1.5px dashed var(--ink-200);
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, var(--paper-soft), #fff);
  padding: var(--sp-5);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--sp-4);
  align-items: center;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease, transform .15s ease;
}
.expense-dropzone:hover,
.expense-dropzone.is-dragover {
  border-color: var(--primary-500);
  background: linear-gradient(180deg, #f7f4ff, #fff);
  box-shadow: 0 0 0 4px rgba(108, 75, 255, .08);
}
.expense-dropzone:focus-visible {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 4px rgba(108, 75, 255, .12);
}
.expense-dropzone-icon {
  width: 44px; height: 44px; border-radius: 14px;
  display: grid; place-items: center;
  background: var(--primary-50); color: var(--primary-700);
  font-size: 1.4rem; font-weight: 800;
}
.expense-dropzone-title {
  font-weight: 700;
  color: var(--ink-900);
}
.expense-attachment-card {
  border: 1px solid var(--ink-100);
  border-radius: var(--r-lg);
  background: var(--paper-soft);
  padding: var(--sp-4);
  display: grid;
  gap: var(--sp-4);
}
.expense-attachment-preview {
  min-height: 180px;
  border-radius: var(--r-md);
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--ink-100);
}
.expense-attachment-preview img,
.expense-attachment-preview iframe {
  display: block;
  width: 100%;
  height: 220px;
  border: 0;
  object-fit: cover;
  background: #fff;
}
.expense-attachment-empty,
.expense-attachment-empty-state {
  min-height: 180px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--ink-500);
  font-weight: 600;
  padding: var(--sp-5);
  border: 1px dashed var(--ink-200);
  border-radius: var(--r-md);
  background: #fff;
}
.expense-attachment-empty-state { min-height: 96px; }
.expense-attachment-meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
}
.expense-attachment-name {
  font-weight: 700;
  color: var(--ink-900);
  word-break: break-word;
}

/* Hero (foundation / roadmap) — retained but softer */
.hero-card {
  background: linear-gradient(135deg, #ffffff 0%, #fbfaff 100%);
  border: 1px solid var(--ink-100); border-radius: var(--r-xl);
  padding: clamp(1.25rem, 3vw, 2rem);
  box-shadow: var(--shadow-md);
}

/* -------- Stats grid (expense KPIs etc.) -------------- */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--sp-4); margin-bottom: var(--sp-6);
}
.stat-card {
  background: var(--paper-raised); border: 1px solid var(--ink-100);
  border-radius: var(--r-lg); padding: var(--sp-5);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--dur) var(--ease);
}
.stat-card:hover { box-shadow: var(--shadow-md); }
.stat-card .label {
  font-size: .72rem; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-500); margin-bottom: .35rem;
}
.stat-card .value {
  font-family: var(--font-head); font-weight: 800;
  font-size: 1.6rem; letter-spacing: -.01em; color: var(--ink-900);
}
.stat-card .meta {
  font-size: .8rem; color: var(--ink-500); margin-top: .35rem;
}

/* -------- Tab navigation ------------------------------ */
.tabs {
  display: flex; gap: 2px;
  border-bottom: 2px solid var(--ink-100);
  margin-bottom: var(--sp-5);
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .65rem 1.1rem; border: 0; background: none;
  font: inherit; font-size: .9rem; font-weight: 600;
  color: var(--ink-500); cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
  text-decoration: none; white-space: nowrap;
}
.tab:hover { color: var(--ink-900); text-decoration: none; }
.tab.active {
  color: var(--primary-700);
  border-bottom-color: var(--primary-600);
}
.tab .icon { width: 18px; height: 18px; display: inline-grid; place-items: center; }
.tab .tab-count {
  font-size: .72rem; font-weight: 700; background: var(--ink-50);
  color: var(--ink-600); padding: .1rem .45rem; border-radius: var(--r-full);
}
.tab.active .tab-count { background: var(--primary-50); color: var(--primary-700); }

/* Tab panels */
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* -------- Table row links ----------------------------- */
.table tbody tr.clickable-row { cursor: pointer; }
.table tbody tr.clickable-row:hover { background: var(--primary-50); }
.table tbody tr.clickable-row td:first-child { position: relative; }

/* -------- Utility classes ----------------------------- */
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }
.fs-mono { font-family: var(--font-mono); }
.fs-head { font-family: var(--font-head); }
.fs-sm { font-size: .85rem; }
.fs-xs { font-size: .78rem; }
.text-ink-900 { color: var(--ink-900); }
.text-ink-500 { color: var(--ink-500); }
.text-primary { color: var(--primary-700); }
.text-success { color: var(--success-700); }
.text-danger { color: var(--danger-700); }
.text-warning { color: var(--warning-700); }
.gap-xs { gap: .35rem; }
.gap-sm { gap: .5rem; }
.flex-wrap { flex-wrap: wrap; }
.d-inline { display: inline; }
.d-inline-flex { display: inline-flex; }
.d-flex { display: flex; }
.d-grid { display: grid; }
.d-none { display: none !important; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.overflow-auto { overflow-x: auto; }
.p-0 { padding: 0; }
.p-4 { padding: var(--sp-4); }
.p-5 { padding: var(--sp-5); }
.bg-soft { background: var(--paper-soft); }
.border-ink { border-color: var(--ink-100); }

/* =========================================================
   Responsive: tablet & mobile
   ========================================================= */
@media (max-width: 1080px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .expense-dropzone { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }

  .appbar { display: none; }
  .appbar-mobile {
    position: sticky; top: 0; z-index: 40;
    display: flex; align-items: center; justify-content: space-between; gap: .75rem;
    padding: 0 var(--sp-4); height: var(--appbar-h);
    background: rgba(255,255,255,.85);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--ink-100);
  }
  .appbar-mobile .brand {
    font-family: var(--font-head); font-weight: 800; font-size: 1.05rem; letter-spacing: -.02em;
    display: flex; align-items: center; gap: .5rem; color: var(--ink-900);
  }
  .appbar-mobile .brand .brand-mark {
    width: 28px; height: 28px; border-radius: 8px;
    background: linear-gradient(135deg, var(--primary-600), var(--accent-500));
    color: #fff; display: grid; place-items: center; font-weight: 800; font-size: .8rem;
  }

  .bottombar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    display: flex; justify-content: space-around; align-items: center;
    padding: 8px env(safe-area-inset-right) calc(8px + env(safe-area-inset-bottom)) env(safe-area-inset-left);
    background: rgba(255,255,255,.95);
    backdrop-filter: blur(14px);
    border-top: 1px solid var(--ink-100);
    box-shadow: 0 -4px 20px rgba(17,25,54,.06);
  }
  .bottombar a {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 6px 4px; color: var(--ink-400); font-size: .66rem; font-weight: 700;
    letter-spacing: .05em; text-transform: uppercase; text-decoration: none;
    border-radius: 10px;
  }
  .bottombar a .icon { width: 22px; height: 22px; display: grid; place-items: center; }
  .bottombar a.active { color: var(--primary-700); background: var(--primary-50); }
  .bottombar a.fab {
    color: #fff;
    background: linear-gradient(135deg, var(--primary-600), var(--accent-500));
    box-shadow: var(--shadow-primary);
    transform: translateY(-14px);
    width: 56px; height: 56px; border-radius: 999px;
    padding: 0; font-size: 0;
    flex: 0 0 auto;
  }
  .bottombar a.fab .icon { width: 26px; height: 26px; }

  .main {
    padding: var(--sp-4) var(--sp-4) calc(var(--sp-12) + var(--bottombar-h));
  }

  .kpi-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .doc-meta { grid-template-columns: 1fr; }

  .hide-mobile { display: none !important; }
  .show-mobile { display: initial !important; }

  .page-header { align-items: flex-start; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-bar > * { width: 100%; }

  .sticky-actions {
    position: fixed; left: 0; right: 0; bottom: var(--bottombar-h);
    padding: .75rem var(--sp-4) calc(.75rem + env(safe-area-inset-bottom));
    background: rgba(255,255,255,.95); backdrop-filter: blur(12px);
    border-top: 1px solid var(--ink-100);
    display: flex; gap: .5rem; z-index: 45;
  }
  .sticky-actions .btn { flex: 1; }
}

@media (max-width: 520px) {
  .kpi-grid { grid-template-columns: 1fr; }
  h1 { font-size: 1.5rem; }
  .page-header { flex-direction: column; align-items: flex-start; gap: var(--sp-3); }
  .page-header > div:last-child { width: 100%; }
  .page-header .btn { flex: 1; }
  .tabs .tab { padding: .6rem .75rem; font-size: .82rem; }
}

.auth-page {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(67, 56, 202, .12), transparent 35%),
    linear-gradient(180deg, #f5f7ff 0%, #eef2ff 100%);
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
}

.auth-card {
  width: min(100%, 28rem);
  background: rgba(255, 255, 255, .92);
  border: 1px solid rgba(255, 255, 255, .75);
  border-radius: 28px;
  box-shadow: 0 24px 80px rgba(37, 99, 235, .10);
  padding: 2rem;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.auth-brand h1 {
  margin: 0;
  font-size: 1.9rem;
}

.auth-kicker {
  color: var(--primary-700);
  font-size: .8rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: .2rem;
}

.auth-subtitle {
  margin: 0 0 1.5rem;
  color: var(--ink-500);
}

.auth-meta {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  display: grid;
  gap: .4rem;
}

/* -------- Skeleton loading (enhanced) ------------------ */
.skeleton-text { height: 1em; width: 60%; display: block; margin: .4em 0; }
.skeleton-heading { height: 1.5em; width: 40%; display: block; margin: .5em 0; }
.skeleton-avatar { width: 40px; height: 40px; border-radius: var(--r-full); }

/* -------- Enhanced Card Styles ------------------------- */
.card {
  transition: transform var(--dur-slow) var(--ease), box-shadow var(--dur-slow) var(--ease), border-color var(--dur) var(--ease);
}
.card:hover {
  box-shadow: var(--shadow-md), 0 0 0 1px rgba(99,102,241,.06);
  transform: translateY(-2px);
}
.card--glass {
  background: rgba(255,255,255,.72);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border: 1px solid rgba(255,255,255,.5);
}

/* -------- Enhanced Button Effects ---------------------- */
.btn-primary {
  position: relative;
  overflow: hidden;
}
.btn-primary::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,.2), transparent 50%);
  opacity: 0;
  transition: opacity var(--dur) var(--ease);
}
.btn-primary:hover::after { opacity: 1; }

/* -------- Enhanced KPI Cards --------------------------- */
.kpi {
  transition: transform var(--dur-slow) var(--ease), box-shadow var(--dur-slow) var(--ease);
  position: relative;
  overflow: hidden;
}
.kpi::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-500), var(--accent-500));
  opacity: 0;
  transition: opacity var(--dur-slow) var(--ease);
}
.kpi:hover::before { opacity: 1; }
.kpi:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

/* -------- Sparklines ----------------------------------- */
.sparkline {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 32px;
}
.sparkline-bar {
  flex: 1;
  min-width: 4px;
  max-width: 8px;
  background: var(--primary-400);
  border-radius: 2px 2px 0 0;
  opacity: .5;
  transition: opacity var(--dur) var(--ease), background var(--dur) var(--ease);
}
.sparkline-bar:last-child { opacity: 1; background: var(--primary-600); }
.sparkline-bar:hover { opacity: 1; background: var(--primary-500); }

/* -------- Progress bars -------------------------------- */
.progress {
  height: 6px;
  background: var(--ink-100);
  border-radius: var(--r-full);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-600), var(--accent-500));
  border-radius: var(--r-full);
  transition: width .6s var(--ease);
}

/* -------- Notification Dot ----------------------------- */
.notif-dot {
  width: 8px; height: 8px;
  background: var(--danger-600);
  border-radius: var(--r-full);
  border: 2px solid white;
  position: absolute;
  top: -2px; right: -2px;
  animation: pulse-ring 2s ease-in-out infinite;
}

/* -------- Table row stagger animation ------------------ */
.table tbody tr {
  animation: fadeIn .3s var(--ease) both;
}
.table tbody tr:nth-child(1) { animation-delay: .02s; }
.table tbody tr:nth-child(2) { animation-delay: .04s; }
.table tbody tr:nth-child(3) { animation-delay: .06s; }
.table tbody tr:nth-child(4) { animation-delay: .08s; }
.table tbody tr:nth-child(5) { animation-delay: .1s; }
.table tbody tr:nth-child(6) { animation-delay: .12s; }
.table tbody tr:nth-child(7) { animation-delay: .14s; }
.table tbody tr:nth-child(8) { animation-delay: .16s; }
.table tbody tr:nth-child(9) { animation-delay: .18s; }
.table tbody tr:nth-child(10) { animation-delay: .2s; }

/* -------- Animated active pill for sidebar nav --------- */
.sidebar .nav a.active {
  position: relative;
}
.sidebar .nav a.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 3px;
  background: linear-gradient(180deg, var(--primary-500), var(--accent-500));
  border-radius: 0 var(--r-full) var(--r-full) 0;
  animation: slideInLeft .3s var(--ease) both;
}

/* -------- Smooth page content appearance --------------- */
.main {
  animation: fadeIn .3s var(--ease) both;
}

/* -------- Auth pages (split-screen) -------------------- */
.auth-page-split {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--paper);
}
.auth-brand-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: var(--sp-12);
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 30%, #4338ca 70%, #6366f1 100%);
  background-size: 200% 200%;
  animation: gradient-shift 8s ease infinite;
  color: white;
  position: relative;
  overflow: hidden;
}
.auth-brand-panel::before {
  content: '';
  position: absolute;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(139,133,255,.3), transparent 70%);
  top: -100px;
  right: -100px;
  pointer-events: none;
}
.auth-brand-panel::after {
  content: '';
  position: absolute;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(124,58,237,.2), transparent 70%);
  bottom: -80px;
  left: -80px;
  pointer-events: none;
}
.auth-brand-panel h1 {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: .5rem;
  z-index: 1;
  color: #fff;
}
.auth-brand-panel p {
  font-size: 1.1rem;
  opacity: .85;
  max-width: 360px;
  text-align: center;
  line-height: 1.7;
  z-index: 1;
}
.auth-brand-panel .feature-list {
  list-style: none;
  padding: 0;
  margin: 2rem 0 0;
  z-index: 1;
}
.auth-brand-panel .feature-list li {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem 0;
  font-size: .95rem;
  opacity: .9;
}
.auth-brand-panel .feature-list li svg {
  color: var(--primary-400);
  flex-shrink: 0;
}
.auth-brand-logo {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: rgba(255,255,255,.15);
  backdrop-filter: blur(10px);
  display: grid;
  place-items: center;
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 1.5rem;
  z-index: 1;
}
.auth-form-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: var(--sp-8);
  background: var(--paper);
}
.auth-form-card {
  width: 100%;
  max-width: 420px;
  animation: fadeInUp .5s var(--ease) both;
}
.auth-form-card h2 {
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: .35rem;
}
.auth-form-card .subtitle {
  color: var(--ink-500);
  margin-bottom: var(--sp-6);
  font-size: .95rem;
}
.auth-form-card .field + .field { margin-top: var(--sp-4); }
.auth-form-card .btn-primary {
  width: 100%;
  justify-content: center;
  padding: .85rem;
  font-size: 1rem;
  margin-top: var(--sp-5);
}
.auth-footer-text {
  margin-top: var(--sp-6);
  text-align: center;
  font-size: .9rem;
  color: var(--ink-500);
}
.auth-footer-text a {
  color: var(--primary-600);
  font-weight: 600;
  text-decoration: none;
}
.auth-footer-text a:hover { text-decoration: underline; }

@media (max-width: 860px) {
  .auth-page-split { grid-template-columns: 1fr; }
  .auth-brand-panel { display: none; }
  .auth-form-panel { padding: var(--sp-4); }
}

/* -------- Quick actions -------------------------------- */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--sp-3);
}
.quick-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-5) var(--sp-3);
  background: var(--paper-raised);
  border: 1px solid var(--ink-100);
  border-radius: var(--r-lg);
  text-decoration: none;
  color: var(--ink-700);
  font-size: .85rem;
  font-weight: 600;
  transition: all var(--dur-slow) var(--ease);
  cursor: pointer;
}
.quick-action:hover {
  border-color: var(--primary-400);
  background: var(--primary-50);
  color: var(--primary-700);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}
.quick-action .qa-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ink-50);
  border-radius: var(--r-md);
  color: var(--primary-600);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.quick-action:hover .qa-icon {
  background: var(--primary-600);
  color: white;
}

/* -------- Mini bar chart ------------------------------- */
.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 120px;
  padding: var(--sp-4) 0;
}
.chart-bar {
  flex: 1;
  background: var(--primary-50);
  border-radius: 4px 4px 0 0;
  position: relative;
  transition: background var(--dur) var(--ease);
  min-height: 4px;
}
.chart-bar:hover { background: var(--primary-400); }
.chart-bar .inner {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: linear-gradient(180deg, var(--primary-500), var(--primary-600));
  border-radius: 4px 4px 0 0;
  transition: height .6s var(--ease);
}
.chart-labels {
  display: flex;
  gap: 6px;
}
.chart-labels span {
  flex: 1;
  text-align: center;
  font-size: .65rem;
  color: var(--ink-400);
  text-transform: uppercase;
}

/* -------- Landing hero --------------------------------- */
.hero-glass {
  background: rgba(255,255,255,.08);
  backdrop-filter: blur(24px) saturate(1.2);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: var(--r-xl);
  padding: var(--sp-8);
}
