/* ============================================================
   CONTIX v2 — Design System
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,300;0,14..32,400;0,14..32,500;0,14..32,600;1,14..32,400&family=DM+Mono:wght@300;400;500&display=swap');

/* ---- Tokens ---- */
:root {
  --bg:           #F4F5F0;
  --surface:      #FFFFFF;
  --border:       #E2E4DC;
  --border-soft:  #ECEEE8;

  --text-primary:   #424953;
  --text-secondary: #8D9BA4;
  --text-tertiary:  #B4BEC5;

  --accent:         oklch(42% 0.09 220);
  --accent-light:   oklch(94% 0.04 220);
  --accent-medium:  oklch(72% 0.09 220);
  --positive:       oklch(52% 0.09 155);
  --positive-light: oklch(95% 0.04 155);
  --negative:       oklch(52% 0.09 20);
  --negative-light: oklch(95% 0.04 20);
  --warning:        oklch(62% 0.09 75);
  --warning-light:  oklch(96% 0.03 75);

  --sidebar-bg:     #1E2328;
  --sidebar-text:   #9BA3AB;
  --sidebar-active: #FFFFFF;
  --sidebar-hover:  rgba(255,255,255,0.07);
  --sidebar-accent: oklch(62% 0.09 220);

  --sidebar-w: 240px;
  --topbar-h:  54px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --shadow-sm: 0 1px 3px rgba(66,73,83,0.06), 0 1px 2px rgba(66,73,83,0.04);
  --shadow-md: 0 4px 12px rgba(66,73,83,0.08), 0 2px 4px rgba(66,73,83,0.04);
  --shadow-lg: 0 16px 40px rgba(66,73,83,0.12), 0 4px 8px rgba(66,73,83,0.06);

  --text-xs:   11px;
  --text-sm:   12px;
  --text-base: 13px;
  --text-md:   14px;
  --text-lg:   16px;
  --text-xl:   20px;
  --text-2xl:  24px;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: var(--text-base);
  color: var(--text-primary);
  background: var(--bg);
  line-height: 1.5;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
input, select, textarea { font-family: inherit; }

/* ============================================================
   VIEW SYSTEM
   ============================================================ */
.view { display: none; width: 100%; min-height: 100vh; }
.view.active { display: block; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: var(--text-base); font-weight: 500; font-family: inherit;
  transition: all 0.15s; cursor: pointer; border: none; white-space: nowrap;
}
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: oklch(38% 0.09 220); }
.btn-secondary { background: var(--surface); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { color: var(--text-primary); background: var(--bg); }
.btn-danger { background: var(--negative-light); color: var(--negative); }
.btn-lg { padding: 10px 20px; font-size: var(--text-md); border-radius: var(--radius-md); }
.btn-sm { padding: 4px 10px; font-size: var(--text-sm); border-radius: 5px; }
.btn svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 2; flex-shrink: 0; }

/* ============================================================
   LANDING
   ============================================================ */
.landing { background: var(--bg); min-height: 100vh; }

.landing-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 64px; height: 62px;
  background: rgba(244,245,240,0.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.nav-logo { display: flex; align-items: center; gap: 8px; font-size: var(--text-lg); font-weight: 600; color: var(--text-primary); letter-spacing: -0.3px; }
.nav-logo-mark { width: 28px; height: 28px; background: var(--accent); border-radius: 7px; display: flex; align-items: center; justify-content: center; }
.nav-logo-mark svg { width: 14px; height: 14px; }
.nav-links { display: flex; align-items: center; gap: 28px; }
.nav-links a { font-size: var(--text-md); color: var(--text-secondary); transition: color 0.15s; }
.nav-links a:hover { color: var(--text-primary); }
.nav-actions { display: flex; align-items: center; gap: 10px; }

.landing-hero {
  max-width: 1100px; margin: 0 auto;
  padding: 96px 64px 72px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 72px; align-items: center;
}
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent-light); color: var(--accent);
  font-size: var(--text-sm); font-weight: 500;
  padding: 4px 10px; border-radius: 20px; margin-bottom: 18px;
}
.hero-eyebrow-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.hero-title { font-size: 40px; font-weight: 600; line-height: 1.15; letter-spacing: -0.8px; margin-bottom: 18px; }
.hero-title span { color: var(--accent); }
.hero-subtitle { font-size: var(--text-lg); color: var(--text-secondary); line-height: 1.65; margin-bottom: 32px; max-width: 400px; }
.hero-actions { display: flex; align-items: center; gap: 10px; margin-bottom: 36px; }
.hero-trust { display: flex; align-items: center; gap: 10px; }
.hero-trust-avatars { display: flex; }
.hero-trust-avatar { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--bg); margin-left: -7px; font-size: 10px; font-weight: 600; display: flex; align-items: center; justify-content: center; color: white; }
.hero-trust-avatar:first-child { margin-left: 0; }
.hero-trust-text { font-size: var(--text-sm); color: var(--text-secondary); }
.hero-trust-text strong { color: var(--text-primary); font-weight: 500; }

