@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* ─── Reset & Base ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --red:        #E11D2B;
  --red-hover:  #FF2D3D;
  --red-dim:    rgba(225, 29, 43, 0.15);
  --red-glow:   rgba(225, 29, 43, 0.35);

  --bg:         #080808;
  --surface:    #111111;
  --card:       #161616;
  --card-hover: #1D1D1D;
  --border:     #242424;
  --border-subtle: #1C1C1C;

  --white:      #FFFFFF;
  --text:       #F0F0F0;
  --text-muted: #777777;
  --text-dim:   #444444;

  --green:      #22C55E;
  --green-dim:  rgba(34, 197, 94, 0.12);
  --yellow:     #F59E0B;
  --yellow-dim: rgba(245, 158, 11, 0.12);

  --radius-sm:  6px;
  --radius:     10px;
  --radius-lg:  16px;
  --radius-xl:  24px;

  --shadow:     0 4px 24px rgba(0,0,0,0.5);
  --shadow-red: 0 0 40px rgba(225, 29, 43, 0.2);

  --sidebar-w:  240px;
  --topbar-h:   64px;

  --transition: all 0.2s ease;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; }
img { display: block; max-width: 100%; }

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: #2A2A2A; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--red); }

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

/* ─── Sidebar ─── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
  transition: var(--transition);
}

.sidebar-logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.sidebar-logo img {
  height: 32px;
  object-fit: contain;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.nav-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 12px 8px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 500;
  transition: var(--transition);
  position: relative;
}

.nav-item:hover {
  background: var(--card);
  color: var(--text);
}

.nav-item.active {
  background: var(--red-dim);
  color: var(--white);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 20px;
  background: var(--red);
  border-radius: 0 3px 3px 0;
}

.nav-item svg { flex-shrink: 0; opacity: 0.7; }
.nav-item.active svg { opacity: 1; color: var(--red); }

.sidebar-bottom {
  padding: 16px 12px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* ─── Main Content ─── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left 0.3s cubic-bezier(.4,0,.2,1);
}

/* ─── Topbar ─── */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 90;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--white);
}

.topbar-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ─── Page Content ─── */
.page {
  padding: 28px;
  flex: 1;
}

.page-header {
  margin-bottom: 28px;
}

.page-header h1 {
  font-size: 22px;
  font-weight: 800;
  color: var(--white);
  margin-bottom: 4px;
}

.page-header p {
  color: var(--text-muted);
  font-size: 13px;
}

/* ─────────────────────────────────────────
   COMPONENTES
───────────────────────────────────────── */

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--red);
  color: var(--white);
}
.btn-primary:hover {
  background: var(--red-hover);
  box-shadow: var(--shadow-red);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  background: var(--card);
  color: var(--text);
  border-color: #333;
}

.btn-surface {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-surface:hover {
  background: var(--card-hover);
  border-color: #333;
}

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-icon { padding: 9px; }

/* ─── Cards ─── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: var(--transition);
}

.card:hover {
  border-color: #2E2E2E;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--white);
}

.card-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ─── Metric Cards ─── */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.metric-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.metric-card:hover {
  border-color: #2E2E2E;
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.metric-card.featured {
  border-color: var(--red);
  background: linear-gradient(135deg, #1A0508, var(--card));
}

.metric-card.featured::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 80px; height: 80px;
  background: radial-gradient(circle at top right, var(--red-glow), transparent 70%);
}

.metric-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  background: var(--red-dim);
  color: var(--red);
}

.metric-icon.green { background: var(--green-dim); color: var(--green); }
.metric-icon.yellow { background: var(--yellow-dim); color: var(--yellow); }
.metric-icon.white { background: rgba(255,255,255,0.05); color: var(--text-muted); }

.metric-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.metric-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--white);
  line-height: 1;
  margin-bottom: 8px;
}

.metric-value.loading {
  background: #222;
  border-radius: 6px;
  color: transparent;
  animation: pulse 1.5s infinite;
}

