/* ══════════════════════════════════════════════
   MORELLÓ STOCK — Design System v2
   Revisado: Inter, tokens premium, UI moderna
══════════════════════════════════════════════ */

:root {
  color-scheme: light;

  /* Paleta */
  --bg: #f0ede8;
  --surface: #ffffff;
  --surface-soft: #edf2ee;
  --surface-raised: rgba(255, 255, 255, 0.94);
  --ink: #151715;
  --ink-2: #2c3830;
  --muted: #636e69;
  --line: rgba(44, 55, 49, 0.13);
  --line-strong: rgba(44, 55, 49, 0.22);
  --brand: #3e5e52;
  --brand-dark: #233a32;
  --brand-light: rgba(62, 94, 82, 0.10);
  --stone: #a6a6a6;
  --warm: #b68a56;
  --warm-light: rgba(182, 138, 86, 0.12);
  --danger: #c0392b;
  --danger-light: rgba(192, 57, 43, 0.10);
  --blue: #2e3bff;
  --red: #ff4b26;
  --green: #36ef5c;

  /* Sombras */
  --shadow-sm: 0 2px 8px rgba(23, 24, 23, 0.08);
  --shadow: 0 10px 36px rgba(23, 24, 23, 0.10);
  --shadow-lg: 0 20px 60px rgba(23, 24, 23, 0.14);

  /* Bordes */
  --radius: 10px;
  --radius-sm: 7px;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  font-family: 'Inter', Arial, Helvetica, sans-serif;
  background:
    radial-gradient(ellipse at 0% 0%, rgba(62, 94, 82, 0.10) 0%, transparent 52%),
    radial-gradient(ellipse at 100% 100%, rgba(182, 138, 86, 0.08) 0%, transparent 52%),
    var(--bg);
  color: var(--ink);
  min-height: 100svh;
}

/* ── Reset base ── */
button, input, select, textarea {
  font: inherit;
}

button {
  touch-action: manipulation;
}

h1, h2, h3, p {
  margin: 0;
}

h1 {
  font-size: clamp(22px, 2.8vw, 32px);
  line-height: 1;
  letter-spacing: -0.02em;
}

h2 {
  font-size: clamp(18px, 2vw, 24px);
  letter-spacing: -0.01em;
}

/* ══════════════════════════════════════════
   LOGIN
══════════════════════════════════════════ */
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(62, 94, 82, 0.14), transparent 56%),
    var(--bg);
}

.login-screen[hidden] {
  display: none;
}

.login-card {
  width: min(420px, 100%);
  display: grid;
  gap: 16px;
  padding: 32px 28px;
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(20px);
}

.login-card .brand-mark {
  width: 72px;
  height: 72px;
  margin-bottom: 4px;
}

.login-error {
  min-height: 20px;
  color: var(--danger);
  font-size: 13px;
  font-weight: 600;
}

/* ══════════════════════════════════════════
   TOPBAR
══════════════════════════════════════════ */
.topbar {
  display: grid;
  grid-template-columns: minmax(240px, 320px) minmax(220px, 1fr) auto;
  gap: 16px;
  align-items: center;
  margin: 12px clamp(12px, 2.5vw, 28px) 0;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: var(--radius);
  box-shadow: 0 8px 28px rgba(23, 24, 23, 0.09);
  position: sticky;
  top: 10px;
  z-index: 20;
  backdrop-filter: blur(20px);
  transition: box-shadow 260ms ease;
}

.topbar:hover {
  box-shadow: 0 12px 40px rgba(23, 24, 23, 0.13);
}

/* ── Brand ── */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  width: 50px;
  height: 50px;
  flex: 0 0 auto;
  transition: transform 340ms ease;
}

.brand:hover .brand-mark {
  transform: rotate(-4deg) scale(1.04);
}

.brand-mark circle {
  fill: var(--ink);
}

.brand-mark text {
  fill: white;
  font-family: Georgia, serif;
  font-size: 118px;
  font-weight: 700;
  text-anchor: middle;
}