.hero-visual { background: var(--surface); border-radius: var(--radius-lg); border: 1px solid var(--border); box-shadow: var(--shadow-lg); overflow: hidden; aspect-ratio: 16/10; }
.hero-visual-topbar { height: 34px; background: var(--sidebar-bg); display: flex; align-items: center; padding: 0 12px; gap: 5px; }
.hero-visual-dot { width: 7px; height: 7px; border-radius: 50%; }
.hero-visual-body { display: flex; height: calc(100% - 34px); }
.hero-visual-sidebar { width: 56px; background: var(--sidebar-bg); display: flex; flex-direction: column; align-items: center; padding: 10px 0; gap: 8px; }
.hero-visual-sidebar-item { width: 26px; height: 26px; border-radius: 5px; background: rgba(255,255,255,0.07); }
.hero-visual-sidebar-item.active { background: var(--sidebar-accent); opacity: 0.6; }
.hero-visual-content { flex: 1; padding: 12px; display: flex; flex-direction: column; gap: 8px; background: var(--bg); }
.hero-visual-kpis { display: grid; grid-template-columns: repeat(4,1fr); gap: 6px; }
.hero-visual-kpi { background: white; border-radius: 5px; padding: 8px; border: 1px solid var(--border-soft); }
.hero-visual-kpi-label { height: 4px; width: 36px; background: var(--border); border-radius: 3px; margin-bottom: 6px; }
.hero-visual-kpi-value { height: 9px; width: 50px; background: var(--text-tertiary); border-radius: 3px; }
.hero-visual-chart { background: white; border-radius: 5px; flex: 1; border: 1px solid var(--border-soft); padding: 8px 12px; }
.hero-visual-chart-bars { display: flex; align-items: flex-end; gap: 4px; height: 52px; margin-top: 8px; }
.hero-visual-bar { flex: 1; border-radius: 2px 2px 0 0; background: var(--accent-light); }
.hero-visual-bar.hi { background: var(--accent); opacity: 0.5; }

.landing-features { max-width: 1100px; margin: 0 auto; padding: 64px 64px; }
.section-label { font-size: var(--text-sm); font-weight: 500; letter-spacing: 0.8px; text-transform: uppercase; color: var(--text-secondary); margin-bottom: 10px; }
.section-title { font-size: 26px; font-weight: 600; letter-spacing: -0.4px; margin-bottom: 40px; }
.features-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 20px; }
.feature-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 24px 20px; transition: box-shadow 0.2s, transform 0.2s; }
.feature-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.feature-icon { width: 36px; height: 36px; border-radius: 8px; background: var(--accent-light); display: flex; align-items: center; justify-content: center; margin-bottom: 14px; }
.feature-icon svg { width: 17px; height: 17px; stroke: var(--accent); fill: none; stroke-width: 1.8; }
.feature-title { font-size: var(--text-md); font-weight: 600; margin-bottom: 6px; }
.feature-desc { font-size: var(--text-sm); color: var(--text-secondary); line-height: 1.6; }

.landing-modules { background: var(--sidebar-bg); padding: 52px 64px; }
.modules-inner { max-width: 1100px; margin: 0 auto; }
.modules-inner .section-label { color: var(--sidebar-text); }
.modules-inner .section-title { color: white; margin-bottom: 28px; }
.modules-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; }
.module-pill { background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.1); border-radius: var(--radius-sm); padding: 14px 16px; display: flex; align-items: center; gap: 8px; color: var(--sidebar-text); font-size: var(--text-sm); font-weight: 500; transition: all 0.15s; }
.module-pill:hover { background: rgba(255,255,255,0.12); color: white; }
.module-pill-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--sidebar-accent); flex-shrink: 0; }

.landing-cta { max-width: 1100px; margin: 0 auto; padding: 64px; text-align: center; }
.cta-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 56px 48px; }
.cta-subtitle { font-size: var(--text-md); color: var(--text-secondary); margin-bottom: 28px; }

