/* ═══════════════════════════════════════════════════════════════
   DOMA UNIFIED THEME — Usado por todas las aplicaciones
   ═══════════════════════════════════════════════════════════════ */

:root {
  /* Brand colors */
  --emerald: #27C47B;
  --emerald-2: #4FD494;
  --emerald-dark: #0E7044;
  --emerald-ink: #084D2E;
  --amethyst: #7A2BC4;
  --amethyst-2: #B47AE6;
  --amethyst-deep: #5E1F9C;
  --amethyst-ink: #3D0F6B;

  /* Dark cinematic surface */
  --ink-0: #05070A;
  --ink-1: #0A0D12;
  --ink-2: #0F1319;
  --ink-3: #151A22;
  --line: #222A38;
  --line-2: #2E3A4D;
  --fg: #ECEFF4;
  --fg-dim: #A4AEC0;
  --fg-mute: #6B7489;

  /* Status colors */
  --warn: #F5B454;
  --bad: #F06B6B;
  --ok: var(--emerald);
  --ok-l: rgba(39,196,123,.12);
  --bad-l: rgba(240,107,107,.12);

  /* Typography */
  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --sans: "Inter", system-ui, -apple-system, sans-serif;

  /* Aliases */
  --brand: var(--emerald);
  --brand-l: var(--ok-l);
  --muted: var(--fg-mute);
  --panel: var(--ink-2);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--ink-0);
  color: var(--fg);
  font-family: var(--sans);
  line-height: 1.5;
}

/* ─── LAYOUT ─────────────────────────────────────────────────── */

#app {
  display: flex;
  height: 100vh;
}

.sidebar {
  width: 280px;
  background: var(--ink-1);
  border-right: 1px solid var(--line);
  padding: 20px;
  overflow-y: auto;
  flex-shrink: 0;
}

.main-col {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: var(--ink-1);
  border-bottom: 1px solid var(--line);
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.content {
  flex: 1;
  overflow: auto;
  padding: 24px;
}

/* ─── SIDEBAR ────────────────────────────────────────────────── */

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 30px;
}

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

.sidebar-logo h1 {
  margin: 0;
  font-size: 18px;
  color: var(--brand);
  font-weight: 700;
}

.sidebar-menu {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar-menu li {
  margin-bottom: 8px;
}

.sidebar-menu a {
  display: block;
  padding: 10px 12px;
  border-radius: 6px;
  text-decoration: none;
  color: var(--fg-dim);
  font-size: 14px;
  transition: all 0.2s ease;
  cursor: pointer;
}

.sidebar-menu a:hover {
  background: var(--ink-2);
  color: var(--fg);
}

.sidebar-menu a.active {
  background: var(--brand-l);
  color: var(--brand);
  font-weight: 600;
}

/* ─── TYPOGRAPHY ─────────────────────────────────────────────── */

.page-title {
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 8px 0;
  color: var(--fg);
}

.page-subtitle {
  font-size: 14px;
  color: var(--fg-dim);
  margin: 0 0 24px 0;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-weight: 700;
  color: var(--fg);
}

p {
  margin: 0;
}

/* ─── BUTTONS ────────────────────────────────────────────────── */

.btn {
  padding: 8px 16px;
  border: 1px solid var(--line);
  background: var(--ink-2);
  color: var(--fg);
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  font-family: var(--sans);
}

.btn:hover {
  background: var(--ink-3);
  border-color: var(--line-2);
}

.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: white;
  font-weight: 600;
}

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

.btn-secondary {
  background: transparent;
  border-color: var(--line);
}

.btn-secondary:hover {
  background: var(--ink-2);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

.btn-xs {
  padding: 4px 8px;
  font-size: 12px;
}

.btn-bad {
  background: var(--bad);
  border-color: var(--bad);
  color: white;
}

.btn-bad:hover {
  background: #e85252;
}

/* ─── FORMS ──────────────────────────────────────────────────── */

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="tel"],
select,
textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--line);
  background: var(--ink-2);
  color: var(--fg);
  border-radius: 6px;
  font-size: 14px;
  font-family: var(--sans);
  transition: border-color 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(39, 196, 123, 0.1);
}