.brand-mark__small {
  fill: var(--brand) !important;
}

.brand-mark__small-text {
  font-size: 82px !important;
}

.eyebrow {
  color: var(--brand);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

/* ── Quick search ── */
.quick-search {
  position: relative;
  display: grid;
  gap: 5px;
}

.quick-search__control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.voice-button {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--brand);
  border-radius: var(--radius-sm);
  background: var(--brand);
  color: white;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 200ms ease, transform 180ms ease;
  white-space: nowrap;
}

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

.voice-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.quick-search label,
label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

label.is-missing {
  color: var(--danger);
}

label.is-missing input,
label.is-missing select,
label.is-missing textarea {
  border-color: var(--danger);
  background: var(--danger-light);
}

.quick-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 380px;
  overflow: auto;
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 40;
  backdrop-filter: blur(16px);
}

.quick-result {
  width: 100%;
  min-height: 54px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  text-align: left;
  padding: 10px 14px;
  cursor: pointer;
  transition: background 160ms ease;
}

.quick-result:hover {
  background: var(--brand-light);
}

.quick-result strong {
  display: block;
  font-size: 14px;
}

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

/* ── Topbar actions ── */
.topbar__actions,
.assistant-box__actions,
.card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.sync-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.56);
}

.sync-status::before {
  content: '';
  display: block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
}

/* ══════════════════════════════════════════
   LAYOUT
══════════════════════════════════════════ */
.layout {
  padding: 18px clamp(12px, 2.5vw, 28px) 40px;
}

/* ── Summary strip ── */
.panel,
.view {
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.panel--summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  overflow: hidden;
  margin-bottom: 16px;
}

.panel--summary article {
  padding: 20px 22px;
  background: var(--surface-raised);
  display: grid;
  gap: 6px;
  border-right: 1px solid var(--line);
  transition: background 200ms ease;
}

.panel--summary article:last-child {
  border-right: 0;
}

.panel--summary article:hover {
  background: rgba(255, 255, 255, 1);
}

