@font-face {
  font-family: Montserrat;
  font-display: swap;
  font-style: normal;
  font-weight: 400;
  src: local("Montserrat Regular"), local("Montserrat");
}

@font-face {
  font-family: Montserrat;
  font-display: swap;
  font-style: normal;
  font-weight: 600;
  src: local("Montserrat SemiBold"), local("Montserrat");
}

@font-face {
  font-family: Montserrat;
  font-display: swap;
  font-style: normal;
  font-weight: 700;
  src: local("Montserrat Bold"), local("Montserrat");
}

@font-face {
  font-family: Cormorant;
  font-display: swap;
  font-style: normal;
  font-weight: 700;
  src: local("Cormorant Garamond Bold"), local("Cormorant Bold"), local("Cormorant");
}

/* ─────────────────────────────────────────
   Tokens
───────────────────────────────────────── */
:root {
  --cream: #faf4e8;
  --sand: #ece2cc;
  --sand-mid: #e0d3b8;
  --brown: #745d4a;
  --brown-dark: #5a4537;
  --taupe: #a18167;
  --taupe-light: #c8b5a6;
  --charcoal: #1e2122;
  --charcoal-mid: #2e3436;
  --ink: #262b2c;
  --muted: #6b7678;
  --line: rgba(116, 93, 74, 0.16);
  --line-strong: rgba(116, 93, 74, 0.28);

  --panel-bg: rgba(255, 255, 255, 0.92);
  --panel-bg-soft: rgba(255, 255, 255, 0.72);
  --shadow-sm: 0 2px 8px rgba(38, 43, 44, 0.06), 0 1px 2px rgba(38, 43, 44, 0.04);
  --shadow: 0 8px 24px rgba(38, 43, 44, 0.08), 0 2px 6px rgba(38, 43, 44, 0.05);
  --shadow-lg: 0 20px 48px rgba(38, 43, 44, 0.12), 0 4px 12px rgba(38, 43, 44, 0.06);

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-pill: 999px;

  --transition: 0.18s ease;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  font-family: Montserrat, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(135deg, rgba(250, 244, 232, 0.95) 0%, rgba(236, 226, 204, 0.85) 100%),
    url("/static/assets/hero-gentleman.jpg") center / cover no-repeat;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg,
    rgba(250, 244, 232, 0.4) 0%,
    rgba(250, 244, 232, 0.88) 40%,
    rgba(250, 244, 232, 1) 100%);
}

a { color: inherit; text-decoration: none; }

button, input, select, textarea {
  font: inherit;
  letter-spacing: 0;
}

button { cursor: pointer; }

h3, h4 {
  margin: 0;
  font-family: Cormorant, serif;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0;
}

/* ─────────────────────────────────────────
   Topbar
───────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 32px;
  padding: 9px 24px;
  color: var(--brown);
  background: var(--sand);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--sand-mid);
}

.topbar a { transition: color var(--transition); }
.topbar a:hover { color: var(--brown-dark); }

/* ─────────────────────────────────────────
   Header / Nav
───────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(30, 33, 34, 0.96);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 32px;
  height: 72px;
}

.brand-logo {
  width: 220px;
  height: auto;
  display: block;
  opacity: 0.95;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-pill);
  padding: 4px;
}

.nav-item {
  position: relative;
}

.nav-button {
  border: 0;
  border-radius: var(--radius-pill);
  padding: 8px 20px;
  color: rgba(255, 255, 255, 0.65);
  background: transparent;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transition: background var(--transition), color var(--transition);
}

.nav-button:hover {
  color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.08);
}

.nav-button.active {
  color: var(--charcoal);
  background: var(--cream);
}

.nav-submenu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 60;
  display: grid;
  min-width: 190px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  background: rgba(30, 33, 34, 0.98);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity var(--transition), transform var(--transition), visibility var(--transition);
}

.nav-item:hover .nav-submenu,
.nav-item:focus-within .nav-submenu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav-submenu button {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  padding: 0 10px;
  color: rgba(255, 255, 255, 0.78);
  background: transparent;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: left;
  text-transform: uppercase;
}

.nav-submenu button:hover {
  color: var(--cream);
  background: rgba(255, 255, 255, 0.08);
}

.logout-button {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-pill);
  padding: 0 16px;
  color: rgba(255, 255, 255, 0.7);
  background: transparent;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transition: all var(--transition);
}

.logout-button:hover {
  border-color: rgba(255, 255, 255, 0.4);
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

/* ─────────────────────────────────────────
   App Shell
───────────────────────────────────────── */
.app-shell {
  max-width: 1600px;
  margin: 0 auto;
  padding: 32px 28px 126px;
}

.view-section { display: none; }
.view-section.active { display: block; }
.view-section[data-view-section="asesoria"].active,
.view-section[data-view-section="facturas"].active {
  display: grid;
  gap: 20px;
}
.hidden-media { display: none !important; }

/* ─────────────────────────────────────────
   Records Hero
───────────────────────────────────────── */
.page-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.records-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.records-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.floating-save-bar {
  position: fixed;
  right: 24px;
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  width: fit-content;
  max-width: min(520px, calc(100vw - 32px));
  border: 1.5px solid rgba(116, 93, 74, 0.26);
  border-radius: var(--radius-sm);
  padding: 8px;
  color: var(--ink);
  background: rgba(250, 244, 232, 0.94);
  box-shadow: 0 14px 42px rgba(30, 33, 34, 0.22);
  backdrop-filter: blur(14px);
}

.floating-save-bar span {
  max-width: 180px;
  overflow: hidden;
  color: var(--brown);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.floating-save-bar .primary-button {
  min-height: 38px;
  padding-inline: 16px;
}

.order-edit-view .floating-save-bar span,
.order-edit-page .floating-save-bar span {
  display: none;
}

.order-edit-view .floating-save-bar,
.order-edit-page .floating-save-bar {
  left: auto;
  width: fit-content;
  max-width: calc(100vw - 32px);
}

.language-select {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0 10px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--charcoal);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.language-select select {
  min-height: 28px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  letter-spacing: 0;
  text-transform: none;
  cursor: pointer;
}

.invoice-language-select {
  min-height: 38px;
  border-radius: var(--radius-pill);
  background: rgba(236, 226, 204, 0.5);
}

.compact-language-select {
  min-height: 34px;
  background: #fff;
}

.section-subnav {
  position: sticky;
  top: 73px;
  z-index: 35;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px;
  background: rgba(250, 244, 232, 0.94);
  box-shadow: var(--shadow-sm);
}

.section-subnav button {
  min-height: 34px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 12px;
  color: var(--brown);
  background: transparent;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.section-subnav button:hover {
  border-color: rgba(116, 93, 74, 0.22);
  background: rgba(116, 93, 74, 0.08);
}

.scroll-anchor {
  display: block;
  position: relative;
  top: -126px;
  height: 0;
  visibility: hidden;
}

.panel,
.clients-section,
.field-details,
.selected-fabrics-bar {
  scroll-margin-top: 126px;
}

/* ─────────────────────────────────────────
   Dashboard
───────────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.dashboard-layout,
.dashboard-bottom-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.42fr);
  gap: 20px;
  align-items: start;
  margin-bottom: 20px;
}

.dashboard-bottom-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dashboard-week-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.dashboard-day {
  display: grid;
  align-content: start;
  min-height: 150px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px;
  background: rgba(255, 255, 255, 0.76);
}

.dashboard-day.today {
  border-color: var(--charcoal);
  box-shadow: inset 0 0 0 1px var(--charcoal);
}

.dashboard-day strong {
  margin-bottom: 8px;
  color: var(--brown);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.dashboard-day div {
  display: grid;
  gap: 6px;
}

.dashboard-day button {
  min-height: 30px;
  border: 1px solid rgba(116, 93, 74, 0.18);
  border-radius: 6px;
  padding: 5px 7px;
  color: var(--ink);
  background: rgba(250, 244, 232, 0.7);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.35;
  text-align: left;
}

.dashboard-day button:hover {
  border-color: var(--brown);
  background: #fff;
}

.dashboard-slot {
  min-height: 30px;
  border: 1px solid rgba(116, 93, 74, 0.18);
  border-radius: 6px;
  padding: 5px 7px;
  color: var(--brown-dark);
  background: rgba(236, 226, 204, 0.55);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.35;
}

.dashboard-slot.blocked {
  color: var(--cream);
  background: var(--charcoal);
}

.invoice-mini-list,
.invoice-list {
  display: grid;
  gap: 8px;
}

.invoice-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 58px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.82);
  text-align: left;
  transition: border-color var(--transition), background var(--transition);
}

.invoice-row:hover {
  border-color: var(--brown);
  background: #fff;
}

.invoice-row span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.invoice-row strong,
.invoice-row b {
  font-family: Cormorant, serif;
  font-size: 20px;
  line-height: 1;
}

.invoice-row small {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ─────────────────────────────────────────
   Orders Directory
───────────────────────────────────────── */
.orders-section {
  max-width: 1280px;
  margin-inline: auto;
}

.order-filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.order-filter-grid label {
  margin-bottom: 0;
}

.order-creation-range {
  display: flex;
  align-items: end;
  gap: 10px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.order-creation-range[hidden] {
  display: none;
}

.order-creation-range label {
  flex: 1;
  margin: 0;
}

.orders-list {
  display: grid;
  gap: 10px;
}

.order-bulk-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 12px 0;
  padding: 12px 14px;
  border: 1px solid var(--line, #ded4c5);
  border-radius: 10px;
  background: #faf7f0;
}

.order-bulk-toolbar select {
  min-width: 220px;
}

.order-bulk-select-all {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  white-space: nowrap;
}

.order-bulk-select-all input[type="checkbox"],
.order-row-selection input[type="checkbox"] {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  min-height: 18px;
  margin: 0;
  padding: 0;
}

.order-bulk-toolbar .status-line {
  flex-basis: 100%;
  margin: 0;
}

.order-row-selection {
  align-self: start;
  padding-top: 3px;
}

.order-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px;
  background: rgba(255, 255, 255, 0.84);
}

.order-row h3 {
  font-size: 24px;
}

.order-row p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.order-row-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
  max-width: 460px;
}

/* ─────────────────────────────────────────
   Panels
───────────────────────────────────────── */
.panel,
.clients-section {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-bg);
  box-shadow: var(--shadow);
}

.panel { padding: 28px; }

.panel-title,
.section-heading {
  margin-bottom: 22px;
}

.panel-title.inline,
.section-heading.inline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

/* ─────────────────────────────────────────
   Typography
───────────────────────────────────────── */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 6px;
  color: var(--brown);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

h1, h2 {
  margin: 0;
  font-family: Cormorant, serif;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: 0;
}

h1 { font-size: 42px; }
h2 { font-size: 32px; }

/* ─────────────────────────────────────────
   Form Elements
───────────────────────────────────────── */
label {
  display: grid;
  gap: 7px;
  margin-bottom: 16px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1.5px solid rgba(116, 93, 74, 0.22);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.9);
  outline: none;
  font-size: 14px;
  font-weight: 400;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

input::placeholder,
textarea::placeholder {
  color: var(--taupe-light);
  font-weight: 400;
}

textarea {
  resize: vertical;
  min-height: 100px;
  line-height: 1.55;
}

input:hover,
select:hover,
textarea:hover {
  border-color: rgba(116, 93, 74, 0.4);
  background: #fff;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brown);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(116, 93, 74, 0.12);
}

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

.field-grid {
  display: grid;
  gap: 14px;
}

.field-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field-grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.field-grid.option-grid {
  grid-template-columns: minmax(160px, 0.6fr) minmax(260px, 1.4fr);
}

.wide-field { min-width: 0; }

.field-help {
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: 0;
  text-transform: none;
}

.field-heading {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
}

/* ─────────────────────────────────────────
   Checkbox Cards (extras)
───────────────────────────────────────── */
.check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.check-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  margin: 0;
  border: 1.5px solid rgba(116, 93, 74, 0.18);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  background: rgba(250, 244, 232, 0.6);
  font-size: 12px;
  font-weight: 400;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}

.check-card:hover {
  border-color: var(--brown);
  background: rgba(250, 244, 232, 0.9);
}

.check-card:has(input:checked) {
  border-color: var(--charcoal);
  background: rgba(30, 33, 34, 0.06);
}

.check-card input {
  width: 16px;
  min-height: 16px;
  accent-color: var(--charcoal);
}

.check-card span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.check-card strong {
  color: var(--brown);
  font-size: 12px;
  font-weight: 700;
}

/* ─────────────────────────────────────────
   Upload Box
───────────────────────────────────────── */
.upload-box {
  display: grid;
  place-items: center;
  min-height: 120px;
  border: 1.5px dashed var(--taupe-light);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  background: rgba(236, 226, 204, 0.4);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}

.upload-box:hover {
  border-color: var(--brown);
  background: rgba(236, 226, 204, 0.6);
}

.upload-box input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.upload-box span {
  color: var(--brown);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.upload-box strong {
  font-family: Cormorant, serif;
  font-size: 22px;
}

.upload-box small {
  max-width: 360px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.5;
}

/* ─────────────────────────────────────────
   Photo Preview
───────────────────────────────────────── */
.photo-preview {
  display: none;
  width: 100%;
  max-height: 260px;
  object-fit: cover;
  border-radius: var(--radius);
  margin: -6px 0 16px;
  box-shadow: var(--shadow-sm);
}

.photo-preview.visible { display: block; }

.zoomable { cursor: zoom-in; }

/* ─────────────────────────────────────────
   Client media
───────────────────────────────────────── */
.client-media-field {
  display: grid;
  gap: 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px;
  background: rgba(255, 255, 255, 0.62);
}

.client-media-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.client-media-heading > div {
  display: grid;
  gap: 3px;
}

.client-media-heading strong {
  font-size: 13px;
}

.client-media-heading small,
.client-media-meta span {
  color: var(--muted);
  font-size: 11px;
}

.client-media-upload {
  position: relative;
  flex: 0 0 auto;
  cursor: pointer;
}

.client-media-upload input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.client-media-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.client-media-gallery > .status-line {
  grid-column: 1 / -1;
  margin: 0;
}

.client-media-item {
  position: relative;
  display: grid;
  align-content: start;
  gap: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: #fff;
}

.client-media-item.is-pending {
  border-style: dashed;
  background: rgba(236, 226, 204, 0.32);
}

.client-media-preview {
  display: block;
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: zoom-in;
}

.client-media-preview img,
.client-media-item video {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 5px;
  background: var(--sand);
  object-fit: cover;
}

.client-media-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  min-width: 0;
}

.client-media-meta strong {
  width: 100%;
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.client-media-remove {
  justify-self: start;
  border: 0;
  padding: 0;
  color: var(--danger, #9f3434);
  background: transparent;
  font-size: 11px;
  cursor: pointer;
  text-decoration: underline;
}

@media (max-width: 640px) {
  .client-media-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .client-media-upload {
    justify-content: center;
  }

  .client-media-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ─────────────────────────────────────────
   Selected Fabrics Bar
───────────────────────────────────────── */
.selected-fabrics-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  padding: 12px 14px;
  background: rgba(236, 226, 204, 0.35);
}

.selected-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.selected-list span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: var(--radius-pill);
  padding: 4px 10px;
  color: var(--cream);
  background: var(--brown);
  font-size: 11px;
  font-weight: 700;
}

.muted-text {
  color: var(--muted) !important;
  font-size: 13px;
}

/* ─────────────────────────────────────────
   Buttons
───────────────────────────────────────── */
.actions,
.result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.primary-button,
.secondary-button,
.secondary-link,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent;
  padding: 0 18px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-decoration: none;
  text-transform: uppercase;
  transition: all var(--transition);
  white-space: nowrap;
}

.primary-button {
  color: var(--cream);
  background: var(--charcoal);
  border-color: var(--charcoal);
  box-shadow: 0 2px 8px rgba(30, 33, 34, 0.2);
}

.primary-button:hover {
  background: var(--charcoal-mid);
  box-shadow: 0 4px 16px rgba(30, 33, 34, 0.28);
  transform: translateY(-1px);
}

.primary-button:active { transform: translateY(0); }

.secondary-button,
.secondary-link {
  color: var(--brown);
  border-color: rgba(116, 93, 74, 0.35);
  background: rgba(250, 244, 232, 0.85);
}

.secondary-button:hover,
.secondary-link:hover {
  border-color: var(--brown);
  background: rgba(116, 93, 74, 0.08);
  transform: translateY(-1px);
}

