/* SOLART PRO · Next-Gen Responsive UI System (Desktop, Tablet & Mobile) */
:root {
  --primary-blue: #1d4ed8;
  --primary-blue-hover: #1e40af;
  --selected-fill: #cce1ff;
  --selected-border: #2563eb;
  --selected-text: #0f172a;
  --brand-yellow: #f59e0b;
  --brand-yellow-soft: #fef3c7;
  --brand-yellow-text: #0f172a;
  --vat-green-bg: #dcfce7;
  --vat-green-border: #22c55e;
  --vat-green-text: #14532d;
  --warn-bg: #fee2e2;
  --warn-border: #f87171;
  --warn-text: #991b1b;
  --saved-bg: #dcfce7;
  --saved-text: #166534;
  --unsaved-bg: #fee2e2;
  --unsaved-text: #991b1b;

  /* Light Mode Surfaces */
  --bg-page: #f1f5f9;
  --bg-sidebar: #0f172a;
  --bg-sidebar-hover: #1e293b;
  --text-sidebar: #e2e8f0;
  --text-sidebar-muted: #94a3b8;
  --bg-card: #ffffff;
  --bg-card-subtle: #f8fafc;
  --bg-field: #f4f7fb;
  --bg-field-focus: #ffffff;
  --bg-zebra: #f8fafc;
  --border-color: #cbd5e1;
  --border-subtle: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #475569;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 14px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.16);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --control-height: 42px;
}

html[data-theme="dark"] {
  --bg-page: #0b1120;
  --bg-sidebar: #070b14;
  --bg-sidebar-hover: #162033;
  --bg-card: #131c31;
  --bg-card-subtle: #18233c;
  --bg-field: #1e293b;
  --bg-field-focus: #26354d;
  --bg-zebra: #17223b;
  --border-color: #334155;
  --border-subtle: #1e293b;
  --text-main: #f8fafc;
  --text-muted: #cbd5e1;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 14px 36px rgba(0, 0, 0, 0.65);
}

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Helvetica, Arial, sans-serif;
  background: var(--bg-page);
  color: var(--text-main);
  line-height: 1.45;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* App Shell Layout */
.app-shell {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  min-height: 100vh;
}

/* Hostinger-Style Sidebar Navigation */
.app-sidebar {
  background: var(--bg-sidebar);
  color: var(--text-sidebar);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 100;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  user-select: none;
}

.sidebar-brand {
  padding: 18px 20px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-logo {
  height: 36px;
  width: auto;
  max-width: 175px;
  object-fit: contain;
  display: block;
}

.sidebar-close-mobile {
  display: none;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  border-radius: 8px;
  width: 36px;
  height: 36px;
  font-size: 18px;
  cursor: pointer;
}

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

/* Strict alignment of icon + text in menu items */
.nav-item,
.nav-group-trigger {
  width: 100%;
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-sidebar);
  font-size: 14.5px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.nav-item:hover,
.nav-group-trigger:hover {
  background: var(--bg-sidebar-hover);
  color: #ffffff;
}

.nav-icon {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.nav-badge {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}

/* Active menu item: ONLY ONE active item highlighted cleanly */
.nav-item.is-active {
  background: var(--selected-fill);
  border-color: var(--selected-border);
  color: var(--selected-text);
  font-weight: 700;
}

.nav-item.is-active .nav-badge {
  background: var(--primary-blue);
  color: #ffffff;
}

.nav-group {
  display: flex;
  flex-direction: column;
}

.nav-group-trigger.has-active-child {
  background: rgba(37, 99, 235, 0.22);
  color: #ffffff;
  font-weight: 600;
}

.nav-chevron {
  font-size: 12px;
  transition: transform 0.2s ease;
  opacity: 0.75;
}

.nav-group.is-open .nav-chevron {
  transform: rotate(180deg);
}

.nav-submenu {
  display: none;
  flex-direction: column;
  gap: 3px;
  padding: 4px 0 6px 22px;
  margin-left: 14px;
  border-left: 1.5px solid rgba(255, 255, 255, 0.14);
}

.nav-group.is-open .nav-submenu {
  display: flex;
}

.nav-subitem {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-sidebar-muted);
  font-size: 13.8px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s;
}

.nav-subitem:hover {
  background: var(--bg-sidebar-hover);
  color: #ffffff;
}

.nav-subitem.is-active {
  background: var(--brand-yellow);
  border-color: #d97706;
  color: #0f172a !important; /* Always dark black text on yellow! */
  font-weight: 700;
}

/* Sidebar Footer: Language, Theme, Sync Status & User Menu */
.sidebar-footer {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(0, 0, 0, 0.2);
}

.sidebar-prefs-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.sidebar-pref-btn {
  height: 36px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
  color: #f8fafc;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.sidebar-pref-btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

.sync-status-pill {
  padding: 8px 10px;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--saved-bg);
  color: var(--saved-text);
  border: 1px solid rgba(22, 101, 52, 0.25);
}

.sync-status-pill.is-unsaved {
  background: var(--unsaved-bg);
  color: var(--unsaved-text);
  border-color: var(--warn-border);
}

.sync-status-quote {
  font-size: 11.5px;
  opacity: 0.9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* User Account Menu at bottom of Sidebar (ONLY place for logout!) */
.user-menu-wrap {
  position: relative;
}

.user-menu-trigger {
  width: 100%;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.07);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
}

.user-menu-trigger:hover {
  background: rgba(255, 255, 255, 0.14);
}

.user-menu-dropdown {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 250;
}

.user-menu-dropdown button {
  width: 100%;
  padding: 9px 12px;
  border: none;
  background: transparent;
  color: var(--text-main);
  text-align: left;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
}

.user-menu-dropdown button:hover {
  background: var(--selected-fill);
  color: var(--selected-text);
}

.user-menu-dropdown button.danger-item {
  color: #dc2626;
}

/* Mobile Top Bar (hidden on desktop) */
.mobile-topbar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 90;
  background: var(--bg-sidebar);
  color: #ffffff;
  padding: 10px 14px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  box-shadow: var(--shadow-md);
}