.panel--summary span {
  display: block;
  font-size: 34px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--ink);
  background: linear-gradient(135deg, var(--ink), var(--brand-dark));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.panel--summary p {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── Workspace ── */
.workspace {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

/* ── Sidebar ── */
.sidebar {
  padding: 12px;
  position: sticky;
  top: 100px;
}

/* ── Tabs (vertical nav) ── */
.tabs {
  display: grid;
  gap: 5px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.tab,
.button,
.segment {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  min-height: 40px;
  padding: 0 14px;
  cursor: pointer;
  background: transparent;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
  transition: background 180ms ease, color 180ms ease, border-color 180ms ease,
              box-shadow 180ms ease, transform 160ms ease;
}

.tab {
  text-align: left;
  display: flex;
  align-items: center;
  gap: 9px;
}

.tab:hover {
  background: var(--brand-light);
  border-color: rgba(62, 94, 82, 0.20);
  color: var(--brand-dark);
}

.tab.is-active {
  background: var(--brand);
  color: white;
  border-color: var(--brand);
  box-shadow: 0 6px 18px rgba(35, 58, 50, 0.22);
}

.tab.is-active:hover {
  background: var(--brand-dark);
  transform: none;
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.button--primary {
  background: var(--brand);
  border-color: var(--brand);
  color: white;
  box-shadow: 0 6px 20px rgba(35, 58, 50, 0.20);
}

.button--primary:hover {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
  box-shadow: 0 10px 28px rgba(35, 58, 50, 0.28);
}

.button--ghost {
  background: transparent;
  color: var(--muted);
}

.button--ghost:hover {
  background: var(--brand-light);
  color: var(--brand-dark);
  border-color: rgba(62, 94, 82, 0.20);
}

.button--soft {
  background: var(--surface-soft);
  border-color: rgba(62, 94, 82, 0.14);
}

.button--soft:hover {
  background: rgba(62, 94, 82, 0.12);
  border-color: rgba(62, 94, 82, 0.24);
  color: var(--brand-dark);
}

.button--danger {
  color: var(--danger);
  border-color: rgba(192, 57, 43, 0.24);
  background: rgba(255, 255, 255, 0.76);
}

.button--danger:hover {
  background: var(--danger-light);
  border-color: rgba(192, 57, 43, 0.40);
}

.button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.file-button input {
  display: none;
}

.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ── Segment control ── */
.segmented {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(237, 242, 238, 0.70);
  gap: 3px;
}

.segment {
  border-color: transparent;
  min-height: 32px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: 5px;
}

.segment.is-active {
  background: var(--brand);
  color: white;
  border-color: var(--brand);
  box-shadow: 0 4px 12px rgba(35, 58, 50, 0.20);
  transform: none;
}

/* ── Filters ── */
.filters,
label {
  display: grid;
  gap: 8px;
}

.filters {
  gap: 11px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  font-size: 14px;
  transition: border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--brand);
  background: white;
  box-shadow: 0 0 0 3px rgba(62, 94, 82, 0.12);
}

textarea {
  resize: vertical;
  line-height: 1.5;
}

/* ══════════════════════════════════════════
   VIEW PANELS
══════════════════════════════════════════ */
.content {
  min-width: 0;
}

.view {
  display: none;
  padding: 22px;
}

.view.is-active {
  display: block;
}

.view-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

/* ══════════════════════════════════════════
   WAREHOUSE MAP
══════════════════════════════════════════ */
.warehouse-map {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  min-height: 420px;
  border: 2px solid rgba(66, 216, 173, 0.60);
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, transparent 75%, rgba(66, 216, 173, 0.08) 75%),
    #fafbfa;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(66, 216, 173, 0.20);
}

.map-building {
  position: absolute;
  left: 2%;
  top: 0;
  width: 76%;
  height: 76%;
  border-right: 2px solid rgba(44, 55, 49, 0.28);
  border-bottom: 2px solid rgba(44, 55, 49, 0.28);
  pointer-events: none;
}

.map-label {
  position: absolute;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  pointer-events: none;
}

.map-zone {
  position: absolute;
  display: grid;
  place-items: center;
  border: 2px solid transparent;
  color: #080808;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  padding: 6px;
  cursor: pointer;
  border-radius: 6px;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease, opacity 160ms ease;
}

.map-zone:hover,
.map-zone.is-selected {
  transform: translateY(-3px) scale(1.02);
  border-color: rgba(0, 0, 0, 0.40);
  box-shadow: 0 10px 28px rgba(28, 28, 28, 0.18);
  z-index: 2;
}

.map-zone__count {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.80);
  border-radius: 999px;
  padding: 2px 7px;
}

.map-zone--red   { background: var(--red); }
.map-zone--blue  { background: var(--blue); color: white; }
.map-zone--green { background: var(--green); }
.map-zone--blank {
  background: repeating-linear-gradient(135deg, #eeede8 0 12px, #fafafa 12px 24px);
  border-color: var(--line);
  color: var(--muted);
}

.map-tooltip {
  position: fixed;
  width: min(340px, calc(100vw - 24px));
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 14px;
  z-index: 60;
  pointer-events: none;
  backdrop-filter: blur(16px);
}

.map-tooltip strong {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
}

.map-tooltip ul {
  margin: 8px 0 0;
  padding-left: 18px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}

/* ── Mini map ── */
.mini-map {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  border: 2px solid rgba(66, 216, 173, 0.52);
  border-radius: var(--radius-sm);
  background:
    linear-gradient(90deg, transparent 75%, rgba(66, 216, 173, 0.08) 75%),
    #fafbfa;
  overflow: hidden;
}

.mini-map__building {
  position: absolute;
  left: 2%;
  top: 0;
  width: 76%;
  height: 76%;
  border-right: 2px solid rgba(44, 55, 49, 0.22);
  border-bottom: 2px solid rgba(44, 55, 49, 0.22);
}

.mini-map__label {
  position: absolute;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
}

.mini-map--upcoming {
  background:
    linear-gradient(90deg, transparent 75%, rgba(66, 216, 173, 0.06) 75%),
    repeating-linear-gradient(135deg, #f1f1ef 0 12px, #ffffff 12px 24px);
}

.mini-map__soon {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 7px 12px;
  border: 1px solid var(--brand);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.92);
  color: var(--brand-dark);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
}

.mini-map__zone {
  position: absolute;
  display: grid;
  place-items: center;
  border: 1px solid rgba(28, 28, 28, 0.22);
  border-radius: 3px;
  opacity: 0.35;
  padding: 2px;
  color: #111;
  text-align: center;
  transition: opacity 160ms ease;
}

.mini-map__zone.is-highlighted {
  opacity: 1;
  border: 2px solid var(--ink);
  box-shadow: 0 0 0 3px rgba(62, 94, 82, 0.18);
}

.mini-map__zone.is-clickable {
  appearance: none;
  cursor: pointer;
}

.mini-map__zone.is-clickable:hover {
  opacity: 0.80;
  border-color: var(--ink);
}

.mini-map__zone-name {
  max-width: 100%;
  overflow: hidden;
  color: inherit;
  font-size: clamp(6px, 1.4vw, 9px);
  font-weight: 800;
  line-height: 1;
  text-overflow: ellipsis;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.70);
  white-space: normal;
}

.mini-map__zone--red   { background: var(--red); }
.mini-map__zone--blue  { background: var(--blue); color: #fff; }
.mini-map__zone--blue .mini-map__zone-name { text-shadow: 0 1px 2px rgba(0,0,0,0.50); }
.mini-map__zone--green { background: var(--green); }
.mini-map__zone--blank { background: repeating-linear-gradient(135deg, #f1f1ef 0 8px, #ffffff 8px 16px); }

/* ══════════════════════════════════════════
   INVENTORY — PIECE CARDS
══════════════════════════════════════════ */
.inventory-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 14px;
}

.piece-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  display: grid;
  gap: 0;
  min-height: 240px;
  background: var(--surface-raised);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  isolation: isolate;
  transition: transform 200ms ease, box-shadow 200ms ease;
}

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

.piece-card:not(.piece-card--has-swatch) {
  padding-top: 16px;
}

.piece-card__swatch {
  min-height: 160px;
  display: flex;
  align-items: flex-end;
  padding: 12px;
  background: var(--piece-swatch);
  position: relative;
}

.piece-card__swatch::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(0,0,0,0.18), transparent 50%);
  pointer-events: none;
}