.landing-footer { border-top: 1px solid var(--border); padding: 24px 64px; display: flex; align-items: center; justify-content: space-between; }
.footer-copy { font-size: var(--text-sm); color: var(--text-tertiary); }

/* ============================================================
   LOGIN
   ============================================================ */
.login { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.login-panel { display: flex; align-items: center; justify-content: center; padding: 48px; background: var(--bg); }
.login-card { width: 100%; max-width: 360px; }
.login-logo { display: flex; align-items: center; gap: 8px; margin-bottom: 36px; }
.login-logo-mark { width: 30px; height: 30px; background: var(--accent); border-radius: 7px; display: flex; align-items: center; justify-content: center; }
.login-logo-name { font-size: var(--text-xl); font-weight: 600; letter-spacing: -0.3px; }
.login-heading { font-size: 22px; font-weight: 600; letter-spacing: -0.4px; margin-bottom: 4px; }
.login-sub { font-size: var(--text-base); color: var(--text-secondary); margin-bottom: 28px; }
.login-visual { background: var(--sidebar-bg); display: flex; align-items: center; justify-content: center; padding: 64px; position: relative; overflow: hidden; }
.login-visual-bg { position: absolute; inset: 0; background: repeating-linear-gradient(0deg,transparent,transparent 39px,rgba(255,255,255,0.03) 39px,rgba(255,255,255,0.03) 40px), repeating-linear-gradient(90deg,transparent,transparent 39px,rgba(255,255,255,0.03) 39px,rgba(255,255,255,0.03) 40px); }
.login-visual-content { position: relative; text-align: center; }
.login-visual-icon { width: 68px; height: 68px; background: rgba(255,255,255,0.08); border-radius: 16px; display: flex; align-items: center; justify-content: center; margin: 0 auto 24px; border: 1px solid rgba(255,255,255,0.12); }
.login-visual-title { font-size: 20px; font-weight: 600; color: white; letter-spacing: -0.3px; margin-bottom: 10px; }
.login-visual-desc { font-size: var(--text-base); color: var(--sidebar-text); line-height: 1.65; max-width: 280px; }
.login-visual-stats { display: flex; gap: 24px; margin-top: 36px; justify-content: center; }
.login-visual-stat-value { font-size: var(--text-xl); font-weight: 600; color: white; font-family: 'DM Mono', monospace; }
.login-visual-stat-label { font-size: var(--text-xs); color: var(--sidebar-text); margin-top: 2px; }
.login-forgot { font-size: var(--text-sm); color: var(--accent); float: right; }
.login-submit { width: 100%; margin-top: 8px; justify-content: center; }
.login-divider { display: flex; align-items: center; gap: 10px; margin: 18px 0; color: var(--text-tertiary); font-size: var(--text-sm); }
.login-divider::before, .login-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.login-footer-text { text-align: center; font-size: var(--text-sm); color: var(--text-secondary); margin-top: 20px; }
.login-footer-text a { color: var(--accent); font-weight: 500; }

/* ============================================================
   FORM ELEMENTS
   ============================================================ */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: var(--text-sm); font-weight: 500; color: var(--text-primary); margin-bottom: 5px; }