.hamburger-btn {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  font-size: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.mobile-topbar-logo {
  height: 30px;
  width: auto;
}

/* Main Workspace Content */
.app-main {
  padding: 22px 26px 90px;
  max-width: 1460px;
  width: 100%;
  margin: 0 auto;
}

.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}

.view-title {
  margin: 0;
  font-size: 23px;
  font-weight: 800;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.view-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

/* Cards & Sections */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 18px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.card-title {
  margin: 0;
  font-size: 16.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 28px;
  padding: 0 8px;
  border-radius: 8px;
  background: var(--selected-fill);
  border: 1.5px solid var(--selected-border);
  color: var(--selected-text);
  font-size: 13px;
  font-weight: 800;
}

/* Grid Systems with Strict Field Alignment */
.form-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.form-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.calc-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(320px, 1fr);
  gap: 20px;
  align-items: start;
}

.calc-sticky-panel {
  position: sticky;
  top: 20px;
}

/* Field Group: Ensures 100% horizontal alignment of inputs across columns! */
.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field-label {
  min-height: 22px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.field-control,
input[type="text"],
input[type="number"],
input[type="date"],
input[type="email"],
input[type="password"],
input[type="tel"],
select {
  width: 100%;
  height: var(--control-height);
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-color);
  background: var(--bg-field);
  color: var(--text-main);
  font-size: 15px;
  font-family: inherit;
  transition: border-color 0.15s, background-color 0.15s, box-shadow 0.15s;
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}

textarea {
  width: 100%;
  min-height: 92px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-color);
  background: var(--bg-field);
  color: var(--text-main);
  font-size: 15px;
  font-family: inherit;
  resize: vertical;
}

textarea.client-notes-area {
  min-height: 260px; /* 3x taller as requested in message 11! */
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary-blue);
  background: var(--bg-field-focus);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

/* Modified field indicator (subtle harmonious blue border instead of ugly orange!) */
.is-modified-field {
  border-color: var(--selected-border) !important;
  background-color: rgba(204, 225, 255, 0.22) !important;
}

html[data-theme="dark"] .is-modified-field {
  background-color: rgba(59, 130, 246, 0.18) !important;
}

/* Warning / Needs Review Field (Soft Red as requested!) */
.has-warning-field {
  border-color: var(--warn-border) !important;
  background-color: var(--warn-bg) !important;
  color: var(--warn-text) !important;
}

.field-hint {
  font-size: 12px;
  color: var(--text-muted);
  min-height: 17px;
  line-height: 1.35;
}

/* Segmented Toggle Buttons (Una cortina / Varias medidas, Izquierda / Derecha, Interior / Exterior) */
.toggle-group-box {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 10px 12px;
}

