/* ============================================================
   GAMAVIRTUAL · PAINEL DO AFILIADO
   Direção: Editorial Tech Brutalist · Dashboard Edition
   ============================================================ */

/* ===== RESET ===== */
*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; height: 100%; }
body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; min-height: 100%; }
img,svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; background: none; border: 0; cursor: pointer; color: inherit; }
ul,ol { list-style: none; }
input,select,textarea { font: inherit; color: inherit; }
table { border-collapse: collapse; width: 100%; }

/* ===== TOKENS ===== */
:root {
  /* Palette — mesmo do site principal */
  --bg:           #F5F1EA;
  --bg-alt:       #ECE6DA;
  --bg-card:      #FFFFFF;
  --bg-deep:      #0E0E0C;
  --ink:          #1A1A18;
  --ink-soft:     #4A4A45;
  --ink-muted:    #8A8A82;
  --line:         #C9C2B3;
  --line-soft:    rgba(26,26,24,0.10);
  --line-table:   rgba(26,26,24,0.08);

  --gold:         #D9A24E;
  --gold-deep:    #B8862F;
  --gold-soft:    #F0DDB4;
  --green:        #00B074;
  --green-deep:   #007A50;
  --green-soft:   #C5EBD9;
  --warm-red:     #C24B3B;
  --red-soft:     #F4D5D0;
  --info:         #3B7BC2;
  --info-soft:    #D6E2F0;

  /* Fonts */
  --font-display: 'Fraunces', 'Times New Roman', serif;
  --font-body:    'Inter', -apple-system, sans-serif;
  --font-mono:    'JetBrains Mono', 'Courier New', monospace;

  /* Layout */
  --sidebar-w:    260px;
  --sidebar-w-collapsed: 76px;
  --header-h:     64px;
  --radius:       0px;
  --radius-sm:    4px;
  --radius-md:    8px;
  --radius-pill:  100px;

  /* Motion */
  --ease:         cubic-bezier(0.65, 0.05, 0.36, 1);
  --ease-out:     cubic-bezier(0.16, 1, 0.3, 1);
  --t-fast:       0.18s;
  --t:            0.32s;
  --t-slow:       0.6s;

  /* Shadows */
  --shadow-sm:    0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:    0 4px 16px rgba(0,0,0,0.06);
  --shadow-lg:    0 8px 32px rgba(0,0,0,0.10);
  --shadow-brutal: 4px 4px 0 var(--ink);
}

/* ===== BODY ===== */
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 14px;
  line-height: 1.55;
  letter-spacing: -0.005em;
}

/* ============================================================
   APP SHELL
   ============================================================ */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
  transition: grid-template-columns var(--t) var(--ease);
}
.app.is-collapsed { grid-template-columns: var(--sidebar-w-collapsed) 1fr; }

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  background: var(--bg-deep);
  color: var(--bg);
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 50;
}

.sidebar__brand {
  padding: 0 22px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.10);
  flex-shrink: 0;
  height: var(--header-h);
  transition: padding var(--t) var(--ease), justify-content var(--t) var(--ease);
}
.app.is-collapsed .sidebar__brand {
  padding: 0;
  justify-content: center;
}
.sidebar__brand-mark {
  width: 32px; height: 32px;
  flex-shrink: 0;
  color: var(--bg);
  transition: transform var(--t-slow) var(--ease);
}
.sidebar__brand:hover .sidebar__brand-mark { transform: rotate(60deg); }
.sidebar__brand-type {
  display: flex;
  flex-direction: column;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  opacity: 1;
  max-width: 200px;
  transition: opacity var(--t-fast), max-width var(--t) var(--ease);
}
.app.is-collapsed .sidebar__brand-type {
  opacity: 0;
  max-width: 0;
  pointer-events: none;
}