.metric-change {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 99px;
}

.metric-change.up { background: var(--green-dim); color: var(--green); }
.metric-change.down { background: rgba(225,29,43,0.12); color: var(--red); }

/* ─── Filtros de Data ─── */
.date-filter {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px;
}

.date-filter-btn {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  transition: var(--transition);
}

.date-filter-btn:hover { color: var(--text); }
.date-filter-btn.active {
  background: var(--red);
  color: var(--white);
}

.date-range-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
}

.date-input {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 6px 10px;
  font-size: 12px;
  outline: none;
  transition: var(--transition);
}

.date-input:focus { border-color: var(--red); }

/* ─── Tabelas ─── */
.table-wrap {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
  vertical-align: middle;
}

.table tr:last-child td { border-bottom: none; }

.table tbody tr {
  transition: var(--transition);
}

.table tbody tr:hover {
  background: rgba(255,255,255,0.02);
}

/* ─── Badge ─── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
}

.badge-green { background: var(--green-dim); color: var(--green); }
.badge-red   { background: rgba(225,29,43,0.15); color: #FF4D5A; }
.badge-gray  { background: rgba(255,255,255,0.05); color: var(--text-muted); }
.badge-yellow{ background: var(--yellow-dim); color: var(--yellow); }

.badge-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ─── Forms ─── */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 11px 14px;
  font-size: 14px;
  outline: none;
  transition: var(--transition);
}

.form-input:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-dim);
}

.form-input::placeholder { color: var(--text-dim); }

.form-select {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 11px 14px;
  font-size: 14px;
  outline: none;
  transition: var(--transition);
  cursor: pointer;
  appearance: none;
}

.form-select:focus { border-color: var(--red); }

.form-hint {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 6px;
}

/* ─── Toggle ─── */
.toggle-switch {
  position: relative;
  width: 32px; height: 18px;
  display: inline-block;
  margin: 0;
  vertical-align: middle;
}

.toggle-switch input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--border);
  border-radius: 99px;
  transition: .3s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  left: 2px; bottom: 2px;
  background: var(--white);
  border-radius: 50%;
  transition: .3s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

input:checked + .toggle-slider { background-color: #0066FF; }
input:checked + .toggle-slider::before { transform: translateX(14px); }

/* ─── Alert / Toast ─── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 20px;
}

.alert-success { background: var(--green-dim); border: 1px solid rgba(34,197,94,0.2); color: var(--green); }
.alert-error   { background: var(--red-dim); border: 1px solid rgba(225,29,43,0.2); color: #FF4D5A; }
.alert-info    { background: rgba(255,255,255,0.04); border: 1px solid var(--border); color: var(--text-muted); }

.toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
}

.toast {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  font-size: 13px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 280px;
  animation: slideIn 0.3s ease;
}

.toast.success { border-left: 3px solid var(--green); }
.toast.error   { border-left: 3px solid var(--red); }

/* ─── Empty State ─── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  color: var(--text-muted);
}

.empty-state svg {
  opacity: 0.2;
  margin-bottom: 16px;
}

.empty-state h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.empty-state p { font-size: 13px; max-width: 300px; }

/* ─── Loading Skeleton ─── */
.skeleton {
  background: linear-gradient(90deg, #1A1A1A 25%, #222 50%, #1A1A1A 75%);
  background-size: 200% 100%;
  animation: skeleton-anim 1.5s infinite;
  border-radius: 6px;
}

/* ─── Divider ─── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 24px 0;
}

/* ─── Avatar ─── */
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--red-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--red);
  flex-shrink: 0;
}

/* ─── Status Indicator ─── */
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.status-dot.online { background: var(--green); box-shadow: 0 0 6px var(--green); animation: blink 2s infinite; }
.status-dot.offline { background: var(--text-dim); }

/* ─── Gráficos ─── */
.chart-container {
  position: relative;
  padding: 4px 0;
}

/* ─── UTM Builder ─── */
.utm-result {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  color: var(--text-muted);
  word-break: break-all;
  line-height: 1.8;
  min-height: 54px;
}