.secondary-button:active,
.secondary-link:active { transform: translateY(0); }

.icon-button {
  width: 42px;
  min-height: 42px;
  padding: 0;
  color: var(--cream);
  background: var(--brown);
  border-color: var(--brown);
  font-size: 22px;
  line-height: 1;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

.icon-button:hover {
  background: var(--brown-dark);
  transform: translateY(-1px);
}

/* ─────────────────────────────────────────
   Status Line
───────────────────────────────────────── */
.status-line {
  min-height: 20px;
  margin: 12px 0 0;
  color: var(--brown);
  font-size: 12px;
  line-height: 1.5;
}

.status-line.error {
  color: #a43b32;
}

.client-conflict-link {
  display: inline-block;
  margin-left: 4px;
  color: #8b241d;
  font-weight: 700;
  text-decoration: underline;
}

.client-conflict-link:hover,
.client-conflict-link:focus-visible {
  color: #5f1712;
}

.autosave-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.78);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.autosave-status::before {
  content: "";
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #a59d91;
}

.autosave-status[data-state="pending"]::before {
  background: #d28b19;
}

.autosave-status[data-state="saving"]::before {
  background: #4d83b8;
  animation: autosave-pulse 0.9s ease-in-out infinite alternate;
}

.autosave-status[data-state="saved"] {
  color: #2f6e48;
}

.autosave-status[data-state="saved"]::before {
  background: #3b9a61;
}

.autosave-status[data-state="error"] {
  color: #9b3028;
  border-color: rgba(155, 48, 40, 0.28);
}

.autosave-status[data-state="error"]::before {
  background: #bf3333;
}

.autosave-bar {
  min-width: min(360px, calc(100vw - 24px));
}

@keyframes autosave-pulse {
  from { opacity: 0.4; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1.08); }
}

/* ── Borrador rápido toggle ──────────────────────────────────── */
.draft-toggle {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 12px 0 0;
  padding: 10px 12px;
  border: 1px solid var(--line, rgba(116, 93, 74, 0.18));
  border-radius: var(--radius-sm, 8px);
  background: rgba(161, 129, 103, 0.06);
  cursor: pointer;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted, #6b6b6b);
}

.draft-toggle input[type="checkbox"] {
  margin-top: 1px;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  accent-color: var(--brown, #745d4a);
  cursor: pointer;
}

.draft-toggle strong {
  color: var(--ink, #2b2b2b);
  font-weight: 700;
}

.draft-toggle:hover {
  border-color: var(--brown, #745d4a);
  background: rgba(161, 129, 103, 0.1);
}

/* ─────────────────────────────────────────
   Workspace (form + result side by side)
───────────────────────────────────────── */
.workspace {
  display: block;
}

/* ─────────────────────────────────────────
   Fabric inventory
───────────────────────────────────────── */
.fabric-form.hidden { display: none; }

.fabric-form {
  padding: 16px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 20px;
  background: rgba(236, 226, 204, 0.4);
}

.inventory-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.inventory-search {
  width: min(280px, 100%);
  min-height: 38px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.92);
  font-size: 12px;
}

.inventory-view-toggle {
  display: inline-flex;
  overflow: hidden;
  border: 1.5px solid rgba(116, 93, 74, 0.28);
  border-radius: var(--radius-sm);
  background: rgba(250, 244, 232, 0.8);
}

.inventory-view-toggle button {
  min-height: 36px;
  border: 0;
  border-right: 1px solid rgba(116, 93, 74, 0.18);
  padding: 0 12px;
  color: var(--brown);
  background: transparent;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.inventory-view-toggle button:last-child {
  border-right: 0;
}

.inventory-view-toggle button.active {
  color: var(--cream);
  background: var(--charcoal);
}

.fabric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  max-height: 800px;
  overflow: auto;
  padding-right: 2px;
}

.fabric-card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.fabric-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.fabric-card.selected {
  border-color: var(--charcoal);
  box-shadow: 0 0 0 2px var(--charcoal), var(--shadow-sm);
}

.fabric-card.low-stock {
  border-color: rgba(154, 62, 47, 0.5);
}

.fabric-card-main {
  display: grid;
  grid-template-rows: 150px auto;
  flex: 1 1 auto;
  width: 100%;
  height: auto;
  padding: 0;
  border: 0;
  color: inherit;
  text-align: left;
  background: transparent;
}

.fabric-card-main img {
  width: 100%;
  height: 150px;
  object-fit: cover;
}

.fabric-info { padding: 12px; }

.fabric-info h3 {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 6px;
  font-family: Cormorant, serif;
  font-size: 20px;
  letter-spacing: 0;
}

.fabric-info p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.fabric-stock-line {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
}

.fabric-price-line {
  color: #2f7d4e;
  font-weight: 800;
}

.inventory-code {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  border-radius: 5px;
  padding: 1px 6px;
  color: #4d5354;
  background: #f1efe9;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  font-weight: 700;
}

.fabric-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
  padding: 8px 10px 10px;
  border-top: 1px solid rgba(116, 93, 74, 0.12);
  background: rgba(250, 247, 241, 0.92);
}

.fabric-action-button {
  flex: 1 1 auto;
  min-height: 32px;
  border: 1.5px solid rgba(116, 93, 74, 0.26);
  border-radius: var(--radius-sm);
  padding: 0 10px;
  color: var(--brown);
  background: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.fabric-action-button:hover {
  border-color: var(--brown);
  background: rgba(116, 93, 74, 0.06);
}

.fabric-action-button.danger {
  color: #9a3e2f;
  border-color: rgba(154, 62, 47, 0.32);
}

.fabric-table-wrap {
  overflow: auto;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-sm);
}

.fabric-table {
  width: 100%;
  min-width: 1040px;
  border-collapse: collapse;
}

.fabric-table th,
.fabric-table td {
  border-bottom: 1px solid rgba(116, 93, 74, 0.12);
  padding: 10px 12px;
  text-align: left;
  vertical-align: middle;
}

.fabric-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--brown);
  background: #f7f0e3;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.fabric-table td {
  color: var(--ink);
  font-size: 12px;
}

.fabric-table tbody tr:hover {
  background: rgba(236, 226, 204, 0.28);
}

.fabric-table tbody tr.low-stock {
  background: rgba(154, 62, 47, 0.05);
}

.fabric-table td strong {
  display: block;
  font-size: 13px;
}

.fabric-table td span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.fabric-table-thumb {
  display: block;
  width: 54px;
  height: 54px;
  border: 1px solid rgba(116, 93, 74, 0.16);
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--sand);
}

.stock-chip {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  border-radius: var(--radius-pill);
  padding: 3px 9px;
  color: #2f7d4e !important;
  background: rgba(47, 125, 78, 0.12);
  font-weight: 800 !important;
}

.stock-chip.low {
  color: #9a3e2f !important;
  background: rgba(154, 62, 47, 0.12);
}

.fabric-table-actions {
  display: flex;
  gap: 6px;
}

.fabric-empty-state,
.fabric-empty-row {
  padding: 22px;
  text-align: center;
}

.fabric-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.fabric-tags span,
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: var(--radius-pill);
  padding: 3px 9px;
  color: var(--brown);
  background: var(--sand);
  font-size: 11px;
  font-weight: 700;
}

.fabric-tags .stock-alert {
  color: var(--cream);
  background: #9a3e2f;
}

.badge.ready {
  color: var(--cream);
  background: var(--charcoal);
}

.badge.demo {
  color: var(--cream);
  background: var(--brown);
}

/* ─────────────────────────────────────────
   Result Panel
───────────────────────────────────────── */
.result-frame {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 340px;
  border: 1.5px solid rgba(116, 93, 74, 0.18);
  border-radius: var(--radius);
  padding: 0;
  background: var(--charcoal);
  overflow: hidden;
  cursor: zoom-in;
}

.result-placeholder {
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 340px;
  padding: 28px;
  color: var(--cream);
  text-align: center;
}

.result-placeholder strong {
  font-family: Cormorant, serif;
  font-size: 30px;
  line-height: 1;
  color: rgba(250, 244, 232, 0.6);
}

.result-placeholder p {
  max-width: 400px;
  margin: 12px 0 0;
  color: rgba(250, 244, 232, 0.4);
  font-size: 13px;
  line-height: 1.6;
}

/* ── Generation loading overlay ──────────────────────────────── */
.generation-loader {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 28px;
  text-align: center;
  cursor: default;
  background:
    linear-gradient(135deg, rgba(30, 33, 34, 0.97), rgba(46, 52, 54, 0.97));
  backdrop-filter: blur(4px);
}

.loader-spinner {
  width: 52px;
  height: 52px;
  border: 4px solid rgba(250, 244, 232, 0.18);
  border-top-color: var(--cream, #faf4e8);
  border-radius: 50%;
  animation: loader-spin 0.9s linear infinite;
}

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

.generation-loader strong {
  font-family: Cormorant, serif;
  font-size: 26px;
  line-height: 1.1;
  color: var(--cream, #faf4e8);
}

.generation-loader > p {
  margin: 0;
  min-height: 18px;
  font-size: 14px;
  font-weight: 600;
  color: rgba(250, 244, 232, 0.85);
  transition: opacity 0.3s ease;
}

.loader-bar {
  width: min(360px, 80%);
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(250, 244, 232, 0.15);
}

.loader-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--taupe, #a18167), var(--cream, #faf4e8));
  transition: width 0.6s ease;
}

.loader-hint {
  font-size: 11.5px;
  color: rgba(250, 244, 232, 0.5);
  max-width: 360px;
  line-height: 1.5;
}

.generation-global-loader {
  position: fixed;
  inset: 0;
  z-index: 9990;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(30, 33, 34, 0.68);
  backdrop-filter: blur(8px);
}

.generation-global-card {
  width: min(440px, 100%);
  border: 1.5px solid rgba(250, 244, 232, 0.2);
  border-radius: var(--radius);
  padding: 28px;
  color: var(--cream);
  background: linear-gradient(135deg, rgba(30, 33, 34, 0.98), rgba(46, 52, 54, 0.98));
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.generation-global-card .loader-spinner {
  margin: 0 auto 16px;
}

.generation-global-card strong {
  display: block;
  font-family: Cormorant, serif;
  font-size: 30px;
  line-height: 1.1;
}

.generation-global-card p {
  min-height: 22px;
  margin: 12px 0 18px;
  color: rgba(250, 244, 232, 0.86);
  font-size: 14px;
  font-weight: 700;
}

.generation-global-card .loader-bar {
  width: 100%;
  margin: 0 auto 14px;
}

.generation-global-card span {
  display: block;
  color: rgba(250, 244, 232, 0.58);
  font-size: 12px;
  line-height: 1.45;
}

body.ai-generation-active {
  cursor: progress;
}

/* Pulse the result frame border while generating */
.result-frame.is-generating {
  cursor: default;
  border-color: var(--taupe, #a18167);
  animation: frame-pulse 2s ease-in-out infinite;
}

@keyframes frame-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(161, 129, 103, 0); }
  50% { box-shadow: 0 0 0 4px rgba(161, 129, 103, 0.25); }
}

.result-frame img {
  width: 100%;
  height: auto;
  display: block;
}

.result-frame span {
  position: absolute;
  right: 12px;
  bottom: 12px;
  min-height: 28px;
  border-radius: var(--radius-pill);
  padding: 6px 12px;
  color: var(--cream);
  background: rgba(30, 33, 34, 0.75);
  backdrop-filter: blur(8px);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.result-meta {
  margin-top: 14px;
}

.result-meta.compact {
  margin-top: 0;
  justify-content: flex-end;
}

.ai-generation-section {
  background: rgba(236, 226, 204, 0.2);
}

.ai-generation-layout {
  display: grid;
  grid-template-columns: minmax(300px, 0.85fr) minmax(460px, 1.15fr);
  gap: 16px;
  align-items: start;
  min-width: 0;
  padding-top: 6px !important;
}

.ai-generation-controls,
.ai-result-panel {
  min-width: 0;
}

.ai-result-panel {
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: var(--shadow-sm);
}

.ai-generation-section .panel-title {
  margin-bottom: 14px;
}

.ai-generation-section .selected-fabrics-bar {
  margin-bottom: 14px;
}

.ai-generation-section .check-grid {
  margin-bottom: 14px;
}

.ai-photo-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(130px, 180px);
  gap: 12px;
  align-items: start;
}

.ai-photo-grid .upload-box {
  min-height: 100%;
}

.ai-photo-grid .photo-preview.visible {
  margin: 0;
}

.ai-generation-section .draft-toggle {
  margin: 14px 0 0;
}

.ai-generation-actions {
  margin-top: 12px;
}

.ai-generation-section .result-frame,
.ai-generation-section .result-placeholder {
  min-height: 360px;
}

.ai-generation-section .generated-gallery {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

/* ─────────────────────────────────────────
   Generated Gallery
───────────────────────────────────────── */
.generated-gallery {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.generated-card {
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--panel-bg-soft);
  transition: transform var(--transition), box-shadow var(--transition);
}

.generated-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.generated-card button {
  display: grid;
  width: 100%;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  text-align: left;
}

.generated-card img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
}

.generated-card span {
  display: block;
  padding: 8px 10px;
  color: var(--brown);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ─────────────────────────────────────────
   Clients List
───────────────────────────────────────── */
.clients-section {
  margin-top: 20px;
  padding: 24px;
}

.view-section[data-view-section="asesoria"].active {
  display: block;
}

.view-section[data-view-section="asesoria"] > .page-hero,
.view-section[data-view-section="asesoria"] > .section-subnav {
  width: 100%;
}

.view-section[data-view-section="asesoria"] > #clientsDirectorySection {
  margin-top: 20px;
  position: static;
  max-height: none;
  overflow: visible;
}

.view-section[data-view-section="asesoria"] > .workspace {
  width: 100%;
}

.view-section[data-view-section="asesoria"] > #clientHistorySection {
  width: 100%;
}

.view-section[data-view-section="asesoria"] #clientsList {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.view-section[data-view-section="asesoria"] #clientsList .client-card img {
  display: block;
}

.view-section[data-view-section="clientes"] #clientsDirectorySection .client-filter-grid,
.view-section[data-view-section="asesoria"] #clientsDirectorySection .client-filter-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.client-search-panel {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px;
  background: rgba(236, 226, 204, 0.28);
}

.search-field {
  margin-bottom: 0;
}

.search-field input {
  min-height: 48px;
  font-size: 15px;
}

.client-filter-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.client-filter-grid label {
  margin-bottom: 0;
}

.search-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.compact-button {
  min-height: 34px;
  padding: 0 12px;
  font-size: 11px;
}

.client-history-section {
  background: rgba(250, 244, 232, 0.9);
}

/* ─────────────────────────────────────────
   Agenda
───────────────────────────────────────── */
.agenda-dashboard {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.metric-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  background: var(--panel-bg);
  box-shadow: var(--shadow-sm);
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  font-family: Cormorant, serif;
  font-size: 38px;
  line-height: 1;
}