.sidebar__brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.02em;
  color: var(--bg);
}
.sidebar__brand-name em {
  font-style: italic;
  font-weight: 500;
  color: var(--gold);
}
.sidebar__brand-tag {
  font-family: var(--font-mono);
  font-size: 9px;
  color: rgba(255,255,255,0.4);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* Sidebar nav */
.sidebar__nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
}
.sidebar__nav::-webkit-scrollbar { width: 4px; }
.sidebar__nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); }

.sidebar__section {
  padding: 12px 22px 6px;
  font-family: var(--font-mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: rgba(255,255,255,0.35);
  white-space: nowrap;
  opacity: 1;
  transition: opacity var(--t-fast), padding var(--t) var(--ease), height var(--t) var(--ease);
  overflow: hidden;
}
.app.is-collapsed .sidebar__section {
  font-size: 0;
  padding: 8px 0 4px;
  height: 8px;
  color: transparent;
}
.app.is-collapsed .sidebar__section::after {
  content: '';
  display: block;
  width: 24px;
  height: 1px;
  background: rgba(255,255,255,0.12);
  margin: 0 auto;
}

/* === LINKS DA SIDEBAR === */
.sidebar__link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 22px;
  color: rgba(255,255,255,0.78);
  font-size: 14px;
  font-weight: 500;
  position: relative;
  transition:
    background var(--t-fast),
    color var(--t-fast),
    padding var(--t) var(--ease),
    justify-content var(--t) var(--ease);
  white-space: nowrap;
}
.sidebar__link svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}
.sidebar__link:hover {
  color: var(--bg);
  background: rgba(255,255,255,0.04);
}
.sidebar__link.is-active {
  color: var(--gold);
  background: rgba(217, 162, 78, 0.08);
}
.sidebar__link.is-active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--gold);
}
.sidebar__link-text {
  opacity: 1;
  overflow: hidden;
  transition: opacity var(--t-fast);
}

/* === MODO COLAPSADO === */
.app.is-collapsed .sidebar__link {
  /* centraliza o ícone na largura colapsada (76px) */
  padding: 14px 0;
  gap: 0;
  justify-content: center;
}
.app.is-collapsed .sidebar__link-text {
  opacity: 0;
  width: 0;
  pointer-events: none;
}
.app.is-collapsed .sidebar__link svg {
  /* leve aumento para destacar visualmente o ícone sozinho */
  width: 22px;
  height: 22px;
}

/* tooltip nativo melhorado para modo colapsado */
.app.is-collapsed .sidebar__link[title]:hover::after {
  content: attr(title);
  position: absolute;
  left: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--ink);
  color: var(--bg);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  pointer-events: none;
}

/* Sidebar footer */
.sidebar__foot {
  padding: 16px 22px;
  border-top: 1px solid rgba(255,255,255,0.10);
  flex-shrink: 0;
  transition: padding var(--t) var(--ease);
}
.app.is-collapsed .sidebar__foot {
  padding: 16px 0;
}
.sidebar__user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  transition: justify-content var(--t) var(--ease);
}
.app.is-collapsed .sidebar__user {
  justify-content: center;
  gap: 0;
}
.sidebar__user-avatar {
  width: 36px; height: 36px;
  background: var(--gold);
  color: var(--ink);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
}
.sidebar__user-info {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  overflow: hidden;
  opacity: 1;
  transition: opacity var(--t-fast), width var(--t) var(--ease);
}
.app.is-collapsed .sidebar__user-info {
  opacity: 0;
  width: 0;
  pointer-events: none;
}
.sidebar__user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--bg);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  max-width: 160px;
}
.sidebar__user-role {
  font-family: var(--font-mono);
  font-size: 10px;
  color: rgba(255,255,255,0.5);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 2px;
}

/* ============================================================
   MAIN AREA
   ============================================================ */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* TOPBAR */
.topbar {
  height: var(--header-h);
  background: var(--bg);
  border-bottom: 1px solid var(--line-soft);
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 24px;
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
}
.topbar.is-scrolled {
  background: rgba(245,241,234,0.85);
  border-bottom-color: var(--line);
}