.segmented-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.seg-btn {
  height: var(--control-height);
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-color);
  background: var(--bg-field);
  color: var(--text-main);
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 12px;
  transition: all 0.15s;
}

.seg-btn:hover {
  border-color: var(--selected-border);
}

.seg-btn.is-selected {
  background: var(--selected-fill) !important;
  border-color: var(--selected-border) !important;
  color: var(--selected-text) !important;
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(37, 99, 235, 0.16);
}

/* Illuminated Check Pill Button (Replaces ugly tiny checkboxes!) */
.pill-toggle-btn {
  min-height: var(--control-height);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-color);
  background: var(--bg-field);
  color: var(--text-main);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  text-align: left;
  transition: all 0.15s;
}

.pill-toggle-btn.is-active {
  background: var(--selected-fill) !important;
  border-color: var(--selected-border) !important;
  color: var(--selected-text) !important;
  font-weight: 700;
}

.pill-indicator {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1.5px solid var(--border-color);
  background: var(--bg-card);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  flex-shrink: 0;
}

.pill-toggle-btn.is-active .pill-indicator {
  background: var(--primary-blue);
  border-color: var(--primary-blue);
  color: #ffffff;
}

/* Unified Searchable Combobox (Tejido, Color, Estancia, Desplazamiento, Cliente) */
.combobox-wrap {
  position: relative;
  width: 100%;
}

.combobox-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.combobox-input-wrap input {
  padding-right: 58px;
}

.combobox-clear-btn {
  position: absolute;
  right: 30px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 15px;
  padding: 4px 6px;
  line-height: 1;
}

.combobox-arrow {
  position: absolute;
  right: 10px;
  pointer-events: none;
  color: var(--text-muted);
  font-size: 12px;
}

.combobox-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 280px;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1.5px solid var(--selected-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  z-index: 180;
  padding: 4px;
}

.combobox-option {
  width: 100%;
  padding: 9px 12px;
  border: none;
  background: transparent;
  color: var(--text-main);
  text-align: left;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.combobox-option:hover,
.combobox-option.is-highlighted {
  background: var(--selected-fill);
  color: var(--selected-text);
}

/* Search Input with Clear (X) Button */
.search-box-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.search-box-wrap input {
  padding-right: 36px;
}

.search-clear-x {
  position: absolute;
  right: 8px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: rgba(100, 116, 139, 0.16);
  color: var(--text-main);
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.search-clear-x:hover {
  background: rgba(220, 38, 38, 0.2);
  color: #dc2626;
}

/* Standard Buttons */
.btn {
  height: var(--control-height);
  padding: 0 16px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn:hover {
  border-color: var(--primary-blue);
  background: var(--bg-card-subtle);
}

.btn-primary {
  background: var(--primary-blue);
  border-color: var(--primary-blue);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--primary-blue-hover);
  color: #ffffff;
}

.btn-yellow {
  background: var(--brand-yellow);
  border-color: #d97706;
  color: #0f172a !important; /* Guaranteed black text on yellow! */
  font-weight: 700;
}

.btn-yellow:hover {
  background: #fbbf24;
}

.btn-success {
  background: var(--saved-bg);
  border-color: #22c55e;
  color: var(--saved-text) !important;
  font-weight: 700;
}

.btn-warning-soft {
  background: var(--warn-bg);
  border-color: var(--warn-border);
  color: var(--warn-text) !important;
  font-weight: 700;
}

.btn-danger {
  background: #fee2e2;
  border-color: #f87171;
  color: #991b1b;
}

.btn-danger:hover {
  background: #fecaca;
}

.btn-sm {
  height: 34px;
  padding: 0 11px;
  font-size: 13px;
}

.info-i-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1.5px solid var(--primary-blue);
  background: var(--selected-fill);
  color: #0f172a;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

/* Soft Red Alert Banner (Never Orange!) */
.alert-soft-red {
  background: var(--warn-bg);
  border: 1.5px solid var(--warn-border);
  color: var(--warn-text);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 13.8px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.alert-soft-blue {
  background: var(--selected-fill);
  border: 1.5px solid var(--selected-border);
  color: var(--selected-text);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 13.8px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

/* Calculator Totals Box (02 Sale ex VAT + 03 Total with VAT in Green + Client Discounted Preview) */
.totals-display-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin: 14px 0;
}

.total-card-box {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-color);
  background: var(--bg-card-subtle);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.total-card-box.total-vat-green {
  background: var(--vat-green-bg) !important;
  border-color: var(--vat-green-border) !important;
  color: var(--vat-green-text) !important;
}

.total-box-label {
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  opacity: 0.85;
}

.total-box-amount {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.15;
}

.total-box-discounted {
  font-size: 12.8px;
  font-weight: 600;
  opacity: 0.9;
  padding-top: 4px;
  border-top: 1px dashed rgba(15, 23, 42, 0.18);
}

/* Expandable Accordions (Desglose, Características, Conceptos y suplementos, Incrementos) */
details.clean-disclosure {
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-card-subtle);
  margin-top: 12px;
  overflow: hidden;
}

details.clean-disclosure > summary {
  padding: 12px 16px;
  font-size: 14.5px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}

details.clean-disclosure > summary::-webkit-details-marker {
  display: none;
}

details.clean-disclosure > summary::after {
  content: "▾";
  font-size: 14px;
  transition: transform 0.2s;
}

details.clean-disclosure[open] > summary::after {
  transform: rotate(180deg);
}

details.clean-disclosure > .disclosure-body {
  padding: 14px 16px 16px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-card);
}

/* Interactive Curtain Attribute Chips in Budget ("En curso") */
.curtain-chips-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.attr-chip {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.15);
  background: var(--selected-fill);
  color: #0f172a;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: transform 0.1s, box-shadow 0.1s;
}

