/* ROCA GOLF — design tokens */
:root {
  --rg-bg: #fafaf7;
  --rg-paper: #ffffff;
  --rg-cream: #f5f1e8;
  --rg-ink: #14110d;
  --rg-ink-2: #3a3530;
  --rg-muted: #8a8580;
  --rg-line: #e8e4dc;
  --rg-line-2: #d8d3c8;

  /* Greens (fairway) */
  --rg-green-900: #0d2818;
  --rg-green-800: #143524;
  --rg-green-700: #1a4d2e;
  --rg-green-600: #2d6a44;
  --rg-green-500: #4a8a63;
  --rg-green-50: #eef4ee;

  /* Accent: brass / trophy */
  --rg-gold: #c9a961;
  --rg-gold-dark: #a88838;

  /* Status flags */
  --rg-flag-ok: #2d6a44;
  --rg-flag-warn: #d4a017;     /* yellow flag — 80% */
  --rg-flag-alert: #c8651b;    /* orange — 90% */
  --rg-flag-over: #b22222;     /* red — 100%+ */

  --rg-shadow-sm: 0 1px 0 rgba(20, 17, 13, 0.04), 0 1px 2px rgba(20, 17, 13, 0.04);
  --rg-shadow-md: 0 1px 0 rgba(20, 17, 13, 0.04), 0 4px 16px -4px rgba(20, 17, 13, 0.08);
  --rg-shadow-lg: 0 1px 0 rgba(20, 17, 13, 0.04), 0 12px 32px -8px rgba(20, 17, 13, 0.12);

  --rg-radius-sm: 6px;
  --rg-radius: 10px;
  --rg-radius-lg: 14px;

  --rg-font-display: "Bricolage Grotesque", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --rg-font-sans: "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --rg-font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

.rg-root {
  font-family: var(--rg-font-sans);
  color: var(--rg-ink);
  background: var(--rg-bg);
  font-size: 13px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.005em;
}

.rg-root *::-webkit-scrollbar { width: 8px; height: 8px; }
.rg-root *::-webkit-scrollbar-thumb { background: var(--rg-line-2); border-radius: 4px; }
.rg-root *::-webkit-scrollbar-track { background: transparent; }

/* ========== Layout ========== */
.rg-app {
  display: grid;
  grid-template-columns: 232px 1fr;
  height: 100%;
  width: 100%;
  background: var(--rg-bg);
}

/* ========== Sidebar ========== */
.rg-sidebar {
  background: var(--rg-green-900);
  color: #d8d3c8;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}
.rg-sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 60% at 50% 100%, rgba(74, 138, 99, 0.18), transparent 60%),
    radial-gradient(80% 40% at 100% 0%, rgba(201, 169, 97, 0.06), transparent 60%);
  pointer-events: none;
}
.rg-brand {
  padding: 20px 18px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}
.rg-brand img {
  width: 44px;
  height: auto;
  display: block;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.4));
}
.rg-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.rg-brand-text .name {
  font-family: var(--rg-font-display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.08em;
  color: #f5f1e8;
}
.rg-brand-text .sub {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #8a8580;
  margin-top: 2px;
}

.rg-nav {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  position: relative;
}
.rg-nav-section {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #6a6560;
  padding: 14px 10px 6px;
}
.rg-nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 10px;
  border-radius: var(--rg-radius-sm);
  color: #b8b3a8;
  font-size: 13px;
  font-weight: 450;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  background: transparent;
  text-align: left;
  width: 100%;
}
.rg-nav-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #f5f1e8;
}
.rg-nav-item.active {
  background: rgba(74, 138, 99, 0.18);
  color: #f5f1e8;
  box-shadow: inset 2px 0 0 var(--rg-gold);
}
.rg-nav-item svg { flex-shrink: 0; opacity: 0.85; }
.rg-nav-item .badge {
  margin-left: auto;
  background: var(--rg-flag-over);
  color: white;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 999px;
  font-weight: 600;
  font-family: var(--rg-font-mono);
}