.metric-card.warning strong { color: #9a3e2f; }
.metric-card.ready strong { color: var(--brown); }

.agenda-layout {
  display: grid;
  grid-template-columns: minmax(620px, 1fr) minmax(360px, 0.42fr);
  gap: 20px;
  align-items: start;
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.calendar-weekdays {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: center;
  text-transform: uppercase;
}

.calendar-day {
  display: grid;
  grid-template-rows: auto minmax(54px, 1fr);
  gap: 6px;
  min-height: 104px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 9px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  text-align: left;
  transition: border-color var(--transition), background var(--transition), transform var(--transition);
}

.calendar-day:hover {
  border-color: var(--brown);
  background: #fff;
  transform: translateY(-1px);
}

.calendar-day.today {
  border-color: var(--charcoal);
}

.calendar-day.selected {
  background: rgba(30, 33, 34, 0.06);
  box-shadow: inset 0 0 0 2px var(--charcoal);
}

.calendar-day.muted-day {
  opacity: 0.45;
}

.day-number {
  color: var(--charcoal);
  font-weight: 700;
}

.day-events {
  display: grid;
  align-content: start;
  gap: 4px;
}

.day-event {
  overflow: hidden;
  min-height: 20px;
  border-radius: 5px;
  padding: 2px 6px;
  color: var(--brown-dark);
  background: var(--sand);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.day-event.delivery {
  color: var(--cream);
  background: var(--brown);
}

.day-event.pickup {
  color: var(--cream);
  background: var(--charcoal);
}

.day-event.event {
  color: var(--cream);
  background: #8b6f47;
}

.day-event.block {
  color: var(--cream);
  background: var(--charcoal-mid);
}

.day-event.more {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.7);
}

.agenda-list {
  display: grid;
  gap: 10px;
}

.agenda-card {
  display: grid;
  gap: 12px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 13px;
  background: rgba(255, 255, 255, 0.82);
}

.agenda-card.overdue {
  border-color: rgba(154, 62, 47, 0.38);
  background: rgba(154, 62, 47, 0.06);
}

.agenda-card.standalone {
  border-color: rgba(116, 93, 74, 0.28);
  background: rgba(250, 244, 232, 0.7);
}

.agenda-card.blocked {
  border-color: rgba(30, 33, 34, 0.28);
  background: rgba(30, 33, 34, 0.06);
}

.agenda-card strong {
  display: block;
  font-family: Cormorant, serif;
  font-size: 22px;
  line-height: 1.05;
}

.agenda-card span,
.agenda-card p {
  display: block;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.agenda-card .agenda-note {
  color: var(--ink);
}

.agenda-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

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

.queue-grid h3 {
  margin: 0 0 12px;
  font-size: 24px;
}

.appointment-form {
  border-top: 1.5px solid var(--line);
  margin-top: 20px;
  padding-top: 18px;
}

.compact-order-heading {
  margin: 12px 0 14px;
}

.garment-orders-editor {
  display: grid;
  gap: 12px;
}

.garment-order-card {
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px;
  background: rgba(255, 255, 255, 0.72);
}

.related-order-card {
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px;
  background: rgba(255, 255, 255, 0.78);
}

.related-order-card--adjustment {
  border-color: rgba(142, 68, 173, 0.28);
  background: rgba(253, 242, 248, 0.64);
}

.related-order-card.is-deleted,
.order-row.is-deleted {
  border-color: rgba(159, 52, 52, 0.45);
  background: rgba(159, 52, 52, 0.10);
  box-shadow: inset 4px 0 0 rgba(159, 52, 52, 0.55);
  opacity: 0.72;
}

.related-order-card.is-deleted:hover,
.order-row.is-deleted:hover {
  opacity: 0.9;
}

.danger-button {
  border-color: rgba(159, 52, 52, 0.5) !important;
  color: #9f3434 !important;
  background: rgba(159, 52, 52, 0.06) !important;
}

.danger-button:hover {
  color: #fff !important;
  background: #9f3434 !important;
}

.deleted-order-label,
.client-badge.deleted {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 4px 10px;
  color: #fff;
  background: #9f3434;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.deleted-orders-group {
  grid-column: 1 / -1;
  margin-top: 10px;
  border: 1px solid rgba(159, 52, 52, 0.32);
  border-radius: 10px;
  background: rgba(159, 52, 52, 0.055);
  overflow: hidden;
}

.deleted-orders-group > summary {
  padding: 10px 14px;
  color: #8f3030;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  list-style-position: inside;
  text-transform: uppercase;
}

.deleted-orders-group > summary:hover {
  background: rgba(159, 52, 52, 0.07);
}

.deleted-orders-list {
  display: grid;
  gap: 10px;
  padding: 0 10px 10px;
}

.deleted-orders-group--listing {
  margin-top: 14px;
}

.garment-order-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.garment-order-head h3 {
  font-size: 22px;
  line-height: 1.06;
}

.related-order-actions {
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.related-order-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.related-order-meta span,
.order-mini-badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(250, 244, 232, 0.68);
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
  padding: 5px 8px;
}

.order-mini-badge {
  display: inline-flex;
  margin-left: 6px;
  color: #8e44ad;
  background: #fdf2f8;
  border-color: rgba(142, 68, 173, 0.24);
  font-weight: 700;
}

.scan-section {
  margin-bottom: 20px;
}

.scan-panel {
  display: grid;
  gap: 14px;
}

.scan-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px;
  background: rgba(255, 255, 255, 0.86);
}

.scan-card h3 {
  margin: 0 0 6px;
  font-size: 26px;
}

.scan-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.compact-title {
  margin-bottom: 14px;
}

.history-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.75fr) minmax(280px, 0.85fr);
  gap: 20px;
}

.history-grid h3 {
  margin: 0 0 14px;
  font-family: Cormorant, serif;
  font-size: 24px;
}

.history-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.history-grid section:nth-child(2) .history-list {
  grid-template-columns: 1fr;
}

.history-grid section:nth-child(3) .history-list {
  grid-template-columns: 1fr;
}

.history-card {
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px;
  background: rgba(255, 255, 255, 0.8);
  transition: transform var(--transition), box-shadow var(--transition);
}

.history-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.history-card img {
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: calc(var(--radius-sm) - 2px);
  object-fit: cover;
  margin-bottom: 10px;
  cursor: zoom-in;
}

.history-card div {
  display: grid;
  gap: 4px;
  margin-bottom: 10px;
}

.history-card strong {
  font-family: Cormorant, serif;
  font-size: 20px;
}

.history-card span {
  color: var(--muted);
  font-size: 12px;
}

.invoice-history-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.invoice-history-card div { margin-bottom: 0; }

.timeline-list {
  max-height: 520px;
  overflow: auto;
}

.timeline-card {
  border: 1.5px solid var(--line);
  border-left: 3px solid var(--charcoal);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.8);
}

.timeline-card.public {
  border-left-color: var(--brown);
}

.timeline-card p {
  margin: 8px 0 0;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.45;
}

.order-timeline-group {
  display: grid;
  gap: 8px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px;
  background: rgba(250, 244, 232, 0.42);
}

.order-timeline-group h4 {
  font-size: 20px;
}

.order-timeline-group > p {
  margin: -4px 0 2px;
  color: var(--muted);
  font-size: 11px;
}

.clients-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 4px;
}

.garment-order-summary {
  display: grid;
  gap: 6px;
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}

.garment-order-summary li {
  display: grid;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 9px;
  background: rgba(250, 244, 232, 0.56);
}

.garment-order-summary strong {
  font-size: 12px;
}

.garment-order-summary span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.client-card {
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
}

.client-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.client-card h3 {
  margin: 0 0 5px;
  font-family: Cormorant, serif;
  font-size: 22px;
}

.client-card > p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.client-card img {
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: calc(var(--radius) - 4px);
  object-fit: cover;
  margin-top: 10px;
}

/* ─────────────────────────────────────────
   Client Status Badges
───────────────────────────────────────── */
.client-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 0 0 10px;
}

.client-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: var(--radius-pill);
  padding: 2px 9px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.client-badge.stage {
  color: var(--cream);
  background: var(--charcoal);
}

.client-badge.internal {
  color: var(--cream);
  background: #3c4b50;
}

.client-badge.public {
  color: var(--charcoal);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line-strong);
}

.client-badge.priority {
  color: var(--cream);
  background: #4f6b4d;
}

.client-badge.priority.soon {
  color: var(--charcoal);
  background: #efd98f;
}

.client-badge.priority.urgent,
.client-badge.priority.overdue {
  color: var(--cream);
  background: #9a3e2f;
}

.client-badge.order {
  color: var(--charcoal);
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--line-strong);
}

.client-badge.payment {
  color: var(--cream);
  background: var(--brown);
}

.client-badge.appointment {
  color: var(--charcoal);
  background: rgba(224, 211, 184, 0.75);
  border: 1px solid var(--sand-mid);
}

.client-badge.event {
  color: var(--cream);
  background: #8b6f47;
}

.client-badge.delivery {
  color: var(--brown-dark);
  background: var(--sand);
  border: 1px solid var(--sand-mid);
}

.client-card.priority-urgent,
.client-card.priority-overdue,
.agenda-card.priority-urgent,
.agenda-card.priority-overdue,
.scan-card.priority-urgent,
.scan-card.priority-overdue {
  border-color: rgba(154, 62, 47, 0.5);
}

.client-card.priority-soon,
.agenda-card.priority-soon,
.scan-card.priority-soon {
  border-color: rgba(139, 111, 71, 0.42);
}

/* ─────────────────────────────────────────
   Fabric module (inventory view)
───────────────────────────────────────── */
.module-panel {
  max-width: 1440px;
  margin: 0 auto;
}

.fabric-grid-module {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  max-height: none;
}

/* ─────────────────────────────────────────
   Invoice
───────────────────────────────────────── */
/* ─── Invoice: two-view layout ─── */
#invoiceListView,
#invoiceEditorView {
  width: 100%;
}
#invoiceListView.hidden,
#invoiceEditorView.hidden {
  display: none;
}

/* Editor topbar */
.invoice-editor-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0 20px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
}
.invoice-editor-topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}
.invoice-editor-topbar-right .inline-status {
  margin: 0;
  font-size: 0.82rem;
}

/* Editor split: form (left) + preview (right) */
.invoice-editor-split {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) minmax(420px, 1fr);
  gap: 24px;
  align-items: start;
}

/* Invoice list: readable but not edge-to-edge on ultra-wide screens */
#invoiceListView #invoicesDirectorySection {
  max-width: 1100px;
}

.invoice-filter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.invoice-filter-grid label {
  margin-bottom: 0;
}

/* ════════════════════════════════════════
   INVOICE PREVIEW HEADER + FORMAT TOGGLE
════════════════════════════════════════ */
.invoice-preview-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.invoice-format-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.invoice-format-toggle {
  display: flex;
  background: rgba(236, 226, 204, 0.5);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 3px;
  gap: 2px;
}

.fmt-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  border: none;
  border-radius: var(--radius-pill);
  padding: 0 14px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.fmt-btn:hover { color: var(--brown); }

.fmt-btn.active {
  color: var(--charcoal);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

/* ════════════════════════════════════════
   INVOICE PREVIEW CONTAINER
════════════════════════════════════════ */
.invoice-preview {
  min-height: 500px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 32px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  overflow: auto;
}

.invoice-preview.empty {
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.7);
}

.invoice-preview.format-ticket {
  padding: 24px;
  display: flex;
  justify-content: center;
}

/* ════════════════════════════════════════
   SHARED invoice-paper
════════════════════════════════════════ */
.invoice-paper {
  color: var(--ink);
  font-family: Montserrat, sans-serif;
}

.text-right { text-align: right !important; }

/* ════════════════════════════════════════
   FACTURA DETALLADA (A4)
════════════════════════════════════════ */
.invoice-detailed {
  max-width: 780px;
  margin: 0 auto;
}

/* Header */
.invoice-detailed .invoice-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  border-bottom: 2px solid var(--sand);
  padding-bottom: 20px;
  margin-bottom: 24px;
}

.invoice-detailed .invoice-header img {
  width: 200px;
  height: auto;
  object-fit: contain;
}

.invoice-header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.invoice-number {
  font-family: Cormorant, serif !important;
  font-size: 30px !important;
  color: var(--charcoal) !important;
}

.invoice-status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: var(--radius-pill);
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.invoice-status-badge.status-draft { background: var(--sand); color: var(--brown); }
.invoice-status-badge.status-sent  { background: #d4edda; color: #2e7d32; }

.invoice-date {
  color: var(--muted);
  font-size: 12px;
}

/* Parties */
.invoice-parties {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  border-bottom: 1.5px solid var(--line);
  padding-bottom: 20px;
  margin-bottom: 20px;
}

.invoice-party-label {
  margin: 0 0 6px;
  color: var(--brown);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.invoice-party-name {
  display: block;
  font-family: Cormorant, serif;
  font-size: 24px;
  margin-bottom: 6px;
}

.invoice-party p {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.invoice-party-right {
  text-align: right;
}

.invoice-party-right p { margin: 0 0 4px; }

.invoice-event { font-style: italic; }

.invoice-delivery {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px !important;
  padding: 3px 9px;
  background: var(--sand);
  border-radius: var(--radius-pill);
  font-size: 12px !important;
  color: var(--brown) !important;
}

.invoice-option-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 8px !important;
  padding: 3px 12px;
  background: var(--charcoal);
  color: var(--cream) !important;
  border-radius: var(--radius-pill);
  font-size: 12px !important;
  font-weight: 700 !important;
}

/* Garment specs inline */
.invoice-garment-specs {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 6px 0 0 !important;
}

.invoice-garment-specs span {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: var(--radius-pill);
  padding: 2px 8px;
  background: rgba(116, 93, 74, 0.1);
  color: var(--brown) !important;
  font-size: 11px;
  font-weight: 700;
  font-style: normal;
}

/* Lines table */
.invoice-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
  font-size: 13px;
}

.invoice-table thead {
  background: rgba(236, 226, 204, 0.4);
}

.invoice-table th {
  padding: 10px 12px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: left;
  border-bottom: 1.5px solid var(--sand);
}

.invoice-table td {
  padding: 11px 12px;
  border-bottom: 1px solid rgba(116, 93, 74, 0.1);
  font-size: 13px;
  vertical-align: middle;
}

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

/* Fabrics section */
.invoice-fabrics {
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  overflow: hidden;
}

.invoice-section-label {
  margin: 0;
  padding: 9px 14px;
  background: rgba(236, 226, 204, 0.45);
  border-bottom: 1.5px solid var(--line);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--brown);
}

.invoice-fabrics-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.invoice-fabrics-table th {
  padding: 8px 12px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.invoice-fabrics-table td {
  padding: 9px 12px;
  border-bottom: 1px solid rgba(116, 93, 74, 0.08);
  vertical-align: middle;
}

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

.fabric-name-cell {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 600;
}

.fabric-code {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--sand);
  color: var(--brown-dark);
  font-family: 'Courier New', monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.fabric-tag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: var(--radius-pill);
  padding: 2px 8px;
  background: rgba(161, 129, 103, 0.12);
  color: var(--taupe);
  font-size: 11px;
  font-weight: 600;
  margin-right: 4px;
}

/* Totals block */
.invoice-totals-block {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 7px;
  margin-bottom: 20px;
}

.totals-row {
  display: grid;
  grid-template-columns: 180px 120px;
  gap: 16px;
  align-items: center;
  font-size: 13px;
}