.attr-chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.14);
}

/* Unified Directory Tables & Zebra Lists (Clientes, Presupuestos, Pedidos, Avión, Facturas) */
.directory-stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat-metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-metric-card small {
  font-size: 12.5px;
  color: var(--text-muted);
  font-weight: 600;
}

.stat-metric-card strong {
  font-size: 22px;
  font-weight: 800;
}

.zebra-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-card);
}

table.zebra-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

table.zebra-table th {
  background: var(--bg-card-subtle);
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 12px 14px;
  border-bottom: 1.5px solid var(--border-subtle);
}

table.zebra-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

table.zebra-table tbody tr:nth-child(even) {
  background: var(--bg-zebra);
}

table.zebra-table .num-col {
  text-align: right;
  white-space: nowrap;
}

.link-btn {
  background: transparent;
  border: none;
  padding: 0;
  color: var(--primary-blue);
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 2px;
}

html[data-theme="dark"] .link-btn {
  color: #60a5fa;
}

/* Status Select Pill with Down Arrow on ALL statuses including Guardado! */
.status-pill-select {
  height: 34px;
  padding: 0 30px 0 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  border: 1px solid rgba(15, 23, 42, 0.16);
  cursor: pointer;
  width: auto;
  min-width: 132px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%230f172a' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

/* Numbered Pagination Bar */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.page-numbers-wrap {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.page-num-btn {
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  font-weight: 600;
  cursor: pointer;
}

.page-num-btn.is-current {
  background: var(--selected-fill);
  border-color: var(--selected-border);
  color: var(--selected-text);
  font-weight: 800;
}

/* Floating Price Summary Pill (Mobile & PC) */
.floating-totals-bar {
  position: fixed;
  bottom: 16px;
  right: 20px;
  z-index: 160;
  background: var(--bg-sidebar);
  color: #ffffff;
  border: 1.5px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 8px 16px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 13px;
  pointer-events: auto;
}

.floating-totals-bar strong {
  color: #4ade80;
  font-size: 14.5px;
}

/* Centered Modals / Dialogs */
dialog.solart-modal {
  margin: auto;
  padding: 0;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  color: var(--text-main);
  box-shadow: var(--shadow-lg);
  max-width: min(880px, 94vw);
  width: 100%;
  max-height: 90vh;
}

dialog.solart-modal.modal-sm {
  max-width: min(460px, 92vw);
}

dialog.solart-modal.modal-xl {
  max-width: min(1040px, 96vw);
}

dialog.solart-modal::backdrop {
  background: rgba(15, 23, 42, 0.58);
  backdrop-filter: blur(2px);
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 10;
}

.modal-header h3 {
  margin: 0;
  font-size: 17.5px;
  font-weight: 800;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  max-height: calc(90vh - 130px);
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  background: var(--bg-card-subtle);
}

/* A4 Document Visual Preview (Perfect on Mobile & Desktop!) */
.a4-preview-container {
  background: #64748b;
  padding: 16px;
  border-radius: var(--radius-md);
  overflow-x: auto;
}

.a4-preview-sheet {
  max-width: 794px;
  margin: 0 auto;
  padding: 36px 40px;
  border-radius: 6px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  font-size: 13px;
  line-height: 1.45;
}

.a4-light {
  background: #ffffff;
  color: #0f172a;
}

.a4-dark {
  background: #0f172a;
  color: #f8fafc;
}

.a4-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 2px solid #cbd5e1;
  margin-bottom: 18px;
}

.a4-logo {
  height: 44px;
  width: auto;
}

.a4-doc-type {
  font-size: 11px;
  font-weight: 800;
  color: #2563eb;
  text-align: right;
  letter-spacing: 0.06em;
}

.a4-dark .a4-doc-type {
  color: #60a5fa;
}

.a4-doc-number {
  font-size: 20px;
  font-weight: 800;
  text-align: right;
}

.a4-parties {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 16px;
}

.a4-party-name,
.a4-client-name {
  font-size: 14.5px;
  font-weight: 800;
  margin-bottom: 4px;
}

.a4-party-label {
  font-size: 11px;
  font-weight: 800;
  color: #2563eb;
  text-transform: uppercase;
}

.a4-meta-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(37, 99, 235, 0.08);
  border-radius: 6px;
  margin-bottom: 14px;
}

