/* =========================================================================
   Sexto Abismo · Mini CRM — Hoja de estilos
   Modern · clean · sans-only. Tokens configurables vía CSS variables.
   ========================================================================= */

/* --- 1. TOKENS ---------------------------------------------------------- */
:root {
  /* Brand — Sexto Abismo (default · azul) */
  --color-primary:        #2563eb;            /* blue-600, base */
  --color-primary-50:     #eff6ff;
  --color-primary-100:    #dbeafe;
  --color-primary-200:    #bfdbfe;
  --color-primary-300:    #93c5fd;
  --color-primary-400:    #60a5fa;
  --color-primary-500:    #3b82f6;
  --color-primary-600:    #2563eb;            /* base */
  --color-primary-700:    #1d4ed8;            /* hover / dark */
  --color-primary-800:    #1e40af;
  --color-primary-900:    #1e3a8a;
  --color-primary-950:    #172554;
  --color-primary-soft:   #eff6ff;            /* light tint for fills */
  --color-primary-dark:   #1d4ed8;

  --color-accent:         #0a0a0a;            /* near-black sidebar */
  --color-accent-soft:    #18181b;

  /* Surfaces — pure white */
  --color-bg:             #ffffff;            /* app bg */
  --color-bg-elev:        #fafafa;            /* elevated areas, hover, subtle wash */
  --color-surface:        #ffffff;            /* cards */
  --color-paper:          #ffffff;
  --color-tint:           #f4f4f5;            /* subtle dividers */

  /* Ink (zinc-ish) */
  --color-text:           #09090b;
  --color-text-muted:     #71717a;
  --color-text-soft:      #a1a1aa;
  --color-text-invert:    #fafafa;

  /* Borders — very subtle */
  --color-border:         #ececec;
  --color-border-strong:  #e4e4e7;
  --color-border-soft:    #f4f4f5;

  /* Semánticos (refined, less saturated) */
  --color-success:        #15803d;
  --color-success-bg:     #f0fdf4;
  --color-success-fg:     #14532d;
  --color-warning:        #b45309;
  --color-warning-bg:     #fffbeb;
  --color-warning-fg:     #78350f;
  --color-danger:         #b91c1c;
  --color-danger-bg:      #fef2f2;
  --color-danger-fg:      #7f1d1d;
  --color-info:           #0e7490;          /* cyan-700 (para no chocar con primary azul) */
  --color-info-bg:        #ecfeff;
  --color-info-fg:        #155e75;
  --color-neutral:        #52525b;
  --color-neutral-bg:     #f4f4f5;
  --color-neutral-fg:     #27272a;

  /* Type */
  --font-sans:   'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:   'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --font-display: 'Geist', sans-serif;        /* keep one family; use weight + tracking */

  /* Sizes */
  --text-xs:    11px;
  --text-sm:    12px;
  --text-base:  13px;
  --text-md:    14px;
  --text-lg:    16px;
  --text-xl:    18px;
  --text-2xl:   22px;
  --text-3xl:   28px;
  --text-4xl:   36px;
  --text-5xl:   48px;
  --text-6xl:   64px;

  /* Spacing */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-7: 32px;
  --sp-8: 40px;
  --sp-9: 56px;
  --sp-10: 72px;
  --sp-11: 96px;

  /* Radii — consistent */
  --radius-xs:  3px;
  --radius-sm:  5px;
  --radius:     7px;
  --radius-md:  10px;
  --radius-lg:  14px;
  --radius-pill: 999px;

  /* Shadows — almost none; rely on borders */
  --shadow-xs: 0 1px 0 rgba(0,0,0,0.02);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.05);
  --shadow-lg: 0 16px 40px rgba(0,0,0,0.08);

  /* Layout */
  --sidebar-w: 232px;
  --header-h:  56px;
  --subnav-h:  44px;
  --container-max: 1320px;
}