.totals-row span { color: var(--muted); }
.totals-row strong { text-align: right; }
.totals-row strong.discount { color: #2e7d32; }

.totals-row.grand-total {
  border-top: 2px solid var(--sand);
  padding-top: 10px;
  font-size: 17px;
  font-weight: 700;
}

.totals-row.grand-total span { color: var(--charcoal); font-weight: 700; }

/* Notes */
.invoice-notes {
  border-top: 1px solid var(--line);
  margin: 20px 0 0;
  padding-top: 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

/* Footer */
.invoice-footer {
  display: flex;
  justify-content: center;
  gap: 28px;
  flex-wrap: wrap;
  border-top: 1.5px solid var(--sand);
  margin-top: 32px;
  padding-top: 16px;
  color: var(--taupe);
  font-size: 11px;
  text-align: center;
}

/* ════════════════════════════════════════
   TICKET SIMPLIFICADO
════════════════════════════════════════ */
.invoice-ticket {
  width: 100%;
  max-width: 320px;
  font-size: 13px;
  line-height: 1.5;
}

.ticket-header {
  text-align: center;
  margin-bottom: 14px;
}

.ticket-logo {
  width: 160px;
  height: auto;
  display: block;
  margin: 0 auto 8px;
  object-fit: contain;
}

.ticket-address {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 11px;
}

.ticket-rule {
  border: none;
  border-top: 1.5px solid var(--ink);
  margin: 12px 0;
}

.ticket-rule.dashed {
  border-top-style: dashed;
  border-color: var(--taupe-light);
}

.ticket-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}

.ticket-number {
  font-family: Cormorant, serif;
  font-size: 16px;
  font-weight: 700;
}

.ticket-date {
  color: var(--muted);
  font-size: 12px;
}

.ticket-client {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 2px 0;
}

.ticket-client strong {
  font-size: 15px;
  font-family: Cormorant, serif;
}

.ticket-client span {
  color: var(--muted);
  font-size: 12px;
}

.ticket-lines-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.ticket-line td {
  padding: 5px 0;
  border-bottom: 1px solid rgba(116, 93, 74, 0.1);
  vertical-align: top;
}

.ticket-line td:last-child { border-bottom: none; }

.ticket-amount {
  text-align: right;
  white-space: nowrap;
  font-weight: 700;
  padding-left: 10px !important;
}

.ticket-section {
  margin: 10px 0;
}

.ticket-section-title {
  margin: 0 0 5px;
  color: var(--brown);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.ticket-fabric-line {
  margin: 0 0 3px;
  font-size: 12px;
  color: var(--ink);
}

.ticket-totals {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ticket-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.ticket-total-row.muted span { color: var(--muted); font-size: 12px; }

.ticket-total-row.total-line {
  font-size: 17px;
  font-weight: 700;
  padding-top: 6px;
  margin-top: 2px;
  border-top: 2px solid var(--ink);
}

.ticket-notes {
  margin: 10px 0 6px;
  padding: 8px;
  background: rgba(236, 226, 204, 0.5);
  border-radius: 4px;
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
}

.ticket-thanks {
  text-align: center;
  margin: 12px 0 0;
  font-family: Cormorant, serif;
  font-size: 16px;
  color: var(--brown);
}

/* ════════════════════════════════════════
   PRINT MEDIA
════════════════════════════════════════ */
@media print {
  .invoice-detailed {
    max-width: none;
    font-size: 12px;
  }

  .invoice-ticket {
    max-width: 72mm;
    font-size: 11px;
  }

  .invoice-footer { margin-top: 18px; padding-top: 10px; }
  .invoice-status-badge, .invoice-option-badge, .invoice-garment-specs span,
  .fabric-code, .fabric-tag, .client-badge { -webkit-print-color-adjust: exact; print-color-adjust: exact; }

  .print-reference-grid img,
  .print-option-img-item img { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ─────────────────────────────────────────
   Collapsible Field Sections
───────────────────────────────────────── */
.field-details {
  margin-bottom: 16px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(236, 226, 204, 0.25);
  transition: border-color var(--transition);
}

.field-details:focus-within {
  border-color: var(--taupe-light);
}

.field-details summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  list-style: none;
  user-select: none;
  color: var(--ink);
}

.field-details summary::-webkit-details-marker { display: none; }

.field-details summary::before {
  content: "▶";
  font-size: 9px;
  color: var(--taupe);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.field-details[open] summary::before {
  transform: rotate(90deg);
}

.field-details summary small {
  color: var(--taupe);
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  font-size: 12px;
}

.field-details > *:not(summary) {
  padding: 0 14px 14px;
}

/* ─────────────────────────────────────────
   Production Stage Track
───────────────────────────────────────── */
.stage-track {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.stage-option {
  display: flex;
  align-items: center;
  margin: 0;
  cursor: pointer;
}

.stage-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  min-height: 0;
  pointer-events: none;
}

.stage-option span {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  border: 1.5px solid rgba(116, 93, 74, 0.25);
  border-radius: var(--radius-pill);
  padding: 0 14px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.7);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: all var(--transition);
}

.stage-option:hover span {
  border-color: var(--brown);
  color: var(--brown);
  background: rgba(116, 93, 74, 0.06);
}

.stage-option input[type="radio"]:checked + span {
  color: var(--cream);
  background: var(--charcoal);
  border-color: var(--charcoal);
  box-shadow: 0 2px 8px rgba(30, 33, 34, 0.2);
}

/* ─────────────────────────────────────────
   Measurements Section
───────────────────────────────────────── */
.measurements-section { padding-top: 4px; }

.measurements-label {
  margin: 12px 0 8px;
  color: var(--brown);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.measurements-label:first-child { margin-top: 0; }

.measurements-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.measurements-grid label {
  margin-bottom: 0;
  font-size: 11px;
  letter-spacing: 0.02em;
}

.measure-input {
  min-height: 38px !important;
  padding: 7px 10px !important;
  font-size: 13px !important;
  text-align: center;
}

.measure-history-panel {
  border-top: 1.5px solid var(--line);
  margin-top: 18px;
  padding-top: 16px;
}

.measurement-history-list {
  display: grid;
  gap: 8px;
}

.measurement-history-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px;
  background: rgba(255, 255, 255, 0.76);
}

.measurement-history-card strong,
.measurement-history-card span {
  display: block;
}

.measurement-history-card strong {
  font-size: 12px;
}

.measurement-history-card span {
  color: var(--muted);
  font-size: 11px;
}

/* ─────────────────────────────────────────
   Image Dialog
───────────────────────────────────────── */
.image-dialog {
  width: min(96vw, 1500px);
  max-width: none;
  border: 0;
  border-radius: var(--radius-lg);
  padding: 0;
  background: transparent;
  box-shadow: 0 32px 80px rgba(0,0,0,0.5);
}

.image-dialog::backdrop {
  background: rgba(10, 10, 10, 0.88);
  backdrop-filter: blur(4px);
}

.image-dialog img {
  width: 100%;
  max-height: 92vh;
  object-fit: contain;
  border-radius: var(--radius-lg);
  background: var(--charcoal);
  display: block;
}

.dialog-close {
  position: fixed;
  top: 20px;
  right: 24px;
  z-index: 2;
  width: 44px;
  height: 44px;
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius-pill);
  color: rgba(255, 255, 255, 0.9);
  background: rgba(30, 33, 34, 0.85);
  backdrop-filter: blur(8px);
  font-size: 24px;
  line-height: 1;
  transition: all var(--transition);
}

.dialog-close:hover {
  background: rgba(30, 33, 34, 0.98);
  border-color: rgba(255, 255, 255, 0.4);
}

/* ─────────────────────────────────────────
   Login
───────────────────────────────────────── */
body.login-page {
  min-height: 100vh;
  overflow-x: hidden;
  background: #fbfbfc;
  color: #111827;
}

.login-page::before,
.login-page::after {
  display: none;
}

.login-shell {
  min-height: 100vh;
  position: relative;
  background: #fbfbfc;
}

.login-status {
  position: fixed;
  top: 47px;
  right: 64px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 18px;
  color: #7a828f;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.login-status-icon {
  width: 30px;
  height: 30px;
  color: #2d3748;
}

.login-status-separator {
  width: 1px;
  height: 34px;
  background: #e2e5ea;
}

.login-status-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #03b437;
  box-shadow: 0 0 0 4px rgba(3, 180, 55, 0.08);
}

.login-container {
  min-height: 100vh;
  width: 100%;
  display: grid;
  grid-template-columns: minmax(360px, 35.55vw) minmax(0, 1fr);
  background: #fbfbfc;
}

.login-branding {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 42px 48px 54px;
  color: #f6c21a;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.04), rgba(0, 0, 0, 0.16)),
    radial-gradient(circle at 50% 7%, rgba(27, 77, 93, 0.42), transparent 36%),
    linear-gradient(135deg, #041721 0%, #061c27 52%, #04141d 100%);
}

.login-branding::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.36;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 58px 58px;
}

.login-branding::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 36%, rgba(255, 255, 255, 0.03), transparent 30%),
    radial-gradient(circle at 50% 77%, rgba(246, 194, 26, 0.1), transparent 44%);
  pointer-events: none;
}

.branding-content {
  position: relative;
  z-index: 1;
  width: min(520px, 100%);
  text-align: center;
  transform: translateY(58px);
}

.branding-logo {
  width: clamp(92px, 6.4vw, 128px);
  height: clamp(92px, 6.4vw, 128px);
  display: block;
  margin: 0 auto 24px;
}

.branding-title {
  margin: 0;
  color: #f6c21a;
  font-family: Cormorant, Georgia, serif;
  font-size: clamp(42px, 2.72vw, 58px);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: 0;
  white-space: nowrap;
}

.branding-divider {
  width: min(280px, 72%);
  height: 25px;
  display: flex;
  align-items: center;
  gap: 15px;
  margin: 29px auto 27px;
  color: #f6c21a;
}

.branding-divider::before,
.branding-divider::after {
  content: "";
  height: 2px;
  flex: 1;
  background: linear-gradient(90deg, transparent, currentColor);
  opacity: 0.72;
}

.branding-divider::after {
  background: linear-gradient(90deg, currentColor, transparent);
}

.branding-divider span {
  width: 18px;
  height: 18px;
  border: 3px solid currentColor;
  transform: rotate(45deg);
}

.branding-subtitle {
  margin: 0;
  color: rgba(236, 241, 247, 0.76);
  font-size: clamp(17px, 1.16vw, 23px);
  font-weight: 700;
  line-height: 1.62;
  letter-spacing: 0.34em;
}

.branding-decorative {
  width: min(490px, 88%);
  height: auto;
  display: block;
  margin: clamp(40px, 5.2vh, 64px) auto clamp(44px, 5.8vh, 72px);
  opacity: 0.72;
}

.branding-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin: 0;
  color: rgba(246, 194, 26, 0.82);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(15px, 1.05vw, 21px);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.branding-footer::before {
  content: "///";
  color: rgba(246, 194, 26, 0.84);
  font-family: Montserrat, sans-serif;
  font-size: 15px;
  letter-spacing: -0.22em;
  transform: rotate(-18deg);
}

.branding-footer span {
  width: clamp(56px, 4.6vw, 90px);
  height: 2px;
  background: linear-gradient(90deg, transparent, currentColor);
  opacity: 0.54;
}

.branding-footer span:last-child {
  background: linear-gradient(90deg, currentColor, transparent);
}

.login-form-area {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 136px 56px 82px;
}

.login-card {
  width: min(700px, 100%);
  padding: 50px 42px 42px;
  border: 1px solid #e7e9ed;
  border-radius: 19px;
  background: #fff;
  color: #101828;
  box-shadow:
    0 26px 45px rgba(17, 24, 39, 0.08),
    0 4px 14px rgba(17, 24, 39, 0.05);
}

.form-header {
  margin-bottom: 43px;
  text-align: center;
}

.form-logo-badge {
  width: 118px;
  height: 118px;
  display: grid;
  place-items: center;
  margin: 0 auto 27px;
  border-radius: 50%;
  background: #fff4e4;
}

.form-logo {
  width: 68px;
  height: 68px;
  display: block;
}

.form-title {
  margin: 0 0 13px;
  color: #111827;
  font-family: Cormorant, Georgia, serif;
  font-size: clamp(38px, 2.25vw, 48px);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: 0;
}

.form-subtitle {
  margin: 0;
  color: #8a94a3;
  font-size: clamp(17px, 1.02vw, 21px);
  font-weight: 600;
  line-height: 1.45;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.form-group {
  margin-bottom: 29px;
}

.input-shell {
  position: relative;
  height: 68px;
  display: flex;
  align-items: center;
  color: #667085;
  border: 2px solid #edf0f3;
  border-radius: 11px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.03);
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.input-shell:focus-within {
  border-color: #d78410;
  box-shadow: 0 0 0 4px rgba(215, 132, 16, 0.1);
}

.input-shell > svg {
  position: absolute;
  left: 23px;
  width: 25px;
  height: 25px;
  color: #667085;
}

.input-shell input {
  width: 100%;
  height: 100%;
  border: 0;
  outline: 0;
  padding: 0 22px 0 68px;
  color: #101828;
  background: transparent;
  font-size: 18px;
  font-weight: 600;
}

.input-shell input::placeholder {
  color: #8993a2;
  opacity: 1;
}

.input-shell:has(.password-toggle) input {
  padding-right: 66px;
}

.password-toggle {
  position: absolute;
  right: 21px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: #596273;
  border-radius: 6px;
}

.password-toggle:hover,
.password-toggle:focus-visible {
  color: #d78410;
  outline: none;
  background: rgba(215, 132, 16, 0.08);
}

.form-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 0 0 32px;
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 0;
  color: #2d3748;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  text-transform: none;
  cursor: pointer;
  user-select: none;
}

.checkbox span {
  text-transform: none;
}

.checkbox input {
  width: 26px;
  height: 26px;
  appearance: none;
  display: grid;
  place-content: center;
  margin: 0;
  border: 2px solid #d7dce3;
  border-radius: 7px;
  background: #fff;
  cursor: pointer;
}

.checkbox input::before {
  content: "";
  width: 12px;
  height: 12px;
  transform: scale(0);
  border-radius: 3px;
  background: #d17800;
  transition: transform var(--transition);
}

.checkbox input:checked {
  border-color: #d17800;
}

.checkbox input:checked::before {
  transform: scale(1);
}

.forgot-password {
  color: #d17800;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  transition: color var(--transition);
}

.forgot-password:hover,
.forgot-password:focus-visible {
  color: #a95f00;
  outline: none;
}

.login-card .primary-button {
  width: 100%;
  min-height: 64px;
  margin: 0;
  padding: 0 18px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(180deg, #d88100 0%, #c97500 100%);
  color: #fff;
  font-size: 21px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
  text-transform: none;
  box-shadow: 0 10px 18px rgba(201, 117, 0, 0.18);
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
}

.login-card .primary-button:hover,
.login-card .primary-button:focus-visible {
  transform: translateY(-1px);
  background: linear-gradient(180deg, #e08b0a 0%, #c97500 100%);
  box-shadow: 0 12px 22px rgba(201, 117, 0, 0.24);
  outline: none;
}

.login-card .primary-button:active {
  transform: translateY(0);
}

.form-divider {
  display: flex;
  align-items: center;
  gap: 26px;
  margin: 34px 0 24px;
  color: #e2962c;
}

.form-divider span {
  height: 1px;
  flex: 1;
  background: #edf0f3;
}

.form-divider svg {
  flex: 0 0 auto;
}

.form-footer {
  margin: 0;
  color: #8a94a3;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.45;
  text-align: center;
}

.login-card .status-line.error {
  margin: -8px 0 22px;
  padding: 13px 16px;
  color: #b42318 !important;
  background: #fff4f3;
  border: 1px solid #fecdca;
  border-radius: 9px;
  font-size: 15px;
  font-weight: 700;
}

@media (max-width: 1280px) {
  .login-status {
    top: 30px;
    right: 34px;
    font-size: 15px;
    gap: 13px;
  }

  .login-status-icon {
    width: 25px;
    height: 25px;
  }

  .login-form-area {
    padding: 112px 36px 64px;
  }

  .login-card {
    width: min(620px, 100%);
  }

  .form-logo-badge {
    width: 104px;
    height: 104px;
  }
}

@media (max-width: 900px) {
  .login-status {
    position: absolute;
    top: 18px;
    right: 20px;
  }

  .login-container {
    grid-template-columns: 1fr;
  }

  .login-branding {
    min-height: 430px;
    padding: 72px 26px 46px;
  }

  .branding-content {
    transform: none;
  }

  .branding-decorative {
    width: min(360px, 86%);
    margin: 30px auto 36px;
  }

  .login-form-area {
    min-height: auto;
    padding: 48px 22px 56px;
  }
}

@media (max-width: 560px) {
  .login-status {
    left: 18px;
    right: 18px;
    justify-content: center;
    gap: 9px;
    font-size: 12px;
  }

  .login-status-icon {
    width: 20px;
    height: 20px;
  }

  .login-status-separator {
    height: 22px;
  }

  .login-status-dot {
    width: 10px;
    height: 10px;
  }

  .login-branding {
    min-height: 390px;
  }

  .branding-logo {
    margin-bottom: 16px;
  }

  .branding-divider {
    margin: 20px auto 18px;
  }

  .branding-subtitle {
    letter-spacing: 0.22em;
  }

  .branding-decorative {
    display: none;
  }

  .branding-footer {
    margin-top: 36px;
    gap: 10px;
    font-size: 13px;
  }

  .branding-footer span {
    width: 36px;
  }

  .login-card {
    padding: 34px 20px 30px;
    border-radius: 15px;
  }

  .form-header {
    margin-bottom: 30px;
  }

  .form-logo-badge {
    width: 88px;
    height: 88px;
    margin-bottom: 20px;
  }

  .form-logo {
    width: 54px;
    height: 54px;
  }

  .input-shell {
    height: 60px;
  }

  .input-shell input {
    font-size: 16px;
  }

  .form-options {
    align-items: flex-start;
    flex-direction: column;
  }

  .forgot-password {
    align-self: flex-end;
  }
}

/* ─────────────────────────────────────────
   Portal cliente / etiquetas
───────────────────────────────────────── */
.portal-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.portal-card {
  width: min(720px, 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  background: var(--panel-bg);
  box-shadow: var(--shadow);
}

.portal-card > img {
  width: 220px;
  max-width: 100%;
  margin-bottom: 24px;
}

.portal-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-top: 20px;
}

.portal-form label {
  margin-bottom: 0;
}

.portal-result {
  display: grid;
  gap: 18px;
  border-top: 1.5px solid var(--line);
  margin-top: 24px;
  padding-top: 20px;
}

.portal-orders {
  display: grid;
  gap: 10px;
}

.portal-order {
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px;
  background: rgba(255, 255, 255, 0.74);
}

.portal-order strong,
.portal-order span {
  display: block;
}

.portal-order strong {
  font-family: Cormorant, serif;
  font-size: 24px;
}

.portal-order span {
  color: var(--brown);
  font-weight: 700;
}

.portal-order p {
  margin: 6px 0 0;
  color: var(--muted);
}

.label-page {
  background: #fff;
}

.label-page::before,
.label-page::after {
  display: none;
}

.order-label {
  width: min(720px, calc(100vw - 32px));
  margin: 24px auto;
  border: 1.5px solid #111;
  border-radius: 8px;
  padding: 22px;
  color: #111;
  background: #fff;
}

.order-label header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid #ddd;
  padding-bottom: 14px;
  margin-bottom: 18px;
}

.order-label header img {
  width: 210px;
}

.barcode-box {
  display: grid;
  gap: 8px;
  justify-items: center;
  border: 1px solid #111;
  padding: 18px;
  margin: 18px 0;
}

.barcode-svg {
  width: 100%;
  max-width: 560px;
  height: 84px;
}

.barcode-svg rect {
  fill: #111;
}

.order-label dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.order-label dl div,
.label-notes {
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 10px;
}

.order-label dt {
  color: #666;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.order-label dd {
  margin: 4px 0 0;
  font-weight: 700;
}

.label-notes {
  margin-top: 12px;
}

.order-print-page {
  color: #111;
  background: #f4f4f4;
  font-size: 12px;
  line-height: 1.38;
}

.order-print-page::before,
.order-print-page::after {
  display: none;
}

.print-toolbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  padding: 14px 20px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid #ddd;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.05);
}