.form-input {
  width: 100%; padding: 8px 11px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: var(--text-base);
  color: var(--text-primary); outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-input:focus { border-color: var(--accent-medium); box-shadow: 0 0 0 3px var(--accent-light); }
.form-input::placeholder { color: var(--text-tertiary); }
.form-select {
  width: 100%; padding: 8px 28px 8px 11px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: var(--text-base);
  color: var(--text-primary); outline: none; cursor: pointer;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238D9BA4' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center;
  transition: border-color 0.15s;
}
.form-select:focus { border-color: var(--accent-medium); box-shadow: 0 0 0 3px var(--accent-light); }
.form-textarea {
  width: 100%; padding: 8px 11px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: var(--text-base);
  color: var(--text-primary); outline: none; resize: vertical; min-height: 72px;
  transition: border-color 0.15s;
}
.form-textarea:focus { border-color: var(--accent-medium); box-shadow: 0 0 0 3px var(--accent-light); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.form-hint { font-size: var(--text-xs); color: var(--text-tertiary); margin-top: 3px; }
.form-section { margin-bottom: 22px; }
.form-section-title { font-size: var(--text-xs); font-weight: 500; letter-spacing: 0.6px; text-transform: uppercase; color: var(--text-secondary); margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border-soft); }

/* ============================================================
   APP LAYOUT
   ============================================================ */
.app-layout { display: flex; min-height: 100vh; }

/* ---- SIDEBAR ---- */
.sidebar {
  width: var(--sidebar-w); min-height: 100vh;
  background: var(--sidebar-bg);
  background-image: radial-gradient(circle, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 20px 20px;
  display: flex; flex-direction: column;
  position: fixed; left: 0; top: 0; bottom: 0; z-index: 200;
}
.sidebar-header {
  height: var(--topbar-h); display: flex; align-items: center;
  padding: 0 16px; border-bottom: 1px solid rgba(255,255,255,0.06);
}
.sidebar-logo { display: flex; align-items: center; gap: 8px; font-size: var(--text-md); font-weight: 600; color: white; letter-spacing: -0.3px; }
.sidebar-logo-mark { width: 24px; height: 24px; background: var(--sidebar-accent); border-radius: 6px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.sidebar-logo-mark svg { width: 13px; height: 13px; }

.sidebar-nav { flex: 1; padding: 12px 10px; overflow-y: auto; scrollbar-width: none; }
.sidebar-nav::-webkit-scrollbar { display: none; }

.sidebar-section-label { font-size: 10px; font-weight: 500; letter-spacing: 0.8px; text-transform: uppercase; color: rgba(255,255,255,0.2); padding: 0 8px; margin: 16px 0 4px; }
.sidebar-section-label:first-child { margin-top: 4px; }

/* Nav items */
.nav-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 9px; border-radius: 6px;
  font-size: var(--text-sm); font-weight: 400;
  color: var(--sidebar-text); cursor: pointer;
  transition: background 0.12s, color 0.12s;
  user-select: none; margin-bottom: 1px;
}
.nav-item svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 1.8; flex-shrink: 0; opacity: 0.75; }
.nav-item:hover { background: var(--sidebar-hover); color: rgba(255,255,255,0.85); }
.nav-item.active { background: rgba(255,255,255,0.1); color: white; font-weight: 500; }
.nav-item.active svg { opacity: 1; }
.nav-item-badge { margin-left: auto; background: var(--accent); color: white; font-size: 10px; font-weight: 600; padding: 1px 5px; border-radius: 10px; }
.nav-item-arrow { margin-left: auto; width: 12px; height: 12px; stroke: currentColor; fill: none; stroke-width: 2; transition: transform 0.2s; }
.nav-item.open .nav-item-arrow { transform: rotate(90deg); }

/* Submenu */
.nav-submenu { overflow: hidden; max-height: 0; transition: max-height 0.25s ease; }
.nav-submenu.open { max-height: 300px; }
.nav-subitem {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 9px 5px 28px;
  border-radius: 6px;
  font-size: var(--text-sm); color: var(--sidebar-text);
  cursor: pointer; transition: background 0.12s, color 0.12s;
  margin-bottom: 1px;
}
.nav-subitem::before { content: ''; width: 4px; height: 4px; border-radius: 50%; background: rgba(255,255,255,0.2); flex-shrink: 0; }
.nav-subitem:hover { background: var(--sidebar-hover); color: rgba(255,255,255,0.8); }
.nav-subitem.active { color: white; font-weight: 500; }
.nav-subitem.active::before { background: var(--sidebar-accent); }

.sidebar-footer { padding: 10px; border-top: 1px solid rgba(255,255,255,0.06); }
.sidebar-user { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border-radius: 6px; cursor: pointer; transition: background 0.12s; }
.sidebar-user:hover { background: var(--sidebar-hover); }
.sidebar-avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--sidebar-accent); display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 600; color: white; flex-shrink: 0; }
.sidebar-user-name { font-size: var(--text-sm); font-weight: 500; color: white; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: var(--text-xs); color: var(--sidebar-text); }

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