.piece-card__swatch span {
  position: relative;
  z-index: 1;
  max-width: 100%;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.30);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.80);
  backdrop-filter: blur(8px);
  color: var(--brand-dark);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.piece-card--dark-swatch .piece-card__swatch span {
  background: rgba(0, 0, 0, 0.44);
  border-color: rgba(255, 255, 255, 0.18);
  color: white;
}

.piece-card[data-status='consumido'] {
  opacity: 0.60;
}

.piece-card[data-status='reservado'] .piece-card__swatch::before {
  content: 'RESERVADO';
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  padding: 4px 8px;
  border-radius: 4px;
  background: rgba(182, 138, 86, 0.90);
  color: white;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.piece-card__top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px 0;
  position: relative;
}

.piece-card h3 {
  font-size: 17px;
  line-height: 1.18;
  letter-spacing: -0.01em;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 700;
  background: var(--surface-soft);
  color: var(--brand-dark);
  white-space: nowrap;
  letter-spacing: 0.03em;
}

.piece-card__top .pill {
  position: absolute;
  top: -1px;
  right: 16px;
  min-height: 24px;
  max-width: 110px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line);
}

.piece-card__top h3 {
  padding-right: 98px;
}

.code-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 28px;
  padding: 3px 10px;
  border: 1px dashed rgba(62, 94, 82, 0.38);
  border-radius: 6px;
  color: var(--brand-dark);
  background: var(--brand-light);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin: 6px 0 0 16px;
}