/* --- 2. RESET / BASE ---------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  font-size: var(--text-md);
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.5;
  font-feature-settings: "cv11", "ss01";
  letter-spacing: -0.005em;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--color-text); text-decoration: none; }
a:hover { color: var(--color-primary); }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
h1, h2, h3, h4, h5 { margin: 0; font-weight: 600; line-height: 1.15; letter-spacing: -0.022em; }
p { margin: 0; }
hr { border: 0; border-top: 1px solid var(--color-border); margin: 0; }

/* --- 3. TYPE SCALE ----------------------------------------------------- */
.t-display {
  font-size: var(--text-5xl);
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: -0.035em;
}
.t-h1 {
  font-size: var(--text-3xl);
  font-weight: 600;
  letter-spacing: -0.028em;
  line-height: 1.1;
}
.t-h2 {
  font-size: var(--text-2xl);
  font-weight: 600;
  letter-spacing: -0.022em;
}
.t-h3 {
  font-size: var(--text-lg);
  font-weight: 600;
  letter-spacing: -0.015em;
}
.t-h4 {
  font-size: var(--text-md);
  font-weight: 600;
  letter-spacing: -0.01em;
}
.t-eyebrow {
  font-size: var(--text-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
}
.t-meta { font-size: var(--text-sm); color: var(--color-text-muted); }
.t-mono { font-family: var(--font-mono); font-feature-settings: "tnum"; }
.t-num  { font-feature-settings: "tnum"; font-variant-numeric: tabular-nums; }

/* --- 4. ICONS ---------------------------------------------------------- */
.icon {
  display: inline-block;
  width: 16px; height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
  vertical-align: -3px;
}
.icon--sm { width: 13px; height: 13px; }
.icon--lg { width: 20px; height: 20px; }
.icon--xl { width: 24px; height: 24px; }

/* --- 5. APP LAYOUT ----------------------------------------------------- */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}
.app-sidebar {
  background: var(--color-accent);
  color: var(--color-text-invert);
  padding: var(--sp-5) 0 var(--sp-4);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto;
}
.app-sidebar__brand {
  display: flex; align-items: center; gap: 10px;
  padding: 0 var(--sp-5) var(--sp-6);
  margin-bottom: var(--sp-4);
}
.app-sidebar__brand-mark { width: 22px; height: 22px; flex-shrink: 0; }
.app-sidebar__brand-name {
  font-size: var(--text-md);
  font-weight: 600;
  letter-spacing: -0.012em;
  line-height: 1;
  white-space: nowrap;
}
.app-sidebar__brand-sub {
  font-size: 10px;
  color: rgba(250,250,250,0.45);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 4px;
  font-weight: 500;
}
.app-sidebar__section {
  padding: var(--sp-3) var(--sp-5) var(--sp-2);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(250,250,250,0.4);
  font-weight: 500;
}
.app-nav { display: flex; flex-direction: column; gap: 1px; padding: 0 var(--sp-3); }
.app-nav__item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  color: rgba(250,250,250,0.65);
  font-size: var(--text-md);
  font-weight: 500;
  position: relative;
  letter-spacing: -0.01em;
}
.app-nav__item:hover { background: rgba(255,255,255,0.05); color: var(--color-text-invert); }
.app-nav__item.is-active {
  background: rgba(255,255,255,0.08);
  color: var(--color-text-invert);
}
.app-nav__item .icon { width: 15px; height: 15px; opacity: 0.85; }
.app-nav__badge {
  margin-left: auto;
  font-size: 9px;
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: rgba(250,250,250,0.4);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
  border: 1px solid rgba(255,255,255,0.08);
}
.app-sidebar__foot {
  margin-top: auto;
  padding: var(--sp-3) var(--sp-3) 0;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.app-user {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
}
.app-user:hover { background: rgba(255,255,255,0.05); }
.app-user__avatar {
  width: 26px; height: 26px;
  border-radius: var(--radius-pill);
  background: var(--color-primary-700);
  color: white;
  display: grid; place-items: center;
  font-weight: 600; font-size: 10px;
  flex-shrink: 0;
  letter-spacing: -0.01em;
}
.app-user__name { font-size: var(--text-sm); color: var(--color-text-invert); line-height: 1.2; font-weight: 500; }
.app-user__role { font-size: 10px; color: rgba(250,250,250,0.45); }

.app-main { display: flex; flex-direction: column; min-width: 0; }
.app-header {
  height: var(--header-h);
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  padding: 0 var(--sp-7);
  display: flex; align-items: center; gap: var(--sp-4);
  position: sticky; top: 0; z-index: 10;
}
.app-header__crumbs {
  display: flex; align-items: center; gap: 6px;
  font-size: var(--text-sm); color: var(--color-text-muted);
}
.app-header__crumbs .icon { width: 11px; height: 11px; opacity: 0.55; }
.app-header__crumbs strong { color: var(--color-text); font-weight: 500; }
.app-header__crumbs a { color: var(--color-text-muted); }
.app-header__spacer { flex: 1; }
.app-header__search {
  position: relative;
  width: 300px;
  max-width: 36%;
}
.app-header__search input {
  width: 100%;
  height: 32px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0 var(--sp-3) 0 32px;
  font-size: var(--text-sm);
  color: var(--color-text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.app-header__search input:focus {
  border-color: var(--color-text);
  box-shadow: 0 0 0 3px var(--color-tint);
}
.app-header__search .icon {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  color: var(--color-text-soft); pointer-events: none;
  width: 13px; height: 13px;
}
.app-header__kbd {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  font-family: var(--font-mono); font-size: 10px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  padding: 1px 5px;
  border-radius: var(--radius-xs);
  color: var(--color-text-soft);
  pointer-events: none;
}
.app-header__icon-btn {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  border-radius: var(--radius);
  color: var(--color-text-muted);
  position: relative;
}
.app-header__icon-btn:hover { color: var(--color-text); border-color: var(--color-border-strong); }
.app-header__icon-btn .dot {
  position: absolute; top: 7px; right: 7px;
  width: 6px; height: 6px;
  background: var(--color-primary); border-radius: var(--radius-pill);
  border: 2px solid var(--color-surface);
}

/* --- 6. PAGE / SECTIONS ------------------------------------------------ */
.page {
  padding: var(--sp-7) var(--sp-8) var(--sp-10);
  max-width: var(--container-max);
  margin: 0 auto;
  width: 100%;
}
.page--narrow { max-width: 880px; }
.page__header {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: var(--sp-6); margin-bottom: var(--sp-7);
}
.page__title {
  font-size: var(--text-3xl);
  font-weight: 600;
  letter-spacing: -0.028em;
  line-height: 1.1;
}
.page__sub {
  color: var(--color-text-muted);
  font-size: var(--text-md);
  margin-top: 8px;
  letter-spacing: -0.005em;
}
.page__actions { display: flex; gap: 8px; align-items: center; }

.subnav {
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg);
  padding: 0 var(--sp-8);
  display: flex; gap: var(--sp-5);
  height: var(--subnav-h);
  align-items: center;
}
.subnav__item {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  height: var(--subnav-h);
  display: flex; align-items: center; gap: 6px;
  position: relative;
  font-weight: 500;
}
.subnav__item:hover { color: var(--color-text); }
.subnav__item.is-active { color: var(--color-text); }
.subnav__item.is-active::after {
  content: ''; position: absolute; bottom: -1px; left: 0; right: 0; height: 1.5px;
  background: var(--color-text);
}
.subnav__count {
  font-size: 10px;
  color: var(--color-text-soft);
  background: var(--color-tint);
  padding: 1px 5px;
  border-radius: var(--radius-xs);
  font-weight: 500;
}
.subnav__item.is-active .subnav__count { background: var(--color-text); color: white; }

/* --- 7. BUTTONS -------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 12px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: var(--text-sm);
  font-weight: 500;
  background: transparent;
  color: var(--color-text);
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
  white-space: nowrap;
  text-decoration: none !important;
  letter-spacing: -0.005em;
}
.btn .icon { width: 13px; height: 13px; }

.btn--primary {
  background: var(--color-text);
  color: var(--color-bg);
  border-color: var(--color-text);
}
.btn--primary:hover { background: #000; color: white; }

.btn--accent {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}
.btn--accent:hover { background: var(--color-primary-dark); border-color: var(--color-primary-dark); }

.btn--secondary {
  background: var(--color-surface);
  border-color: var(--color-border-strong);
  color: var(--color-text);
}
.btn--secondary:hover { background: var(--color-tint); border-color: var(--color-border-strong); }

.btn--ghost {
  background: transparent;
  color: var(--color-text-muted);
  border-color: transparent;
}
.btn--ghost:hover { background: var(--color-tint); color: var(--color-text); }

.btn--danger {
  background: var(--color-surface);
  border-color: var(--color-border);
  color: var(--color-danger);
}
.btn--danger:hover { background: var(--color-danger-bg); border-color: var(--color-danger); }

.btn--sm { height: 26px; padding: 0 10px; font-size: var(--text-xs); }
.btn--lg { height: 38px; padding: 0 16px; font-size: var(--text-md); }
.btn--icon { width: 28px; padding: 0; }
.btn--block { width: 100%; }

/* --- 8. BADGES --------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  height: 20px;
  padding: 0 7px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: -0.005em;
  border-radius: var(--radius-xs);
  background: var(--color-neutral-bg);
  color: var(--color-neutral-fg);
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge .dot { width: 5px; height: 5px; border-radius: var(--radius-pill); background: currentColor; opacity: 0.85; }

.badge--ok       { background: var(--color-success-bg); color: var(--color-success-fg); }
.badge--warn     { background: var(--color-warning-bg); color: var(--color-warning-fg); }
.badge--danger   { background: var(--color-danger-bg);  color: var(--color-danger-fg); }
.badge--info     { background: var(--color-info-bg);    color: var(--color-info-fg); }
.badge--soft     { background: var(--color-primary-soft); color: var(--color-primary-800); }
.badge--neutral  { background: var(--color-neutral-bg); color: var(--color-neutral-fg); }
.badge--outline  { background: transparent; border-color: var(--color-border-strong); color: var(--color-text-muted); }
.badge--solid    { background: var(--color-text); color: white; }

/* Cotización states */
.badge--borrador  { background: var(--color-neutral-bg); color: #52525b; }
.badge--enviada   { background: var(--color-info-bg);    color: var(--color-info-fg); }
.badge--aceptada  { background: var(--color-success-bg); color: var(--color-success-fg); }
.badge--rechazada { background: var(--color-danger-bg);  color: var(--color-danger-fg); }
.badge--expirada  { background: var(--color-neutral-bg); color: #71717a; }

/* Pedido states */
.badge--preparado { background: var(--color-neutral-bg); color: #52525b; }
.badge--enviado   { background: var(--color-info-bg);    color: var(--color-info-fg); }
.badge--entregado { background: var(--color-success-bg); color: var(--color-success-fg); }
.badge--cobrado   { background: var(--color-warning-bg); color: var(--color-warning-fg); }
.badge--cancelado { background: var(--color-danger-bg);  color: var(--color-danger-fg); }

/* --- 9. CARDS ---------------------------------------------------------- */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}
.card__head {
  padding: 14px var(--sp-5);
  border-bottom: 1px solid var(--color-border);
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-3);
}
.card__title {
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: -0.005em;
}
.card__head-actions { display: flex; gap: 6px; align-items: center; }
.card__body { padding: var(--sp-5); }
.card__foot {
  padding: 12px var(--sp-5);
  border-top: 1px solid var(--color-border);
  font-size: var(--text-sm); color: var(--color-text-muted);
  display: flex; align-items: center; justify-content: space-between;
}

/* KPI cards */
.kpi {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--sp-5);
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.kpi__label {
  display: flex; align-items: center; justify-content: space-between;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  font-weight: 500;
  letter-spacing: -0.005em;
}
.kpi__label .icon { width: 14px; height: 14px; color: var(--color-text-soft); }
.kpi__value {
  font-size: 30px;
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.035em;
  margin: 8px 0 4px;
  color: var(--color-text);
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.kpi__value small {
  font-size: 13px;
  color: var(--color-text-soft);
  font-weight: 500;
  margin-left: 3px;
  letter-spacing: -0.005em;
}
.kpi__delta {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 11px;
  font-weight: 500;
  padding: 1px 5px;
  border-radius: var(--radius-xs);
  background: var(--color-success-bg);
  color: var(--color-success-fg);
}
.kpi__delta--down { background: var(--color-danger-bg); color: var(--color-danger-fg); }
.kpi__delta--flat { background: var(--color-neutral-bg); color: var(--color-text-muted); }
.kpi__delta .icon { width: 11px; height: 11px; stroke-width: 2; }
.kpi__meta {
  font-size: 11px;
  color: var(--color-text-soft);
}
.kpi__spark {
  margin-top: 8px;
  width: 100%;
  height: 28px;
  opacity: 0.9;
}

/* --- 10. TABLES -------------------------------------------------------- */
.table-wrap {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
.table th {
  text-align: left;
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-soft);
  padding: 10px var(--sp-4);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg);
  white-space: nowrap;
}
.table td {
  padding: 12px var(--sp-4);
  border-bottom: 1px solid var(--color-border-soft);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--color-bg); }
.table .table__num { text-align: right; font-feature-settings: "tnum"; font-variant-numeric: tabular-nums; }
.table .table__actions { text-align: right; white-space: nowrap; }
.table .table__id {
  font-family: var(--font-mono); font-size: 11px;
  color: var(--color-text-muted); letter-spacing: 0;
}
.table .table__primary { color: var(--color-text); font-weight: 500; }
.table .table__sub { font-size: 11px; color: var(--color-text-soft); margin-top: 2px; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 26px; height: 26px;
  border-radius: var(--radius-sm);
  color: var(--color-text-soft);
  background: transparent;
  border: 0;
}
.icon-btn:hover { background: var(--color-tint); color: var(--color-text); }
.icon-btn--danger:hover { background: var(--color-danger-bg); color: var(--color-danger); }

/* --- 11. TOOLBARS ----------------------------------------------------- */
.toolbar {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: var(--sp-5);
}
.toolbar__search {
  position: relative; flex: 1; max-width: 320px;
}
.toolbar__search input {
  width: 100%; height: 32px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 0 12px 0 32px;
  font-size: var(--text-sm); outline: none;
}
.toolbar__search input:focus { border-color: var(--color-text); }
.toolbar__search .icon {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  color: var(--color-text-soft); width: 13px; height: 13px;
}
.select {
  height: 32px; padding: 0 28px 0 10px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  border-radius: var(--radius);
  font-size: var(--text-sm); color: var(--color-text);
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 8px center;
  font-weight: 500;
  letter-spacing: -0.005em;
}
.toolbar__spacer { flex: 1; }

/* --- 12. KANBAN -------------------------------------------------------- */
.kanban {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  min-height: 70vh;
}
.kanban__col {
  background: var(--color-bg-elev);
  border-radius: var(--radius-md);
  display: flex; flex-direction: column;
  min-width: 0;
}
.kanban__col-head {
  display: flex; align-items: center; gap: 8px;
  padding: 12px var(--sp-4);
}
.kanban__col-dot { width: 6px; height: 6px; border-radius: var(--radius-pill); flex-shrink: 0; }
.kanban__col-title { font-size: var(--text-sm); font-weight: 600; flex: 1; letter-spacing: -0.005em; }
.kanban__col-count {
  font-size: 10px;
  color: var(--color-text-muted);
  background: var(--color-surface);
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--color-border);
  font-weight: 500;
}
.kanban__col-add {
  width: 22px; height: 22px;
  display: grid; place-items: center;
  border: 0; background: transparent;
  color: var(--color-text-soft);
  border-radius: var(--radius-sm);
}
.kanban__col-add:hover { background: var(--color-surface); color: var(--color-text); }
.kanban__col-body {
  padding: 0 8px 8px;
  display: flex; flex-direction: column; gap: 6px;
  flex: 1;
  overflow-y: auto;
}
.kanban-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 10px 12px;
  cursor: grab;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.kanban-card:hover { border-color: var(--color-border-strong); box-shadow: var(--shadow-sm); }
.kanban-card__top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 6px;
  gap: 8px;
}
.kanban-card__id {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--color-text-soft);
}
.kanban-card__pri {
  width: 6px; height: 6px; border-radius: var(--radius-pill); background: var(--color-text-soft);
}
.kanban-card__pri--alta { background: var(--color-danger); }
.kanban-card__pri--media { background: var(--color-warning); }
.kanban-card__pri--baja { background: var(--color-text-soft); }
.kanban-card__title {
  font-size: var(--text-sm);
  color: var(--color-text);
  font-weight: 500;
  line-height: 1.3;
  margin-bottom: 4px;
  letter-spacing: -0.005em;
}
.kanban-card__sub {
  font-size: 11px;
  color: var(--color-text-muted);
  margin-bottom: 8px;
}
.kanban-card__foot {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11px;
  color: var(--color-text-soft);
}
.kanban-card__date { display: inline-flex; align-items: center; gap: 4px; }
.kanban-card__date .icon { width: 11px; height: 11px; }
.kanban-card__avatar {
  width: 20px; height: 20px;
  border-radius: var(--radius-pill);
  background: var(--color-neutral-bg);
  color: var(--color-neutral-fg);
  display: grid; place-items: center;
  font-size: 9px; font-weight: 600;
}
.kanban-card__amount {
  font-feature-settings: "tnum";
  font-weight: 600;
  color: var(--color-text);
  font-size: 11px;
}