.topbar__toggle {
  width: 36px; height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--ink);
  transition: background var(--t-fast), border-color var(--t-fast);
}
.topbar__toggle:hover {
  background: var(--bg-alt);
  border-color: var(--line-soft);
}
.topbar__toggle svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.6; }

.topbar__breadcrumb {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-muted);
}
.topbar__breadcrumb b {
  color: var(--ink);
  font-weight: 500;
}
.topbar__breadcrumb-sep { color: var(--gold); }

.topbar__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 22px;
  letter-spacing: -0.025em;
  color: var(--ink);
  margin-right: auto;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.topbar__search {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--bg-alt);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0 12px;
  height: 36px;
  width: 240px;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.topbar__search:focus-within {
  border-color: var(--ink);
  background: var(--bg-card);
}
.topbar__search svg {
  width: 14px; height: 14px;
  color: var(--ink-muted);
  margin-right: 8px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
}
.topbar__search input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 13px;
  color: var(--ink);
}
.topbar__search input::placeholder { color: var(--ink-muted); }

.topbar__icon-btn {
  width: 36px; height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  position: relative;
  color: var(--ink);
  transition: background var(--t-fast);
}
.topbar__icon-btn:hover { background: var(--bg-alt); }
.topbar__icon-btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.6; }
.topbar__icon-btn .badge-dot {
  position: absolute;
  top: 8px; right: 8px;
  width: 7px; height: 7px;
  background: var(--warm-red);
  border-radius: 50%;
  border: 2px solid var(--bg);
}

/* ============================================================
   CONTENT
   ============================================================ */
.content {
  padding: 32px 28px 60px;
  max-width: 100%;
}
.content__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.content__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(28px, 3vw, 40px);
  line-height: 1.05;
  letter-spacing: -0.035em;
  color: var(--ink);
  font-feature-settings: 'ss01' on;
}
.content__title em {
  font-style: italic;
  font-weight: 400;
  background: linear-gradient(180deg, var(--gold-deep), var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.content__sub {
  margin-top: 6px;
  color: var(--ink-soft);
  font-size: 14px;
}

.content__meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-muted);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--ink);
  margin-bottom: 16px;
}
.content__meta-num { color: var(--ink-muted); }

/* ============================================================
   SECTION TITLES (inside dashboard)
   ============================================================ */
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--ink);
  gap: 16px;
}
.section-head__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.section-head__meta {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-muted);
}
.section-head__action {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--ink-soft);
  padding-bottom: 2px;
  transition: color var(--t-fast);
}
.section-head__action:hover { color: var(--gold-deep); border-color: var(--gold-deep); }