label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--fg);
}

label.req::after {
  content: " *";
  color: var(--bad);
}

/* ─── CARDS & CONTAINERS ────────────────────────────────────── */

.card {
  background: var(--ink-1);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
}

.card-hdr {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  margin: -20px -20px 20px -20px;
  padding: 16px 20px;
}

.cht {
  font-weight: 600;
  font-size: 14px;
}

.card-acts {
  display: flex;
  gap: 8px;
}

/* ─── TOOLBAR ────────────────────────────────────────────────── */

.toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  align-items: center;
  flex-wrap: wrap;
}

.toolbar input[type="text"],
.toolbar input[type="search"] {
  flex: 1;
  min-width: 200px;
}

/* ─── SECTION ────────────────────────────────────────────────── */

.section {
  display: none;
}

.section.active {
  display: block;
  animation: fadeIn 0.2s ease-in;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ─── LOGIN ──────────────────────────────────────────────────── */

#loginWrap {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--ink-0);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

#loginWrap.show {
  display: flex;
}

.lcard {
  width: 360px;
  background: var(--ink-1);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 32px;
}

.lcard h2 {
  margin: 16px 0 8px 0;
  font-size: 20px;
}

.llogo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.llogo img {
  width: 40px;
  height: 40px;
}

.lfull {
  grid-column: span 2;
}

.lgrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 20px 0;
}

.lgrid input,
.lgrid select {
  width: 100%;
}

.btn-login {
  width: 100%;
  padding: 10px;
  background: var(--brand);
  border: none;
  color: white;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  font-size: 14px;
}

.btn-login:hover {
  background: var(--emerald-dark);
}

.lerr {
  color: var(--bad);
  font-size: 12px;
  margin-top: 8px;
}

/* ─── MODALS & DRAWERS ───────────────────────────────────────── */

.drawer-bg {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 900;
}

.drawer-bg.show {
  display: block;
}

.drawer {
  display: none;
  position: fixed;
  right: 0;
  top: 0;
  height: 100vh;
  width: 400px;
  max-width: 90vw;
  background: var(--ink-1);
  border-left: 1px solid var(--line);
  z-index: 901;
  flex-direction: column;
  box-shadow: -4px 0 16px rgba(0, 0, 0, 0.3);
}

.drawer.show {
  display: flex;
}

.drawer-hdr {
  padding: 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.drawer-hdr h3 {
  margin: 0;
  font-size: 18px;
}

.drawer-close {
  background: none;
  border: none;
  color: var(--fg-dim);
  cursor: pointer;
  font-size: 20px;
}

.drawer-close:hover {
  color: var(--fg);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.drawer-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ─── RECORD DRAWER (DomaDrawer — Notion-style slide-over) ───── */

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  z-index: 900;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.drawer-backdrop.open {
  opacity: 1;
  pointer-events: all;
}

.record-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(56rem, 90vw);
  background: var(--ink-1);
  border-left: 1px solid var(--line);
  box-shadow: -1rem 0 3rem rgba(0, 0, 0, 0.4);
  z-index: 901;
  display: flex;
  flex-direction: column;
  transform: translateX(105%);
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), width 0.3s ease;
}

.record-drawer.open {
  transform: translateX(0);
}

.record-drawer.maximized {
  width: 100vw;
}

.record-drawer.minimized {
  transform: translateX(105%);
  pointer-events: none;
}

#domaDrawerFab {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 950;
  background: var(--brand);
  color: #fff;
  border: 1px solid var(--brand);
  border-radius: 9999px;
  padding: 10px 18px;
  font-weight: 600;
  font-size: 13px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  display: none;
  align-items: center;
  gap: 0.5rem;
  transition: background 0.15s ease, transform 0.15s ease;
}
#domaDrawerFab.open { display: inline-flex; }
#domaDrawerFab:hover { background: var(--emerald-dark); transform: translateY(-1px); }
#domaDrawerFab svg { width: 16px; height: 16px; }

/* ========================================================================
 * DomaCombobox — selector con búsqueda + display rico
 * ======================================================================== */