.print-toolbar strong {
  flex: 1 1 220px;
  font-size: 20px;
}

.order-print-sheet {
  width: min(1120px, calc(100vw - 24px));
  margin: 22px auto 34px;
  padding: 14px;
  color: #111;
  background: #fff;
  border: 1px solid #cfcfcf;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.08);
}

.order-print-header {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 250px;
  gap: 18px;
  align-items: center;
  padding: 18px;
  border: 1px solid #cfcfcf;
}

.print-brand {
  display: flex;
  gap: 14px;
  align-items: center;
}

.print-brand img {
  width: 64px;
  height: 64px;
  display: block;
  object-fit: contain;
}

.print-brand span {
  display: grid;
  gap: 2px;
}

.print-brand strong {
  font-family: Cormorant, Georgia, serif;
  font-size: 31px;
  line-height: 0.9;
}

.print-brand small {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.order-print-header h1 {
  margin: 0;
  font-family: Montserrat, sans-serif;
  font-size: 27px;
  font-weight: 800;
  line-height: 1.12;
  text-align: center;
  text-transform: uppercase;
}

.order-print-header table,
.print-data-table {
  width: 100%;
  border-collapse: collapse;
}

.print-header-meta {
  display: contents;
}

.print-header-meta .print-order-data {
  grid-column: 1 / -1;
  grid-row: 2;
}

.print-header-meta .print-qr-card {
  grid-column: 3;
  grid-row: 1;
}

.print-qr-card {
  display: grid;
  justify-items: center;
  gap: 5px;
  padding: 8px;
  border: 1px solid #cfcfcf;
  border-radius: 6px;
  background: #fff;
}

.print-qr-card img {
  width: 94px;
  height: 94px;
  display: block;
  image-rendering: pixelated;
}

.print-qr-card a {
  display: grid;
  place-items: center;
  width: 94px;
  height: 94px;
  border: 1px dashed #999;
  color: #111;
  font-weight: 900;
  text-decoration: none;
}

.print-qr-card span {
  color: #777;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
}

.order-print-header th,
.order-print-header td,
.print-data-table th,
.print-data-table td {
  border: 1px solid #cfcfcf;
  padding: 11px 12px;
  vertical-align: top;
}

.order-print-header th,
.print-data-table th {
  width: 42%;
  font-size: 11px;
  font-weight: 800;
  text-align: left;
  text-transform: uppercase;
}

.order-print-header .print-order-data th {
  width: auto;
  padding: 7px 9px;
  text-align: center;
}

.order-print-header .print-order-data td {
  padding: 8px 9px;
  font-weight: 700;
  text-align: center;
}

.order-print-header .print-order-data th:nth-child(3),
.order-print-header .print-order-data td:nth-child(3) {
  width: 34%;
  text-align: left;
}

.print-box {
  margin-top: 14px;
  background: #fff;
  border: 1px solid #cfcfcf;
  break-inside: avoid;
}

.print-box h2 {
  margin: 0;
  padding: 12px 16px;
  border-bottom: 1px solid #cfcfcf;
  font-family: Montserrat, sans-serif;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.1;
  text-transform: uppercase;
}

.print-client-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) 230px;
  min-height: 205px;
}

.print-client-grid dl {
  display: grid;
  align-content: start;
  gap: 16px;
  margin: 0;
  padding: 26px 20px;
  border-right: 1px solid #cfcfcf;
}

.print-client-grid dl div,
.summary-dl div {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  gap: 12px;
}

.print-client-grid dt,
.summary-dl dt {
  font-weight: 800;
}

.print-client-grid dd,
.summary-dl dd {
  margin: 0;
}

.print-client-grid aside {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  padding: 18px;
  text-align: center;
}

.print-client-grid aside strong {
  text-transform: uppercase;
}

.print-client-grid aside img {
  width: 135px;
  height: 145px;
  border-radius: 4px;
  object-fit: cover;
}

.print-client-grid aside span {
  font-size: 11px;
}

.print-silhouette {
  width: 135px;
  height: 145px;
  border-radius: 4px;
  background:
    radial-gradient(circle at 50% 28%, #cfcfcf 0 22px, transparent 23px),
    radial-gradient(ellipse at 50% 88%, #cfcfcf 0 58px, transparent 59px);
}

.morphology-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.morphology-grid article {
  min-height: 275px;
  padding: 24px 28px 18px;
  text-align: center;
  border-right: 1px solid #cfcfcf;
}

.morphology-grid article:last-child {
  border-right: 0;
}

.morphology-grid h3,
.garment-schema h3 {
  margin: 0 0 14px;
  font-family: Montserrat, sans-serif;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.morphology-grid svg {
  width: min(190px, 100%);
  height: 120px;
  margin-bottom: 12px;
}

.morphology-reference-image {
  display: block;
  width: min(220px, 100%);
  height: 140px;
  margin: 0 auto 12px;
  object-fit: contain;
}

.morphology-grid svg {
  display: none;
}

.morphology-grid path,
.garment-schema path {
  fill: none;
  stroke: #222;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.morphology-grid path {
  stroke: #777;
  stroke-width: 1.35;
}

.morphology-grid p {
  width: 150px;
  margin: 4px auto;
  text-align: left;
}

.pantalon-morphology-grid {
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.35fr);
}

.pantalon-morphology-grid article {
  min-height: 310px;
}

.pantalon-morphology-grid svg {
  width: min(260px, 100%);
  height: 155px;
}

.pantalon-morphology-grid .morphology-reference-image {
  width: min(280px, 100%);
  height: 180px;
}

.pantalon-morphology-grid article:nth-child(2) svg {
  width: min(360px, 100%);
}

.pantalon-morphology-grid article:nth-child(2) .morphology-reference-image {
  width: min(390px, 100%);
}

.pantalon-morphology-grid p,
.pantalon-morphology-grid .radio-line {
  width: min(190px, 100%);
}

.pantalon-morphology-grid article:nth-child(2) p,
.pantalon-morphology-grid article:nth-child(2) .radio-line {
  width: min(260px, 100%);
}

.garment-print-grid {
  display: grid;
  grid-template-columns: minmax(250px, 0.75fr) minmax(0, 1.25fr);
  gap: 22px;
  align-items: start;
  padding: 20px;
}

.print-data-table caption {
  padding: 0 0 8px;
  font-weight: 800;
  text-align: left;
  text-transform: uppercase;
}

.print-data-table td {
  font-weight: 600;
}

.garment-schema {
  display: grid;
  justify-items: center;
  min-height: 260px;
  padding-left: 18px;
  border-left: 1px solid #cfcfcf;
  text-align: center;
}

.garment-schema svg {
  width: min(230px, 100%);
  height: 260px;
}

.garment-schema svg {
  display: none;
}

.garment-schema-image {
  display: block;
  width: min(260px, 100%);
  height: 340px;
  border-radius: 4px;
  background: #fff;
  object-fit: contain;
}

.pantalon-garment-schema svg {
  width: min(300px, 100%);
}

.pantalon-garment-schema .garment-schema-image {
  width: min(280px, 100%);
}

.garment-schema .schema-marker {
  fill: #111;
  stroke: none;
}

.garment-schema .schema-marker-text {
  fill: #fff;
  stroke: none;
  font-family: Montserrat, sans-serif;
  font-size: 9px;
  font-weight: 800;
  text-anchor: middle;
  dominant-baseline: central;
}

.garment-schema .schema-guide {
  stroke-width: 1.2;
}

.print-two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.print-two-col .print-box {
  min-height: 185px;
}

.print-box ul,
.print-box p {
  margin: 0;
  padding: 20px 22px;
}

.print-box li + li {
  margin-top: 5px;
}

.print-reference-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(80px, 1fr));
  gap: 14px;
  padding: 18px;
}

.print-reference-grid img,
.more-files {
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 4px;
}

.print-reference-grid img {
  display: block;
  object-fit: cover;
  border: 1px solid #d5d5d5;
}

.client-visual-reference-grid {
  grid-template-columns: repeat(auto-fit, minmax(130px, 190px));
}

.client-visual-reference-grid > .muted-text {
  grid-column: 1 / -1;
  padding: 18px 4px;
}

.print-option-images-section {
  margin-top: 12px;
  border-top: 1px solid #e0e0e0;
  padding-top: 10px;
}

.print-option-images-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #888;
  margin: 0 0 8px;
}

.print-option-images-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.print-option-img-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.print-option-img-item img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid #d5d5d5;
  display: block;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.print-option-img-item span {
  font-size: 0.65rem;
  color: #666;
  text-align: center;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.more-files {
  display: grid;
  place-items: center;
  align-content: center;
  padding: 10px;
  border: 1px dashed #777;
  text-align: center;
  font-weight: 800;
}

.more-files small {
  display: block;
  margin-top: 6px;
  color: #555;
  font-weight: 600;
}

.summary-dl {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 18px 22px 8px;
}

.print-barcode {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 2px 22px 12px;
}

.print-barcode .barcode-svg {
  max-width: 260px;
  height: 46px;
}

.print-barcode span {
  font-size: 10px;
  font-weight: 800;
}

.print-summary-qr {
  margin-top: 6px;
  text-align: center;
}

.print-summary-qr img {
  width: 72px;
  height: 72px;
  border: 1px solid #ddd;
  border-radius: 4px;
  image-rendering: pixelated;
}

.signature-line {
  width: min(320px, 70%);
  margin: 16px auto 18px;
  padding-top: 8px;
  border-top: 1px solid #222;
  text-align: center;
}

.print-footer {
  padding: 18px 0 4px;
  color: #555;
  text-align: center;
}

.order-sheet-form input,
.order-sheet-form select,
.order-sheet-form textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid #d4d4d4;
  border-radius: 3px;
  padding: 7px 8px;
  color: #111;
  background: #fff;
  font-size: 12px;
}

.order-sheet-form .print-data-table input,
.order-sheet-form .summary-dl input,
.order-sheet-form .summary-dl select,
.order-sheet-form .print-client-grid input {
  border-color: transparent;
  padding: 2px 0;
  font-weight: 700;
  line-height: 1.25;
}

.order-sheet-form .print-data-table th,
.order-sheet-form .print-data-table td {
  padding: 8px 10px;
}

.order-sheet-form .print-data-table input::placeholder {
  color: #9c9c9c;
}

.order-sheet-form .print-data-table input:focus,
.order-sheet-form .summary-dl input:focus,
.order-sheet-form .summary-dl select:focus,
.order-sheet-form .print-client-grid input:focus {
  border-color: #b08a4a;
  padding: 2px 6px;
  outline: none;
}

.radio-line {
  display: flex;
  width: 150px;
  gap: 8px;
  align-items: center;
  margin: 4px auto;
  text-align: left;
}

.radio-line input {
  width: auto;
}

.sheet-textarea {
  display: grid;
  gap: 6px;
  margin: 14px 18px 0;
  font-weight: 800;
}

.order-sheet-form textarea {
  display: block;
  margin: 12px 18px 18px;
  width: calc(100% - 36px);
  resize: vertical;
}

.order-type-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

/* ─────────────────────────────────────────
   Editable Order Form
───────────────────────────────────────── */
.order-edit-page {
  min-height: 100vh;
  color: var(--ink);
  background: var(--cream);
}

.order-edit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.order-edit-shell {
  width: auto;
  margin: 0 auto;
}

.order-edit-view {
  display: grid;
  gap: 20px;
}

.order-edit-form {
  display: grid;
  gap: 18px;
}

.order-form-hero {
  display: grid;
  grid-template-columns: minmax(250px, 0.8fr) minmax(0, 1fr) auto;
  gap: 22px;
  align-items: center;
}

.order-form-hero h1 {
  margin: 0;
  font-size: clamp(30px, 4vw, 52px);
  line-height: 0.95;
}

.order-code-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.order-header-fields {
  grid-column: 1 / -1;
  grid-template-columns: minmax(180px, 0.85fr) minmax(160px, 0.75fr) minmax(230px, 1.1fr) minmax(230px, 1.1fr);
  align-items: end;
}

.order-header-fields .order-client-name-field {
  grid-column: span 2;
}

.order-edit-form input[readonly],
.order-edit-form select:disabled {
  color: #777;
  background-color: #eeeeec;
  border-color: #d8d8d4;
  cursor: not-allowed;
  opacity: 1;
}

.order-qr-card {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-width: 210px;
  justify-self: end;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
}

.order-qr-card img {
  width: 74px;
  height: 74px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.order-qr-card strong,
.order-qr-card small {
  display: block;
}

.order-qr-card small {
  margin-top: 3px;
  color: var(--muted);
}

.qr-order-view {
  display: grid;
  gap: 20px;
}

.qr-order-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.42fr);
  gap: 18px;
  align-items: start;
}

.qr-summary-panel,
.qr-notes-panel {
  grid-column: 1 / -1;
}

.qr-summary-grid input[readonly] {
  color: var(--ink);
  background: var(--cream);
}

.qr-action-panel,
.qr-upload-panel,
.qr-notes-panel {
  display: grid;
  gap: 14px;
}

.qr-upload-form {
  display: grid;
  gap: 10px;
}

.order-form-section {
  display: grid;
  gap: 18px;
}

.order-collapsible-section > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 0;
  cursor: pointer;
  list-style: none;
}

.order-collapsible-section > summary::-webkit-details-marker { display: none; }

.order-collapsible-section > summary > span:first-child {
  display: grid;
  gap: 2px;
}

.order-collapsible-section > summary strong {
  font-family: Cormorant, serif;
  font-size: clamp(26px, 3vw, 38px);
  line-height: 1;
}

.order-collapse-label::after {
  content: "Mostrar";
  color: var(--brown);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.order-collapsible-section[open] .order-collapse-label::after { content: "Ocultar"; }

.order-collapsible-section[open] > summary { margin-bottom: 4px; }

.order-client-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
}

.order-form-fields,
.order-garment-editor > div {
  display: grid;
  gap: 14px;
}

.order-photo-field {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 10px;
  min-height: 240px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px;
  background: rgba(255, 255, 255, 0.72);
  text-align: center;
}