/* ---- TOPBAR ---- */
.topbar {
  height: var(--topbar-h); background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 24px; gap: 10px;
  position: sticky; top: 0; z-index: 100;
}
.topbar-breadcrumb { display: flex; align-items: center; gap: 5px; font-size: var(--text-sm); color: var(--text-secondary); flex: 1; }
.topbar-breadcrumb-current { color: var(--text-primary); font-weight: 500; }
.topbar-sep { color: var(--border); }
.topbar-search { display: flex; align-items: center; gap: 6px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 5px 10px; width: 200px; cursor: text; }
.topbar-search svg { width: 12px; height: 12px; stroke: var(--text-tertiary); fill: none; stroke-width: 2; }
.topbar-search-text { font-size: var(--text-sm); color: var(--text-tertiary); }
.topbar-actions { display: flex; align-items: center; gap: 6px; }
.topbar-notif { position: relative; padding: 6px; border-radius: var(--radius-sm); cursor: pointer; color: var(--text-secondary); transition: background 0.12s; }
.topbar-notif:hover { background: var(--bg); }
.topbar-notif svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.8; display: block; }
.notif-dot { position: absolute; top: 5px; right: 5px; width: 6px; height: 6px; background: var(--negative); border-radius: 50%; border: 1.5px solid white; }
.topbar-company { display: flex; align-items: center; gap: 6px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 4px 9px; font-size: var(--text-sm); font-weight: 500; cursor: pointer; }
.topbar-company-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--positive); flex-shrink: 0; }

/* ---- PAGE ---- */
.page { display: none; padding: 24px 28px; flex: 1; }
.page.active { display: block; animation: fadeIn 0.18s ease; }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 22px; }
.page-title { font-size: var(--text-xl); font-weight: 600; letter-spacing: -0.3px; margin-bottom: 2px; }
.page-subtitle { font-size: var(--text-sm); color: var(--text-secondary); }
.page-actions { display: flex; align-items: center; gap: 8px; }

/* ============================================================
   CARDS & KPI
   ============================================================ */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 18px 20px; box-shadow: var(--shadow-sm); }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-title { font-size: var(--text-base); font-weight: 600; }
.card-subtitle { font-size: var(--text-xs); color: var(--text-secondary); margin-top: 1px; }
.card-action { font-size: var(--text-sm); color: var(--accent); cursor: pointer; font-weight: 500; }
.card-action:hover { text-decoration: underline; }

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

.kpi-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 16px 18px; box-shadow: var(--shadow-sm); }
.kpi-label { font-size: var(--text-xs); font-weight: 500; letter-spacing: 0.4px; text-transform: uppercase; color: var(--text-secondary); margin-bottom: 8px; display: flex; align-items: center; justify-content: space-between; }
.kpi-icon { width: 26px; height: 26px; border-radius: 6px; display: flex; align-items: center; justify-content: center; }
.kpi-icon svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.kpi-icon.blue { background: var(--accent-light); color: var(--accent); }
.kpi-icon.green { background: var(--positive-light); color: var(--positive); }
.kpi-icon.red { background: var(--negative-light); color: var(--negative); }
.kpi-icon.warn { background: var(--warning-light); color: var(--warning); }
.kpi-value { font-size: 20px; font-weight: 600; letter-spacing: -0.4px; font-family: 'DM Mono', monospace; margin-bottom: 4px; }
.kpi-delta { display: inline-flex; align-items: center; gap: 3px; font-size: var(--text-xs); font-weight: 500; padding: 2px 5px; border-radius: 4px; }
.kpi-delta.up { color: var(--positive); background: var(--positive-light); }
.kpi-delta.down { color: var(--negative); background: var(--negative-light); }
.kpi-delta svg { width: 9px; height: 9px; stroke: currentColor; fill: none; stroke-width: 2.5; }
.kpi-period { font-size: var(--text-xs); color: var(--text-tertiary); margin-top: 3px; }

.kpi-sparkline { display: flex; align-items: flex-end; gap: 2px; height: 24px; margin-top: 8px; }
.spark-bar { flex: 1; border-radius: 2px 2px 0 0; background: var(--accent-light); min-height: 3px; }
.spark-bar.hi { background: var(--accent); opacity: 0.55; }

/* ============================================================
   GRIDS
   ============================================================ */
.grid-2   { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-3   { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; }
.grid-3b  { display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: 18px; }
.mb-18    { margin-bottom: 18px; }
.mb-20    { margin-bottom: 20px; }

/* ============================================================
   TABLES
   ============================================================ */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.table th { font-size: var(--text-xs); font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-secondary); text-align: left; padding: 9px 13px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 10px 13px; color: var(--text-primary); border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background 0.1s; }
.table tbody tr:hover { background: var(--bg); }
.table-mono { font-family: 'DM Mono', monospace; font-size: var(--text-sm); }
.table-dim { color: var(--text-secondary); font-size: var(--text-sm); }
.tr { text-align: right; }
.tc { text-align: center; }
.table-link { color: var(--accent); font-weight: 500; font-family: 'DM Mono', monospace; font-size: 12px; cursor: pointer; }
.table-link:hover { text-decoration: underline; }