.rg-sidebar-footer {
  margin-top: auto;
  padding: 14px 18px;
  border-top: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
}
.rg-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--rg-gold);
  color: var(--rg-green-900);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 12px;
  font-family: var(--rg-font-display);
}
.rg-user-info { display: flex; flex-direction: column; line-height: 1.2; }
.rg-user-info .n { color: #f5f1e8; font-size: 12.5px; font-weight: 500; }
.rg-user-info .r { color: #8a8580; font-size: 10.5px; }

/* ========== Main ========== */
.rg-main {
  overflow: auto;
  display: flex;
  flex-direction: column;
}

.rg-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  background: var(--rg-paper);
  border-bottom: 1px solid var(--rg-line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.rg-topbar .crumbs {
  font-size: 11.5px;
  color: var(--rg-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.rg-topbar h1 {
  font-family: var(--rg-font-display);
  font-weight: 600;
  font-size: 22px;
  margin: 2px 0 0;
  letter-spacing: -0.015em;
}
.rg-topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rg-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  background: var(--rg-cream);
  border: 1px solid transparent;
  border-radius: var(--rg-radius-sm);
  width: 240px;
  color: var(--rg-muted);
  font-size: 12.5px;
}
.rg-search:focus-within { border-color: var(--rg-green-500); background: white; }
.rg-search input {
  border: none;
  background: transparent;
  outline: none;
  flex: 1;
  font-family: inherit;
  font-size: 12.5px;
  color: var(--rg-ink);
}

.rg-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border-radius: var(--rg-radius-sm);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--rg-line-2);
  background: white;
  color: var(--rg-ink);
  transition: all 0.15s;
  font-family: inherit;
}
.rg-btn:hover { background: var(--rg-cream); border-color: var(--rg-line-2); }
.rg-btn.primary {
  background: var(--rg-green-700);
  color: white;
  border-color: var(--rg-green-700);
}
.rg-btn.primary:hover { background: var(--rg-green-800); }
.rg-btn.icon { padding: 7px; }

/* ========== Content ========== */
.rg-content {
  padding: 24px 28px 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* KPI cards */
.rg-kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.rg-kpi {
  background: var(--rg-paper);
  border: 1px solid var(--rg-line);
  border-radius: var(--rg-radius-lg);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
}
.rg-kpi.featured {
  background: linear-gradient(135deg, var(--rg-green-900) 0%, var(--rg-green-700) 100%);
  color: #f5f1e8;
  border-color: transparent;
}
.rg-kpi.featured::after {
  content: "";
  position: absolute;
  right: -40px;
  top: -40px;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(201, 169, 97, 0.15) 0%, transparent 60%);
  pointer-events: none;
}
.rg-kpi .label {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--rg-muted);
  font-weight: 500;
}
.rg-kpi.featured .label { color: rgba(245, 241, 232, 0.7); }
.rg-kpi .value {
  font-family: var(--rg-font-display);
  font-weight: 600;
  font-size: 30px;
  margin-top: 8px;
  letter-spacing: -0.02em;
  line-height: 1;
}
.rg-kpi .value .currency {
  font-size: 16px;
  color: var(--rg-muted);
  margin-right: 4px;
  font-weight: 400;
}
.rg-kpi.featured .value .currency { color: rgba(245, 241, 232, 0.6); }
.rg-kpi .delta {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--rg-muted);
}
.rg-kpi.featured .delta { color: rgba(245, 241, 232, 0.7); }
.rg-kpi .delta .pill {
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--rg-cream);
  color: var(--rg-ink-2);
  font-family: var(--rg-font-mono);
  font-size: 11px;
}
.rg-kpi.featured .delta .pill {
  background: rgba(255,255,255,0.1);
  color: #f5f1e8;
}