.dc-combo {
  position: relative;
  display: inline-block;
  width: 100%;
}
.dc-combo-trigger {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--ink-1);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 6px 0 0;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.dc-combo.dc-open .dc-combo-trigger,
.dc-combo-trigger:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(39, 196, 123, 0.15);
}
.dc-combo-trigger.dc-disabled {
  opacity: 0.6;
  pointer-events: none;
}
.dc-combo-input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  color: inherit;
  padding: 8px 10px;
  font-size: 14px;
  font-family: inherit;
  width: 100%;
}
.dc-combo-input::placeholder {
  color: var(--fg-mute, #6B7489);
}
.dc-combo-clear,
.dc-combo-arrow {
  border: none;
  background: transparent;
  color: var(--fg-mute, #6B7489);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
}
.dc-combo-clear:hover,
.dc-combo-arrow:hover {
  background: var(--ink-2);
  color: var(--ink-7);
}
.dc-combo-arrow svg {
  width: 14px;
  height: 14px;
  transition: transform 0.15s ease;
}
.dc-combo.dc-open .dc-combo-arrow svg {
  transform: rotate(180deg);
}
.dc-combo-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  /* min-width garantiza dropdown legible aunque el wrapper sea angosto
     (ej: combobox dentro de celda de tabla con columna estrecha).
     360px caben sublabels típicos: "CODIGO-XXXXXXX · TIPO · ESTADO" */
  min-width: 360px;
  z-index: 1050; /* sobre el drawer (z=1000) — el dropdown puede flotar fuera */
  background: var(--ink-1);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  max-height: 320px;
  overflow-y: auto;
  padding: 4px;
}
.dc-combo-item {
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: background 0.1s ease;
}
.dc-combo-item:hover,
.dc-combo-item.dc-active {
  background: var(--ink-2);
}
.dc-combo-item.selected {
  background: var(--brand-l);
}
.dc-combo-item.selected .dc-combo-item-label {
  color: var(--brand);
  font-weight: 600;
}
.dc-combo-item-label {
  font-size: 13.5px;
  color: inherit;
  line-height: 1.3;
  font-weight: 500;
}
.dc-combo-item-sublabel {
  font-size: 11.5px;
  color: var(--fg-dim, #A4AEC0);
  line-height: 1.2;
  font-weight: 400;
}
/* En el item seleccionado el sublabel debe seguir legible sobre brand-l */
.dc-combo-item.selected .dc-combo-item-sublabel {
  color: var(--emerald-dark, #0E7044);
}
.dc-combo-empty {
  padding: 12px;
  font-size: 13px;
  color: var(--fg-mute, #6B7489);
  text-align: center;
}

.record-drawer .drawer-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.record-drawer .drawer-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--fg);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.record-drawer .drawer-subtitle {
  font-size: 0.8rem;
  color: var(--fg-dim, var(--muted));
  margin-top: 0.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.record-drawer .drawer-icon-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--fg-dim, var(--muted));
  font-size: 1rem;
  line-height: 1;
  padding: 0.35rem 0.55rem;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.record-drawer .drawer-icon-btn:hover {
  background: var(--ink-2, rgba(255, 255, 255, 0.05));
  color: var(--fg);
  border-color: var(--line);
}

.record-drawer .drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1.5rem;
}

.record-drawer .drawer-footer {
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-shrink: 0;
}

.record-drawer .drawer-cancel-btn,
.record-drawer .drawer-save-btn {
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--line);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.record-drawer .drawer-cancel-btn {
  background: transparent;
  color: var(--fg-dim, var(--muted));
}

.record-drawer .drawer-cancel-btn:hover {
  background: var(--ink-2, rgba(255, 255, 255, 0.05));
  color: var(--fg);
}

.record-drawer .drawer-save-btn {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.record-drawer .drawer-save-btn:hover {
  background: var(--emerald-dark);
  border-color: var(--emerald-dark);
}

/* ─── Drawer form sections (SVG icons — consistente con sidebar DOMA) ─── */

.form-section-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--fg-mute, var(--muted));
  margin-bottom: 0.75rem;
}

.form-section-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  color: var(--emerald);
  flex-shrink: 0;
}