.order-photo-field strong {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.order-photo-field img,
.order-photo-field .print-silhouette {
  width: 128px;
  height: 146px;
  border-radius: 6px;
  object-fit: cover;
}

.order-photo-field input[type="file"] {
  display: none;
}

.order-photo-field span {
  color: var(--muted);
  font-size: 11px;
}

.order-client-media-field {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 240px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px;
  background: rgba(255, 255, 255, 0.72);
  text-align: center;
}

.order-client-media-field > strong {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.order-client-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.order-client-media-grid img,
.order-client-media-grid video,
.order-client-media-grid .print-silhouette {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 6px;
  background: var(--sand);
  object-fit: cover;
}

.order-client-media-grid > .muted-text {
  grid-column: 1 / -1;
  margin: 0;
  padding: 28px 16px;
}

.order-client-media-grid .print-silhouette {
  grid-column: 1 / -1;
  width: 128px;
  height: 146px;
  margin-inline: auto;
}

.order-client-media-field > span {
  color: var(--muted);
  font-size: 11px;
}

.editable-morphology-grid {
  overflow: hidden;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.64);
}

.editable-morphology-grid article {
  background: rgba(255, 255, 255, 0.5);
}

.editable-morphology-grid .radio-line {
  width: min(190px, 100%);
}

.order-garment-editor {
  display: grid;
  grid-template-columns: minmax(240px, 0.75fr) minmax(360px, 1.25fr);
  gap: 20px;
  align-items: start;
}

.suit-order-sections {
  display: grid;
  gap: 18px;
}

.suit-order-block {
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 18px;
  background: rgba(255, 255, 255, 0.58);
}

.suit-order-editor {
  margin-top: 14px;
}

.suit-order-notes {
  display: grid;
  gap: 7px;
  margin-top: 16px;
}

.suit-order-notes > span {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.suit-order-notes textarea {
  min-height: 108px;
  resize: vertical;
}

.suit-order-editor .garment-schema-image {
  max-height: 300px;
}

.order-garment-editor h3 {
  margin: 0 0 12px;
  font-size: 13px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.compact-field-grid {
  gap: 10px;
}

.compact-field-grid label {
  font-size: 10px;
}

.editable-garment-schema {
  min-height: 100%;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 18px;
  background: rgba(255, 255, 255, 0.62);
}

.editable-garment-schema svg {
  height: 300px;
}

.editable-reference-grid {
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.58);
}

.order-client-reference {
  display: grid;
  align-content: start;
  gap: 5px;
  min-width: 0;
}

.order-client-reference img,
.order-client-reference video {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  border: 1px solid #d5d5d5;
  border-radius: 4px;
  background: var(--sand);
  object-fit: cover;
}

.order-client-reference span {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-files-upload {
  min-height: 100%;
  color: var(--ink);
  cursor: pointer;
  transition: all var(--transition);
}

.order-files-upload:hover {
  border-color: var(--brown);
  background: rgba(255, 255, 255, 0.82);
}

.order-files-upload input {
  display: none;
}

.order-edit-actions {
  justify-self: end;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(12px);
}

/* ─────────────────────────────────────────
   Print
───────────────────────────────────────── */
@media print {
  @page {
    size: A4 portrait;
    margin: 7mm;
  }

  body::before,
  body::after,
  .topbar,
  .site-header,
  .section-subnav,
  .agenda-dashboard,
  .calendar-panel,
  .day-agenda-panel,
  .invoice-builder,
  .clients-section,
  .panel-title .result-meta,
  .dialog-close,
  .no-print {
    display: none !important;
  }

  .label-page {
    background: #fff !important;
  }

  .label-page .order-label {
    width: auto;
    margin: 0;
    box-shadow: none;
  }

  .order-print-page {
    background: #fff !important;
    font-size: 9.5px;
  }

  .order-print-sheet {
    width: auto;
    margin: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
  }

  .order-print-header {
    padding: 10px;
    grid-template-columns: 220px 1fr 145px;
    gap: 10px;
  }

  .order-print-header h1 {
    font-size: 20px;
  }

  .print-header-meta {
    gap: 6px;
  }

  .print-qr-card {
    gap: 3px;
    padding: 5px;
    break-inside: avoid;
  }

  .print-qr-card img,
  .print-qr-card a {
    width: 76px;
    height: 76px;
  }

  .print-qr-card span {
    font-size: 7px;
  }

  .print-brand img {
    width: 52px;
    height: 52px;
  }

  .print-brand strong {
    font-size: 24px;
  }

  .print-box {
    margin-top: 8px;
  }

  .print-box h2 {
    padding: 8px 10px;
    font-size: 12px;
  }

  .print-client-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) 165px;
    min-height: 145px;
  }

  .print-client-grid dl {
    gap: 8px;
    padding: 14px 10px;
  }

  .print-client-grid dl div,
  .summary-dl div {
    grid-template-columns: 80px minmax(0, 1fr);
    gap: 6px;
  }

  .print-client-grid aside {
    padding: 10px;
  }

  .print-client-grid aside img,
  .print-silhouette {
    width: 92px;
    height: 100px;
  }

  .morphology-grid article {
    min-height: 190px;
    padding: 12px 18px;
  }

  .morphology-grid svg {
    height: 80px;
  }

  .garment-print-grid {
    grid-template-columns: minmax(210px, 0.75fr) minmax(0, 1.25fr);
    gap: 12px;
    padding: 12px;
  }

  .garment-schema {
    min-height: 205px;
  }

  .garment-schema svg {
    height: 200px;
  }

  .print-two-col {
    gap: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .print-two-col .print-box {
    min-height: 140px;
  }

  .print-barcode img {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .print-box ul,
  .print-box p {
    padding: 10px 14px;
  }

  .print-reference-grid {
    gap: 8px;
    padding: 10px;
  }

  .summary-dl {
    padding: 10px 14px 4px;
  }

  .print-barcode .barcode-svg {
    max-width: 190px;
    height: 32px;
  }

  .signature-line {
    margin-top: 8px;
    margin-bottom: 8px;
  }

  .app-shell { max-width: none; padding: 0; }
  .view-section { display: none !important; }
  [data-view-section="facturas"] { display: block !important; }
  .invoice-editor-split { display: block; }

  .panel,
  .invoice-preview {
    border: 0;
    box-shadow: none;
    padding: 0;
  }
}

/* ─────────────────────────────────────────
   Responsive — 1260px
───────────────────────────────────────── */
@media (max-width: 1260px) {
  .workspace {
    grid-template-columns: 1fr 1fr;
  }

  .ai-generation-layout {
    grid-template-columns: 1fr;
  }

  .result-panel {
    grid-column: 1 / -1;
  }

  .clients-list,
  .fabric-grid-module {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .client-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .view-section[data-view-section="clientes"] #clientsDirectorySection .client-filter-grid,
  .view-section[data-view-section="asesoria"] #clientsDirectorySection .client-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .agenda-layout,
  .queue-grid {
    grid-template-columns: 1fr;
  }

  .agenda-dashboard {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-grid,
  .dashboard-week-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-layout,
  .dashboard-bottom-grid,
  .view-section[data-view-section="asesoria"].active {
    grid-template-columns: 1fr;
  }

  .view-section[data-view-section="asesoria"] > #clientsDirectorySection,
  .view-section[data-view-section="asesoria"] > .workspace,
  .view-section[data-view-section="asesoria"] > #clientHistorySection {
    grid-column: 1;
    grid-row: auto;
    position: static;
    max-height: none;
  }

  .invoice-editor-split {
    grid-template-columns: 1fr;
  }

  .order-form-hero,
  .order-client-layout,
  .order-garment-editor {
    grid-template-columns: 1fr;
  }

  .order-header-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .order-qr-card {
    justify-self: start;
  }
}

/* ─────────────────────────────────────────
   Responsive — 820px
───────────────────────────────────────── */
@media (max-width: 820px) {
  .order-edit-actions {
    justify-content: flex-start;
  }

  .order-edit-shell {
    width: auto;
  }

  .field-grid.four {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .topbar {
    display: none;
  }

  .header-inner {
    height: auto;
    flex-direction: column;
    gap: 12px;
    padding: 16px 18px 18px;
  }

  .brand-logo { width: min(200px, 72vw); }

  .nav-links {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
    border-radius: var(--radius-sm);
  }

  .nav-item {
    flex: 1 1 30%;
    min-width: 104px;
  }

  .nav-button {
    width: 100%;
    flex: 1;
    padding: 8px 10px;
    font-size: 11px;
    text-align: center;
  }

  .nav-submenu {
    position: static;
    display: none;
    min-width: 0;
    margin-top: 6px;
    box-shadow: none;
  }

  .nav-item:focus-within .nav-submenu {
    display: grid;
  }

  .app-shell { padding: 18px 14px 32px; }

  .app-shell { padding-bottom: 112px; }

  .floating-save-bar {
    right: 12px;
    bottom: max(10px, env(safe-area-inset-bottom));
    left: 12px;
    width: auto;
    max-width: none;
    justify-content: space-between;
  }

  .floating-save-bar span {
    max-width: 42vw;
  }

  .section-subnav {
    position: static;
  }

  .workspace,
  .ai-generation-layout,
  .ai-photo-grid,
  .field-grid.two,
  .field-grid.three,
  .field-grid.option-grid,
  .client-filter-grid,
  .invoice-filter-grid,
  .dashboard-grid,
  .dashboard-layout,
  .dashboard-bottom-grid,
  .dashboard-week-grid,
  .agenda-dashboard,
  .agenda-layout,
  .queue-grid,
  .check-grid,
  .fabric-grid,
  .fabric-grid-module,
  .invoice-editor-split,
  .clients-list {
    grid-template-columns: 1fr;
  }

  .view-section[data-view-section="clientes"] #clientsDirectorySection .client-filter-grid,
  .view-section[data-view-section="asesoria"] #clientsDirectorySection .client-filter-grid {
    grid-template-columns: 1fr;
  }

  .scan-card {
    grid-template-columns: 1fr;
  }

  .measurements-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .selected-fabrics-bar,
  .page-hero,
  .records-hero,
  .section-heading.inline,
  .invoice-header,
  .invoice-parties {
    flex-direction: column;
  }

  .page-hero {
    align-items: flex-start;
  }

  .inventory-toolbar {
    width: 100%;
    justify-content: stretch;
  }

  .inventory-search,
  .inventory-view-toggle,
  .inventory-toolbar .compact-button {
    width: 100%;
  }

  .inventory-view-toggle button {
    flex: 1;
  }

  .fabric-table {
    min-width: 900px;
  }

  .garment-order-head {
    flex-direction: column;
  }

  .portal-form,
  .order-label dl,
  .order-filter-grid,
  .qr-order-grid,
  .order-row,
  .measurement-history-card {
    grid-template-columns: 1fr;
  }

  .order-row-actions {
    justify-content: flex-start;
    max-width: none;
  }

  .invoice-header div { justify-items: start; }

  .invoice-totals div {
    grid-template-columns: 1fr auto;
  }

  .history-grid,
  .history-list,
  .generated-gallery {
    grid-template-columns: 1fr;
  }

  .calendar-weekdays,
  .calendar-grid {
    gap: 4px;
  }

  .calendar-day {
    min-height: 76px;
    padding: 6px;
  }

  .day-event {
    font-size: 9px;
    padding: 2px 4px;
  }

  .stage-track { gap: 5px; }

  .panel { padding: 18px; }
  h1 { font-size: 34px; }

  .order-header-fields {
    grid-template-columns: 1fr;
  }

  .order-header-fields .order-client-name-field {
    grid-column: auto;
  }
  h2 { font-size: 26px; }

  .print-toolbar {
    position: static;
    align-items: stretch;
  }

  .print-toolbar > * {
    width: 100%;
    justify-content: center;
  }

  .order-print-sheet {
    width: min(100%, calc(100vw - 16px));
    margin: 8px auto 24px;
    padding: 8px;
  }

  .order-print-header,
  .print-client-grid,
  .morphology-grid,
  .garment-print-grid,
  .print-two-col {
    grid-template-columns: 1fr;
  }

  .order-print-header h1 {
    font-size: 20px;
    text-align: left;
  }

  .print-header-meta .print-order-data,
  .print-header-meta .print-qr-card {
    grid-column: 1;
    grid-row: auto;
  }

  .print-order-data {
    font-size: 10px;
  }

  .print-client-grid dl,
  .morphology-grid article,
  .garment-schema {
    border-right: 0;
    border-left: 0;
    border-bottom: 1px solid #cfcfcf;
  }

  .garment-schema {
    padding-left: 0;
  }

  .print-reference-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ═══════════════════════════════════════════════════════ ADMIN PANEL */

.admin-modal {
  background: #fff;
  border: none;
  border-radius: 12px;
  padding: 28px;
  max-width: 480px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.18);
}

.admin-modal h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 20px;
}

.admin-modal label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 14px;
}

.admin-modal label input,
.admin-modal label select {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.9rem;
  color: #1a1a2e;
  background: #fafafa;
  font-weight: 400;
}

.admin-modal label input:focus,
.admin-modal label select:focus {
  outline: 2px solid #B8860B;
  border-color: #B8860B;
  background: #fff;
}

.admin-modal .form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}

.admin-modal::backdrop {
  background: rgba(0,0,0,0.45);
}

.records-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  padding: 4px 0;
}

.record-card {
  background: #fff;
  border: 1px solid #e8dfc8;
  border-radius: 10px;
  overflow: hidden;
  transition: box-shadow 0.15s;
}

.record-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

.record-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: #faf7f1;
  border-bottom: 1px solid #f0ece4;
}

.record-card-body {
  padding: 10px 14px;
}

.icon-button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  padding: 2px 4px;
  border-radius: 4px;
  line-height: 1;
  opacity: 0.7;
  transition: opacity 0.15s;
}

.icon-button:hover {
  opacity: 1;
}

.section-help {
  padding: 0 0 8px;
}