/* --- 13. FORMS -------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field__label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text);
  letter-spacing: -0.005em;
}
.field__input,
.field input[type="text"],
.field input[type="email"],
.field input[type="number"],
.field input[type="password"],
.field input[type="date"],
.field textarea,
.field select {
  width: 100%;
  height: 34px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0 10px;
  font-size: var(--text-sm); color: var(--color-text);
  outline: none; transition: border-color 0.12s, box-shadow 0.12s;
}
.field textarea { height: auto; min-height: 88px; padding: 8px 10px; resize: vertical; line-height: 1.5; }
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--color-text);
  box-shadow: 0 0 0 3px var(--color-tint);
}
.field__hint { font-size: 11px; color: var(--color-text-soft); }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); }
.field-row--3 { grid-template-columns: 1fr 1fr 1fr; }

.form-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--sp-6);
  display: flex; flex-direction: column; gap: var(--sp-5);
}
.form-card__actions {
  display: flex; justify-content: flex-end; gap: 8px;
  padding-top: var(--sp-4);
  border-top: 1px solid var(--color-border);
}

/* --- 14. AVATAR ------------------------------------------------------- */
.avatar {
  width: 24px; height: 24px;
  border-radius: var(--radius-pill);
  background: var(--color-neutral-bg);
  color: var(--color-neutral-fg);
  display: inline-grid; place-items: center;
  font-size: 9px; font-weight: 600;
  flex-shrink: 0;
  letter-spacing: -0.01em;
}
.avatar--lg { width: 40px; height: 40px; font-size: 13px; }
.avatar--xl { width: 64px; height: 64px; font-size: 20px; }
.avatar--stack { box-shadow: 0 0 0 2px var(--color-surface); }
.avatar-group { display: inline-flex; }
.avatar-group .avatar + .avatar { margin-left: -6px; }