/* ============================================================
   KPI CARDS
   ============================================================ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  margin-bottom: 32px;
  border: 1px solid var(--ink);
  background: var(--bg-card);
}
.kpi {
  padding: 24px 24px 22px;
  border-right: 1px solid var(--line-soft);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 158px;
  transition: background var(--t-fast);
}
.kpi:last-child { border-right: 0; }
.kpi:hover { background: var(--bg); }

.kpi__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.kpi__label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-muted);
  font-weight: 500;
}
.kpi__icon {
  width: 28px; height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-alt);
  border-radius: 50%;
  flex-shrink: 0;
}
.kpi__icon svg { width: 14px; height: 14px; stroke: var(--ink); fill: none; stroke-width: 1.6; }
.kpi--gold .kpi__icon { background: var(--gold); }
.kpi--gold .kpi__icon svg { stroke: var(--ink); }
.kpi--green .kpi__icon { background: var(--green-soft); }
.kpi--green .kpi__icon svg { stroke: var(--green-deep); }
.kpi--info .kpi__icon { background: var(--info-soft); }
.kpi--info .kpi__icon svg { stroke: var(--info); }

.kpi__value {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 38px;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--ink);
  font-feature-settings: 'tnum' on;
}
.kpi__value-suf {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 300;
  font-size: 22px;
  color: var(--gold-deep);
  margin-left: 4px;
}

.kpi__trend {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  margin-top: auto;
}
.kpi__trend.is-up    { color: var(--green-deep); }
.kpi__trend.is-down  { color: var(--warm-red); }
.kpi__trend.is-flat  { color: var(--ink-muted); }
.kpi__trend svg { width: 12px; height: 12px; stroke: currentColor; fill: none; stroke-width: 2; }
.kpi__trend-meta { color: var(--ink-muted); font-weight: 400; }

/* ============================================================
   CARD (generic)
   ============================================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--ink);
  padding: 24px;
  margin-bottom: 24px;
  position: relative;
}
.card--no-pad { padding: 0; }
.card--accent {
  background: var(--ink);
  color: var(--bg);
}
.card--accent .section-head { border-color: rgba(255,255,255,0.2); }
.card--accent .section-head__title { color: var(--bg); }
.card--accent .section-head__meta { color: rgba(255,255,255,0.5); }

.card__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line-soft);
  gap: 16px;
}
.card__head h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.02em;
}
.card__head-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-muted);
}
.card__body { padding: 24px; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 13px;
  border-radius: var(--radius-sm);
  position: relative;
  transition: transform var(--t-fast) var(--ease), background var(--t-fast), color var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast);
  white-space: nowrap;
  border: 1px solid transparent;
  cursor: pointer;
}
.btn svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 1.6; }

.btn--solid {
  background: var(--ink);
  color: var(--bg);
}
.btn--solid:hover {
  background: var(--green-deep);
  transform: translateY(-1px);
  box-shadow: var(--shadow-brutal);
}
.btn--gold {
  background: var(--gold);
  color: var(--ink);
}
.btn--gold:hover {
  background: var(--gold-deep);
  color: var(--bg);
  transform: translateY(-1px);
  box-shadow: var(--shadow-brutal);
}
.btn--ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--ink);
}
.btn--ghost:hover {
  background: var(--ink);
  color: var(--bg);
}
.btn--outline {
  background: transparent;
  color: var(--ink-soft);
  border-color: var(--line);
}
.btn--outline:hover {
  border-color: var(--ink);
  color: var(--ink);
}
.btn--danger {
  background: transparent;
  color: var(--warm-red);
  border-color: var(--warm-red);
}
.btn--danger:hover { background: var(--warm-red); color: var(--bg); }

.btn--sm  { padding: 6px 12px; font-size: 12px; }
.btn--xs  { padding: 4px 10px; font-size: 11px; }
.btn--xs svg { width: 11px; height: 11px; }
.btn--lg  { padding: 14px 22px; font-size: 14px; }
.btn--icon { padding: 8px; width: 34px; height: 34px; justify-content: center; }
.btn--full { width: 100%; justify-content: center; }

/* ============================================================
   BADGES / STATUS
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-radius: var(--radius-pill);
  border: 1px solid currentColor;
  white-space: nowrap;
}
.badge--green { color: var(--green-deep); background: var(--green-soft); border-color: transparent; }
.badge--gold  { color: var(--gold-deep); background: var(--gold-soft); border-color: transparent; }
.badge--red   { color: var(--warm-red);  background: var(--red-soft); border-color: transparent; }
.badge--info  { color: var(--info);      background: var(--info-soft); border-color: transparent; }
.badge--gray  { color: var(--ink-soft);  background: var(--bg-alt); border-color: transparent; }
.badge--solid {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
.badge__dot {
  width: 6px; height: 6px;
  background: currentColor;
  border-radius: 50%;
  flex-shrink: 0;
}
.badge--green .badge__dot { background: var(--green); }
.badge--gold  .badge__dot { background: var(--gold); }
.badge--red   .badge__dot { background: var(--warm-red); }
.badge--info  .badge__dot { background: var(--info); }

/* ============================================================
   TABLES — editorial style
   ============================================================ */
.table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--ink);
  overflow: hidden;
}
.table-wrap__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 22px;
  border-bottom: 1px solid var(--ink);
  background: var(--bg);
  gap: 12px;
  flex-wrap: wrap;
}
.table-wrap__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.02em;
}
.table-wrap__actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.table-scroll { overflow-x: auto; }