.material-preview {
  min-height: 100px;
  display: flex;
  align-items: flex-end;
  margin: 12px 16px 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--piece-swatch);
  overflow: hidden;
}

.material-preview span {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 0 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.80);
  backdrop-filter: blur(8px);
  color: var(--brand-dark);
  font-size: 11px;
  font-weight: 700;
}

.details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
  color: var(--muted);
  font-size: 13px;
  padding: 8px 16px 4px;
  line-height: 1.4;
}

.details strong {
  display: block;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}

.piece-card > p {
  padding: 0 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.piece-card .card-actions {
  padding: 10px 16px 16px;
  margin-top: auto;
}

/* ══════════════════════════════════════════
   ADD FORM
══════════════════════════════════════════ */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.form-grid__wide {
  grid-column: 1 / -1;
}

/* ── Zone/map pickers ── */
.zone-picker,
.map-picker {
  position: relative;
}

.zone-picker__menu,
.map-picker__menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 260px;
  overflow: auto;
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 85;
  backdrop-filter: blur(16px);
}

.assistant-missing-card .zone-picker__menu {
  position: static;
  max-height: none;
  overflow: visible;
  margin-top: 6px;
  box-shadow: none;
}

.zone-picker__hint {
  padding: 8px 12px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
  background: rgba(240, 242, 238, 0.90);
}

.zone-picker__map {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  background: #fafbfa;
}

.zone-picker__map .mini-map {
  max-height: 168px;
}

.assistant-missing-card .zone-picker__map {
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
}

.assistant-missing-card .zone-picker__map .mini-map {
  max-height: 138px;
}

.assistant-missing-card .zone-picker__option {
  min-height: 34px;
  padding: 7px 10px;
}

.zone-picker__option,
.map-picker__option {
  width: 100%;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 8px 14px;
  background: white;
  color: var(--ink);
  text-align: left;
  font-size: 13px;
  cursor: pointer;
  transition: background 140ms ease;
}

.zone-picker__option:hover,
.zone-picker__option.is-selected,
.map-picker__option:hover,
.map-picker__option.is-selected {
  background: var(--brand-light);
}

.zone-picker__option small,
.map-picker__option small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.map-picker input[readonly] {
  cursor: pointer;
}

.zone-picker__empty {
  padding: 14px;
  color: var(--muted);
  font-size: 13px;
}

/* ── Zone preview tooltip ── */
.zone-preview {
  position: fixed;
  width: 280px;
  padding: 14px;
  background: var(--surface-raised);
  border: 1px solid var(--brand);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 120;
  pointer-events: none;
  backdrop-filter: blur(16px);
}

.zone-preview strong {
  display: block;
  margin-bottom: 5px;
  font-size: 14px;
}

.zone-preview p {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 10px;
  line-height: 1.5;
}

/* ══════════════════════════════════════════
   ASSISTANT
══════════════════════════════════════════ */
.assistant-box {
  display: grid;
  gap: 14px;
}

.assistant-result,
.movement-list {
  display: grid;
  gap: 10px;
}

.result-card,
.movement-item,
.empty,
.voice-note {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px;
  background: rgba(255, 255, 255, 0.78);
  font-size: 14px;
  line-height: 1.5;
}

.guided-form {
  display: grid;
  gap: 12px;
}

.audit-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  max-height: 420px;
  overflow: auto;
}

.audit-item {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
  background: rgba(255, 255, 255, 0.78);
}

.audit-item p {
  color: var(--muted);
  font-size: 13px;
  margin-top: 3px;
  line-height: 1.5;
}

.audit-item ul {
  margin: 8px 0 0;
  padding-left: 18px;
  line-height: 1.6;
}

/* ══════════════════════════════════════════
   HISTORY
══════════════════════════════════════════ */
.movement-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.movement-item__side {
  display: grid;
  justify-items: end;
  gap: 8px;
  flex-shrink: 0;
}