/* --- 15. EMPTY STATES ------------------------------------------------- */
.empty {
  text-align: center;
  padding: var(--sp-10) var(--sp-6);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}
.empty__art {
  width: 96px; height: 96px;
  margin: 0 auto var(--sp-5);
  color: var(--color-border-strong);
}
.empty__title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-text);
  letter-spacing: -0.018em;
  margin-bottom: 6px;
}
.empty__text { font-size: var(--text-sm); color: var(--color-text-muted); max-width: 360px; margin: 0 auto var(--sp-5); }

/* --- 16. ALERTS ------------------------------------------------------- */
.alert {
  display: flex; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid;
  font-size: var(--text-sm);
  align-items: flex-start;
}
.alert .icon { flex-shrink: 0; margin-top: 1px; }
.alert--info    { background: var(--color-info-bg);    color: var(--color-info-fg);    border-color: #dbeafe; }
.alert--success { background: var(--color-success-bg); color: var(--color-success-fg); border-color: #dcfce7; }
.alert--warn    { background: var(--color-warning-bg); color: var(--color-warning-fg); border-color: #fef3c7; }
.alert--danger  { background: var(--color-danger-bg);  color: var(--color-danger-fg);  border-color: #fee2e2; }

/* --- 17. UTILS --------------------------------------------------------- */
.grid { display: grid; gap: var(--sp-4); }
.grid--2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.grid--12 { grid-template-columns: repeat(12, minmax(0,1fr)); }
.col-4 { grid-column: span 4; }
.col-5 { grid-column: span 5; }
.col-6 { grid-column: span 6; }
.col-7 { grid-column: span 7; }
.col-8 { grid-column: span 8; }
.col-12 { grid-column: span 12; }

.row { display: flex; align-items: center; gap: 8px; }
.row--between { justify-content: space-between; }
.row--end { justify-content: flex-end; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.stack--lg { gap: var(--sp-5); }

.muted { color: var(--color-text-muted); }
.soft { color: var(--color-text-soft); }
.text-num { font-feature-settings: "tnum"; font-variant-numeric: tabular-nums; }

.divider { height: 1px; background: var(--color-border); margin: var(--sp-5) 0; }
.dot-sep { display: inline-block; width: 2px; height: 2px; border-radius: 50%; background: var(--color-text-soft); margin: 0 8px; vertical-align: middle; }

/* --- 18. BRAND MARK ---------------------------------------------------- */
.brand-mark { display: inline-flex; align-items: center; gap: 10px; }
.brand-mark__logo {
  width: 26px; height: 26px;
  flex-shrink: 0;
}
.brand-mark__name {
  font-size: var(--text-md);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1;
}
.brand-mark__tag {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-soft);
  font-weight: 500;
  margin-top: 4px;
}

/* --- 19. RESPONSIVE --------------------------------------------------- */
@media (max-width: 1100px) {
  .grid--4 { grid-template-columns: repeat(2, 1fr); }
  .grid--12 .col-7,
  .grid--12 .col-8 { grid-column: span 12; }
  .grid--12 .col-5,
  .grid--12 .col-4 { grid-column: span 12; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .app-sidebar { display: none; }
  .kanban { grid-template-columns: 1fr; }
  .page { padding: var(--sp-5) var(--sp-4); }
  .page__header { flex-direction: column; align-items: flex-start; }
}

/* =========================================================================
   20. COMPAT — clases legadas que aún consumen las vistas existentes.
   ========================================================================= */

/* placeholder (legado) → empty-style */
.placeholder {
  text-align: center;
  padding: var(--sp-10) var(--sp-6);
  background: var(--color-surface);
  border: 1px dashed var(--color-border-strong);
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
}
.placeholder h2 {
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--sp-2);
  letter-spacing: -0.02em;
}

/* field__error / field--check / field__label small */
.field__error { font-size: var(--text-xs); color: var(--color-danger); margin-top: 4px; }
.field__label small { color: var(--color-text-soft); font-weight: 400; text-transform: none; letter-spacing: 0; }
.field--check { flex-direction: row; align-items: center; gap: var(--sp-2); }
.field--check input { width: 16px; height: 16px; }
.field--check span { font-size: var(--text-sm); }
.field__color {
  width: 100%; height: 36px;
  padding: 4px; border: 1px solid var(--color-border-strong);
  border-radius: var(--radius); background: var(--color-surface); cursor: pointer;
}

/* page header legado */
.page__header--row { display: flex; align-items: flex-start; justify-content: space-between; }
.page__subtitle { color: var(--color-text-muted); font-size: var(--text-md); margin-top: 4px; }
.table__actions-col { text-align: right; }

/* section-tabs (sub-nav del módulo Ventas) */
.section-tabs {
  display: flex; flex-wrap: wrap; gap: var(--sp-4);
  margin-bottom: var(--sp-6);
  border-bottom: 1px solid var(--color-border);
}
.section-tabs__item {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-3) 0;
  color: var(--color-text-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-size: var(--text-sm); font-weight: 500;
}
.section-tabs__item:hover { color: var(--color-text); }
.section-tabs__item--active { color: var(--color-primary); border-bottom-color: var(--color-primary); }
.section-tabs__item--disabled { color: var(--color-text-soft); cursor: default; }
.app-nav__soon {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em;
  background: var(--color-tint); color: var(--color-text-soft);
  padding: 1px 7px; border-radius: var(--radius-pill);
}

/* Settings (configuración) */
.settings-section {
  font-size: var(--text-md); font-weight: 600;
  margin: var(--sp-6) 0 var(--sp-3);
  padding-bottom: var(--sp-2);
  border-bottom: 1px solid var(--color-border);
  letter-spacing: -0.012em;
}
.settings-section:first-of-type { margin-top: 0; }
.settings-note {
  font-size: var(--text-sm); color: var(--color-text-soft);
  margin: calc(var(--sp-2) * -1) 0 var(--sp-3);
}
.logo-field { display: flex; align-items: center; gap: var(--sp-4); }
.logo-field__preview {
  width: 84px; height: 84px; flex-shrink: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg-elev);
  display: grid; place-items: center;
  overflow: hidden;
}
.logo-field__preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-field__default {
  width: 100%; height: 100%;
  background: var(--color-accent); color: var(--color-text-invert);
  display: grid; place-items: center;
  font-size: 2.4rem; font-weight: 600;
  letter-spacing: -0.02em;
}
.logo-field__controls { flex: 1; min-width: 0; }
.logo-field__controls input[type="file"] { font-size: var(--text-xs); max-width: 100%; }
.logo-field__state { margin: 0 0 var(--sp-2); }
.logo-field__hint { margin: var(--sp-2) 0 0; font-size: var(--text-xs); color: var(--color-text-soft); }

/* Tabla de partidas (items) — cotizaciones / pedidos */
.items-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: var(--sp-4);
}
.items-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.items-table thead th {
  text-align: left;
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--text-xs);
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--color-text-muted);
  background: var(--color-bg-elev);
  border-bottom: 1px solid var(--color-border);
}
.items-table tbody td {
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--color-border-soft);
  vertical-align: middle;
}
.items-table tbody tr:last-child td { border-bottom: none; }
.items-col-num     { text-align: right; width: 8rem; }
.items-col-actions { width: 2.5rem; text-align: center; }
.items-table .item-producto,
.items-table .item-desc,
.items-table .item-qty,
.items-table .item-price {
  width: 100%; padding: 7px 10px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius); background: var(--color-surface);
  font-size: var(--text-sm);
}
.items-table .item-desc { margin-top: 6px; }
.items-table .item-qty, .items-table .item-price { text-align: right; font-feature-settings: "tnum"; }
.items-table .item-subtotal { text-align: right; font-feature-settings: "tnum"; }
.items-table .item-remove { padding: 2px 8px; line-height: 1; font-size: 1.1rem; color: var(--color-danger); }
.items-table tfoot td {
  padding: 8px 16px;
  border-top: 1px solid var(--color-border);
  font-feature-settings: "tnum";
}
.items-tfoot-label  { text-align: right; color: var(--color-text-muted); }
.items-tfoot-amount { text-align: right; }
.items-tfoot-total td { background: var(--color-bg-elev); font-size: var(--text-md); }
.items-card__actions {
  padding: 10px 16px;
  border-top: 1px solid var(--color-border);
  background: var(--color-bg-elev);
}