table.gv-table {
  width: 100%;
  font-size: 13px;
  border-collapse: collapse;
}
table.gv-table thead th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-muted);
  padding: 14px 22px;
  background: var(--bg);
  border-bottom: 1px solid var(--ink);
  white-space: nowrap;
  position: sticky;
  top: 0;
}
table.gv-table tbody td {
  padding: 16px 22px;
  border-bottom: 1px solid var(--line-table);
  vertical-align: middle;
  color: var(--ink);
}
table.gv-table tbody tr:last-child td { border-bottom: 0; }
table.gv-table tbody tr {
  transition: background var(--t-fast);
}
table.gv-table tbody tr:hover { background: var(--bg); }

.td-strong { font-weight: 500; }
.td-mono   { font-family: var(--font-mono); font-size: 12px; }
.td-num    { font-family: var(--font-mono); font-feature-settings: 'tnum' on; text-align: right; white-space: nowrap; }
.td-money  { font-family: var(--font-display); font-weight: 600; font-feature-settings: 'tnum' on; }
.td-money em {
  font-family: var(--font-mono);
  font-style: normal;
  font-weight: 500;
  font-size: 11px;
  color: var(--ink-muted);
  margin-right: 4px;
}
.td-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.table-empty {
  padding: 60px 24px;
  text-align: center;
  color: var(--ink-muted);
}
.table-empty__icon {
  width: 48px; height: 48px;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--line);
  border-radius: 50%;
  color: var(--ink-muted);
}
.table-empty__icon svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.5; }
.table-empty__title { font-family: var(--font-display); font-weight: 500; font-size: 16px; color: var(--ink); margin-bottom: 6px; }

/* Pagination */
.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 22px;
  border-top: 1px solid var(--line-soft);
  font-size: 12px;
  color: var(--ink-soft);
  flex-wrap: wrap;
  gap: 12px;
}
.pagination__pages {
  display: flex;
  gap: 4px;
  align-items: center;
}
.pagination__btn {
  min-width: 32px; height: 32px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-soft);
  border-radius: var(--radius-sm);
  transition: background var(--t-fast), color var(--t-fast);
}
.pagination__btn:hover {
  background: var(--bg-alt);
  color: var(--ink);
}
.pagination__btn.is-active {
  background: var(--ink);
  color: var(--bg);
}
.pagination__btn:disabled, .pagination__btn.is-disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* ============================================================
   FORMS
   ============================================================ */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.form-row--3 { grid-template-columns: repeat(3, 1fr); }
.form-row--full { grid-template-columns: 1fr; }

.form-field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.form-field--inline { flex-direction: row; align-items: center; gap: 10px; }
.form-field label, .form-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
  font-weight: 500;
}
.form-field label .req { color: var(--warm-red); }

.form-input, .form-field input[type="text"],
.form-field input[type="email"],
.form-field input[type="tel"],
.form-field input[type="password"],
.form-field input[type="number"],
.form-field input[type="url"],
.form-field input[type="search"],
.form-field input[type="date"],
.form-field select,
.form-field textarea {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink);
  transition: border-color var(--t-fast), background var(--t-fast), box-shadow var(--t-fast);
  outline: 0;
  width: 100%;
}
.form-field input::placeholder, .form-field textarea::placeholder { color: var(--ink-muted); font-weight: 300; }
.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(217, 162, 78, 0.18);
}
.form-field textarea { resize: vertical; min-height: 96px; line-height: 1.5; }
.form-field select {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%231A1A18' stroke-width='1.4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 34px;
}
.form-help {
  font-size: 12px;
  color: var(--ink-muted);
  line-height: 1.4;
  margin-top: 4px;
}

/* checkbox / radio simple */
.form-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--ink-soft);
}
.form-check input { accent-color: var(--ink); }

/* form footer */
.form-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line-soft);
}

/* ============================================================
   ALERTS / FLASH
   ============================================================ */