/* Featured KPI: budget bar + flag */
.rg-budget-track {
  margin-top: 16px;
  height: 8px;
  border-radius: 4px;
  background: rgba(255,255,255,0.12);
  overflow: hidden;
  position: relative;
}
.rg-budget-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--rg-gold-dark), var(--rg-gold));
  border-radius: 4px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.rg-budget-meta {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  font-family: var(--rg-font-mono);
  color: rgba(245, 241, 232, 0.8);
}

/* ========== Card ========== */
.rg-card {
  background: var(--rg-paper);
  border: 1px solid var(--rg-line);
  border-radius: var(--rg-radius-lg);
  overflow: hidden;
}
.rg-card-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--rg-line);
}
.rg-card-header h3 {
  font-family: var(--rg-font-display);
  font-weight: 600;
  font-size: 15px;
  margin: 0;
  letter-spacing: -0.01em;
}
.rg-card-header .sub {
  font-size: 11.5px;
  color: var(--rg-muted);
  margin-top: 1px;
}
.rg-card-header-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

/* Tabs */
.rg-tabs {
  display: inline-flex;
  background: var(--rg-cream);
  border-radius: var(--rg-radius-sm);
  padding: 3px;
  gap: 2px;
}
.rg-tab {
  padding: 5px 12px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--rg-muted);
  cursor: pointer;
  border-radius: 5px;
  border: none;
  background: transparent;
  font-family: inherit;
}
.rg-tab.active {
  background: white;
  color: var(--rg-ink);
  box-shadow: var(--rg-shadow-sm);
}

/* ========== Two-column layout ========== */
.rg-two-col {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 20px;
}

/* ========== Categories list ========== */
.rg-categories {
  display: flex;
  flex-direction: column;
}
.rg-cat-row {
  padding: 16px 20px;
  border-bottom: 1px solid var(--rg-line);
  display: grid;
  grid-template-columns: 26px minmax(0, 1.6fr) minmax(0, 1.2fr) 70px 90px;
  gap: 16px;
  align-items: center;
  cursor: pointer;
  transition: background 0.12s;
}
.rg-cat-row:hover { background: var(--rg-cream); }
.rg-cat-row:last-child { border-bottom: none; }
.rg-cat-row .cat-name {
  font-weight: 500;
  font-size: 13px;
  color: var(--rg-ink);
}
.rg-cat-row .cat-meta {
  font-size: 11px;
  color: var(--rg-muted);
  margin-top: 2px;
  font-family: var(--rg-font-mono);
}
.rg-cat-row .cat-amounts {
  font-family: var(--rg-font-mono);
  font-size: 12px;
  color: var(--rg-ink-2);
  text-align: right;
}
.rg-cat-row .cat-amounts .small {
  font-size: 10.5px;
  color: var(--rg-muted);
  margin-top: 2px;
}
.rg-cat-row .cat-pct {
  font-family: var(--rg-font-mono);
  font-size: 13px;
  font-weight: 600;
  text-align: right;
}

/* Progress bar inline */
.rg-track {
  height: 6px;
  background: var(--rg-line);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 6px;
}
.rg-track .fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s;
}
.rg-track .fill.ok { background: var(--rg-flag-ok); }
.rg-track .fill.warn { background: var(--rg-flag-warn); }
.rg-track .fill.alert { background: var(--rg-flag-alert); }
.rg-track .fill.over { background: var(--rg-flag-over); }

/* ========== Flag SVG container ========== */
.rg-flag {
  width: 26px;
  height: 30px;
  display: grid;
  place-items: center;
}
.rg-flag.pulse svg .triangle { animation: rg-flag-wave 2s ease-in-out infinite; transform-origin: 8px 8px; }
@keyframes rg-flag-wave {
  0%, 100% { transform: scaleX(1); }
  50% { transform: scaleX(0.92); }
}