/* form-card legado */
.form-card textarea {
  width: 100%; min-height: 88px;
  padding: 10px 12px; resize: vertical;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius);
  background: var(--color-surface);
  font-family: inherit; font-size: var(--text-sm);
  outline: none;
}
.form-card textarea:focus {
  border-color: var(--color-text);
  box-shadow: 0 0 0 3px var(--color-tint);
}

/* brand logo (img uploaded) */
.brand-logo {
  height: 32px; width: auto; max-width: 150px;
  border-radius: var(--radius-sm); object-fit: contain; display: block;
}
.brand-logo--auth { height: 48px; max-width: 180px; }

/* AUTH shell (login / forgot / reset) */
.auth-body {
  min-height: 100vh;
  display: grid; place-items: center;
  background: var(--color-bg-elev);
  padding: 2rem 1rem;
}
.auth-shell { width: 100%; max-width: 420px; display: grid; gap: var(--sp-5); }
.auth-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: var(--sp-7);
}
.auth-brand { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-6); }
.auth-logo {
  width: 40px; height: 40px;
  border-radius: var(--radius);
  background: var(--color-accent);
  color: var(--color-text-invert);
  display: grid; place-items: center;
  font-size: 1.2rem; font-weight: 600;
  letter-spacing: -0.02em;
}
.auth-brand h1 { font-size: var(--text-2xl); font-weight: 600; margin: 0; letter-spacing: -0.022em; }
.auth-subtitle { margin: 4px 0 0; font-size: var(--text-xs); color: var(--color-text-soft); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 500; }
.auth-form h2 { font-size: var(--text-xl); font-weight: 600; margin-bottom: var(--sp-1); letter-spacing: -0.018em; }
.auth-help { color: var(--color-text-muted); font-size: var(--text-sm); margin-bottom: var(--sp-5); }
.auth-form .field { margin-bottom: var(--sp-4); }
.auth-form .field input { height: 38px; }
.auth-secondary { text-align: center; margin: var(--sp-4) 0 0; font-size: var(--text-sm); }
.auth-footer { text-align: center; color: var(--color-text-soft); font-size: var(--text-xs); }