.alert {
  display: flex;
  gap: 12px;
  padding: 14px 18px;
  border: 1px solid;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-size: 13.5px;
  align-items: flex-start;
}
.alert__icon {
  flex-shrink: 0;
  width: 18px; height: 18px;
  margin-top: 1px;
}
.alert__icon svg { width: 100%; height: 100%; stroke: currentColor; fill: none; stroke-width: 1.6; }
.alert__body { flex: 1; }
.alert__title { font-weight: 600; margin-bottom: 2px; }
.alert--success { background: var(--green-soft); border-color: var(--green-deep); color: var(--green-deep); }
.alert--info    { background: var(--info-soft); border-color: var(--info); color: var(--info); }
.alert--warn    { background: var(--gold-soft); border-color: var(--gold-deep); color: var(--gold-deep); }
.alert--error   { background: var(--red-soft); border-color: var(--warm-red); color: var(--warm-red); }

/* ============================================================
   GRIDS / LAYOUTS
   ============================================================ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; }
.grid-1-2 { display: grid; grid-template-columns: 1fr 2fr; gap: 24px; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg);
}
.login__left {
  background: var(--bg-deep);
  color: var(--bg);
  padding: 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.login__left::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(255,255,255,0.04) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 80px 80px;
  pointer-events: none;
  mask-image: radial-gradient(ellipse 90% 60% at 30% 50%, black 30%, transparent 90%);
  -webkit-mask-image: radial-gradient(ellipse 90% 60% at 30% 50%, black 30%, transparent 90%);
}
.login__brand { position: relative; z-index: 1; }
.login__brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 28px;
  letter-spacing: -0.02em;
  color: var(--bg);
}
.login__brand-name em { font-style: italic; font-weight: 500; color: var(--gold); }
.login__brand-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(255,255,255,0.4);
  margin-top: 6px;
  display: block;
}

.login__hero { position: relative; z-index: 1; }
.login__hero h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(36px, 4vw, 56px);
  line-height: 1.0;
  letter-spacing: -0.04em;
  color: var(--bg);
  margin-bottom: 20px;
  font-feature-settings: 'ss01' on;
}
.login__hero h1 em {
  font-style: italic;
  font-weight: 400;
  background: linear-gradient(180deg, var(--gold), #FFD27A);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.login__hero p {
  color: rgba(255,255,255,0.7);
  font-size: 16px;
  font-family: var(--font-display);
  font-weight: 300;
  line-height: 1.5;
  max-width: 42ch;
}

.login__panel {
  position: relative;
  z-index: 1;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  padding: 22px;
  margin-top: 28px;
}
.login__panel-row { display: flex; justify-content: space-between; gap: 24px; }
.login__panel-cell {
  display: flex;
  flex-direction: column;
  line-height: 1;
}
.login__panel-label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.5);
  margin-bottom: 6px;
}
.login__panel-value {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 24px;
  letter-spacing: -0.02em;
  color: var(--bg);
}
.login__panel-value em {
  font-style: normal;
  color: var(--gold);
  margin: 0 4px;
}

.login__foot {
  position: relative; z-index: 1;
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.4);
}

.login__right {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 56px;
}
.login__form {
  width: 100%;
  max-width: 420px;
}
.login__form-head {
  margin-bottom: 36px;
}
.login__form-head h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 36px;
  letter-spacing: -0.035em;
  color: var(--ink);
  margin-bottom: 8px;
}
.login__form-head p {
  color: var(--ink-soft);
  font-size: 14px;
}

/* ============================================================
   QUICK LINK CARDS (used in dashboard)
   ============================================================ */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.quick-card {
  background: var(--bg-card);
  border: 1px solid var(--line-soft);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast);
  position: relative;
}
.quick-card:hover {
  border-color: var(--ink);
  transform: translate(-2px, -2px);
  box-shadow: 4px 4px 0 var(--ink);
}
.quick-card__icon {
  width: 32px; height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-alt);
  border-radius: 50%;
}
.quick-card__icon svg { width: 16px; height: 16px; stroke: var(--ink); fill: none; stroke-width: 1.6; }
.quick-card__title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 16px;
  letter-spacing: -0.015em;
  color: var(--ink);
}
.quick-card__sub {
  font-size: 12px;
  color: var(--ink-muted);
  line-height: 1.4;
}
.quick-card__arrow {
  position: absolute;
  top: 18px; right: 18px;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--ink-muted);
  transition: color var(--t-fast), transform var(--t-fast);
}
.quick-card:hover .quick-card__arrow { color: var(--gold-deep); transform: translateX(2px); }

