/* =====================================================================
   SNT Global — Secure Portal stylesheet
   Built from genius-pro-tax-design-dna.json:
   navy anchor zone · ice-blue workspace · one royal-blue action colour
   · champagne-gold highlight used sparingly.
   ===================================================================== */

/* ---------------------------------------------------------------------
   1. TOKENS — change the scheme here only
   --------------------------------------------------------------------- */
:root {
  /* Scheme 1 (active): Navy + Royal Blue + Champagne Gold */
  --primary-color: #0B60F2;
  --primary-hover: #0A52CF;
  --primary-tint: #EAF3FC;
  --on-primary: #FFFFFF;
  --secondary-color: #011E49;
  --secondary-2: #062555;
  --secondary-tint: #D5E8FA;
  --on-secondary: #FFFFFF;
  --gold: #DEC782;

  /* Scheme 2: Deep Teal + Emerald + Brass
  --primary-color: #0F8B6C; --primary-hover: #0C7359; --primary-tint: #E6F5F0; --on-primary: #FFFFFF;
  --secondary-color: #0B2E33; --secondary-2: #10404A; --secondary-tint: #CFEAE3; --on-secondary: #FFFFFF; --gold: #D4B062;
  */

  /* Scheme 3: Midnight Indigo + Electric Violet + Sand
  --primary-color: #5B4CF0; --primary-hover: #4A3BD6; --primary-tint: #EFEDFF; --on-primary: #FFFFFF;
  --secondary-color: #14123A; --secondary-2: #1E1B52; --secondary-tint: #DCD8FF; --on-secondary: #FFFFFF; --gold: #E2C690;
  */

  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-head: 'Plus Jakarta Sans', 'Inter', system-ui, sans-serif;

  /* Neutrals (light -> dark) */
  --bg: #F2F8FD;
  --surface: #FFFFFF;
  --surface-2: #F9FCFD;
  --line: #E3ECF7;
  --line-strong: #C9D6EE;
  --muted-2: #8296D3;
  --muted: #5B6C9A;
  --label: #345496;
  --ink: #011E49;
  --ink-2: #24365E;

  /* Semantic */
  --success: #1E8E4F;
  --success-tint: #E5F5EC;
  --warning: #B86E00;
  --warning-tint: #FFF3DC;
  --danger: #D64928;
  --danger-tint: #FCEAE5;
  --info: #0B60F2;

  /* Shape & depth */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-pill: 999px;
  --sh-low: 0 1px 2px rgba(1, 30, 73, .06);
  --sh-md: 0 4px 16px rgba(1, 30, 73, .08);
  --sh-high: 0 12px 32px rgba(1, 30, 73, .14);
  --sh-glow: 0 8px 22px rgba(11, 96, 242, .35);
  --ease: cubic-bezier(.2, 0, 0, 1);

  --topbar-h: 72px;
  --sidebar-w: 268px;
  --sidebar-w-collapsed: 84px;

  /* legacy aliases used by older pages */
  --primary: var(--primary-color);
  --muted-foreground: var(--muted);
  --border: var(--line);
  --foreground: var(--ink);
  --background: var(--bg);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  font-size: 15px;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary-color); text-decoration: none; }
img { max-width: 100%; }
svg.lucide { width: 18px; height: 18px; stroke-width: 1.85; flex: none; }
h1, h2, h3, h4 { font-family: var(--font-head); color: var(--ink); letter-spacing: -.01em; }
[hidden] { display: none !important; }
::selection { background: var(--secondary-tint); }

/* ---------------------------------------------------------------------
   2. BRAND LOGO
   --------------------------------------------------------------------- */