/* dev panel (acceso rápido en login dev) */
.dev-panel {
  margin-top: var(--sp-5); padding: var(--sp-4);
  border: 1px dashed var(--color-border-strong);
  border-radius: var(--radius); background: var(--color-bg-elev);
}
.dev-panel__title {
  display: flex; align-items: center; gap: var(--sp-2);
  margin: 0 0 var(--sp-3);
  font-size: var(--text-xs); font-weight: 600;
  color: var(--color-text-soft);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.dev-panel__tag {
  background: var(--color-warning); color: white;
  font-size: 10px; font-weight: 700;
  padding: 2px 6px; border-radius: var(--radius-xs); letter-spacing: 0.05em;
}
.dev-panel__buttons { display: grid; gap: 6px; }
.dev-panel__btn {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  width: 100%; padding: 8px 10px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius); background: var(--color-surface);
  cursor: pointer; text-align: left;
}
.dev-panel__btn:hover { border-color: var(--color-primary); background: var(--color-primary-soft); }
.dev-panel__btn strong { font-size: var(--text-sm); color: var(--color-text); }
.dev-panel__btn small  { font-size: var(--text-xs); color: var(--color-text-soft); }
.dev-panel__hint { margin: var(--sp-2) 0 0; font-size: var(--text-xs); color: var(--color-text-soft); text-align: center; }