/* ============================================================
   CHARTS / VISUALS — minimal SVG
   ============================================================ */
.chart-area {
  position: relative;
  width: 100%;
  height: 220px;
  padding: 16px 8px 8px;
}
.chart-area svg { width: 100%; height: 100%; }
.chart-legend {
  display: flex;
  gap: 18px;
  margin-top: 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
}
.chart-legend__item { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend__dot { width: 10px; height: 2px; }

/* ============================================================
   AVATAR & USER
   ============================================================ */
.avatar {
  width: 32px; height: 32px;
  background: var(--gold);
  color: var(--ink);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  flex-shrink: 0;
}
.avatar--lg { width: 56px; height: 56px; font-size: 22px; }
.avatar--green { background: var(--green-soft); color: var(--green-deep); }
.avatar--ink { background: var(--ink); color: var(--bg); }

/* ============================================================
   COPY / CODE BOX
   ============================================================ */
.code-box {
  background: var(--bg-deep);
  color: var(--bg);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  position: relative;
  overflow-x: auto;
  white-space: nowrap;
}
.code-box code { color: var(--gold); }
.code-box__copy {
  position: absolute;
  top: 8px; right: 8px;
  background: rgba(255,255,255,0.08);
  color: var(--bg);
  padding: 4px 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-radius: var(--radius-sm);
  transition: background var(--t-fast);
}
.code-box__copy:hover { background: var(--gold); color: var(--ink); }

/* ============================================================
   UTILITIES
   ============================================================ */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-mono { font-family: var(--font-mono); }
.text-display { font-family: var(--font-display); }
.text-muted { color: var(--ink-muted); }
.text-soft { color: var(--ink-soft); }
.text-ink { color: var(--ink); }
.text-gold { color: var(--gold-deep); }
.text-green { color: var(--green-deep); }
.text-red { color: var(--warm-red); }

.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }

.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }

.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }

.hidden { display: none !important; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .kpi { border-bottom: 1px solid var(--line-soft); }
  .kpi:nth-child(2n) { border-right: 0; }
  .kpi:nth-last-child(-n+2) { border-bottom: 0; }
  .quick-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2-1, .grid-1-2 { grid-template-columns: 1fr; }
  .login { grid-template-columns: 1fr; }
  .login__left { display: none; }
}

@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: 0; top: 0;
    width: var(--sidebar-w);
    height: 100vh;
    transform: translateX(-100%);
    transition: transform var(--t) var(--ease);
    box-shadow: 0 0 40px rgba(0,0,0,0.3);
  }
  .app.is-mobile-open .sidebar { transform: translateX(0); }
  .app.is-mobile-open::after {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 49;
  }
  .topbar__search { display: none; }
}

@media (max-width: 640px) {
  .topbar { padding: 0 16px; gap: 12px; }
  .topbar__breadcrumb { display: none; }
  .topbar__title { font-size: 18px; }
  .content { padding: 24px 16px 40px; }
  .content__head { flex-direction: column; align-items: stretch; }
  .kpi-grid { grid-template-columns: 1fr; }
  .kpi { border-right: 0 !important; border-bottom: 1px solid var(--line-soft); }
  .kpi:last-child { border-bottom: 0; }
  .quick-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  table.gv-table { font-size: 12px; }
  table.gv-table thead th, table.gv-table tbody td { padding: 12px 14px; }
  .login__right { padding: 32px 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