/* ============================================================
   BADGES
   ============================================================ */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px; border-radius: 20px; font-size: var(--text-xs); font-weight: 500; white-space: nowrap; }
.badge-dot { width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0; }
.badge-paid    { background: var(--positive-light); color: var(--positive); }
.badge-paid .badge-dot { background: var(--positive); }
.badge-pending { background: var(--warning-light); color: var(--warning); }
.badge-pending .badge-dot { background: var(--warning); }
.badge-overdue { background: var(--negative-light); color: var(--negative); }
.badge-overdue .badge-dot { background: var(--negative); }
.badge-draft   { background: var(--bg); color: var(--text-secondary); border: 1px solid var(--border); }
.badge-draft .badge-dot { background: var(--text-tertiary); }
.badge-blue    { background: var(--accent-light); color: var(--accent); }
.badge-blue .badge-dot { background: var(--accent); }
.badge-neutral { background: var(--bg); color: var(--text-secondary); border: 1px solid var(--border); }

/* ============================================================
   FILTERS BAR
   ============================================================ */
.filters-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.filter-search { display: flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 10px; }
.filter-search svg { width: 12px; height: 12px; stroke: var(--text-secondary); fill: none; stroke-width: 2; flex-shrink: 0; }
.filter-search input { border: none; outline: none; background: transparent; font-size: var(--text-sm); color: var(--text-primary); width: 170px; }
.filter-search input::placeholder { color: var(--text-tertiary); }
.filter-select-sm { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 26px 6px 9px; font-size: var(--text-sm); color: var(--text-primary); cursor: pointer; outline: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='11' viewBox='0 0 24 24' fill='none' stroke='%238D9BA4' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 7px center; }
.filter-sep { flex: 1; }
.filter-count { font-size: var(--text-sm); color: var(--text-secondary); }

/* ============================================================
   CHIP TABS
   ============================================================ */
.chip-tabs { display: flex; gap: 2px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 2px; width: fit-content; margin-bottom: 18px; }
.chip-tab { padding: 5px 12px; border-radius: 4px; font-size: var(--text-sm); color: var(--text-secondary); cursor: pointer; transition: all 0.12s; white-space: nowrap; }
.chip-tab.active { background: var(--surface); color: var(--text-primary); font-weight: 500; box-shadow: var(--shadow-sm); }

/* ============================================================
   RANK LIST
   ============================================================ */
.rank-list { display: flex; flex-direction: column; }
.rank-item { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border-soft); }
.rank-item:last-child { border-bottom: none; }
.rank-num { font-size: var(--text-xs); font-weight: 600; color: var(--text-tertiary); width: 14px; text-align: center; font-family: 'DM Mono', monospace; }
.rank-info { flex: 1; min-width: 0; }
.rank-name { font-size: var(--text-sm); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-sub { font-size: var(--text-xs); color: var(--text-secondary); margin-top: 1px; }
.rank-bar-wrap { width: 64px; height: 3px; background: var(--bg); border-radius: 2px; overflow: hidden; }
.rank-bar { height: 100%; background: var(--accent-light); border-radius: 2px; }
.rank-item:nth-child(1) .rank-bar { background: var(--accent); }
.rank-item:nth-child(2) .rank-bar { background: var(--accent-medium); opacity: 0.65; }
.rank-amount { font-size: var(--text-sm); font-weight: 500; font-family: 'DM Mono', monospace; white-space: nowrap; }

/* ============================================================
   ACTIVITY FEED
   ============================================================ */
.activity-list { display: flex; flex-direction: column; }
.activity-item { display: flex; align-items: flex-start; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border-soft); }
.activity-item:last-child { border-bottom: none; }
.activity-dot-wrap { display: flex; flex-direction: column; align-items: center; padding-top: 4px; flex-shrink: 0; }
.activity-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.activity-line { width: 1px; height: 20px; background: var(--border-soft); margin-top: 4px; }
.activity-item:last-child .activity-line { display: none; }
.activity-info { flex: 1; min-width: 0; }
.activity-title { font-size: var(--text-sm); font-weight: 500; }
.activity-desc { font-size: var(--text-xs); color: var(--text-secondary); margin-top: 1px; }
.activity-time { font-size: var(--text-xs); color: var(--text-tertiary); white-space: nowrap; flex-shrink: 0; }

/* ============================================================
   PROGRESS BAR
   ============================================================ */
.progress-bar { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); border-radius: 2px; transition: width 0.6s ease; }

/* ============================================================
   CHARTS
   ============================================================ */