/* ========== Alerts panel ========== */
.rg-alerts-list {
  display: flex;
  flex-direction: column;
}
.rg-alert {
  padding: 14px 20px;
  border-bottom: 1px solid var(--rg-line);
  display: flex;
  gap: 12px;
  align-items: flex-start;
  cursor: pointer;
  transition: background 0.12s;
}
.rg-alert:hover { background: var(--rg-cream); }
.rg-alert:last-child { border-bottom: none; }
.rg-alert .ic {
  width: 28px;
  height: 32px;
  flex-shrink: 0;
}
.rg-alert .body { flex: 1; min-width: 0; }
.rg-alert .title {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--rg-ink);
}
.rg-alert .desc {
  font-size: 11.5px;
  color: var(--rg-muted);
  margin-top: 2px;
  line-height: 1.4;
}
.rg-alert .meta {
  font-size: 10.5px;
  color: var(--rg-muted);
  margin-top: 6px;
  font-family: var(--rg-font-mono);
  letter-spacing: 0.04em;
}

.rg-alert-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-family: var(--rg-font-mono);
  font-weight: 600;
  letter-spacing: 0.02em;
}
.rg-alert-tag.warn { background: rgba(212, 160, 23, 0.12); color: var(--rg-flag-warn); }
.rg-alert-tag.alert { background: rgba(200, 101, 27, 0.12); color: var(--rg-flag-alert); }
.rg-alert-tag.over { background: rgba(178, 34, 34, 0.12); color: var(--rg-flag-over); }
.rg-alert-tag.ok { background: var(--rg-green-50); color: var(--rg-flag-ok); }

/* ========== Banner ========== */
.rg-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-radius: var(--rg-radius);
  background: linear-gradient(135deg, rgba(178, 34, 34, 0.04), rgba(178, 34, 34, 0.08));
  border: 1px solid rgba(178, 34, 34, 0.18);
}
.rg-banner .ic-wrap {
  width: 36px;
  height: 40px;
  flex-shrink: 0;
}
.rg-banner .body { flex: 1; }
.rg-banner .ttl {
  font-weight: 600;
  font-size: 13px;
  color: var(--rg-flag-over);
}
.rg-banner .msg { font-size: 12px; color: var(--rg-ink-2); margin-top: 2px; }
.rg-banner .actions { display: flex; gap: 8px; }

/* ========== Course chart (mini fairway) ========== */
.rg-course {
  padding: 20px;
  background: linear-gradient(180deg, #eef4ee 0%, #dde8de 100%);
  border-radius: var(--rg-radius);
  position: relative;
  height: 220px;
  overflow: hidden;
}
.rg-course svg { width: 100%; height: 100%; }

/* ========== Threshold control ========== */
.rg-threshold-card {
  padding: 18px 20px;
}
.rg-threshold-row {
  display: grid;
  grid-template-columns: 30px 1fr 64px;
  gap: 14px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px dashed var(--rg-line);
}
.rg-threshold-row:last-child { border-bottom: none; }
.rg-threshold-label {
  font-size: 12.5px;
  font-weight: 500;
}
.rg-threshold-label .desc {
  font-size: 11px;
  color: var(--rg-muted);
  font-weight: 400;
  margin-top: 2px;
}
.rg-threshold-input {
  width: 100%;
  padding: 5px 8px;
  border: 1px solid var(--rg-line-2);
  border-radius: 6px;
  font-family: var(--rg-font-mono);
  font-size: 13px;
  text-align: right;
  background: var(--rg-cream);
  outline: none;
}
.rg-threshold-input:focus { border-color: var(--rg-green-500); background: white; }

/* Slider */
.rg-slider-wrap {
  position: relative;
  height: 22px;
  display: flex;
  align-items: center;
}
.rg-slider {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: var(--rg-line);
  border-radius: 2px;
  outline: none;
}
.rg-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: white;
  border: 2px solid var(--rg-green-700);
  cursor: pointer;
  box-shadow: var(--rg-shadow-sm);
}
.rg-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: white;
  border: 2px solid var(--rg-green-700);
  cursor: pointer;
}

/* Donut */
.rg-donut-wrap {
  display: flex;
  gap: 22px;
  align-items: center;
  padding: 20px;
}