.a4-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
}

.a4-table th {
  background: #1d4ed8;
  color: #ffffff;
  padding: 8px 10px;
  font-size: 11.5px;
  text-align: left;
}

.a4-table th.col-num,
.a4-table td.col-num {
  text-align: right;
  white-space: nowrap;
}

.a4-table td {
  padding: 10px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.3);
  vertical-align: top;
}

.a4-row-title {
  font-weight: 700;
  font-size: 13.5px;
}

.a4-row-details {
  font-size: 12px;
  opacity: 0.82;
  margin-top: 3px;
}

.a4-summary-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 24px;
  align-items: start;
}

.a4-tot-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 8px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
}

.a4-tot-discount {
  background: rgba(37, 99, 235, 0.1);
  color: #1d4ed8;
  border-radius: 4px;
}

.a4-dark .a4-tot-discount {
  color: #93c5fd;
}

.a4-tot-grand {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: #16a34a;
  color: #ffffff;
  border-radius: 8px;
  margin-top: 8px;
  font-size: 16px;
}

.a4-footer {
  margin-top: 24px;
  padding-top: 12px;
  border-top: 1px solid rgba(148, 163, 184, 0.35);
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  opacity: 0.8;
}

.hidden {
  display: none !important;
}

/* Mobile & Tablet Responsive Adaptations (Zero Horizontal Overflow!) */
@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .mobile-topbar {
    display: flex;
  }

  .app-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 285px;
    transform: translateX(-105%);
    transition: transform 0.24s ease;
    box-shadow: var(--shadow-lg);
  }

  .app-sidebar.is-mobile-open {
    transform: translateX(0);
  }

  .sidebar-close-mobile {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .app-main {
    padding: 14px 12px 95px;
  }

  .calc-layout,
  .form-grid-2,
  .form-grid-3,
  .form-grid-4,
  .a4-parties,
  .a4-summary-grid {
    grid-template-columns: 1fr;
  }

  .calc-sticky-panel {
    position: static;
  }

  input[type="text"],
  input[type="number"],
  input[type="date"],
  input[type="email"],
  input[type="password"],
  input[type="tel"],
  select,
  textarea {
    font-size: 16px; /* Prevents iOS auto-zoom on focus */
  }

  /* Responsive Stacked Cards for Tables on Mobile so user never scrolls right to see prices/actions! */
  table.zebra-table,
  table.zebra-table thead,
  table.zebra-table tbody,
  table.zebra-table tr,
  table.zebra-table td {
    display: block;
    width: 100%;
  }

  table.zebra-table thead {
    display: none;
  }

  table.zebra-table tr {
    padding: 12px;
    border-bottom: 2px solid var(--border-subtle);
  }

  table.zebra-table td {
    padding: 4px 0;
    border: none;
    text-align: left !important;
  }

  .a4-preview-sheet {
    padding: 18px 14px;
  }

  .floating-totals-bar {
    left: 12px;
    right: 12px;
    bottom: 10px;
    justify-content: space-between;
  }
}