.chart-h200 { position: relative; height: 200px; }
.chart-h160 { position: relative; height: 160px; }
.chart-h140 { position: relative; height: 140px; }

/* ============================================================
   SIDE PANEL / MODAL
   ============================================================ */
.overlay { position: fixed; inset: 0; background: rgba(30,35,40,0.32); z-index: 300; display: none; align-items: flex-start; justify-content: flex-end; backdrop-filter: blur(2px); }
.overlay.open { display: flex; }
.side-panel { width: 500px; height: 100vh; background: var(--surface); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: slideIn 0.22s ease; overflow: hidden; }
.panel-header { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.panel-title { font-size: var(--text-lg); font-weight: 600; letter-spacing: -0.2px; }
.panel-subtitle { font-size: var(--text-sm); color: var(--text-secondary); margin-top: 2px; }
.panel-close { width: 28px; height: 28px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-secondary); transition: background 0.12s; }
.panel-close:hover { background: var(--bg); color: var(--text-primary); }
.panel-close svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; }
.panel-body { flex: 1; padding: 22px; overflow-y: auto; }
.panel-footer { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-shrink: 0; }

/* Line items */
.line-items { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.line-items-hdr { display: grid; grid-template-columns: 2fr 70px 90px 90px 28px; gap: 8px; padding: 7px 11px; background: var(--bg); font-size: var(--text-xs); font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-secondary); }
.line-item-row { display: grid; grid-template-columns: 2fr 70px 90px 90px 28px; gap: 8px; padding: 7px 11px; border-top: 1px solid var(--border-soft); align-items: center; }
.line-item-row input { width: 100%; padding: 4px 7px; border: 1px solid transparent; border-radius: 4px; font-size: var(--text-sm); background: transparent; outline: none; color: var(--text-primary); font-family: inherit; transition: border-color 0.12s, background 0.12s; }
.line-item-row input:focus { border-color: var(--border); background: var(--bg); }
.line-item-row input.mono { font-family: 'DM Mono', monospace; text-align: right; }
.line-item-del { width: 24px; height: 24px; border-radius: 4px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-tertiary); transition: all 0.12s; }
.line-item-del:hover { background: var(--negative-light); color: var(--negative); }
.line-item-del svg { width: 11px; height: 11px; stroke: currentColor; fill: none; stroke-width: 2; }
.line-items-footer { padding: 8px 11px; border-top: 1px solid var(--border-soft); display: flex; justify-content: space-between; align-items: center; }
.line-items-total { font-size: var(--text-sm); color: var(--text-secondary); }
.line-items-total strong { color: var(--text-primary); font-family: 'DM Mono', monospace; font-size: var(--text-md); }

/* ============================================================
   IMPORT / UPLOAD
   ============================================================ */
.import-steps { display: flex; align-items: center; margin-bottom: 28px; }
.import-step { display: flex; align-items: center; gap: 8px; flex: 1; }
.import-step-num { width: 24px; height: 24px; border-radius: 50%; background: var(--bg); border: 1.5px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: var(--text-xs); font-weight: 600; color: var(--text-secondary); flex-shrink: 0; }
.import-step.done .import-step-num { background: var(--positive); border-color: var(--positive); color: white; }
.import-step.active .import-step-num { background: var(--accent); border-color: var(--accent); color: white; }
.import-step-label { font-size: var(--text-sm); color: var(--text-secondary); white-space: nowrap; }
.import-step.active .import-step-label { color: var(--text-primary); font-weight: 500; }
.import-step-line { flex: 1; height: 1px; background: var(--border); margin: 0 8px; }

.upload-zone { border: 2px dashed var(--border); border-radius: var(--radius-md); padding: 48px 32px; text-align: center; transition: all 0.15s; cursor: pointer; margin-bottom: 16px; }
.upload-zone:hover, .upload-zone.drag { border-color: var(--accent); background: var(--accent-light); }
.upload-icon { width: 48px; height: 48px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; margin: 0 auto 14px; }
.upload-icon svg { width: 20px; height: 20px; stroke: var(--text-secondary); fill: none; stroke-width: 1.5; }
.upload-title { font-size: var(--text-md); font-weight: 600; margin-bottom: 4px; }
.upload-sub { font-size: var(--text-sm); color: var(--text-secondary); }
.upload-formats { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 10px; }
.format-tag { background: var(--surface); border: 1px solid var(--border); border-radius: 3px; padding: 2px 6px; font-size: var(--text-xs); font-weight: 500; color: var(--text-secondary); font-family: 'DM Mono', monospace; }