.form-section-icon svg {
  width: 16px;
  height: 16px;
  display: block;
}

/* ─── DOMA CONFIRM (modal de confirmación reutilizable) ──────── */

.confirm-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  z-index: 950;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.confirm-backdrop.open {
  opacity: 1;
  pointer-events: all;
}

.confirm-modal {
  background: var(--ink-1, #1a1d23);
  color: var(--fg, #ECEFF4);
  border: 1px solid var(--line);
  border-radius: 0.875rem;
  box-shadow: 0 1.5rem 4rem rgba(0, 0, 0, 0.55);
  min-width: 22rem;
  max-width: min(32rem, 92vw);
  padding: 1.25rem 1.25rem 1rem 1.25rem;
  transform: translateY(-0.75rem) scale(0.98);
  opacity: 0;
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s ease;
}

.confirm-backdrop.open .confirm-modal {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.confirm-header {
  display: flex;
  gap: 0.875rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.confirm-icon {
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  font-weight: 700;
  font-family: "Segoe UI", system-ui, sans-serif;
  line-height: 1;
}

.confirm-modal.variant-danger  .confirm-icon { background: rgba(239, 68, 68, 0.18);  color: #ef4444; }
.confirm-modal.variant-warning .confirm-icon { background: rgba(245, 158, 11, 0.18); color: #f59e0b; }
.confirm-modal.variant-info    .confirm-icon { background: rgba(59, 130, 246, 0.18); color: #3b82f6; }
.confirm-modal.variant-success .confirm-icon { background: rgba(34, 197, 94, 0.18);  color: #22c55e; }

.confirm-header-text {
  flex: 1;
  min-width: 0;
}

.confirm-title {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--fg, #ECEFF4);
  line-height: 1.35;
  margin-bottom: 0.25rem;
  letter-spacing: 0.01em;
}

.confirm-message {
  font-size: 0.9rem;
  color: var(--fg-dim, #c7cdd6);
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.confirm-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

.confirm-btn {
  padding: 0.55rem 1rem;
  border-radius: 0.5rem;
  border: 1px solid var(--line);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.15s;
}

.confirm-btn:hover { transform: translateY(-1px); }
.confirm-btn:focus-visible { outline: 2px solid var(--brand, #3b82f6); outline-offset: 2px; }

.confirm-btn-primary {
  background: var(--brand, #3b82f6);
  border-color: var(--brand, #3b82f6);
  color: #fff;
}
.confirm-btn-primary:hover { filter: brightness(1.08); }

.confirm-btn-danger {
  background: #ef4444;
  border-color: #ef4444;
  color: #fff;
}
.confirm-btn-danger:hover { filter: brightness(1.08); }

.confirm-btn-warning {
  background: #f59e0b;
  border-color: #f59e0b;
  color: #1f1500;
}
.confirm-btn-warning:hover { filter: brightness(1.06); }

.confirm-btn-ghost {
  background: transparent;
  color: var(--fg, #ECEFF4);
  border-color: var(--line);
}
.confirm-btn-ghost:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--fg-dim, #c7cdd6);
  color: var(--fg, #ECEFF4);
}

/* ─── TABLES ─────────────────────────────────────────────────── */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

thead {
  background: var(--ink-2);
}

th {
  padding: 12px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--fg-mute);
  border-bottom: 1px solid var(--line);
}

td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

tbody tr:hover {
  background: var(--ink-2);
}

/* ─── UTILITIES ──────────────────────────────────────────────── */

.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--fg-dim);
}

.ei {
  font-size: 48px;
  margin-bottom: 12px;
}

.et {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

.es {
  font-size: 13px;
  color: var(--fg-mute);
}

.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--line);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Scrollbar styling — paleta DOMA brand
   Aplica a TODA la app DOMA (ERP, HC_Lite, drawers, modales, dropdowns).
   WebKit (Chrome/Edge/Safari) + Firefox via scrollbar-color. */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--ink-1);
  border-radius: 6px;
}

::-webkit-scrollbar-thumb {
  background: var(--brand);
  border-radius: 6px;
  border: 2px solid var(--ink-1);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--emerald-dark);
}

::-webkit-scrollbar-thumb:active {
  background: var(--emerald-dark);
}

::-webkit-scrollbar-corner {
  background: var(--ink-1);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--brand) var(--ink-1);
}

/* ═══════════════════════════════════════════════════════════════
   MASTER-DETAIL RECORD CARD
   Tarjeta de resumen del registro seleccionado (panel derecho).
   Usada por Proveedores, Clientes, Productos, Terceros, Empleados.
   ═══════════════════════════════════════════════════════════════ */

.record-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  padding: 2.5rem 1.25rem;
  color: var(--fg-dim, var(--muted));
  text-align: center;
}

.record-empty-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(39,196,123,.10), rgba(39,196,123,.02));
  border: 1px solid rgba(39,196,123,.18);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--emerald);
  margin-bottom: .25rem;
}
.record-empty-icon svg { width: 26px; height: 26px; }
.record-empty-title { font-weight: 600; color: var(--fg); font-size: .95rem; }
.record-empty-hint  { font-size: .78rem; color: var(--fg-dim); }

.record-card {
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 2px 10px rgba(0, 0, 0, .25);
}

.record-card-head {
  display: flex;
  align-items: center;
  gap: .9rem;
  padding: 1.15rem 1.25rem .95rem;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(39,196,123,.10) 0%, rgba(39,196,123,0) 100%);
}

.record-avatar {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--emerald) 0%, var(--emerald-dark) 100%);
  color: #fff;
  box-shadow: 0 2px 6px rgba(14, 112, 68, .28);
}
.record-avatar svg { width: 22px; height: 22px; }

.record-head-text { min-width: 0; flex: 1; }

.record-card-title {
  font-weight: 700;
  font-size: 1.02rem;
  color: var(--fg);
  letter-spacing: -.01em;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.record-card-sub {
  margin-top: .2rem;
  font-size: .72rem;
  color: var(--fg-dim);
  letter-spacing: .01em;
}

.record-status-badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .25rem .55rem;
  border-radius: 999px;
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .02em;
  text-transform: uppercase;
}
.record-status-badge.is-active {
  background: rgba(39,196,123,.12);
  color: var(--emerald-dark, #0E7044);
  border: 1px solid rgba(39,196,123,.28);
}
.record-status-badge.is-inactive {
  background: rgba(240,107,107,.10);
  color: #c0392e;
  border: 1px solid rgba(240,107,107,.24);
}
.record-status-badge svg { width: 12px; height: 12px; }

.record-card-body { padding: .65rem 1.25rem 1rem; }

.record-field-row {
  display: grid;
  grid-template-columns: 20px 1fr auto;
  align-items: start;
  gap: .6rem;
  padding: .55rem 0;
  border-bottom: 1px dashed var(--line);
}
.record-field-row:last-child { border-bottom: 0; }

.record-field-icon {
  width: 16px;
  height: 16px;
  color: var(--emerald);
  margin-top: .12rem;
  opacity: .85;
}
.record-field-icon svg { width: 16px; height: 16px; display: block; }

.record-field-label {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--fg-dim);
  font-weight: 600;
}

.record-field-value {
  grid-column: 2 / 4;
  margin-top: .15rem;
  font-size: .88rem;
  font-weight: 500;
  color: var(--fg);
  word-break: break-word;
  line-height: 1.35;
}
.record-field-value.is-muted { color: var(--fg-dim); font-weight: 400; }
.record-field-value .mono { font-family: var(--mono); font-size: .82rem; color: var(--fg); }

.record-section-title {
  margin: 1rem 0 .45rem;
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--emerald);
  font-weight: 700;
}
.record-section-title svg { width: 14px; height: 14px; }