/* =====================================================================
   Cotizaciones v2 — selector de tipo, catálogo, partidas, totales
   ===================================================================== */
.cotizacion-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-bottom: var(--sp-5); }

/* Selector de tipo */
.tipo-switch { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.tipo-opt {
  display: block; padding: var(--sp-4); cursor: pointer;
  border: 1px solid var(--color-border-strong); border-radius: var(--radius-md);
  background: var(--color-surface); transition: border-color .12s, background .12s;
}
.tipo-opt:has(input:checked) { border-color: var(--color-text); background: var(--color-tint); }
.tipo-opt input { margin-right: 8px; }
.tipo-opt__title { font-weight: 600; font-size: var(--text-md); }
.tipo-opt__desc { display: block; margin-top: 4px; font-size: var(--text-xs); color: var(--color-text-muted); line-height: 1.5; }

/* Catálogo de conceptos (proyecto) */
.catsec { border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: var(--sp-3) var(--sp-4); margin-bottom: var(--sp-3); }
.catsec legend { font-weight: 600; font-size: var(--text-sm); padding: 0 6px; }
.catsec__num { display: inline-grid; place-items: center; width: 20px; height: 20px; margin-right: 6px; border-radius: var(--radius-sm); background: var(--color-text); color: #fff; font-size: 11px; }
.catsec__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; }
.chk { display: flex; align-items: flex-start; gap: 8px; font-size: var(--text-sm); line-height: 1.4; cursor: pointer; }
.chk input { margin-top: 3px; flex-shrink: 0; }

/* Capítulos de obra */
.cap { border: 1px solid var(--color-border); border-radius: var(--radius-md); margin-bottom: var(--sp-3); overflow: hidden; }
.cap__head { padding: 8px 14px; background: var(--color-bg-elev); border-bottom: 1px solid var(--color-border); font-weight: 600; font-size: var(--text-sm); }
.cap__clave { display: inline-block; min-width: 42px; color: var(--color-text-muted); font-feature-settings: "tnum"; }

/* Tabla de partidas genérica */
.partidas__table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.partidas__table thead th { text-align: left; padding: 8px 10px; font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .05em; color: var(--color-text-muted); border-bottom: 1px solid var(--color-border); }
.partidas__table td { padding: 6px 10px; border-bottom: 1px solid var(--color-border-soft); vertical-align: top; }
.partidas__table input, .partidas__table textarea { width: 100%; padding: 6px 8px; border: 1px solid var(--color-border-strong); border-radius: var(--radius); background: var(--color-surface); font: inherit; font-size: var(--text-sm); }
.partidas__table textarea { resize: vertical; min-height: 38px; }
.partidas__table input.num, .partidas__table td.num { text-align: right; font-feature-settings: "tnum"; }
.partidas__table th.ck, .partidas__table td.ck { width: 44px; text-align: center; }
.partidas__table td.ck input { width: auto; }
.partidas__col-action { width: 36px; text-align: center; }
.row-del { border: none; background: none; cursor: pointer; color: var(--color-danger); font-size: 1rem; line-height: 1; padding: 4px; }
.partidas__actions { padding: 8px 0 4px; }

/* Totales */
.totales { width: 340px; margin-left: auto; margin-top: var(--sp-4); border-top: 1px solid var(--color-border); padding-top: var(--sp-2); }
.totales__row { display: flex; justify-content: space-between; align-items: center; padding: 5px 0; font-size: var(--text-sm); }
.totales__row strong { font-feature-settings: "tnum"; }
.totales__row--total { border-top: 1px solid var(--color-text); margin-top: 6px; padding-top: 8px; font-size: var(--text-md); font-weight: 600; }
.iva-input { width: 60px !important; display: inline-block; padding: 3px 6px !important; text-align: right; }

/* =====================================================================
   Catálogo de cotizaciones (admin)
   ===================================================================== */
.cat-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--color-border); margin-bottom: var(--sp-4); }
.cat-tab { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; font-size: var(--text-sm); font-weight: 500; color: var(--color-text-muted); border-bottom: 2px solid transparent; margin-bottom: -1px; text-decoration: none; }
.cat-tab:hover { color: var(--color-text); }
.cat-tab.is-active { color: var(--color-text); border-bottom-color: var(--color-text); }
.cat-tab__n { font-size: 11px; background: var(--color-tint); border-radius: var(--radius-pill); padding: 1px 7px; color: var(--color-text-muted); }