.movement-item time {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
  font-weight: 500;
}

.movement-item .button {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

/* ══════════════════════════════════════════
   POST-ADD & ASSISTANT PROMPTS
══════════════════════════════════════════ */
.post-add-prompt {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: min(390px, calc(100vw - 28px));
  padding: 16px;
  border: 1px solid var(--brand);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-lg);
  z-index: 140;
  backdrop-filter: blur(16px);
}

.post-add-prompt p {
  color: var(--muted);
  font-size: 14px;
  margin: 4px 0 14px;
  line-height: 1.5;
}

.assistant-missing-prompt {
  position: fixed;
  inset: 0;
  z-index: 180;
  display: grid;
  place-items: center;
  padding: 18px;
}

.assistant-missing-prompt[hidden] {
  display: none;
}

.assistant-missing-prompt__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(14, 18, 16, 0.50);
  backdrop-filter: blur(6px);
}

.assistant-missing-card {
  position: relative;
  z-index: 1;
  width: min(520px, 100%);
  max-height: calc(100vh - 44px);
  overflow: auto;
  display: grid;
  gap: 14px;
  padding: 22px;
  border: 1px solid rgba(51, 92, 77, 0.22);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 30px 80px rgba(14, 18, 16, 0.28);
}

.assistant-missing-card h3 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.01em;
}

.assistant-missing-card p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.assistant-missing-fields {
  display: grid;
  gap: 12px;
}

.assistant-missing-fields label {
  display: grid;
  gap: 6px;
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 700;
}

.assistant-missing-fields input,
.assistant-missing-fields select {
  min-height: 44px;
  border-color: rgba(192, 57, 43, 0.42);
  background: #fffbfb;
}

/* ══════════════════════════════════════════
   DIALOG
══════════════════════════════════════════ */
dialog {
  border: 0;
  padding: 0;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: min(640px, calc(100vw - 32px));
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(16px);
}

dialog::backdrop {
  background: rgba(14, 18, 16, 0.40);
  backdrop-filter: blur(4px);
}

.dialog-card {
  padding: 22px;
}

.dialog-card menu {
  padding: 0;
  margin: 18px 0 0;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ══════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════ */
@media (max-width: 1100px) {
  .topbar {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

@media (max-width: 860px) {
  .topbar {
    grid-template-columns: 1fr;
    gap: 8px;
    margin: 8px 8px 0;
    padding: 8px;
    top: 6px;
  }

  .topbar .brand,
  .topbar__actions {
    display: none;
  }

  .quick-search {
    gap: 0;
  }

  .quick-search label {
    display: none;
  }

  .quick-search__control {
    gap: 6px;
  }

  .quick-search input,
  .voice-button {
    min-height: 40px;
  }

  .voice-button {
    padding-inline: 10px;
    font-size: 13px;
  }

  .layout {
    padding-top: 10px;
  }

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

  .panel--summary article {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .view-header {
    align-items: stretch;
    flex-direction: column;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

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

  .form-grid {
    grid-template-columns: 1fr;
  }

  .movement-item,
  .movement-item__side {
    align-items: stretch;
    justify-items: stretch;
  }

  .movement-item {
    flex-direction: column;
  }

  .post-add-prompt {
    left: 10px;
    right: 10px;
    bottom: 10px;
    width: auto;
  }

  .assistant-missing-prompt {
    align-items: end;
    padding: 10px;
  }

  .assistant-missing-card {
    max-height: calc(100vh - 28px);
    overflow: auto;
  }

  .warehouse-map {
    min-height: 360px;
  }

  .map-zone {
    font-size: 11px;
  }
}

@media (max-width: 520px) {
  .layout {
    padding-inline: 10px;
  }

  .tabs,
  .panel--summary {
    grid-template-columns: 1fr;
  }

  .inventory-list {
    grid-template-columns: 1fr;
  }
}