.utm-result span { color: var(--red); }

.utm-history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  transition: var(--transition);
}

.utm-history-item:hover { background: rgba(255,255,255,0.02); }
.utm-history-item:last-child { border-bottom: none; }

.utm-history-url {
  font-size: 12px;
  color: var(--text-muted);
  font-family: 'Courier New', monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 500px;
}

/* ─────────────────────────────────────────
   LOGIN PAGE
───────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}

.login-bg {
  position: absolute;
  inset: 0;
  background: 
    radial-gradient(ellipse 60% 50% at 50% -10%, rgba(225,29,43,0.15), transparent),
    radial-gradient(ellipse 40% 40% at 80% 80%, rgba(225,29,43,0.07), transparent);
  pointer-events: none;
}

.login-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 1;
  box-shadow: 0 24px 80px rgba(0,0,0,0.6);
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo img { height: 40px; margin: 0 auto; }

.login-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--white);
  text-align: center;
  margin-bottom: 6px;
}

.login-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 32px;
}

/* ─────────────────────────────────────────
   ANIMATIONS
───────────────────────────────────────── */
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }
@keyframes skeleton-anim { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes fadeIn  { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes blink   { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }
@keyframes spin    { to { transform: rotate(360deg); } }

.fade-in  { animation: fadeIn 0.4s ease both; }

.spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* ─────────────────────────────────────────
   RESPONSIVE
───────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .page { padding: 20px 16px; }
}

@media (max-width: 600px) {
  .metrics-grid { grid-template-columns: 1fr 1fr; }
  .login-card { padding: 32px 24px; margin: 16px; }
}

/* ─── Grids ─── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.col-2  { grid-column: span 2; }

@media (max-width: 768px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .col-2 { grid-column: span 1; }
}

/* ─── Utility ─── */
.flex   { display: flex; }
.flex-col { 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; }
.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.text-red    { color: var(--red); }
.text-green  { color: var(--green); }
.text-muted  { color: var(--text-muted); }
.text-white  { color: var(--white); }
.font-bold   { font-weight: 700; }
.font-mono   { font-family: 'Courier New', monospace; }
.text-sm     { font-size: 12px; }
.text-xs     { font-size: 11px; }
.w-full      { width: 100%; }
.hidden      { display: none !important; }

/* Global Modal Styles */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center; justify-content: center;
  z-index: 1000;
}
.modal-overlay.active { display: flex !important; }
.modal-content {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
  width: 100%;
  max-width: 460px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.5);
  position: relative;
}


/* ==================================================
   UTMify Table & Layout Redesign
   ================================================== */
   
/* TABS */
.utm-tabs {
  display: flex;
  background: #111111;
  border-bottom: 1px solid var(--border);
  border-radius: 8px 8px 0 0;
  overflow: hidden;
}
.utm-tab {
  padding: 14px 24px;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  border-right: 1px solid var(--border);
  transition: all 0.2s ease;
  background: #161821;
}
.utm-tab:hover {
  background: #1e212b;
}
.utm-tab.active {
  background: #111111;
  color: var(--white);
  border-top: 3px solid var(--primary);
  border-bottom: none;
}
.utm-tab svg { width: 16px; height: 16px; }