.record-contact-row {
  padding: .55rem 0;
  border-bottom: 1px solid var(--line);
}
.record-contact-row:last-child { border-bottom: 0; }
.record-contact-name { font-weight: 600; font-size: .88rem; color: var(--fg); }
.record-contact-role { font-weight: 400; color: var(--fg-dim); margin-left: .25rem; }
.record-contact-meta { font-size: .76rem; color: var(--fg-dim); margin-top: .15rem; }

.record-open-btn {
  width: 100%;
  margin-top: 1rem;
  padding: .7rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--emerald-dark, #0E7044);
  background: linear-gradient(180deg, var(--emerald) 0%, var(--emerald-dark) 100%);
  color: #fff;
  font-weight: 600;
  font-size: .88rem;
  letter-spacing: .01em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  box-shadow: 0 1px 2px rgba(14, 112, 68, .18), 0 4px 10px rgba(14, 112, 68, .18);
  transition: transform .08s ease, box-shadow .15s ease, filter .15s ease;
}
.record-open-btn:hover {
  filter: brightness(1.04);
  box-shadow: 0 2px 3px rgba(14, 112, 68, .22), 0 6px 14px rgba(14, 112, 68, .22);
}
.record-open-btn:active { transform: translateY(1px); }
.record-open-btn svg { width: 16px; height: 16px; }