/* Priority badges inline */
.badge-critica { background: #e74c3c; color: white; padding: 2px 8px; border-radius: 12px; font-size: 0.72rem; font-weight: 700; }
.badge-alta    { background: #e67e22; color: white; padding: 2px 8px; border-radius: 12px; font-size: 0.72rem; font-weight: 700; }
.badge-media   { background: #f39c12; color: white; padding: 2px 8px; border-radius: 12px; font-size: 0.72rem; font-weight: 700; }
.badge-baja    { background: #27ae60; color: white; padding: 2px 8px; border-radius: 12px; font-size: 0.72rem; font-weight: 700; }

/* ═══════════════════════════════════════════════ OPERATIONAL STATS BAR */

.dashboard-stats-bar {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}

@media (max-width: 1100px) {
  .dashboard-stats-bar { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 640px) {
  .dashboard-stats-bar { grid-template-columns: repeat(2, 1fr); }

  .field-grid.four {
    grid-template-columns: 1fr;
  }
}

.stat-card {
  background: #fff;
  border: 1px solid #e8dfc8;
  border-radius: 10px;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: box-shadow 0.15s;
}
.stat-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,0.08); }

.stat-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #888;
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: #1a1a2e;
  line-height: 1;
}

.stat-urgent .stat-value { color: #e67e22; }
.stat-danger  .stat-value { color: #e74c3c; }
.stat-ok      .stat-value { color: #27ae60; }
.stat-adjust  .stat-value { color: #8e44ad; }

.stat-urgent { border-left: 3px solid #e67e22; }
.stat-danger  { border-left: 3px solid #e74c3c; }
.stat-ok      { border-left: 3px solid #27ae60; }
.stat-adjust  { border-left: 3px solid #8e44ad; }

/* alerts strip */
.alert-strip-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border-left: 4px solid #e74c3c;
  border-radius: 0 8px 8px 0;
  padding: 8px 14px;
  margin-bottom: 6px;
  font-size: 0.82rem;
}
.alert-strip-item.alta  { border-color: #e67e22; }
.alert-strip-item.media { border-color: #f39c12; }
.alert-strip-item .alert-type { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; color: #888; }

/* ═══════════════════════════════════════ ENHANCED ORDER CARDS */

.garment-order-card--adjustment {
  border-left: 4px solid #8e44ad;
}

.garment-order-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

/* Compact inline action buttons in order card head */
.garment-order-head .result-meta.compact {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: flex-start;
}
.garment-order-head .compact-button {
  font-size: 0.72rem;
  padding: 4px 8px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   EDITOR DE ESTADOS DE PEDIDO
═══════════════════════════════════════════════════════════════════════════ */

.states-table-wrap {
  overflow-x: auto;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
}

.states-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 560px;
}

.states-table thead th {
  padding: 9px 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: left;
  background: rgba(236, 226, 204, 0.4);
  border-bottom: 1.5px solid var(--line);
  white-space: nowrap;
}

.st-th-hint { font-weight:400; letter-spacing:0; text-transform:none; color:var(--taupe-light); font-size:10px; }

.st-col-color    { width: 40px; text-align: center; }
.st-col-internal { min-width: 200px; }
.st-col-external { width: 180px; }
.st-col-group    { width: 170px; }
.st-col-del      { width: 50px; text-align: center; }

.st-row td {
  padding: 6px 8px;
  vertical-align: middle;
  border-bottom: 1px solid rgba(116, 93, 74, 0.08);
}
.st-row:last-child td { border-bottom: none; }
.st-row-builtin { background: rgba(250, 244, 232, 0.35); }
.st-row-custom  { background: #fff; }
.st-row-dirty   { background: rgba(52, 152, 219, 0.05) !important; }
.st-row-dirty td { box-shadow: inset 3px 0 0 rgba(52, 152, 219, 0.5); }
.states-table tbody tr:hover { background: rgba(250, 244, 232, 0.6) !important; }

.st-color-input {
  width: 28px; height: 28px;
  border: 1.5px solid var(--line);
  border-radius: 6px;
  padding: 2px;
  cursor: pointer;
  background: transparent;
  display: block;
  margin: 0 auto;
}

.st-input {
  width: 100%;
  min-height: 32px;
  border: 1.5px solid transparent;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 13px;
  font-family: inherit;
  color: var(--ink);
  background: transparent;
  transition: border-color var(--transition), background var(--transition);
}
.st-input:hover  { border-color: rgba(116, 93, 74, 0.28); background: rgba(255,255,255,0.9); }
.st-input:focus  { outline: none; border-color: var(--brown); background: #fff; box-shadow: 0 0 0 3px rgba(116,93,74,0.1); }

select.st-input {
  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='%23745d4a' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 28px;
}

.st-id-label {
  display: block;
  margin-top: 2px;
  color: var(--taupe-light);
  font-family: 'Courier New', monospace;
  font-size: 10px;
  letter-spacing: 0.04em;
  padding-left: 9px;
}

.st-builtin-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: var(--radius-pill);
  padding: 2px 8px;
  background: var(--sand);
  color: var(--taupe);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.st-del-btn { margin: 0 auto; }

/* ═══════════════════════════════════════════════════════════════════════════
   BORRADOR DE FACTURA — TABLA EDITABLE
═══════════════════════════════════════════════════════════════════════════ */

.draft-client-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin-bottom: 16px;
}
.draft-client-row label { flex: 1; min-width: 0; margin-bottom: 0; }
.draft-client-row .secondary-button { flex-shrink: 0; white-space: nowrap; gap: 6px; }

.catalogue-add-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.catalogue-add-item {
  display: flex;
  gap: 6px;
  flex: 1;
  min-width: 200px;
}
.catalogue-select {
  flex: 1;
  min-width: 0;
  font-size: 13px;
}

.payment-method-row { margin-top: 6px; border-top: 1px solid var(--line); padding-top: 6px; }
.payment-method-row .pay-method-val { font-style: italic; color: var(--muted); }

.invoice-nif { font-size: 12px; color: var(--muted); }

.draft-lines-section { margin-bottom: 14px; }

.draft-lines-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.draft-markup-legend {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--muted);
  font-weight: 400;
}

.markup-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: rgba(234, 130, 0, 0.35);
  border: 1px solid rgba(234, 130, 0, 0.55);
  flex-shrink: 0;
}

.draft-empty {
  padding: 22px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  font-style: italic;
  border: 1.5px dashed var(--line);
  border-radius: var(--radius-sm);
  background: rgba(236, 226, 204, 0.2);
}

.draft-table-wrap {
  overflow-x: auto;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
}

.draft-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 640px;
}

.draft-table thead th {
  padding: 9px 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: left;
  background: rgba(236, 226, 204, 0.4);
  border-bottom: 1.5px solid var(--line);
  white-space: nowrap;
}

.markup-th-label { display: inline-flex; align-items: center; gap: 4px; }

.draft-table tbody tr { transition: background var(--transition); }
.draft-table tbody tr:hover { background: rgba(250, 244, 232, 0.55); }
.draft-table tbody tr:not(:last-child) td { border-bottom: 1px solid rgba(116, 93, 74, 0.08); }
.draft-table td { padding: 5px 6px; vertical-align: middle; }

.col-desc   { min-width: 180px; }
.col-base   { width: 105px; }
.col-markup { width: 90px; background: rgba(234, 130, 0, 0.05); }
.col-unit   { width: 105px; }
.col-qty    { width: 58px; }
.col-total  { width: 90px; text-align: right; white-space: nowrap; }
.col-del    { width: 34px; text-align: center; }

.markup-wrap {
  background: rgba(234, 130, 0, 0.1);
  border-radius: 6px;
}

.draft-input {
  width: 100%;
  min-height: 34px;
  border: 1.5px solid transparent;
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 13px;
  font-family: inherit;
  color: var(--ink);
  background: transparent;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}
.draft-input:hover {
  border-color: rgba(116, 93, 74, 0.28);
  background: rgba(255, 255, 255, 0.9);
}
.draft-input:focus {
  outline: none;
  border-color: var(--brown);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(116, 93, 74, 0.1);
}
.draft-input::placeholder { color: var(--taupe-light); }
.draft-num { text-align: right; }

.draft-num-wrap {
  display: flex;
  align-items: center;
  gap: 3px;
}
.draft-num-wrap .draft-input { flex: 1; min-width: 0; }

.draft-unit {
  font-size: 11px;
  font-weight: 700;
  color: var(--taupe);
  flex-shrink: 0;
}

.line-total {
  font-size: 13px;
  font-weight: 700;
  color: var(--charcoal);
  display: block;
  text-align: right;
  padding-right: 4px;
}

.del-line-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 1.5px solid transparent;
  border-radius: 6px;
  padding: 0;
  color: var(--taupe-light);
  background: transparent;
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition);
}
.del-line-btn:hover {
  border-color: rgba(191, 51, 51, 0.35);
  color: #bf3333;
  background: rgba(191, 51, 51, 0.06);
}

.draft-discount-block {
  margin: 4px 0 14px;
  padding: 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(236, 226, 204, 0.18);
}

.draft-totals-preview { margin-top: 10px; }

.totals-mini { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }

.totals-mini-row {
  display: grid;
  grid-template-columns: 140px 100px;
  gap: 12px;
  font-size: 13px;
}
.totals-mini-row span   { color: var(--muted); }
.totals-mini-row strong { text-align: right; }
.totals-mini-row.discount-row strong { color: #2e7d32; }
.totals-mini-row.grand-row {
  border-top: 1.5px solid var(--line);
  padding-top: 6px;
  margin-top: 2px;
  font-size: 15px;
  font-weight: 700;
}
.totals-mini-row.grand-row span { color: var(--charcoal); font-weight: 700; }

/* ═══════════════════════════════════════════════════════════════════════════
   EDITOR DE TARIFAS
═══════════════════════════════════════════════════════════════════════════ */

.content-section {
  background: var(--panel-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 24px 28px;
  margin-bottom: 20px;
}

.admin-collapsible-section .section-header {
  justify-content: flex-start;
}

.admin-collapsible-section .section-header > .admin-section-toggle + * {
  flex: 1;
  min-width: 0;
}

.admin-section-toggle {
  display: inline-grid;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.admin-section-toggle:hover {
  border-color: var(--gold);
  background: var(--cream);
}

.admin-section-toggle:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.admin-section-toggle svg {
  width: 17px;
  height: 17px;
  transition: transform 180ms ease;
}

.content-section[data-collapsed="true"] {
  padding-block: 18px;
}

.content-section[data-collapsed="true"] > :not(.section-header) {
  display: none !important;
}

.content-section[data-collapsed="true"] .section-header {
  align-items: center;
  margin-bottom: 0;
}

.content-section[data-collapsed="true"] .section-help {
  display: none;
}

.content-section[data-collapsed="true"] .admin-section-toggle svg {
  transform: rotate(-90deg);
}

.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-header h2 {
  margin: 0 0 4px;
  font-family: Cormorant, serif;
  font-size: 26px;
  font-weight: 700;
  line-height: 1.1;
}

.section-header .section-help {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.pricing-editor {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.pricing-block {
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.7);
}

.pricing-block--wide {
  grid-column: 1 / -1;
}

.pricing-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  background: rgba(236, 226, 204, 0.4);
  border-bottom: 1.5px solid var(--line);
}

.pricing-block-header .eyebrow { margin: 0; }

.pricing-block-help {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.pricing-add-btn {
  border: 1.5px solid rgba(116, 93, 74, 0.35);
  border-radius: var(--radius-pill);
  padding: 4px 14px;
  min-height: 30px;
  color: var(--brown);
  background: rgba(255, 255, 255, 0.9);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all var(--transition);
}

.pricing-add-btn:hover {
  border-color: var(--brown);
  background: rgba(116, 93, 74, 0.08);
}

.pricing-table-wrap {
  overflow-x: auto;
}

.pricing-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.pricing-table thead th {
  padding: 9px 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: left;
  background: rgba(250, 244, 232, 0.6);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.pricing-table thead th:nth-child(4) { width: 36px; }
.pricing-options-table thead th:nth-child(1) { width: 130px; }
.pricing-options-table thead th:nth-child(2) { width: 240px; }
.pricing-options-table thead th:nth-child(4) { width: 160px; }

.pricing-row { transition: background var(--transition); }
.pricing-row:hover { background: rgba(250, 244, 232, 0.55); }
.pricing-row:not(:last-child) td { border-bottom: 1px solid rgba(116, 93, 74, 0.1); }

.pricing-row td {
  padding: 6px 8px;
  vertical-align: middle;
}

.pricing-row td:last-child {
  text-align: center;
  width: 36px;
}

/* Inline edit inputs */
.pricing-input {
  width: 100%;
  min-height: 34px;
  border: 1.5px solid transparent;
  border-radius: 6px;
  padding: 5px 9px;
  font-size: 13px;
  font-family: inherit;
  color: var(--ink);
  background: transparent;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}

.pricing-input:hover {
  border-color: rgba(116, 93, 74, 0.3);
  background: rgba(255, 255, 255, 0.9);
}

.pricing-input:focus {
  outline: none;
  border-color: var(--brown);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(116, 93, 74, 0.1);
}

.pricing-input::placeholder { color: var(--taupe-light); }

.pricing-price-cell {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pricing-price {
  width: 80px;
  min-width: 70px;
  text-align: right;
}

.pricing-currency {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.pricing-desc { font-size: 12px; color: var(--muted); }

.pricing-option-row .pricing-input {
  background: rgba(255, 255, 255, 0.58);
}

.pricing-delete-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1.5px solid transparent;
  border-radius: 6px;
  padding: 0;
  color: var(--taupe);
  background: transparent;
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition);
}

.pricing-delete-btn:hover {
  border-color: rgba(191, 51, 51, 0.35);
  color: #bf3333;
  background: rgba(191, 51, 51, 0.06);
}

.pricing-empty {
  padding: 18px 12px;
  color: var(--muted);
  font-size: 13px;
  font-style: italic;
  text-align: center;
}

/* IVA row */
.pricing-iva-row {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 16px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(236, 226, 204, 0.25);
}

.pricing-iva-label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
  white-space: nowrap;
}

.pricing-iva-input-wrap {
  display: flex;
  align-items: center;
  gap: 5px;
}

.pricing-iva-input-wrap input {
  width: 72px;
  min-height: 36px;
  border: 1.5px solid rgba(116, 93, 74, 0.28);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  color: var(--ink);
  background: #fff;
}

.pricing-iva-input-wrap input:focus {
  outline: none;
  border-color: var(--brown);
  box-shadow: 0 0 0 3px rgba(116, 93, 74, 0.1);
}

.pricing-iva-input-wrap span {
  font-size: 14px;
  font-weight: 700;
  color: var(--brown);
}

.pricing-iva-hint {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

/* Status message */
.pricing-status {
  min-height: 18px;
  margin: -10px 0 12px;
  font-size: 13px;
  font-weight: 600;
  transition: color 0.2s;
}

.pricing-status-ok    { color: #2e7d32; }
.pricing-status-error { color: #bf3333; }

/* Workshop kanban */
.workshop-kanban-page {
  min-height: 100vh;
  overflow-x: hidden;
  background:
    linear-gradient(180deg, rgba(250, 244, 232, 0.96), rgba(236, 226, 204, 0.72)),
    var(--cream);
}

.workshop-board-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 22px;
  border-bottom: 1px solid rgba(236, 226, 204, 0.18);
  color: var(--cream);
  background: var(--navy);
  box-shadow: 0 12px 28px rgba(26, 26, 46, 0.16);
}

.workshop-board-topbar h1 {
  margin: 0;
  color: #fff;
  font-size: 24px;
}

.workshop-board-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.workshop-board-actions form {
  margin: 0;
}

.workshop-board-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.workshop-board-filter select {
  min-width: 220px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  color: var(--ink);
  background: #fff;
}

.workshop-board-error {
  margin: 16px 22px 0;
  border-left: 4px solid #bf3333;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: #8f2020;
  background: #fff5f3;
}

.workshop-board-shell {
  padding-top: 32px;
}

.workshop-board-view {
  display: block;
}

.workshop-board-hero {
  align-items: flex-end;
}

.workshop-board-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.workshop-board-summary article {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow-sm);
}

.workshop-board-summary span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.workshop-board-summary strong {
  display: block;
  margin-top: 5px;
  color: var(--ink);
  font-size: 30px;
  line-height: 1;
}

.workshop-board-tools {
  display: grid;
  grid-template-columns: minmax(260px, 420px) minmax(0, 1fr);
  align-items: end;
  gap: 14px;
  margin-bottom: 16px;
}

.workshop-board-search {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.workshop-board-search input {
  min-height: 40px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.88);
}

.workshop-kanban-board {
  display: grid;
  grid-auto-columns: minmax(280px, 320px);
  grid-auto-flow: column;
  gap: 14px;
  min-height: calc(100vh - 230px);
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 2px 18px;
  scroll-snap-type: x proximity;
}

.workshop-kanban-column {
  display: grid;
  grid-template-rows: auto minmax(240px, 1fr);
  min-height: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.58);
  box-shadow: var(--shadow-sm);
  scroll-snap-align: start;
  overflow: hidden;
}

.workshop-kanban-column > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 58px;
  padding: 12px 12px 11px;
  border-top: 4px solid var(--column-color, var(--brown));
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
}

.workshop-kanban-column > header > div {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.column-marker {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--column-color, var(--brown));
}

.workshop-kanban-column h2 {
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.03em;
  line-height: 1.2;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.column-count {
  min-width: 30px;
  border-radius: 999px;
  padding: 4px 8px;
  color: #fff;
  background: var(--ink);
  font-size: 12px;
  text-align: center;
}

.workshop-kanban-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 260px;
  max-height: calc(100vh - 286px);
  overflow-y: auto;
  padding: 12px;
  transition: background var(--transition), box-shadow var(--transition);
}

.workshop-kanban-list.is-over {
  background: rgba(184, 134, 11, 0.11);
  box-shadow: inset 0 0 0 2px rgba(184, 134, 11, 0.18);
}

.workshop-kanban-card {
  border: 1px solid rgba(38, 43, 44, 0.1);
  border-left: 4px solid #b9b0a0;
  border-radius: var(--radius-sm);
  padding: 12px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(38, 43, 44, 0.08);
  cursor: grab;
  transition: transform var(--transition), opacity var(--transition), box-shadow var(--transition);
}

.workshop-kanban-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(38, 43, 44, 0.12);
}

.workshop-kanban-card:active {
  cursor: grabbing;
}

.workshop-kanban-card.is-dragging,
.workshop-kanban-card.is-saving {
  opacity: 0.62;
}

.workshop-kanban-card.priority-critica { border-left-color: #bf3333; }
.workshop-kanban-card.priority-alta { border-left-color: #c96f28; }
.workshop-kanban-card.priority-media { border-left-color: #b8860b; }
.workshop-kanban-card.priority-baja { border-left-color: #4f8f5f; }

.kanban-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.workshop-kanban-card h3 {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.25;
}

.workshop-kanban-card dl {
  display: grid;
  gap: 6px;
  margin: 0;
}

.workshop-kanban-card dl div {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 8px;
}

.workshop-kanban-card dt {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.workshop-kanban-card dd {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.priority-chip {
  border-radius: 999px;
  padding: 3px 7px;
  color: #fff;
  background: #8f8576;
  font-size: 10px;
}

.priority-chip.priority-critica { background: #bf3333; }
.priority-chip.priority-alta { background: #c96f28; }
.priority-chip.priority-media { background: #b8860b; }
.priority-chip.priority-baja { background: #4f8f5f; }

.kanban-card-note {
  margin: 10px 0 0;
  border-radius: var(--radius-sm);
  padding: 8px 9px;
  color: #5e5145;
  background: rgba(236, 226, 204, 0.52);
  font-size: 12px;
  line-height: 1.4;
}

.kanban-card-links {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.kanban-card-links a {
  color: var(--brown);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-decoration: none;
  text-transform: uppercase;
}

.kanban-card-links a:hover {
  text-decoration: underline;
}

.workshop-kanban-column.is-filter-empty {
  opacity: 0.38;
}

@media (max-width: 760px) {
  .workshop-board-topbar,
  .workshop-board-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .workshop-board-filter {
    align-items: stretch;
    flex-direction: column;
  }

  .workshop-board-filter select {
    min-width: 0;
    width: 100%;
  }

  .workshop-board-summary,
  .workshop-board-tools {
    grid-template-columns: 1fr;
  }

  .workshop-kanban-board {
    grid-auto-columns: minmax(270px, 86vw);
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   INVOICE NUMBER FIELD + SEQUENCES ADMIN
═══════════════════════════════════════════════════════════════════════════ */

.invoice-num-wrap {
  display: grid;
  gap: 4px;
}

.invoice-num-hint {
  font-size: 11px;
  font-weight: 400;
  color: var(--taupe);
  letter-spacing: 0;
  text-transform: none;
  padding-left: 2px;
}

/* Sequences admin grid */
.sequences-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.seq-card {
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: var(--shadow-sm);
}

.seq-card-top {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 6px;
}

.seq-prefix {
  font-family: 'Courier New', monospace;
  font-size: 20px;
  font-weight: 700;
  color: var(--charcoal);
  letter-spacing: 0.08em;
}

.seq-year {
  font-size: 13px;
  font-weight: 700;
  color: var(--taupe);
}

.seq-counter {
  margin-left: auto;
  font-family: 'Courier New', monospace;
  font-size: 22px;
  font-weight: 700;
  color: var(--brown);
}

.seq-company {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 12px;
}

.seq-edit-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.seq-prefix-input {
  width: 90px;
  min-height: 34px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 5px 9px;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.9);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.seq-prefix-input:focus {
  outline: none;
  border-color: var(--brown);
  box-shadow: 0 0 0 3px rgba(116, 93, 74, 0.1);
}

/* ═══════════════════════════════════════════════════════════════════════════
   PERSONALIZACIÓN — option image admin & order form preview
   ═══════════════════════════════════════════════════════════════════════════ */

/* Detail field wrapper in order form */
.detail-field-wrap {
  display: contents;
}
.detail-field-wrap label {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.detail-select-with-note {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(110px, 0.65fr);
  gap: 6px;
}
.detail-select-with-note > * {
  min-width: 0;
}
.detail-option-preview {
  grid-column: 1 / -1;
  margin: -4px 0 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: rgba(250, 247, 241, 0.72);
}
.detail-option-preview summary {
  cursor: pointer;
  color: var(--brown);
  font-size: 12px;
  font-weight: 800;
}
.detail-option-images {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  margin-top: 10px;
}
.detail-option-preview img {
  width: 100%;
  height: 130px;
  border-radius: 8px;
  border: 1px solid var(--line);
  object-fit: cover;
  display: block;
}

/* Option images in references section */
.option-image-ref {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.option-image-label {
  font-size: 0.68rem;
  color: #888;
  text-align: center;
  max-width: 100px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Admin: garment tabs */
.cust-garment-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.cust-tab {
  padding: 6px 16px;
  border: 1.5px solid var(--line);
  border-radius: 20px;
  background: #fff;
  cursor: pointer;
  font-size: 0.88rem;
  color: var(--ink);
  transition: background 0.15s, border-color 0.15s;
}
.cust-tab:hover { background: var(--sand); }
.cust-tab.active {
  background: var(--brown);
  border-color: var(--brown);
  color: #fff;
  font-weight: 600;
}

/* Admin: field grid */
.cust-fields-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}
.cust-field-block {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  background: #fff;
}
.cust-field-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.cust-field-header strong {
  font-size: 0.9rem;
  color: var(--ink);
}
.cust-empty {
  font-size: 0.82rem;
  color: #aaa;
  padding: 8px 0;
}

/* Admin: option rows */
.cust-options-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cust-option-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.cust-option-name {
  flex: 1;
  min-width: 0;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 0.82rem;
}
.cust-option-img-wrap {
  position: relative;
  cursor: pointer;
  border-radius: 6px;
  overflow: hidden;
  border: 1.5px solid var(--line);
  width: 52px;
  height: 40px;
  flex-shrink: 0;
  background: var(--sand);
  display: flex;
  align-items: center;
  justify-content: center;
}
.cust-option-img-wrap:hover .cust-img-edit-hint { opacity: 1; }
.cust-thumb-stack {
  position: relative;
  width: 100%;
  height: 100%;
}
.cust-thumb-stack .cust-thumb {
  position: absolute;
  inset: 0;
}
.cust-thumb-stack .cust-thumb:nth-child(2) { transform: translate(5px, 3px); }
.cust-thumb-stack .cust-thumb:nth-child(3) { transform: translate(10px, 6px); }
.cust-image-count {
  position: absolute;
  right: 2px;
  bottom: 2px;
  z-index: 2;
  min-width: 18px;
  border-radius: 10px;
  padding: 1px 5px;
  color: #fff;
  background: var(--charcoal);
  font-size: 10px;
  font-weight: 800;
  text-align: center;
}
.cust-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.cust-thumb-empty {
  font-size: 0.62rem;
  color: #aaa;
  text-align: center;
  padding: 2px;
  line-height: 1.2;
}
.cust-img-edit-hint {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.45);
  color: #fff;
  font-size: 0.65rem;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s;
}
.icon-button.danger-icon {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  color: #c0392b;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1;
  flex-shrink: 0;
}
.icon-button.danger-icon:hover { background: #fce; }

/* Billing field highlight */
.cust-field-block--billing {
  border-color: var(--brown);
}
.cust-billing-badge {
  display: inline-block;
  background: var(--brown);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 10px;
  letter-spacing: 0.02em;
  vertical-align: middle;
  margin-left: 4px;
}

/* Cust option price field */
.cust-price-wrap {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}
.cust-price-input {
  width: 64px;
  padding: 5px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 0.82rem;
  text-align: right;
}
.cust-price-unit {
  font-size: 0.8rem;
  color: #888;
  flex-shrink: 0;
}

/* Extras block inside customization section */
.cust-extras-block {
  margin-top: 28px;
}

/* Admin: image picker modal */
.cust-image-modal {
  max-width: min(90vw, 820px);
  width: 100%;
}
.cust-modal-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 12px 0;
}
.cust-modal-upload {
  display: flex;
  align-items: center;
  gap: 10px;
}
.cust-modal-filter input {
  width: 100%;
}
.cust-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
  max-height: 55vh;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--cream);
}
.cust-img-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px;
  border: 2px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
  background: #fff;
}
.cust-img-item:hover { border-color: var(--taupe); background: var(--sand); }
.cust-img-item.selected { border-color: var(--brown); background: rgba(116,93,74,0.07); }
.cust-img-item img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 5px;
}
.cust-img-item span {
  font-size: 0.65rem;
  color: #666;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.admin-settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.admin-settings-grid label {
  display: grid;
  gap: 6px;
  margin: 0;
}

.admin-settings-grid input,
.admin-settings-grid textarea {
  width: 100%;
  min-height: 42px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  color: var(--ink);
  background: #fff;
}

.admin-settings-grid textarea {
  resize: vertical;
}

.admin-settings-grid small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.admin-settings-wide {
  grid-column: 1 / -1;
}

@media (max-width: 760px) {
  .admin-settings-grid {
    grid-template-columns: 1fr;
  }
}

/* ─────────────────────────────────────────
   Sidebar layout + dashboard chart
───────────────────────────────────────── */
.app-body--sidebar .site-header {
  position: fixed;
  inset: 0 auto 0 0;
  width: 264px;
  height: 100vh;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 0;
  background: linear-gradient(180deg, rgba(30, 33, 34, 0.98), rgba(25, 30, 30, 0.98));
}

.app-body--sidebar .header-inner {
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 28px;
  width: 100%;
  max-width: none;
  height: 100%;
  padding: 28px 14px 18px;
}

.app-body--sidebar .sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 70px;
  padding: 0 8px 8px;
  color: #e5c36b;
  font-family: Cormorant, serif;
  font-size: 27px;
  font-weight: 700;
  line-height: 1;
}

.app-body--sidebar .brand-logo {
  width: 62px;
  max-width: 62px;
  height: auto;
  margin: 0;
}

.app-body--sidebar .nav-links {
  display: grid;
  width: 100%;
  gap: 8px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.app-body--sidebar .nav-item {
  width: 100%;
}

.app-body--sidebar .nav-button {
  position: relative;
  justify-content: flex-start;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 50px;
  border-radius: 8px;
  padding: 0 16px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  letter-spacing: 0;
  text-align: left;
  text-transform: none;
}

.app-body--sidebar .nav-button:hover,
.app-body--sidebar .nav-button.active {
  color: var(--cream);
  background: rgba(255, 255, 255, 0.08);
}

.app-body--sidebar .nav-button.active::before {
  content: "";
  position: absolute;
  inset: 10px auto 10px -2px;
  width: 4px;
  border-radius: 999px;
  background: #d79a28;
}

.app-body--sidebar .nav-icon {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  color: currentColor;
  font-size: 20px;
  line-height: 1;
}

.app-body--sidebar .nav-submenu {
  position: static;
  display: none;
  min-width: 0;
  margin: 4px 0 8px 42px;
  padding: 4px;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  box-shadow: none;
  opacity: 1;
  visibility: visible;
  transform: none;
}

.app-body--sidebar .nav-item:hover .nav-submenu,
.app-body--sidebar .nav-item:focus-within .nav-submenu {
  display: grid;
}

.app-body--sidebar .nav-submenu button {
  min-height: 30px;
  padding: 0 9px;
  font-size: 10px;
  line-height: 1.2;
}

.app-body--sidebar .sidebar-session {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.app-body--sidebar .logout-button {
  min-height: 38px;
  width: 100%;
  justify-content: center;
}

.app-body--sidebar .app-shell {
  width: calc(100% - 264px);
  max-width: none;
  margin: 0 0 0 264px;
  padding: 32px 36px 126px;
}

.dashboard-company-filter {
  display: grid;
  gap: 4px;
  min-width: 240px;
  color: var(--brown);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.dashboard-company-filter select {
  min-height: 38px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  padding: 0 36px 0 12px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.92);
  font-size: 13px;
  font-weight: 700;
  text-transform: none;
}

.dashboard-chart-panel {
  margin-bottom: 20px;
}

.monthly-orders-chart {
  min-height: 320px;
  overflow-x: auto;
  padding: 6px 0 0;
}

.monthly-orders-chart svg {
  display: block;
  width: 100%;
  min-width: 720px;
  height: 320px;
}

.monthly-chart-grid {
  stroke: rgba(116, 93, 74, 0.12);
  stroke-width: 1;
}

.monthly-chart-axis {
  stroke: rgba(38, 43, 44, 0.26);
  stroke-width: 1.2;
}

.monthly-chart-bar {
  fill: #d6ad63;
}

.monthly-chart-bar:hover {
  fill: #c58f2d;
}

.monthly-chart-line {
  fill: none;
  stroke: var(--charcoal);
  stroke-width: 2.5;
}

.monthly-chart-point {
  fill: var(--charcoal);
}

.monthly-chart-label {
  fill: var(--muted);
  font-family: Montserrat, sans-serif;
  font-size: 12px;
  font-weight: 700;
}

.monthly-chart-value {
  fill: var(--ink);
  font-family: Montserrat, sans-serif;
  font-size: 12px;
  font-weight: 700;
}

.monthly-chart-legend {
  fill: var(--brown);
  font-family: Montserrat, sans-serif;
  font-size: 12px;
  font-weight: 700;
}

/* ═══════════════════════════════════════════════════════════════════════════
   CENTRO DE NOTIFICACIONES DEL ADMINISTRADOR
═══════════════════════════════════════════════════════════════════════════ */

.notification-nav-badge {
  display: inline-grid;
  min-width: 22px;
  height: 22px;
  margin-left: auto;
  padding: 0 6px;
  place-items: center;
  border: 2px solid #202526;
  border-radius: 999px;
  color: #fff;
  background: #c53f3f;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}

.notification-nav-badge[hidden] {
  display: none;
}

.notification-hero-copy {
  max-width: 640px;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.notification-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.notification-summary-card {
  display: flex;
  min-height: 112px;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow-sm);
}

.notification-summary-card span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.notification-summary-card strong {
  color: var(--ink);
  font-family: Cormorant, serif;
  font-size: 42px;
  line-height: 0.9;
}

.notification-summary-card--unread {
  border-color: rgba(197, 63, 63, 0.35);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.94), rgba(197, 63, 63, 0.07));
}

.notification-summary-card--unread strong {
  color: #a92f2f;
}

.notification-center {
  min-height: 360px;
}

.notification-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.notification-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.notification-filter {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--brown);
  background: rgba(255, 255, 255, 0.72);
  font: inherit;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}

.notification-filter:hover,
.notification-filter.active {
  border-color: var(--brown);
  color: var(--cream);
  background: var(--brown);
}

.notification-filter:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.notification-status {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.notification-status.is-error {
  color: #a92f2f;
}

.admin-notifications-list {
  display: grid;
  gap: 10px;
}

.admin-notification-card {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: start;
  gap: 14px;
  padding: 17px 18px;
  border: 1px solid var(--line);
  border-left: 4px solid #c29a4b;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.88);
  transition: opacity 160ms ease, background 160ms ease, border-color 160ms ease;
}

.admin-notification-card[data-level="critica"] {
  border-left-color: #bf3333;
}

.admin-notification-card[data-level="alta"] {
  border-left-color: #dd762c;
}

.admin-notification-card[data-level="media"] {
  border-left-color: #d3a32b;
}

.admin-notification-card[data-kind="comment"] {
  border-left-color: #4e7487;
}

.admin-notification-card.is-unread {
  background: #fff;
  box-shadow: 0 7px 22px rgba(38, 43, 44, 0.06);
}

.admin-notification-card.is-read {
  opacity: 0.68;
}

.admin-notification-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: #876d56;
  font-size: 19px;
}

.admin-notification-card[data-kind="comment"] .admin-notification-icon {
  background: #4e7487;
}

.admin-notification-content {
  min-width: 0;
}

.admin-notification-heading {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.admin-notification-heading strong {
  color: var(--ink);
  font-size: 14px;
}

.admin-notification-kind {
  padding: 3px 7px;
  border-radius: 999px;
  color: var(--brown);
  background: var(--cream);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.admin-notification-message {
  margin: 7px 0;
  color: #4f4f4f;
  font-size: 13px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.admin-notification-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  color: var(--muted);
  font-size: 11px;
}

.admin-notification-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.admin-notification-actions .secondary-button {
  white-space: nowrap;
}

.admin-notifications-empty {
  display: grid;
  min-height: 250px;
  place-items: center;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 980px) {
  .app-body--sidebar .site-header {
    position: sticky;
    inset: auto;
    width: auto;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  .app-body--sidebar .header-inner {
    gap: 14px;
    height: auto;
    padding: 16px 14px;
  }

  .app-body--sidebar .nav-links {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app-body--sidebar .nav-submenu {
    margin-left: 0;
  }

  .app-body--sidebar .sidebar-session {
    margin-top: 0;
  }

  .app-body--sidebar .app-shell {
    width: auto;
    margin-left: 0;
    padding: 22px 14px 112px;
  }

  .dashboard-company-filter {
    width: 100%;
    min-width: 0;
  }

  .notification-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .notification-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .notification-status {
    text-align: left;
  }

  .admin-notification-card {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .admin-notification-actions {
    grid-column: 2;
    flex-wrap: wrap;
  }
}

@media (max-width: 560px) {
  .notification-summary-grid {
    grid-template-columns: 1fr;
  }

  .admin-notification-card {
    grid-template-columns: 1fr;
  }

  .admin-notification-actions {
    grid-column: 1;
  }
}