/* TABLE CONTAINER & SCROLL */
.utm-table-container {
  width: 100%;
  overflow-x: auto;
  background: #111111;
  border: 1px solid var(--border);
  border-radius: 0 0 8px 8px;
  border-top: none;
}
.utm-table-container table {
  width: 100%;
  min-width: 1600px;
  border-collapse: collapse;
}
.utm-table-container th {
  background: #1a1c23;
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
}
.utm-table-container td {
  padding: 12px 16px;
  font-size: 12px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.utm-table-container tr:hover td {
  background: #15171e;
}
/* Fixed left columns if needed, optional for now */

/* TOGGLE SWITCH (iOS Style) */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #4b5563;
  transition: .3s;
  border-radius: 34px;
}
.toggle-slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}
input:checked + .toggle-slider { background-color: #10B981; }
input:focus + .toggle-slider { box-shadow: 0 0 1px var(--primary); }
input:checked + .toggle-slider:before { transform: translateX(16px); }

/* EDITABLE BUDGET */
.editable-budget-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
}
.editable-budget-wrap input {
  background: transparent;
  border: 1px dashed transparent;
  color: var(--white);
  font-size: 13px;
  font-weight: 600;
  width: 70px;
  padding: 2px 4px;
  border-radius: 4px;
}
.editable-budget-wrap input:focus, .editable-budget-wrap input:hover {
  border: 1px dashed var(--border);
  outline: none;
  background: #1a1c23;
}
.budget-label {
  font-size: 10px;
  color: var(--text-muted);
  display: block;
  margin-top: 2px;
}

/* UPDATE BOX COMPACT */
.update-box {
  background: #1a1c23;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 10px;
  color: var(--text-dim);
  line-height: 1.4;
}
.update-box span { font-weight: 600; color: var(--white); }

/* SPINNER IN BUTTON */
.btn-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}
.btn-loading::after {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  width: 14px; height: 14px;
  margin: -7px 0 0 -7px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* TABLE REFRESH FADE */
.table-updating {
  opacity: 0.5;
  pointer-events: none;
}


.pencil-icon { color: var(--text-muted); margin-left: 4px; cursor: pointer; }
.editable-budget-wrap:hover .pencil-icon { color: var(--primary); }


/* BUDGET POPUP */
.budget-popup {
  position: absolute;
  background: #1e212b; /* dark blueish */
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  width: 280px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.8);
  z-index: 1000;
  transition: opacity 0.2s ease, transform 0.2s ease;
  transform-origin: top left;
}
.budget-popup.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-5px) scale(0.98);
}
.budget-popup-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}
.budget-popup-label {
  color: var(--white);
  font-size: 13px;
  font-weight: 600;
}
.budget-input-group {
  display: flex;
  align-items: center;
  background: #2a2d3a;
  border: 1px solid #2563eb; /* blue border */
  border-radius: 6px;
  padding: 8px 12px;
  flex: 1;
}
.budget-input-group span {
  color: var(--text-dim);
  font-size: 13px;
  margin-right: 4px;
}
.budget-input-group input {
  background: transparent;
  border: none;
  color: var(--white);
  font-size: 13px;
  width: 100%;
  outline: none;
}
.budget-popup-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.budget-popup-actions .btn-cancel {
  background: transparent;
  border: 1px solid #4b5563;
  color: var(--white);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 16px;
  border-radius: 6px;
  flex: 1;
  transition: all 0.2s;
}
.budget-popup-actions .btn-cancel:hover {
  background: rgba(255,255,255,0.05);
}
.budget-popup-actions .btn-save {
  background: #0066ff; /* bright blue */
  border: none;
  color: white;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  flex: 1;
  transition: all 0.2s;
}
.budget-popup-actions .btn-save:hover {
  background: #005ce6;
}
.editable-budget-wrap input { display: none; } /* hide inline input */


/* UTMIFY STYLE TABLE */
.table-wrapper {
  background: var(--bg-main);
  border-radius: 8px;
  border: 1px solid var(--border);
  overflow-x: auto;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th, .data-table td {
  padding: 12px 16px;
  font-size: 13px;
  color: var(--white);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table th {
  background: var(--bg-panel);
  text-transform: uppercase;
  font-weight: 700;
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}
.data-table tbody tr:hover {
  background: #232A3B;
}
.update-box {
  font-size: 12px;
  line-height: 1.6;
}
.update-box span {
  font-weight: 600;
}
.editable-budget-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.pencil-icon {
  cursor: pointer;
  color: var(--text-muted);
  transition: color 0.2s;
}
.pencil-icon:hover {
  color: var(--white);
}
.budget-label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