/* ─── icon-btn (compact action button used by IAM and similar modules) ─── */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  padding: .35rem .6rem;
  border-radius: .35rem;
  border: 1px solid var(--line);
  background: var(--ink-2);
  color: var(--fg);
  font-size: .82rem;
  font-weight: 500;
  cursor: pointer;
  line-height: 1;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.icon-btn:hover { background: var(--ink-3); border-color: var(--brand); }
.icon-btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn svg { width: 14px; height: 14px; }
.icon-btn.primary {
  background: var(--brand);
  color: #fff;
  border-color: var(--emerald-dark, #0E7044);
}
.icon-btn.primary:hover { background: var(--emerald-dark, #0E7044); filter: brightness(1.05); }
.icon-btn.warning {
  color: var(--bad);
  border-color: var(--bad);
  background: transparent;
}
.icon-btn.warning:hover { background: rgba(240, 107, 107, .08); }

/* ── ADR-029 fix: SVGs inline dentro de cualquier <button> sin clase de icono ──
   Los SVG de master-detail.js no traen width/height intrinsecos. En un button con
   display:flex sin wrapper de tamano, ocupan todo el espacio (~80x80px) y rompen
   la UI. Esta regla limita a 14x14 por defecto, salvo nav-icon u otras clases
   explicitas.                                                                  */
button > svg[aria-hidden]:not(.nav-icon),
button > span > svg[aria-hidden]:not(.nav-icon),
button > span:not([class]) > svg[aria-hidden] {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  display: inline-block;
}

/* ════════════════════════════════════════════════════════════════════
   UPPERCASE de captura — decisión CEO 2026-05-25.
   Toda escritura nueva de identidad comercial se persiste en MAYÚSCULA
   en el backend (Pydantic mixin DomaInputModel). Esta capa CSS es
   sólo UX: el usuario ve en MAYÚSCULA lo que va a guardarse.

   Exclusiones obligatorias:
   - input[type=email] (RFC 5321 case-sensitive)
   - input[type=password] (binario)
   - input[type=url] (HTTP case-sensitive)
   - input[type=hidden] (no se ve)
   - textarea (texto libre / observaciones largas)
   - input.no-uppercase (override explícito por módulo si hace falta)
   ════════════════════════════════════════════════════════════════════ */
input[type="text"]:not(.no-uppercase),
input[type="search"]:not(.no-uppercase),
input:not([type]):not(.no-uppercase) {
  text-transform: uppercase;
}
input[type="text"]::placeholder,
input[type="search"]::placeholder,
input:not([type])::placeholder {
  text-transform: none;
}
/* Selects también suelen mostrar identidad comercial — uppercase visual */
select:not(.no-uppercase) option {
  text-transform: uppercase;
}
/* Filtros de búsqueda: el usuario debe poder tipear en cualquier case;
   el backend hace match case-insensitive. La capa visual queda igual. */

/* Emails siempre en MINÚSCULA (decisión CEO 2026-05-25) — evita duplicados
   "Juan@Gmail" vs "juan@gmail" y normaliza login. Backend ya aplica
   `.lower().strip()` en escritura via Pydantic mixin. */
input[type="email"]:not(.no-lowercase) {
  text-transform: lowercase;
}
input[type="email"]::placeholder {
  text-transform: none;
}