.process-list { display: flex; flex-direction: column; gap: 8px; }
.process-item { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; }
.process-icon { width: 30px; height: 30px; border-radius: 7px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.process-icon.success { background: var(--positive-light); color: var(--positive); }
.process-icon.warn    { background: var(--warning-light); color: var(--warning); }
.process-icon.error   { background: var(--negative-light); color: var(--negative); }
.process-icon svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; }
.process-info { flex: 1; }
.process-name { font-size: var(--text-sm); font-weight: 500; }
.process-desc { font-size: var(--text-xs); color: var(--text-secondary); margin-top: 1px; }
.process-count { font-size: var(--text-sm); font-family: 'DM Mono', monospace; font-weight: 500; }

/* ============================================================
   MISC UTILITIES
   ============================================================ */
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.mono { font-family: 'DM Mono', monospace; }
.text-pos { color: var(--positive); }
.text-neg { color: var(--negative); }
.text-warn { color: var(--warning); }
.text-dim { color: var(--text-secondary); }
.text-accent { color: var(--accent); }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }

.info-box { background: var(--accent-light); border: 1px solid oklch(88% 0.05 220); border-radius: var(--radius-sm); padding: 10px 14px; font-size: var(--text-sm); color: var(--accent); display: flex; align-items: flex-start; gap: 8px; margin-bottom: 16px; }
.info-box svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; flex-shrink: 0; margin-top: 1px; }
.warn-box { background: var(--warning-light); border: 1px solid oklch(88% 0.06 75); border-radius: var(--radius-sm); padding: 10px 14px; font-size: var(--text-sm); color: var(--warning); display: flex; align-items: flex-start; gap: 8px; margin-bottom: 16px; }
.warn-box svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; flex-shrink: 0; margin-top: 1px; }

.empty-state { text-align: center; padding: 48px 24px; }
.empty-state-icon { width: 42px; height: 42px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; margin: 0 auto 12px; }
.empty-state-icon svg { width: 18px; height: 18px; stroke: var(--text-tertiary); fill: none; stroke-width: 1.5; }
.empty-state-title { font-size: var(--text-md); font-weight: 600; margin-bottom: 4px; }
.empty-state-desc { font-size: var(--text-sm); color: var(--text-secondary); margin-bottom: 18px; }

/* Toggle switch */
.toggle { width: 34px; height: 18px; background: var(--border); border-radius: 9px; position: relative; cursor: pointer; transition: background 0.2s; flex-shrink: 0; }
.toggle.on { background: var(--positive); }
.toggle-knob { width: 14px; height: 14px; background: white; border-radius: 50%; position: absolute; top: 2px; left: 2px; transition: transform 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.2); }
.toggle.on .toggle-knob { transform: translateX(16px); }

/* IVA summary box */
.iva-summary { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; margin-bottom: 20px; }
.iva-box { border-radius: var(--radius-sm); padding: 14px 16px; }
.iva-box-label { font-size: var(--text-xs); font-weight: 500; text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 6px; }
.iva-box-value { font-size: 20px; font-weight: 700; font-family: 'DM Mono', monospace; }
.iva-box-sub { font-size: var(--text-xs); margin-top: 2px; opacity: 0.75; }

/* Period selector */
.period-selector { display: flex; align-items: center; gap: 8px; }
.period-selector input[type="month"] { padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); font-size: var(--text-sm); color: var(--text-primary); outline: none; font-family: 'DM Mono', monospace; }
.period-selector input[type="month"]:focus { border-color: var(--accent-medium); }

/* Account tree */
.account-row { display: flex; align-items: center; gap: 8px; padding: 8px 13px; border-bottom: 1px solid var(--border-soft); font-size: var(--text-sm); transition: background 0.1s; }
.account-row:hover { background: var(--bg); }
.account-row.level-1 { font-weight: 600; background: var(--bg); color: var(--text-primary); }
.account-row.level-2 { padding-left: 28px; font-weight: 500; }
.account-row.level-3 { padding-left: 44px; color: var(--text-secondary); }
.account-code { font-family: 'DM Mono', monospace; font-size: 12px; color: var(--accent); width: 64px; flex-shrink: 0; }
.account-name { flex: 1; }
.account-type { font-size: var(--text-xs); color: var(--text-secondary); width: 80px; flex-shrink: 0; }

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

/* Animations */
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideIn { from { transform: translateX(16px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