.cat-grupo { border: 1px solid var(--color-border); border-radius: var(--radius-md); margin-bottom: var(--sp-3); background: var(--color-surface); }
.cat-grupo--new { border-style: dashed; padding: var(--sp-4); }
.cat-grupo__head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: 10px 14px; border-bottom: 1px solid var(--color-border); flex-wrap: wrap; }
.cat-grupo__title { display: flex; align-items: center; gap: 10px; font-size: var(--text-md); }
.cat-grupo__clave { display: inline-grid; place-items: center; min-width: 26px; height: 22px; padding: 0 6px; border-radius: var(--radius-sm); background: var(--color-text); color: #fff; font-size: 11px; font-weight: 600; }
.cat-grupo__count { font-size: var(--text-xs); color: var(--color-text-muted); }
.cat-grupo__actions { display: flex; align-items: center; gap: 6px; }

.cat-conceptos { list-style: none; margin: 0; padding: 0; }
.cat-concepto { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: 7px 14px; border-bottom: 1px solid var(--color-border-soft); font-size: var(--text-sm); }
.cat-concepto:last-child { border-bottom: none; }
.cat-concepto--empty { color: var(--color-text-muted); font-style: italic; }
.cat-concepto__u { display: inline-block; margin-left: 8px; font-size: 11px; color: var(--color-text-muted); background: var(--color-tint); border-radius: var(--radius-sm); padding: 1px 7px; }
.cat-concepto__actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.cat-add { display: flex; gap: 6px; align-items: center; padding: 10px 14px; background: var(--color-bg-elev); border-top: 1px solid var(--color-border-soft); flex-wrap: wrap; }
.cat-grupo--new .cat-add { background: none; border-top: none; padding: 0; }
.cat-add input[type="text"] { flex: 1; min-width: 140px; height: 32px; padding: 6px 10px; border: 1px solid var(--color-border-strong); border-radius: var(--radius); background: var(--color-surface); font: inherit; font-size: var(--text-sm); }

.inline-edit { position: relative; }
.inline-edit > summary { list-style: none; cursor: pointer; }
.inline-edit > summary::-webkit-details-marker { display: none; }
.inline-edit__form { display: flex; gap: 6px; align-items: center; margin-top: 6px; padding: 10px; border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-surface); box-shadow: var(--shadow-md); flex-wrap: wrap; }
.inline-edit[open] { z-index: 5; }
.inline-edit__form input[type="text"] { height: 30px; padding: 5px 9px; border: 1px solid var(--color-border-strong); border-radius: var(--radius); font: inherit; font-size: var(--text-sm); min-width: 160px; }

/* =====================================================================
   Refinamientos de UI — cards de detalle, filtros y selects
   ===================================================================== */

/* Grid de cards en páginas de detalle (show) */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
}
.cards .card { padding: var(--sp-5); }
.cards .card > h3 {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  margin: 0 0 12px;
}

/* Filas clave/valor dentro de una card */
.card__row {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; padding: 5px 0; font-size: var(--text-sm);
}
.card__row + .card__row { border-top: 1px solid var(--color-border-soft); }
.card__row span { color: var(--color-text-muted); }
.card__row strong { font-weight: 500; text-align: right; }
.card__big { font-size: 1.5rem; font-weight: 600; letter-spacing: -0.012em; margin: 2px 0 4px; }
.card__meta { font-size: var(--text-xs); color: var(--color-text-muted); margin: 0; }

/* Barra de filtros (index) */
.filters {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin-bottom: var(--sp-5);
}
.filters__search {
  flex: 1; min-width: 220px; height: 36px; padding: 0 12px;
  border: 1px solid var(--color-border-strong); border-radius: var(--radius);
  background: var(--color-surface); font: inherit; font-size: var(--text-sm);
  color: var(--color-text); outline: none; transition: border-color .12s, box-shadow .12s;
}
.filters__search:focus { border-color: var(--color-text); box-shadow: 0 0 0 3px var(--color-tint); }

/* Selects con flecha custom (filtros y formularios) */
.filters__select {
  height: 36px; padding: 0 32px 0 12px;
  border: 1px solid var(--color-border-strong); border-radius: var(--radius);
  background-color: var(--color-surface); color: var(--color-text);
  font: inherit; font-size: var(--text-sm); font-weight: 500;
  outline: none; cursor: pointer; transition: border-color .12s, box-shadow .12s;
}
.filters__select:focus { border-color: var(--color-text); box-shadow: 0 0 0 3px var(--color-tint); }
.field select, .filters__select {
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat; background-position: right 11px center;
}
.field select { padding-right: 30px; cursor: pointer; }

/* Celdas de tabla con título + meta */
.cell-strong { font-weight: 500; color: var(--color-text); }
.cell-meta { display: block; font-size: var(--text-xs); color: var(--color-text-muted); margin-top: 2px; }

/* Panel de contenido (bloques con borde, alineado a la izquierda) */
.panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--sp-5);
  margin-bottom: var(--sp-4);
  text-align: left;
}
.panel > h2 { font-size: 1rem; font-weight: 600; color: var(--color-text); margin: 0 0 var(--sp-3); }
