:root {
  --color-bg:       #0f1117;
  --color-surface:  #1a1d27;
  --color-border:   #2a2d3e;
  --color-accent:   #7c6ef5;
  --color-accent2:  #5b8df5;
  --color-text:     #e2e4f0;
  --color-muted:    #8b8fa8;
  --color-success:  #4caf82;
  --color-warning:  #f5a623;
  --color-danger:   #f55b5b;
  --radius:         10px;
  --radius-sm:      6px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.5;
}

/* ── Layout ─────────────────────────── */
.app-layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1rem;
  position: fixed;
  height: 100vh;
  top: 0; left: 0;
  z-index: 100;
}

.sidebar-logo {
  padding: 0.25rem 0.5rem 1.25rem;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 1.5rem;
}
.sidebar-logo img {
  width: 100%;
  max-width: 150px;
  display: block;
  opacity: 0.92;
}

.sidebar-nav { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 0.25rem; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--color-border) transparent; }

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--color-muted);
  text-decoration: none;
  font-size: 0.9rem;
  transition: all 0.15s;
}
.sidebar-link:hover, .sidebar-link.active {
  background: rgba(124,110,245,0.12);
  color: var(--color-text);
}
.sidebar-link.active { color: var(--color-accent); }

/* Sub-items bajo Centro de costos */
.sidebar-sublink {
  padding-left: 1.85rem;
  font-size: 0.85rem;
  color: var(--color-muted);
}
.sidebar-sublink::before {
  content: '└ ';
  font-size: 0.7rem;
  opacity: 0.5;
}

.sidebar-bottom {
  border-top: 1px solid var(--color-border);
  padding-top: 1rem;
  font-size: 0.8rem;
  color: var(--color-muted);
}
.sidebar-user { font-weight: 600; color: var(--color-text); margin-bottom: 0.25rem; }

.main-content {
  margin-left: 220px;
  padding: 2rem;
  flex: 1;
  max-width: 1200px;
}

/* ── Cards ──────────────────────────── */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.card-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--color-text);
}

/* ── Formularios ────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--color-muted);
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 0.6rem 0.85rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--color-accent);
}
.form-textarea { resize: vertical; min-height: 80px; }

/* ── Botones ────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: opacity 0.15s, transform 0.1s;
  text-decoration: none;
}
.btn:active { transform: scale(0.97); }
.btn-primary  { background: var(--color-accent);  color: #fff; }
.btn-secondary{ background: var(--color-border);  color: var(--color-text); }
.btn-success  { background: var(--color-success);  color: #fff; }
.btn-danger   { background: var(--color-danger);   color: #fff; }
.btn-sm       { padding: 0.35rem 0.75rem; font-size: 0.82rem; }
.btn:hover    { opacity: 0.88; }

/* ── Tabla ──────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.7rem 1rem; text-align: left; border-bottom: 1px solid var(--color-border); }
th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-muted); }
td { font-size: 0.9rem; }
tr:hover td { background: rgba(255,255,255,0.02); }

/* ── Badges ─────────────────────────── */
.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-borrador      { background: rgba(139,143,168,0.2); color: var(--color-muted); }
.badge-enviado       { background: rgba(91,141,245,0.2);  color: var(--color-accent2); }
.badge-en_negociacion{ background: rgba(245,166,35,0.2);  color: var(--color-warning); }
.badge-confirmado    { background: rgba(76,175,130,0.2);  color: var(--color-success); }
.badge-cancelado     { background: rgba(245,91,91,0.2);   color: var(--color-danger); }

/* ── Page header ────────────────────── */
.page-header { margin-bottom: 1.5rem; display: flex; align-items: center; justify-content: space-between; }
.page-title  { font-size: 1.4rem; font-weight: 700; }

/* ── Stats strip ────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 1.25rem; }
.stat-label { font-size: 0.78rem; color: var(--color-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.stat-value { font-size: 1.6rem; font-weight: 700; margin-top: 0.25rem; }

/* ── Alerts ─────────────────────────── */
.alert { padding: 0.75rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; font-size: 0.9rem; }
.alert-error   { background: rgba(245,91,91,0.15);  border: 1px solid rgba(245,91,91,0.3);  color: #f88; }
.alert-success { background: rgba(76,175,130,0.15); border: 1px solid rgba(76,175,130,0.3); color: #6ee; }

/* ── Responsive ─────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .main-content { margin-left: 0; padding: 1rem; }
}