.brand-logo { display: inline-flex; align-items: center; gap: 10px; }
.brand-logo__mark { width: 40px; height: 40px; transition: transform .6s var(--ease); }
.brand-logo:hover .brand-logo__mark { transform: rotate(-18deg); }
.brand-logo__text { display: flex; flex-direction: column; line-height: 1; }
.brand-logo__name { font: 800 22px/1 var(--font-head); color: var(--ink); letter-spacing: -.02em; }
.brand-logo__sub { margin-top: 4px; padding-top: 4px; border-top: 2px solid var(--gold); font: 700 10px/1 var(--font); letter-spacing: .32em; text-transform: uppercase; color: var(--primary-color); }
.brand-logo--light .brand-logo__name { color: #fff; }
.brand-logo--light .brand-logo__sub { color: #A8B7DE; }

/* ---------------------------------------------------------------------
   3. LAYOUT — topbar / sidebar / main
   --------------------------------------------------------------------- */
.dashboard { min-height: 100vh; }

.topbar {
  position: fixed; inset: 0 0 auto 0; height: var(--topbar-h); z-index: 50;
  display: flex; align-items: center; gap: 24px; padding: 0 24px;
  background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); box-shadow: var(--sh-low);
}
.logo-container { display: flex; align-items: center; gap: 10px; width: calc(var(--sidebar-w) - 24px); flex: none; }
.topbar-menu { display: none; border: 0; background: none; color: var(--ink); cursor: pointer; padding: 6px; }
.search-container { position: relative; flex: 1; max-width: 460px; }
.search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-input { width: 100%; height: 42px; padding: 0 44px 0 42px; border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface-2); font: 14px var(--font); color: var(--ink); transition: border-color .2s, box-shadow .2s, background .2s; }
.search-input:focus { outline: none; border-color: var(--primary-color); background: #fff; box-shadow: 0 0 0 4px rgba(11, 96, 242, .12); }
.search-kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font: 600 11px var(--font); color: var(--muted); border: 1px solid var(--line-strong); border-radius: 5px; padding: 1px 7px; background: #fff; }
.actions-container { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.action-link { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; color: var(--ink); font-weight: 500; border-radius: var(--r-md); transition: background .2s; }
.action-link:hover { background: var(--primary-tint); }
.action-link .icon { color: var(--primary-color); }
.action-button { position: relative; width: 42px; height: 42px; display: grid; place-items: center; border: 0; border-radius: var(--r-md); background: none; color: var(--ink); cursor: pointer; transition: background .2s; }
.action-button:hover { background: var(--primary-tint); }
.action-button.ring svg { animation: bell-ring .9s var(--ease); }
@keyframes bell-ring { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(16deg); } 40% { transform: rotate(-14deg); } 60% { transform: rotate(8deg); } 80% { transform: rotate(-5deg); } }
.notification-badge { position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--r-pill); background: var(--danger); color: #fff; font: 700 10.5px/14px var(--font); text-align: center; border: 2px solid #fff; box-sizing: border-box; }
.action-button .icon { width: 22px; height: 22px; }

.user-container { display: flex; align-items: center; gap: 10px; padding: 5px 10px 5px 5px; border: 0; background: none; border-radius: var(--r-pill); cursor: pointer; color: var(--ink); font: inherit; transition: background .2s; }
.user-container:hover { background: var(--primary-tint); }
.avatar { position: relative; width: 40px; height: 40px; flex: none; }
.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.status-indicator { position: absolute; right: 0; bottom: 0; width: 11px; height: 11px; border-radius: 50%; border: 2px solid #fff; background: var(--muted-2); }
.status-indicator.online { background: var(--success); }
.user-info { display: flex; flex-direction: column; text-align: left; line-height: 1.2; }
.user-name { font-weight: 600; font-size: 14px; }
.user-role { font-size: 12px; color: var(--muted); }

/* Sidebar */
.sidebar {
  position: fixed; top: var(--topbar-h); left: 0; bottom: 0; width: var(--sidebar-w); z-index: 40;
  display: flex; flex-direction: column;
  background: linear-gradient(165deg, var(--secondary-2) 0%, var(--secondary-color) 55%, #01183B 100%);
  color: #fff; transition: width .3s var(--ease), transform .3s var(--ease);
}
.sidebar::before { content: ''; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(420px 260px at 0% 0%, rgba(11, 96, 242, .25), transparent 70%); }
.sidebar-nav { position: relative; flex: 1; overflow-y: auto; padding: 22px 14px; display: flex; flex-direction: column; gap: 4px; scrollbar-width: none; }
.sidebar-nav::-webkit-scrollbar { display: none; }
.sidebar-link {
  position: relative; display: flex; align-items: center; gap: 14px; padding: 12px 16px;
  border-radius: var(--r-md); color: rgba(255, 255, 255, .78); font-weight: 500; font-size: 15px;
  transition: background .2s var(--ease), color .2s, transform .2s var(--ease);
}
.sidebar-link:hover { background: rgba(255, 255, 255, .07); color: #fff; transform: translateX(3px); }
.sidebar-link.active { background: var(--primary-color); color: #fff; box-shadow: var(--sh-glow); }
.sidebar-link.active::after { content: ''; position: absolute; left: -14px; top: 10px; bottom: 10px; width: 4px; border-radius: 0 4px 4px 0; background: var(--gold); }
.sidebar-link.is-danger:hover { background: rgba(214, 73, 40, .18); }
.sidebar-icon { width: 21px !important; height: 21px !important; }
.sidebar-text { white-space: nowrap; overflow: hidden; }
.sidebar-badge { margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: var(--r-pill); font: 700 11px/22px var(--font); text-align: center; background: rgba(255, 255, 255, .16); color: #fff; }
.sidebar-badge--warn { background: var(--gold); color: var(--secondary-color); }
.sidebar-link.active .sidebar-badge { background: #fff; color: var(--primary-color); }
.nav-line { height: 1px; margin: 14px 10px; background: rgba(168, 183, 222, .22); }
.sidebar-foot { position: relative; padding: 0 22px 22px; }
.sidebar-map {display: block;width: 100%;opacity: .16;margin-bottom: 10px;position: absolute;bottom: 0;left: 0;}
.sidebar-secure { display: flex; align-items: center; gap: 10px; padding-top: 14px; border-top: 2px solid var(--gold); color: rgba(255, 255, 255, .85); font-size: 13px; }
.sidebar-secure svg { color: var(--gold); }
.sidebar-toggle { position: absolute; top: 26px; right: -14px; width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line); background: #fff; color: var(--ink); display: grid; place-items: center; cursor: pointer; box-shadow: var(--sh-md); transition: transform .3s var(--ease); }
.sidebar-toggle svg { width: 16px; height: 16px; }
.sidebar.collapsed { width: var(--sidebar-w-collapsed); }
.sidebar.collapsed .sidebar-text, .sidebar.collapsed .sidebar-foot, .sidebar.collapsed .sidebar-badge { display: none; }
.sidebar.collapsed .sidebar-link { justify-content: center; padding: 12px; }
.sidebar.collapsed .sidebar-toggle { transform: rotate(180deg); }
.sidebar-scrim { display: none; }

.main-content { margin-left: var(--sidebar-w); padding: calc(var(--topbar-h) + 32px) 36px 48px; min-width: 0; transition: margin .3s var(--ease); }
.sidebar.collapsed ~ .main-content { margin-left: var(--sidebar-w-collapsed); }

/* ---------------------------------------------------------------------
   4. PAGE HEADER
   --------------------------------------------------------------------- */
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 26px; }
.page-title { font: 800 34px/1.12 var(--font-head); letter-spacing: -.025em; }
.page-title .hl { color: var(--primary-color); }
.page-subtitle { margin-top: 6px; color: var(--muted); font-size: 16px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font: 600 12px var(--font); letter-spacing: .12em; text-transform: uppercase; color: var(--label); margin-bottom: 8px; }
.eyebrow::before { content: ''; width: 18px; height: 2px; background: var(--gold); }
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--primary-color); }
.breadcrumb svg { width: 14px; height: 14px; }

.protected-badge { display: inline-flex; align-items: center; gap: 12px; padding: 12px 20px; border-radius: var(--r-md); background: linear-gradient(135deg, #EAF7EF, #F4FBF7); border: 1px solid #CBE8D6; color: var(--success); font-weight: 600; }
.protected-badge svg { width: 30px; height: 30px; color: #fff; fill: var(--success); }

/* ---------------------------------------------------------------------
   5. CARDS & SURFACES
   --------------------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-low); padding: 24px; transition: box-shadow .25s var(--ease), transform .25s var(--ease); }
.card.hoverable:hover { box-shadow: var(--sh-md); transform: translateY(-2px); }
.card + .card { margin-top: 20px; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.card-title { font: 700 19px/1.3 var(--font-head); display: flex; align-items: center; gap: 10px; }
.card-title svg { color: var(--primary-color); }
.card-subtitle { color: var(--muted); font-size: 14px; margin-top: 2px; }
.card-content { min-width: 0; }
.card--flush { padding: 0; overflow: hidden; }
.card--tint { background: var(--primary-tint); border-color: var(--secondary-tint); }
.card--navy { background: linear-gradient(150deg, var(--secondary-2), var(--secondary-color)); color: #fff; border: 0; position: relative; overflow: hidden; }
.card--navy h3, .card--navy .card-title { color: #fff; }
.card--navy .muted { color: #A8B7DE; }

.icon-circle { width: 52px; height: 52px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--primary-tint); color: var(--primary-color); }
.icon-circle svg { width: 24px; height: 24px; }
.icon-circle.sm { width: 40px; height: 40px; }
.icon-circle.sm svg { width: 19px; height: 19px; }
.icon-circle.navy { background: var(--secondary-color); color: #fff; }
.icon-circle.gold { background: #FBF5E3; color: #9C7A1F; }
.icon-circle.success { background: var(--success-tint); color: var(--success); }
.icon-circle.warn { background: var(--warning-tint); color: var(--warning); }
.icon-circle.danger { background: var(--danger-tint); color: var(--danger); }

/* Stat strip (client id / period / country / active services + CTA) */
.stat-strip { display: flex; align-items: stretch; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-low); padding: 18px 22px; gap: 0; margin-bottom: 28px; flex-wrap: wrap; }
.stat-strip__item { display: flex; align-items: center; gap: 14px; padding: 4px 24px; border-right: 1px solid var(--line); min-width: 0; }
.stat-strip__item:first-child { padding-left: 0; }
.stat-strip__item:last-of-type { border-right: 0; }
.stat-strip__item svg { width: 26px; height: 26px; color: var(--label); }
.stat-strip__label { font-size: 13px; color: var(--muted); }
.stat-strip__value { font: 700 17px/1.2 var(--font-head); color: var(--ink); white-space: nowrap; }
.stat-strip__cta { margin-left: auto; align-self: center; }

/* KPI tiles */
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin-bottom: 24px; }
.kpi { position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px 20px 18px; box-shadow: var(--sh-low); transition: transform .25s var(--ease), box-shadow .25s; }
.kpi:hover { transform: translateY(-3px); box-shadow: var(--sh-md); }
.kpi__top { display: flex; justify-content: space-between; align-items: flex-start; }
.kpi__label { font-size: 13px; font-weight: 500; color: var(--muted); }
.kpi__value { margin-top: 10px; font: 800 30px/1 var(--font-head); color: var(--ink); letter-spacing: -.02em; }
.kpi__meta { margin-top: 10px; font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.kpi__meta .up { color: var(--success); font-weight: 600; }
.kpi__meta .down { color: var(--danger); font-weight: 600; }
.kpi--navy { background: linear-gradient(150deg, var(--secondary-2), var(--secondary-color)); border: 0; }
.kpi--navy .kpi__label, .kpi--navy .kpi__meta { color: #A8B7DE; }
.kpi--navy .kpi__value { color: #fff; }
.kpi--navy::after { content: ''; position: absolute; right: -40px; bottom: -40px; width: 140px; height: 140px; border-radius: 50%; border: 18px solid rgba(222, 199, 130, .16); }

/* Dues alert box (admin) */
.due-box { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; padding: 18px 22px; border-radius: var(--r-lg); background: linear-gradient(120deg, #FFF6F2, #FFFFFF 60%); border: 1px solid #F5CFC3; margin-bottom: 24px; box-shadow: var(--sh-low); }
.due-box__amount { font: 800 26px/1 var(--font-head); color: var(--danger); }
.due-box__text { color: var(--ink-2); font-size: 14px; }
.due-box .btn-secondary { margin-left: auto; }

/* Service cards */
.svc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.svc-card { display: flex; align-items: center; gap: 16px; padding: 18px 20px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--sh-low); color: var(--ink); transition: transform .25s var(--ease), box-shadow .25s, background .25s; min-width: 0; }
.svc-card:hover { transform: translateY(-2px); box-shadow: var(--sh-md); }
.svc-card__body { min-width: 0; flex: 1; }
.svc-card__name { font: 700 16px/1.3 var(--font-head); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.svc-card__meta { display: block; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.svc-card__side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }
.svc-card__chev { color: var(--muted); transition: transform .25s var(--ease); }
.svc-card:hover .svc-card__chev { transform: translateX(4px); }
.svc-card.is-active { background: var(--primary-color); border-color: var(--primary-color); color: #fff; box-shadow: var(--sh-glow); }
.svc-card.is-active .svc-card__meta, .svc-card.is-active .svc-card__chev { color: rgba(255, 255, 255, .85); }
.svc-card.is-active .icon-circle { background: rgba(255, 255, 255, .18); color: #fff; }
.svc-card.is-active .badge { background: #fff; }

/* ---------------------------------------------------------------------
   6. STEPPER + PROGRESS
   --------------------------------------------------------------------- */
.stepper { display: flex; justify-content: space-between; position: relative; isolation: isolate; margin: 8px 0 18px; }
.stepper__step { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; }
.stepper__step::before { content: ''; position: absolute; top: 20px; right: 50%; width: 100%; height: 3px; background: var(--line); z-index: 0; }
.stepper__step:first-child::before { display: none; }
.stepper__step.done::before, .stepper__step.current::before { background: var(--success); }
.stepper__step.current::before { background: linear-gradient(90deg, var(--success), var(--primary-color)); }
.stepper__dot { position: relative; z-index: 1; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: #E4EAF3; color: #fff; border: 3px solid #fff; box-shadow: var(--sh-low); transition: transform .3s var(--ease); }
.stepper__dot svg { width: 19px; height: 19px; }
.stepper__step.done .stepper__dot { background: var(--success); }
.stepper__step.current .stepper__dot { background: var(--primary-color); box-shadow: 0 0 0 6px rgba(11, 96, 242, .16); animation: pulse-ring 2.4s infinite; }
.stepper__label { position: relative; z-index: 1; font-size: 13px; color: var(--muted); font-weight: 500; line-height: 1.25; }
.stepper__step.current .stepper__label { color: var(--primary-color); font-weight: 600; }
.stepper__step.done .stepper__label { color: var(--ink-2); }
@keyframes pulse-ring { 0%, 100% { box-shadow: 0 0 0 4px rgba(11, 96, 242, .18); } 50% { box-shadow: 0 0 0 9px rgba(11, 96, 242, .06); } }
.stepper--compact .stepper__dot { width: 30px; height: 30px; }
.stepper--compact .stepper__dot svg { width: 14px; height: 14px; }
.stepper--compact .stepper__step::before { top: 14px; }
.stepper--compact .stepper__label { font-size: 11.5px; }

.step-current { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 16px; border-radius: var(--r-md); background: var(--primary-tint); font-size: 14.5px; }
.step-current b { color: var(--primary-color); font-weight: 600; }
.step-current strong { color: var(--primary-color); }

.progress { height: 9px; border-radius: var(--r-pill); background: #E4EAF3; overflow: hidden; }
.progress__bar { height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--primary-color), #3D86FF); transition: width 1.1s var(--ease); }
.progress__bar.success { background: var(--success); }
.progress-row { display: flex; align-items: center; gap: 12px; }
.progress-row .progress { flex: 1; }
.progress-row strong { font-size: 14px; color: var(--primary-color); }

/* Key/value list */
.kv { display: grid; grid-template-columns: auto 1fr; }
.kv dt, .kv dd { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.kv dt { color: var(--muted); padding-right: 20px; }
.kv dd { color: var(--ink); font-weight: 500; }
.kv dt:last-of-type, .kv dd:last-of-type { border-bottom: 0; }

/* ---------------------------------------------------------------------
   7. BADGES
   --------------------------------------------------------------------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: var(--r-pill); font: 600 12px/1.4 var(--font); white-space: nowrap; background: var(--primary-tint); color: var(--primary-color); }
.badge-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge-success { background: var(--success-tint); color: var(--success); }
.badge-warning { background: var(--warning-tint); color: var(--warning); }
.badge-danger { background: var(--danger-tint); color: var(--danger); }
.badge-info { background: var(--primary-tint); color: var(--primary-color); }
.badge-navy { background: #E3E9F5; color: var(--secondary-color); }
.badge-muted { background: #EEF1F6; color: var(--muted); }
.badge .icon-small, .badge svg { width: 13px; height: 13px; }
.tag { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--label); background: var(--surface-2); border: 1px solid var(--line); padding: 3px 9px; border-radius: var(--r-sm); }
.flag { border-radius: 3px; vertical-align: -3px; box-shadow: 0 0 0 1px rgba(1, 30, 73, .08); object-fit: cover; }

/* ---------------------------------------------------------------------
   8. BUTTONS
   --------------------------------------------------------------------- */
.btn-primary, .btn-secondary, .btn-ghost, .btn-danger, .btn-gold {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  height: 44px; padding: 0 20px; border-radius: var(--r-md); border: 1.5px solid transparent;
  font: 600 13px/1 var(--font); letter-spacing: .05em; text-transform: uppercase; cursor: pointer;
  transition: background .2s var(--ease), color .2s, border-color .2s, box-shadow .25s, transform .15s; white-space: nowrap; text-decoration: none;
}
.btn-primary:active, .btn-secondary:active, .btn-danger:active, .btn-gold:active { transform: translateY(1px) scale(.99); }
.btn-primary { background: var(--primary-color); color: var(--on-primary); box-shadow: 0 6px 16px rgba(11, 96, 242, .25); }
.btn-primary:hover { background: var(--primary-hover); box-shadow: 0 10px 22px rgba(11, 96, 242, .32); }
.btn-secondary { background: #fff; border-color: var(--primary-color); color: var(--primary-color); }
.btn-secondary:hover { background: var(--primary-tint); }
.btn-secondary.navy { border-color: var(--secondary-color); color: var(--secondary-color); }
.btn-ghost { background: transparent; color: var(--ink-2); border-color: transparent; }
.btn-ghost:hover { background: var(--primary-tint); color: var(--primary-color); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #BC3B1D; }
.btn-gold { background: var(--gold); color: var(--secondary-color); }
.btn-gold:hover { background: #D4BA6C; }
.btn-action { height: 34px; padding: 0 12px; font-size: 11.5px; }
.btn-sm { height: 36px; padding: 0 14px; font-size: 12px; }
.w-100 { width: 100%; }
.btn-primary:disabled, .btn-secondary:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }
.is-loading { color: transparent !important; pointer-events: none; }
.is-loading::after { content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .5); border-top-color: #fff; animation: spin .7s linear infinite; }
.btn-secondary.is-loading::after { border-color: var(--secondary-tint); border-top-color: var(--primary-color); }
@keyframes spin { to { transform: rotate(360deg); } }

.btn-icon { width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: var(--r-sm); border: 1px solid var(--line); background: #fff; color: var(--label); cursor: pointer; transition: all .2s; }
.btn-icon:hover { border-color: var(--primary-color); color: var(--primary-color); background: var(--primary-tint); }
.btn-icon.danger:hover { border-color: var(--danger); color: var(--danger); background: var(--danger-tint); }
.btn-icon.success:hover { border-color: var(--success); color: var(--success); background: var(--success-tint); }
.btn-icon svg { width: 16px; height: 16px; }
.link-button, .btn-link { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; color: var(--primary-color); font: 600 14px var(--font); cursor: pointer; padding: 0; }
.link-button:hover, .btn-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.action-buttons, .row-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* ---------------------------------------------------------------------
   9. FORMS
   --------------------------------------------------------------------- */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; min-width: 0; }
.form-label { font-size: 14px; font-weight: 500; color: var(--ink); }
.form-label b { color: var(--danger); font-weight: 600; }
.form-input {
  width: 100%; min-height: 42px; padding: 9px 13px; border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: #fff; font: 14.5px/1.4 var(--font); color: var(--ink); transition: border-color .2s, box-shadow .2s;
}
.form-input::placeholder { color: var(--muted-2); }
.form-input:hover { border-color: #AFC0E2; }
.form-input:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 4px rgba(11, 96, 242, .12); }
select.form-input { appearance: none; padding-right: 36px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23011E49' stroke-width='2' stroke-linecap='round' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center; }
textarea.form-input { min-height: 96px; resize: vertical; }
.form-hint { font-size: 12.5px; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 18px; }
.check-row { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
.check-row input { width: 18px; height: 18px; accent-color: var(--primary-color); }

.filter-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; padding: 16px 18px; margin-bottom: 18px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md); }
.filter-bar .form-group { margin: 0; min-width: 160px; flex: 1; }
.filter-bar .form-group.grow-2 { flex: 2; }
.filter-bar .filter-actions { display: flex; gap: 8px; }

.info-strip { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-radius: var(--r-md); background: var(--primary-tint); color: var(--ink-2); font-size: 14px; border: 1px solid var(--secondary-tint); }
.info-strip svg { color: var(--primary-color); width: 22px; height: 22px; }
.info-strip.warn { background: var(--warning-tint); border-color: #F6DDAE; }
.info-strip.warn svg { color: var(--warning); }
.info-strip.danger { background: var(--danger-tint); border-color: #F5CFC3; }
.info-strip.danger svg { color: var(--danger); }
.footer-strip { margin-top: 28px; justify-content: center; text-align: center; }

/* ---------------------------------------------------------------------
   10. TABLES
   --------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
.trabit-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.trabit-table thead th { position: sticky; top: 0; background: var(--surface-2); text-align: left; font: 600 12px var(--font); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.trabit-table thead th:first-child { border-top-left-radius: var(--r-sm); }
.trabit-table thead th:last-child { border-top-right-radius: var(--r-sm); }
.trabit-table td { padding: 14px; border-bottom: 1px solid var(--line); vertical-align: middle; color: var(--ink-2); }
.trabit-table tbody tr { transition: background .15s; }
.trabit-table tbody tr:hover { background: #F7FAFE; }
.trabit-table tr:last-child td { border-bottom: 0; }
.trabit-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.cell-strong { font-weight: 600; color: var(--ink); }
.cell-sub { font-size: 12.5px; color: var(--muted); }
.employee-name, .person { display: flex; align-items: center; gap: 12px; min-width: 0; }
.employee-avatar, .person img { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; flex: none; }

/* DataTables overrides */
div.dt-container .dt-search input { height: 38px; border: 1px solid var(--line-strong) !important; border-radius: var(--r-sm) !important; padding: 0 12px !important; font: 14px var(--font); }
div.dt-container .dt-search input:focus { outline: none; border-color: var(--primary-color) !important; box-shadow: 0 0 0 4px rgba(11, 96, 242, .12); }
div.dt-container .dt-buttons .dt-button { border: 1px solid var(--line) !important; background: #fff !important; border-radius: var(--r-sm) !important; padding: 6px 10px !important; color: var(--label) !important; margin-right: 4px; }
div.dt-container .dt-buttons .dt-button:hover { border-color: var(--primary-color) !important; color: var(--primary-color) !important; background: var(--primary-tint) !important; }
div.dt-container .dt-buttons .dt-button svg { width: 16px; height: 16px; }
div.dt-container .dt-layout-row { margin: 0 0 12px !important; }
table.dataTable > thead > tr > th, table.dataTable > thead > tr > td { border-bottom: 1px solid var(--line) !important; }
table.dataTable.no-footer { border-bottom: 0 !important; }
div.dt-container .dt-paging .dt-paging-button.current { background: var(--primary-color) !important; color: #fff !important; border: 0 !important; border-radius: var(--r-sm); }

/* ---------------------------------------------------------------------
   11. MODALS
   --------------------------------------------------------------------- */
.modal-overlay { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(1, 24, 59, .5); backdrop-filter: blur(3px); opacity: 0; visibility: hidden; transition: opacity .25s var(--ease), visibility .25s; }
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal { width: 100%; max-width: 620px; max-height: calc(100vh - 40px); overflow-y: auto; background: #fff; border-radius: var(--r-lg); box-shadow: var(--sh-high); transform: translateY(16px) scale(.98); transition: transform .3s var(--ease); }
.modal.lg { max-width: 900px; }
.modal.sm { max-width: 460px; }
.modal-overlay.active .modal { transform: none; }
.modal-header { display: flex; align-items: flex-start; gap: 16px; padding: 26px 28px 8px; }
.modal-header .icon-circle { width: 58px; height: 58px; }
.modal-title { font: 800 22px/1.25 var(--font-head); }
.modal-sub { color: var(--muted); font-size: 14.5px; margin-top: 2px; }
.modal-close { margin-left: auto; width: 36px; height: 36px; border-radius: 50%; border: 0; background: none; color: var(--ink); cursor: pointer; display: grid; place-items: center; transition: background .2s, transform .2s; flex: none; }
.modal-close:hover { background: var(--primary-tint); transform: rotate(90deg); }
.modal-content { padding: 18px 28px 26px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 10px; }
.modal-footer.split > * { flex: 1; }
.modal-note { text-align: center; font-size: 13px; color: var(--muted); margin-top: 12px; }

/* ---------------------------------------------------------------------
   12. TABS / SEGMENTS
   --------------------------------------------------------------------- */
.tab-header { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tab-button { position: relative; padding: 12px 18px; border: 0; background: none; font: 600 13px var(--font); letter-spacing: .05em; text-transform: uppercase; color: var(--muted); cursor: pointer; white-space: nowrap; transition: color .2s; }
.tab-button::after { content: ''; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--primary-color); transform: scaleX(0); transition: transform .25s var(--ease); }
.tab-button:hover { color: var(--ink); }
.tab-button.active { color: var(--primary-color); }
.tab-button.active::after { transform: scaleX(1); }
.tab-button .count { margin-left: 6px; padding: 1px 7px; border-radius: var(--r-pill); background: var(--primary-tint); font-size: 11px; }
.tab-pane { display: none; }
.tab-pane.active { display: block; animation: fade-in .3s var(--ease); }

.segmented { display: inline-flex; padding: 4px; gap: 2px; background: #E9F0F9; border-radius: var(--r-md); flex-wrap: wrap; }
.segmented a, .segmented button { padding: 8px 14px; border-radius: var(--r-sm); border: 0; background: none; font: 600 13px var(--font); color: var(--muted); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; transition: all .2s; }
.segmented a:hover, .segmented button:hover { color: var(--ink); }
.segmented .is-active { background: #fff; color: var(--primary-color); box-shadow: var(--sh-low); }

/* ---------------------------------------------------------------------
   13. DROPDOWNS (topbar)
   --------------------------------------------------------------------- */
.dropdown { position: relative; }
.dropdown-panel { position: absolute; right: 0; top: calc(100% + 10px); min-width: 240px; background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-high); opacity: 0; visibility: hidden; transform: translateY(-6px); transition: all .2s var(--ease); z-index: 60; overflow: hidden; }
.dropdown.open .dropdown-panel { opacity: 1; visibility: visible; transform: none; }
.user-panel { padding: 8px; }
.user-panel a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r-sm); color: var(--ink); font-size: 14px; }
.user-panel a:hover { background: var(--primary-tint); color: var(--primary-color); }
.user-panel a.danger { color: var(--danger); }
.user-panel a.danger:hover { background: var(--danger-tint); }
.dropdown-sep { height: 1px; background: var(--line); margin: 6px 0; }
.notif-panel { width: 380px; max-width: calc(100vw - 24px); }
.notif-panel__head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.notif-panel__list { max-height: 380px; overflow-y: auto; }
.notif-panel__foot { display: block; text-align: center; padding: 12px; font-weight: 600; font-size: 14px; border-top: 1px solid var(--line); }
.notif-item { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); color: var(--ink); transition: background .15s; }
.notif-item:hover { background: var(--surface-2); }
.notif-item.unread { background: #F5F9FF; }
.notif-item.unread .notif-item__body strong::after { content: ''; display: inline-block; width: 7px; height: 7px; margin-left: 6px; border-radius: 50%; background: var(--primary-color); vertical-align: middle; }
.notif-item__icon { width: 36px; height: 36px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--primary-tint); color: var(--primary-color); }
.notif-item__icon svg { width: 17px; height: 17px; }
.notif-item__icon.notif-payment { background: var(--success-tint); color: var(--success); }
.notif-item__icon.notif-document { background: var(--warning-tint); color: var(--warning); }
.notif-item__body { display: flex; flex-direction: column; gap: 2px; font-size: 13.5px; min-width: 0; }
.notif-item__body span { color: var(--muted); }
.notif-item__body small { color: var(--muted-2); font-size: 12px; }
.notif-empty { padding: 30px 16px; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 8px; }

/* ---------------------------------------------------------------------
   14. EMPTY STATES / ACTIVITY
   --------------------------------------------------------------------- */
.empty-state { text-align: center; padding: 42px 20px; color: var(--muted); }
.empty-state .icon-circle { margin: 0 auto 14px; width: 64px; height: 64px; }
.empty-state h4 { font-size: 17px; margin-bottom: 6px; }
.empty-state p { max-width: 380px; margin: 0 auto 16px; font-size: 14px; }

.timeline { list-style: none; position: relative; }
.timeline li { position: relative; padding: 0 0 18px 28px; font-size: 14px; }
.timeline li::before { content: ''; position: absolute; left: 6px; top: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--primary-color); box-shadow: 0 0 0 4px var(--primary-tint); }
.timeline li::after { content: ''; position: absolute; left: 10px; top: 18px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline li.success::before { background: var(--success); box-shadow: 0 0 0 4px var(--success-tint); }
.timeline li.warn::before { background: var(--warning); box-shadow: 0 0 0 4px var(--warning-tint); }
.timeline li.danger::before { background: var(--danger); box-shadow: 0 0 0 4px var(--danger-tint); }
.timeline__text { color: var(--ink-2); }
.timeline__time { color: var(--muted-2); font-size: 12px; margin-top: 2px; }

/* Bars (simple CSS charts) */
.bar-list { display: flex; flex-direction: column; gap: 14px; }
.bar-list__row { display: grid; grid-template-columns: 150px 1fr 48px; gap: 12px; align-items: center; font-size: 13.5px; }
.bar-list__row span:last-child { text-align: right; font-weight: 600; color: var(--ink); }
.chart-box { position: relative; height: 280px; }

/* ---------------------------------------------------------------------
   15. DOCUMENTS
   --------------------------------------------------------------------- */
.service-switch { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 22px; scrollbar-width: thin; }
.service-switch a { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: var(--r-md); background: #fff; border: 1px solid var(--line); color: var(--ink); white-space: nowrap; transition: all .2s var(--ease); font-size: 14px; }
.service-switch a:hover { border-color: var(--primary-color); }
.service-switch a.is-active { background: var(--primary-color); border-color: var(--primary-color); color: #fff; box-shadow: var(--sh-glow); }
.service-switch a small { display: block; font-size: 11.5px; opacity: .75; }
.service-switch .sw-count { min-width: 20px; height: 20px; border-radius: var(--r-pill); background: var(--gold); color: var(--secondary-color); font: 700 11px/20px var(--font); text-align: center; padding: 0 6px; }

.doc-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.dropzone { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 8px; padding: 30px 20px; border: 2px dashed #AFC4EA; border-radius: var(--r-lg); background: linear-gradient(180deg, #F7FAFF, #EEF5FE); cursor: pointer; transition: border-color .2s, background .2s, transform .2s; }
.dropzone:hover, .dropzone.is-over { border-color: var(--primary-color); background: var(--primary-tint); }
.dropzone.is-over { transform: scale(1.01); }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone__icon { width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; background: #fff; color: var(--primary-color); box-shadow: var(--sh-md); }
.dropzone__icon svg { width: 26px; height: 26px; }
.dropzone strong { font: 700 16px var(--font-head); }
.dropzone span { font-size: 13px; color: var(--muted); }
.upload-queue { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.upload-queue__item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--line); font-size: 13.5px; }
.upload-queue__item .progress { flex: 1; height: 6px; }
.upload-queue__item.done svg { color: var(--success); }
.upload-queue__item.fail { border-color: #F5CFC3; background: var(--danger-tint); }

.doc-section-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 24px 0 12px; font: 700 16px var(--font-head); }
.doc-section-title small { font: 500 13px var(--font); color: var(--muted); }
.doc-list { display: flex; flex-direction: column; gap: 10px; }
.doc-row { display: flex; align-items: center; gap: 14px; padding: 13px 14px; border-radius: var(--r-md); background: #fff; border: 1px solid var(--line); transition: border-color .2s, box-shadow .2s, transform .2s; }
.doc-row:hover { border-color: #B9CCEC; box-shadow: var(--sh-md); }
.doc-row.is-selected { border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(11, 96, 242, .12); }
.doc-row.is-requested { background: #FFFCF4; border-style: dashed; border-color: #EBD9A6; }
.doc-row.is-revision { background: #FFF8F6; border-color: #F5CFC3; }
.doc-row__icon { width: 42px; height: 42px; flex: none; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--primary-tint); color: var(--primary-color); }
.doc-row.is-requested .doc-row__icon { background: #FBF0D2; color: #9C7A1F; }
.doc-row__body { flex: 1; min-width: 0; }
.doc-row__title { font-weight: 600; font-size: 14.5px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-row__meta { font-size: 12.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 10px; }
.doc-row__note { font-size: 12.5px; color: var(--danger); margin-top: 3px; }
.doc-row__actions { display: flex; gap: 6px; align-items: center; flex: none; }
.doc-upload-btn { position: relative; overflow: hidden; }
.doc-upload-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.doc-preview { position: sticky; top: calc(var(--topbar-h) + 20px); }
.doc-preview__frame { height: 460px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; display: grid; place-items: center; }
.doc-preview__frame iframe, .doc-preview__frame img { width: 100%; height: 100%; border: 0; object-fit: contain; background: #fff; }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.compare__col h5 { font: 600 12px var(--font); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.compare .doc-preview__frame { height: 360px; }

/* ---------------------------------------------------------------------
   16. MESSAGES / CHAT
   --------------------------------------------------------------------- */
.chat-layout { display: grid; grid-template-columns: 340px minmax(0, 1fr); height: calc(100vh - var(--topbar-h) - 150px); min-height: 520px; background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-low); overflow: hidden; }
.chat-threads { display: flex; flex-direction: column; border-right: 1px solid var(--line); background: var(--surface-2); min-height: 0; }
.chat-threads__search { padding: 14px; border-bottom: 1px solid var(--line); }
.chat-threads__list { flex: 1; overflow-y: auto; }
.chat-thread { display: flex; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); cursor: pointer; transition: background .15s; position: relative; color: var(--ink); }
.chat-thread:hover { background: #F0F6FE; }
.chat-thread.is-active { background: #fff; }
.chat-thread.is-active::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--primary-color); }
.chat-thread__avatar { position: relative; flex: none; }
.chat-thread__avatar img { width: 44px; height: 44px; border-radius: 50%; }
.chat-thread__avatar .status-indicator { width: 12px; height: 12px; }
.chat-thread__body { flex: 1; min-width: 0; }
.chat-thread__top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.chat-thread__name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-thread__time { font-size: 11.5px; color: var(--muted-2); flex: none; }
.chat-thread__svc { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; color: var(--primary-color); background: var(--primary-tint); border-radius: var(--r-pill); padding: 1px 8px; margin: 3px 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-thread__preview { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-thread__unread { min-width: 20px; height: 20px; border-radius: var(--r-pill); background: var(--primary-color); color: #fff; font: 700 11px/20px var(--font); text-align: center; padding: 0 6px; align-self: center; }

.chat-window { display: flex; flex-direction: column; min-height: 0; }
.chat-head { display: flex; align-items: center; gap: 14px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.chat-head__title { font: 700 16px var(--font-head); }
.chat-head__sub { font-size: 12.5px; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.chat-head__actions { margin-left: auto; display: flex; gap: 6px; }
.online-dot { display: inline-flex; align-items: center; gap: 5px; }
.online-dot::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--muted-2); }
.online-dot.on::before { background: var(--success); box-shadow: 0 0 0 3px var(--success-tint); }
.chat-body { flex: 1; overflow-y: auto; padding: 22px 24px; background: radial-gradient(circle at 1px 1px, #E3ECF7 1px, transparent 0) 0 0 / 22px 22px, #FAFCFF; display: flex; flex-direction: column; gap: 6px; }
.chat-day { align-self: center; font-size: 12px; color: var(--muted); background: #fff; border: 1px solid var(--line); padding: 3px 12px; border-radius: var(--r-pill); margin: 10px 0; }
.chat-msg { display: flex; gap: 10px; max-width: 72%; animation: msg-in .25s var(--ease); }
.chat-msg img { width: 30px; height: 30px; border-radius: 50%; align-self: flex-end; }
.chat-msg__bubble { padding: 10px 14px; border-radius: 14px 14px 14px 4px; background: #fff; border: 1px solid var(--line); box-shadow: var(--sh-low); font-size: 14.5px; color: var(--ink); white-space: pre-wrap; word-wrap: break-word; }
.chat-msg__who { font-size: 12px; font-weight: 600; color: var(--label); margin-bottom: 2px; }
.chat-msg__meta { font-size: 11px; color: var(--muted-2); margin-top: 3px; display: flex; gap: 4px; align-items: center; }
.chat-msg__meta svg { width: 14px; height: 14px; }
.chat-msg.me { align-self: flex-end; flex-direction: row-reverse; }
.chat-msg.me .chat-msg__bubble { background: var(--primary-color); border-color: var(--primary-color); color: #fff; border-radius: 14px 14px 4px 14px; }
.chat-msg.me .chat-msg__meta { justify-content: flex-end; }
.chat-msg.me .seen { color: var(--primary-color); }
.chat-msg.grouped img { visibility: hidden; }
.chat-msg.grouped .chat-msg__who { display: none; }
@keyframes msg-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.chat-typing-note { font-size: 12px; color: var(--muted); padding: 0 24px 6px; min-height: 18px; }
.chat-compose { display: flex; gap: 10px; align-items: flex-end; padding: 14px 18px; border-top: 1px solid var(--line); background: #fff; }
.chat-compose textarea { flex: 1; resize: none; min-height: 46px; max-height: 140px; }
.chat-compose .btn-primary { height: 46px; width: 46px; padding: 0; }
.chat-locked { padding: 16px 20px; border-top: 1px solid var(--line); text-align: center; color: var(--muted); font-size: 14px; background: var(--surface-2); }
.chat-empty { margin: auto; text-align: center; color: var(--muted); max-width: 320px; }

/* ---------------------------------------------------------------------
   17. INVOICE DOCUMENT
   --------------------------------------------------------------------- */
.invoice-doc { background: #fff; border-radius: var(--r-lg); border: 1px solid var(--line); box-shadow: var(--sh-md); overflow: hidden; }
.invoice-doc__head { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; padding: 30px 34px; background: linear-gradient(150deg, var(--secondary-2), var(--secondary-color)); color: #fff; position: relative; }
.invoice-doc__head::after { content: ''; position: absolute; left: 34px; bottom: 0; width: 70px; height: 3px; background: var(--gold); }
.invoice-doc__head h2 { color: #fff; font-size: 30px; }
.invoice-doc__head .muted { color: #A8B7DE; }
.invoice-doc__body { padding: 30px 34px; }
.invoice-parties { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-bottom: 26px; font-size: 14px; }
.invoice-parties h6 { font: 600 11.5px var(--font); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.invoice-totals { margin-left: auto; width: min(360px, 100%); margin-top: 18px; }
.invoice-totals div { display: flex; justify-content: space-between; padding: 8px 0; font-size: 14.5px; border-bottom: 1px solid var(--line); }
.invoice-totals .grand { font: 800 20px var(--font-head); color: var(--ink); border-bottom: 0; padding-top: 12px; }
.invoice-totals .due { color: var(--danger); font-weight: 700; }

.items-editor .item-row { display: grid; grid-template-columns: minmax(0, 1fr) 90px 130px 120px 40px; gap: 10px; align-items: center; margin-bottom: 10px; }
.items-editor .item-row .amount { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.items-editor .item-head { font: 600 12px var(--font); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.totals-preview { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 18px; }
.totals-preview div { display: flex; justify-content: space-between; padding: 4px 0; font-size: 14px; }
.totals-preview .grand { font: 800 18px var(--font-head); border-top: 1px solid var(--line); margin-top: 6px; padding-top: 10px; }

/* Catalog */
.catalog-country { margin-bottom: 26px; }
.catalog-country__head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.catalog-country__head img { width: 34px; height: 25px; border-radius: 4px; object-fit: cover; box-shadow: var(--sh-low); }
.catalog-country__head h3 { font-size: 19px; }
.catalog-cats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.catalog-cat { background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; box-shadow: var(--sh-low); }
.catalog-cat h4 { display: flex; align-items: center; gap: 10px; font-size: 15px; margin-bottom: 12px; }
.catalog-item { display: flex; align-items: center; gap: 10px; justify-content: space-between; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; }
.catalog-item:first-of-type { border-top: 0; }
.catalog-item__name { font-weight: 500; color: var(--ink); }
.catalog-item__desc { font-size: 12.5px; color: var(--muted); }
.catalog-item.is-inactive { opacity: .55; }

/* ---------------------------------------------------------------------
   18. GRID HELPERS + UTILITIES
   --------------------------------------------------------------------- */
.grid { display: grid; gap: 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.grid-main { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 22px; align-items: start; }
.span-2 { grid-column: span 2; }
.stack { display: flex; flex-direction: column; gap: 20px; }
.row-flex { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.between { justify-content: space-between; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.nowrap { white-space: nowrap; }
.fw-600 { font-weight: 600; }
.mono { font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace; font-size: 13px; }
.section-gap { margin-top: 28px; }
.section-title { display: flex; align-items: center; gap: 10px; font: 700 22px var(--font-head); margin: 0 0 14px; }
.d-flex { display: flex; } .flex-wrap { flex-wrap: wrap; } .d-block { display: block; } .d-inline { display: inline; }
.m-0 { margin: 0 !important; } .mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 16px; } .mt-4 { margin-top: 24px; } .mt-5 { margin-top: 32px; }
.mb-0 { margin-bottom: 0 !important; } .mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 16px; } .mb-4 { margin-bottom: 24px; } .mb-5 { margin-bottom: 32px; }
.icon-small { width: 15px; height: 15px; }

/* Entrance animations */
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.animate-fade-in { animation: fade-in .5s var(--ease) both; }
.animate-scale-in, .rise { animation: rise-in .5s var(--ease) both; }
.animation-delay-100, .d1 { animation-delay: .06s; }
.animation-delay-200, .d2 { animation-delay: .12s; }
.animation-delay-300, .d3 { animation-delay: .18s; }
.animation-delay-400, .d4 { animation-delay: .24s; }
.animation-delay-500, .d5 { animation-delay: .3s; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; } }

/* Print (invoices) */
@media print {
  .topbar, .sidebar, .no-print, .notifications, .sidebar-scrim { display: none !important; }
  .main-content { margin: 0 !important; padding: 0 !important; }
  body { background: #fff; }
  .invoice-doc { box-shadow: none; border: 0; }
}

/* ---------------------------------------------------------------------
   19. RESPONSIVE
   --------------------------------------------------------------------- */
@media (max-width: 1279px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main { grid-template-columns: minmax(0, 1fr); }
  .catalog-cats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .doc-layout { grid-template-columns: minmax(0, 1fr); }
  .doc-preview { position: static; }
}

@media (max-width: 991px) {
  .topbar { padding: 0 14px; gap: 10px; }
  .topbar-menu { display: grid; }
  .logo-container { width: auto; }
  .search-container, .action-link span, .user-info, .user-container > svg { display: none; }
  .sidebar { transform: translateX(-100%); width: var(--sidebar-w) !important; }
  .sidebar.open { transform: none; box-shadow: var(--sh-high); }
  .sidebar.collapsed .sidebar-text, .sidebar.collapsed .sidebar-foot { display: block; }
  .sidebar-toggle { display: none; }
  .sidebar-scrim.show { display: block; position: fixed; inset: var(--topbar-h) 0 0 0; background: rgba(1, 24, 59, .45); z-index: 35; }
  .main-content, .sidebar.collapsed ~ .main-content { margin-left: 0; padding: calc(var(--topbar-h) + 22px) 18px 40px; }
  .svc-grid, .grid-2, .grid-3, .compare { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .chat-layout { grid-template-columns: minmax(0, 1fr); height: auto; }
  .chat-threads { max-height: 300px; border-right: 0; border-bottom: 1px solid var(--line); }
  .chat-window { height: 70vh; }
  .stat-strip__item { border-right: 0; padding: 8px 12px 8px 0; width: 50%; }
  .stat-strip__cta { width: 100%; margin-top: 10px; }
  .stat-strip__cta .btn-secondary { width: 100%; }
}

@media (max-width: 640px) {
  .page-title { font-size: 26px; }
  .kpi-grid, .form-grid, .form-grid-3, .catalog-cats, .invoice-parties { grid-template-columns: minmax(0, 1fr); }
  .stat-strip__item { width: 100%; }
  .page-header > * { min-width: 0; }
  .main-content { overflow-x: hidden; }
  .stepper { overflow-x: auto; justify-content: flex-start; gap: 6px; padding-bottom: 6px; }
  .stepper__step { min-width: 84px; }
  .items-editor .item-row { grid-template-columns: 1fr 70px 100px; }
  .items-editor .item-row .amount, .items-editor .item-head { display: none; }
  .modal-header, .modal-content { padding-left: 18px; padding-right: 18px; }
  .card { padding: 18px; }
  .chat-msg { max-width: 90%; }
  .doc-row { flex-wrap: wrap; }
  .notifications { right: 10px; left: 10px; }
  .notifications .toast { width: auto; }
  .info-strip { flex-direction: column; }
}

/* ---- refinements after visual QA ---- */
.chat-thread__avatar { display: block; height: 44px; }
.chat-thread__body { display: flex; flex-direction: column; }
.chat-thread__top { display: flex; }
.chat-thread__svc { align-self: flex-start; }
.chat-thread__preview { display: block; }
.doc-row { flex-wrap: wrap; }
.doc-row__body { flex: 1 1 220px; }
.doc-row__title { white-space: normal; overflow: visible; }
.doc-row__actions { flex-wrap: wrap; justify-content: flex-end; margin-left: auto; }

/* ---- Brand logo image (admin-images/snt-logo) ---- */
.brand-logo { display: inline-flex; align-items: center; line-height: 0; }
.brand-logo picture { display: block; }
.brand-logo__img { height: 58px; width: auto; display: block; }
.auth-topbar .brand-logo__img { height: 60px; }
.brand-logo--light { background: #fff; padding: 8px 14px; border-radius: 12px; }
.brand-logo--light .brand-logo__img { height: 60px; }
@media (max-width: 991px) { .brand-logo__img { height: 42px; } }
body[data-page="messages"] .chat-layout { height: calc(100vh - var(--topbar-h) - 110px); }