/* ========== Variation B styling overrides ========== */
.variant-light .rg-sidebar {
  background: var(--rg-cream);
  color: var(--rg-ink-2);
  border-right: 1px solid var(--rg-line);
}
.variant-light .rg-sidebar::before { display: none; }
.variant-light .rg-brand-text .name { color: var(--rg-ink); }
.variant-light .rg-brand-text .sub { color: var(--rg-muted); }
.variant-light .rg-nav-section { color: var(--rg-muted); }
.variant-light .rg-nav-item { color: var(--rg-ink-2); }
.variant-light .rg-nav-item:hover { background: rgba(0,0,0,0.04); color: var(--rg-ink); }
.variant-light .rg-nav-item.active {
  background: white;
  color: var(--rg-green-700);
  box-shadow: inset 2px 0 0 var(--rg-green-700), var(--rg-shadow-sm);
}
.variant-light .rg-sidebar-footer { border-top-color: var(--rg-line); }
.variant-light .rg-user-info .n { color: var(--rg-ink); }

.variant-light .rg-kpi.featured {
  background: var(--rg-paper);
  color: var(--rg-ink);
  border: 1px solid var(--rg-line);
}
.variant-light .rg-kpi.featured .label { color: var(--rg-muted); }
.variant-light .rg-kpi.featured .delta { color: var(--rg-muted); }
.variant-light .rg-kpi.featured .delta .pill { background: var(--rg-cream); color: var(--rg-ink-2); }
.variant-light .rg-kpi.featured .value .currency { color: var(--rg-muted); }
.variant-light .rg-budget-track { background: var(--rg-line); }
.variant-light .rg-budget-fill { background: linear-gradient(90deg, var(--rg-green-700), var(--rg-green-500)); }
.variant-light .rg-budget-meta { color: var(--rg-muted); }
.variant-light .rg-kpi.featured::after { display: none; }

/* ========== misc ========== */
.rg-row { display: flex; align-items: center; gap: 10px; }
.rg-spacer { flex: 1; }
.rg-mono { font-family: var(--rg-font-mono); }
.rg-muted { color: var(--rg-muted); }
.rg-eyebrow {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--rg-muted);
  font-weight: 500;
}

/* tooltip */
.rg-tip {
  position: absolute;
  background: var(--rg-ink);
  color: var(--rg-cream);
  padding: 5px 9px;
  border-radius: 5px;
  font-size: 11px;
  font-family: var(--rg-font-mono);
  pointer-events: none;
  white-space: nowrap;
  z-index: 100;
  transform: translate(-50%, -120%);
}

/* Sparkline */
.rg-spark { display: block; }

/* status dot */
.rg-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; }
.rg-dot.ok { background: var(--rg-flag-ok); }
.rg-dot.warn { background: var(--rg-flag-warn); }
.rg-dot.alert { background: var(--rg-flag-alert); }
.rg-dot.over { background: var(--rg-flag-over); }

/* pill */
.rg-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--rg-cream);
  font-size: 10.5px;
  font-family: var(--rg-font-mono);
  color: var(--rg-ink-2);
  font-weight: 500;
}

/* OC mini list */
.rg-oc-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 14px;
  align-items: center;
  padding: 10px 20px;
  border-bottom: 1px solid var(--rg-line);
  font-size: 12.5px;
}
.rg-oc-row:last-child { border-bottom: none; }
.rg-oc-row .folio { font-family: var(--rg-font-mono); color: var(--rg-muted); font-size: 11px; }
.rg-oc-row .vendor { font-weight: 500; }
.rg-oc-row .amount { font-family: var(--rg-font-mono); font-weight: 600; }

/* ── Animaciones API: spinner y toast ───────────────────────────────────── */
@keyframes rg-spin {
  to { transform: rotate(360deg); }
}
@keyframes rg-toast-in {
  from { opacity: 0; transform: translateX(24px); }
  to   { opacity: 1; transform: translateX(0); }
}
