/* Suite A33 — Centro de Mando — tema oscuro como base segura.
   La apariencia clara se activa únicamente cuando el sistema global resuelve data-theme="light". */
:root,
html[data-theme="dark"]{
  --cmd-bg:#060606;
  --cmd-body-top:#0b0b0b;
  --cmd-card:#111111;
  --cmd-surface:#161616;
  --cmd-surface-soft:#1c1c1c;
  --cmd-control:#141414;
  --cmd-text:#f6f2e8;
  --cmd-muted:rgba(246,242,232,.70);
  --cmd-border:rgba(221,191,100,.24);
  --cmd-border-strong:rgba(221,191,100,.34);
  --cmd-line:rgba(255,255,255,.11);
  --cmd-line-soft:rgba(255,255,255,.075);
  --cmd-gold:#ddbf64;
  --cmd-gold-dark:#b28d38;
  --cmd-gold-soft:rgba(221,191,100,.08);
  --cmd-gold-soft-hover:rgba(221,191,100,.14);
  --cmd-wine:#e39a9a;
  --cmd-wine-dark:#551010;
  --cmd-wine-soft:rgba(197,76,76,.14);
  --cmd-primary-top:#8c2020;
  --cmd-primary-bottom:#551010;
  --cmd-ok:#72c996;
  --cmd-warn:#e2b45d;
  --cmd-danger:#ff8585;
  --cmd-info:#78aee8;
  --cmd-shadow:0 16px 38px rgba(0,0,0,.38);
  --cmd-press-shadow:0 5px 12px rgba(0,0,0,.28);
  --cmd-focus-ring:rgba(221,191,100,.34);
  --cmd-overlay:rgba(0,0,0,.74);
  --cmd-toast-bg:#24201d;
}

html[data-theme="light"]{
  --cmd-bg:#f6f2eb;
  --cmd-body-top:#faf7f1;
  --cmd-card:#fffdf9;
  --cmd-surface:#ffffff;
  --cmd-surface-soft:#fbf8f2;
  --cmd-control:#ffffff;
  --cmd-text:#231c19;
  --cmd-muted:#716861;
  --cmd-border:rgba(92,62,42,.18);
  --cmd-border-strong:rgba(92,62,42,.22);
  --cmd-line:rgba(92,62,42,.14);
  --cmd-line-soft:rgba(92,62,42,.10);
  --cmd-gold:#b88a35;
  --cmd-gold-dark:#8a6427;
  --cmd-gold-soft:rgba(184,138,53,.07);
  --cmd-gold-soft-hover:rgba(184,138,53,.09);
  --cmd-wine:#7b1818;
  --cmd-wine-dark:#551010;
  --cmd-wine-soft:rgba(123,24,24,.08);
  --cmd-primary-top:#8c2020;
  --cmd-primary-bottom:#7b1818;
  --cmd-ok:#246b45;
  --cmd-warn:#9a6500;
  --cmd-danger:#a52b2b;
  --cmd-info:#28679a;
  --cmd-shadow:0 12px 32px rgba(55,34,19,.10);
  --cmd-press-shadow:0 5px 12px rgba(66,35,20,.08);
  --cmd-focus-ring:rgba(184,138,53,.38);
  --cmd-overlay:rgba(30,18,12,.62);
  --cmd-toast-bg:#24201d;
}

*{ box-sizing:border-box; }
html{ min-height:100%; overflow-x:hidden; background:var(--cmd-bg); }
body{
  margin:0;
  min-height:100vh;
  overflow-x:hidden;
  background:
    radial-gradient(circle at 5% 0%, rgba(184,138,53,.10), transparent 34%),
    linear-gradient(180deg, var(--cmd-body-top) 0%, var(--cmd-bg) 100%);
  color:var(--cmd-text);
  font-family:Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button,input{ font:inherit; }
button{ -webkit-tap-highlight-color:transparent; }
[hidden]{ display:none !important; }

.cmd-main{
  width:min(1500px, calc(100% - 32px));
  margin:0 auto;
  padding:24px 0 calc(48px + env(safe-area-inset-bottom));
  display:grid;
  gap:18px;
}

.cmd-block{
  width:100%;
  min-width:0;
  padding:22px;
  border:1px solid var(--cmd-border);
  border-radius:20px;
  background:var(--cmd-card);
  box-shadow:var(--cmd-shadow);
}

.cmd-block-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:18px;
  margin-bottom:18px;
}
.cmd-block-title{
  margin:0;
  font-size:clamp(1.1rem, 2vw, 1.4rem);
  line-height:1.2;
  letter-spacing:.01em;
}
.cmd-muted{ color:var(--cmd-muted); font-size:.92rem; line-height:1.45; }
.cmd-block-head .cmd-muted{ margin:.35rem 0 0; }

.cmd-operational{
  border-color:rgba(184,138,53,.36);
  background:
    linear-gradient(135deg, rgba(123,24,24,.035), rgba(184,138,53,.07)),
    var(--cmd-card);
}
.cmd-operational-status{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:12px;
  margin-bottom:18px;
}
.cmd-operational-status article{
  min-width:0;
  display:flex;
  flex-direction:column;
  gap:5px;
  padding:13px 15px;
  border:1px solid rgba(184,138,53,.28);
  border-radius:14px;
  background:var(--cmd-gold-soft);
}
.cmd-operational-status span{
  color:var(--cmd-muted);
  font-size:.76rem;
  font-weight:800;
  letter-spacing:.07em;
  text-transform:uppercase;
}
.cmd-operational-status strong{
  min-width:0;
  overflow:hidden;
  color:var(--cmd-wine);
  text-overflow:ellipsis;
  white-space:nowrap;
}

.cmd-operational-grid{
  display:grid;
  grid-template-columns:minmax(0, 1fr) minmax(260px, .42fr);
  gap:18px;
  align-items:end;
}
.cmd-field{ min-width:0; }
.cmd-label{ display:block; margin-bottom:7px; font-weight:800; font-size:.88rem; }
.cmd-picker{ position:relative; display:grid; grid-template-columns:minmax(0,1fr) 48px; }
.cmd-input{
  width:100%;
  min-height:48px;
  padding:0 14px;
  border:1px solid var(--cmd-border);
  border-right:0;
  border-radius:13px 0 0 13px;
  background:var(--cmd-control);
  color:var(--cmd-text);
  outline:none;
}
.cmd-picker-display{
  display:flex;
  align-items:center;
  overflow:hidden;
  text-align:left;
  text-overflow:ellipsis;
  white-space:nowrap;
  cursor:pointer;
  user-select:none;
  -webkit-user-select:none;
}
.cmd-input:focus{ border-color:var(--cmd-gold); box-shadow:0 0 0 3px rgba(184,138,53,.14); }
.cmd-picker-btn{
  min-height:48px;
  border:1px solid var(--cmd-border);
  border-radius:0 13px 13px 0;
  background:var(--cmd-control);
  color:var(--cmd-wine);
  font-size:1.15rem;
  cursor:pointer;
}
.cmd-picker-list{
  position:static;
  grid-column:1 / -1;
  width:100%;
  max-height:320px;
  margin-top:7px;
  overflow:auto;
  border:1px solid var(--cmd-border);
  border-radius:14px;
  background:var(--cmd-control);
  box-shadow:0 18px 45px rgba(45,27,16,.18);
}
.cmd-picker-item{
  width:100%;
  display:block;
  padding:12px 14px;
  border:0;
  border-bottom:1px solid var(--cmd-line-soft);
  background:var(--cmd-surface);
  text-align:left;
  cursor:pointer;
}
.cmd-picker-item:last-child{ border-bottom:0; }
.cmd-picker-item:hover,.cmd-picker-item:focus-visible{ background:var(--cmd-gold-soft-hover); outline:none; }
.cmd-picker-item.is-selected{ background:var(--cmd-wine-soft); }
.cmd-picker-item strong,.cmd-picker-item small{ display:block; }
.cmd-picker-item small{ margin-top:2px; color:var(--cmd-muted); }
.cmd-picker-hint{ margin-top:7px; min-height:1.3em; }
.cmd-use-pos{ display:flex; flex-direction:column; gap:8px; }

.cmd-btn,.cmd-pill-btn{
  min-height:44px;
  border:1px solid rgba(123,24,24,.25);
  border-radius:12px;
  padding:10px 15px;
  background:var(--cmd-surface);
  color:var(--cmd-wine);
  font-weight:800;
  cursor:pointer;
  text-decoration:none;
  text-align:center;
}
.cmd-btn:active,.cmd-pill-btn:active{ transform:scale(.99); box-shadow:var(--cmd-press-shadow); }
.cmd-btn:disabled{ opacity:.45; cursor:not-allowed; transform:none; box-shadow:none; }
.cmd-btn-primary{
  border-color:var(--cmd-wine);
  background:linear-gradient(180deg, var(--cmd-primary-top), var(--cmd-primary-bottom));
  color:#fff;
}
.cmd-pill-btn{ min-height:38px; padding:8px 13px; border-radius:999px; white-space:nowrap; }
.cmd-inline-btn{ display:inline-flex; width:auto; margin-top:10px; }

.cmd-metrics-grid{ display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:14px; }
.cmd-metric-card{
  min-width:0;
  display:flex;
  flex-direction:column;
  gap:6px;
  padding:18px;
  border:1px solid var(--cmd-line);
  border-radius:16px;
  background:linear-gradient(180deg,var(--cmd-surface),var(--cmd-surface-soft));
}
.cmd-metric-label{ color:var(--cmd-muted); font-weight:750; }
.cmd-metric-value{ font-size:clamp(1.55rem,3vw,2.25rem); line-height:1.05; overflow-wrap:anywhere; }
.cmd-state-value{ font-size:clamp(1.3rem,2.5vw,1.9rem); }
.cmd-metric-card.is-ok{ border-color:rgba(36,107,69,.35); box-shadow:inset 0 3px 0 rgba(36,107,69,.65); }
.cmd-metric-card.is-warning{ border-color:rgba(154,101,0,.35); box-shadow:inset 0 3px 0 rgba(154,101,0,.65); }
.cmd-metric-card.is-danger{ border-color:rgba(165,43,43,.35); box-shadow:inset 0 3px 0 rgba(165,43,43,.7); }
.cmd-metric-card.is-muted{ opacity:.88; }

.cmd-attention-list,.cmd-list{ display:grid; gap:10px; }
.cmd-attention-item,.cmd-list-item{
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  gap:12px;
  align-items:center;
  padding:13px 14px;
  border:1px solid var(--cmd-line);
  border-radius:14px;
  background:var(--cmd-surface);
}
.cmd-attention-item.is-danger{ border-left:5px solid var(--cmd-danger); }
.cmd-attention-item.is-warning{ border-left:5px solid var(--cmd-warn); }
.cmd-attention-item strong,.cmd-list-item strong{ display:block; }
.cmd-attention-item small,.cmd-list-item small{ display:block; margin-top:3px; color:var(--cmd-muted); }
.cmd-attention-main{ min-width:0; }
.cmd-attention-meta{ display:flex; align-items:center; gap:8px; margin-bottom:4px; }
.cmd-attention-level{
  display:inline-flex;
  align-items:center;
  min-height:22px;
  padding:3px 8px;
  border-radius:999px;
  font-size:.7rem;
  font-weight:900;
  letter-spacing:.06em;
}
.cmd-attention-item.is-danger .cmd-attention-level{ background:rgba(165,43,43,.11); color:var(--cmd-danger); }
.cmd-attention-item.is-warning .cmd-attention-level{ background:rgba(154,101,0,.12); color:var(--cmd-warn); }

.cmd-credit-attention{
  display:block;
  padding:0;
  overflow:hidden;
}
.cmd-credit-toggle{
  width:100%;
  min-height:64px;
  border:0;
  background:transparent;
  color:inherit;
  padding:13px 14px;
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  align-items:center;
  gap:14px;
  text-align:left;
  cursor:pointer;
  font:inherit;
  touch-action:manipulation;
}
.cmd-credit-toggle:focus-visible{
  outline:3px solid var(--cmd-focus-ring);
  outline-offset:-3px;
}
.cmd-credit-action{
  display:inline-flex;
  align-items:center;
  gap:7px;
  min-height:40px;
  padding:8px 11px;
  border:1px solid var(--cmd-border);
  border-radius:999px;
  font-weight:800;
  white-space:nowrap;
  background:var(--cmd-surface-soft);
}
.cmd-credit-chevron{ font-size:1.05rem; line-height:1; }
.cmd-credit-detail{
  border-top:1px solid var(--cmd-border);
  padding:14px;
  background:var(--cmd-surface-soft);
}
.cmd-credit-detail[hidden]{ display:none !important; }
.cmd-credit-detail-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:12px;
}
.cmd-credit-close{ width:auto; min-width:72px; padding:0 12px; font-size:.84rem; }
.cmd-credit-list{
  display:grid;
  gap:10px;
  max-height:min(56vh,560px);
  overflow:auto;
  overscroll-behavior:contain;
  padding-right:2px;
}
.cmd-credit-row{
  min-width:0;
  padding:12px;
  border:1px solid var(--cmd-border);
  border-radius:14px;
  background:var(--cmd-card);
}
.cmd-credit-row-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom:10px;
}
.cmd-credit-row-head strong{
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.cmd-credit-status{
  flex:0 0 auto;
  display:inline-flex;
  align-items:center;
  min-height:28px;
  padding:4px 9px;
  border-radius:999px;
  font-size:.75rem;
  font-weight:900;
  letter-spacing:.04em;
  text-transform:uppercase;
}
.cmd-credit-status.is-pending{ background:rgba(154,101,0,.14); color:var(--cmd-warn); }
.cmd-credit-status.is-partial{ background:rgba(43,112,165,.14); color:var(--cmd-info); }
.cmd-credit-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:9px 12px;
}
.cmd-credit-field{ min-width:0; }
.cmd-credit-field.is-wide{ grid-column:span 2; }
.cmd-credit-field span{
  display:block;
  color:var(--cmd-muted);
  font-size:.74rem;
  margin-bottom:3px;
}
.cmd-credit-field b{
  display:block;
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  font-size:.9rem;
}
.cmd-credit-field.is-money b{ font-variant-numeric:tabular-nums; }
.cmd-credit-field.is-balance b{ color:var(--cmd-warn); }
.cmd-attention-head{ align-items:center; }
.cmd-alert-count{
  display:inline-grid;
  place-items:center;
  min-width:42px;
  height:42px;
  padding:0 12px;
  border:1px solid rgba(123,24,24,.28);
  border-radius:999px;
  background:var(--cmd-wine-soft);
  color:var(--cmd-wine);
  font-size:1.05rem;
  font-weight:900;
}
.cmd-empty-line{ padding:14px; border:1px dashed var(--cmd-border-strong); border-radius:14px; color:var(--cmd-muted); text-align:center; }
.cmd-all-clear{ border-color:rgba(36,107,69,.28); background:rgba(36,107,69,.07); color:var(--cmd-ok); font-weight:850; }

.cmd-agenda-counts{ display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; margin-bottom:14px; }
.cmd-agenda-counts span{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:12px 14px;
  border:1px solid var(--cmd-line);
  border-radius:13px;
  background:var(--cmd-surface);
}
.cmd-agenda-counts b{ color:var(--cmd-wine); font-size:1.2rem; }


.cmd-order-metrics{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:10px;
  margin-bottom:18px;
}
.cmd-compact-metric{
  min-width:0;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:13px 15px;
  border:1px solid var(--cmd-line);
  border-radius:14px;
  background:var(--cmd-surface);
}
.cmd-compact-metric span{ color:var(--cmd-muted); font-weight:800; }
.cmd-compact-metric strong{ color:var(--cmd-wine); font-size:1.45rem; }
.cmd-compact-metric.is-danger{ border-left:5px solid var(--cmd-danger); }
.cmd-compact-metric.is-warning{ border-left:5px solid var(--cmd-warn); }
.cmd-subsection-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin:0 0 10px;
}
.cmd-subsection-head h3,.cmd-category-head h3{ margin:0; font-size:1rem; }
.cmd-urgent-list,.cmd-category-list{ display:grid; gap:9px; }
.cmd-operational-item{
  min-width:0;
  display:grid;
  grid-template-columns:minmax(0,1fr) auto auto;
  align-items:center;
  gap:10px;
  padding:12px 13px;
  border:1px solid var(--cmd-line);
  border-radius:13px;
  background:var(--cmd-surface);
}
.cmd-operational-item-main{ min-width:0; }
.cmd-operational-item strong{
  display:block;
  overflow-wrap:anywhere;
  line-height:1.35;
}
.cmd-operational-item small{
  display:block;
  margin-top:3px;
  color:var(--cmd-muted);
  line-height:1.35;
  overflow-wrap:anywhere;
}
.cmd-temporal-state{
  display:inline-flex;
  align-items:center;
  min-height:28px;
  padding:5px 9px;
  border-radius:999px;
  font-size:.72rem;
  font-weight:900;
  white-space:nowrap;
}
.cmd-temporal-state.is-danger{ background:rgba(165,43,43,.11); color:var(--cmd-danger); }
.cmd-temporal-state.is-warning{ background:rgba(154,101,0,.12); color:var(--cmd-warn); }
.cmd-temporal-state.is-neutral{ background:rgba(92,62,42,.09); color:var(--cmd-muted); }
.cmd-icon-action{
  min-width:42px;
  min-height:34px;
  padding:6px 10px;
  border:1px solid rgba(123,24,24,.22);
  border-radius:999px;
  background:var(--cmd-surface);
  color:var(--cmd-wine);
  font-weight:850;
  cursor:pointer;
}
.cmd-compact-empty{ padding:11px 12px; }

.cmd-agenda-categories{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:14px;
  align-items:start;
}
.cmd-agenda-category{
  min-width:0;
  padding:15px;
  border:1px solid var(--cmd-line);
  border-radius:16px;
  background:linear-gradient(180deg,var(--cmd-surface),var(--cmd-surface-soft));
}
.cmd-category-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom:11px;
}
.cmd-category-link{
  min-height:32px;
  padding:6px 10px;
  border:1px solid rgba(123,24,24,.20);
  border-radius:999px;
  background:var(--cmd-surface);
  color:var(--cmd-wine);
  font-size:.76rem;
  font-weight:850;
  white-space:nowrap;
  cursor:pointer;
}
.cmd-category-metrics{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:8px;
  margin-bottom:11px;
}
.cmd-category-metrics span{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  padding:9px 10px;
  border:1px solid var(--cmd-line-soft);
  border-radius:11px;
  background:var(--cmd-surface);
  color:var(--cmd-muted);
  font-size:.82rem;
  font-weight:800;
}
.cmd-category-metrics b{ color:var(--cmd-wine); font-size:1.05rem; }
.cmd-agenda-category .cmd-operational-item{ grid-template-columns:minmax(0,1fr) auto; }

.cmd-list-more{
  display:flex;
  justify-content:flex-end;
  margin-top:10px;
}

.cmd-list-more[hidden]{ display:none !important; }
.cmd-agenda-category .cmd-temporal-state{ display:none; }

.cmd-inventory-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:10px;
  margin-bottom:17px;
}
.cmd-inventory-grid article{
  min-width:0;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  min-height:78px;
  padding:14px 16px;
  border:1px solid var(--cmd-line);
  border-radius:14px;
  background:var(--cmd-surface);
}
.cmd-inventory-grid article.is-danger{ border-left:5px solid var(--cmd-danger); }
.cmd-inventory-grid article.is-warning{ border-left:5px solid var(--cmd-warn); }
.cmd-inventory-grid span{ color:var(--cmd-muted); font-weight:800; }
.cmd-inventory-grid article.is-danger b{ color:var(--cmd-danger); }
.cmd-inventory-grid article.is-warning b{ color:var(--cmd-warn); }
.cmd-inventory-grid b{ font-size:1.65rem; }
.cmd-inventory-subhead{ margin-top:2px; }
.cmd-inventory-risk-list{ display:grid; gap:9px; }
.cmd-inventory-risk{
  min-width:0;
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  align-items:center;
  gap:12px;
  padding:12px 14px;
  border:1px solid var(--cmd-line);
  border-radius:13px;
  background:var(--cmd-surface);
}
.cmd-inventory-risk.is-danger{ border-left:5px solid var(--cmd-danger); }
.cmd-inventory-risk.is-warning{ border-left:5px solid var(--cmd-warn); }
.cmd-inventory-risk-main{ min-width:0; }
.cmd-inventory-risk strong{ display:block; overflow-wrap:anywhere; }
.cmd-inventory-risk small{ display:block; margin-top:3px; color:var(--cmd-muted); line-height:1.4; }
.cmd-risk-chip{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:28px;
  padding:5px 9px;
  border-radius:999px;
  font-size:.71rem;
  font-weight:900;
  white-space:nowrap;
}
.cmd-inventory-risk.is-danger .cmd-risk-chip{ background:rgba(165,43,43,.11); color:var(--cmd-danger); }
.cmd-inventory-risk.is-warning .cmd-risk-chip{ background:rgba(154,101,0,.12); color:var(--cmd-warn); }
.cmd-reviewed{ margin-top:11px; color:var(--cmd-muted); font-size:.78rem; font-weight:750; text-align:right; }

.cmd-global-list{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:14px;
}
.cmd-global-card{
  min-width:0;
  align-self:start;
  border:1px solid var(--cmd-line);
  border-radius:17px;
  background:var(--cmd-surface);
  overflow:hidden;
}
.cmd-global-card.is-pos-active{ border-color:rgba(36,107,69,.48); box-shadow:inset 4px 0 0 var(--cmd-ok); }
.cmd-global-card-head{ padding:15px; }
.cmd-global-card-title{
  min-width:0;
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  margin-bottom:13px;
}
.cmd-global-card-title strong{ display:block; overflow-wrap:anywhere; }
.cmd-global-card-title small{ display:block; margin-top:4px; color:var(--cmd-muted); }
.cmd-pos-badge{
  display:inline-flex;
  align-items:center;
  min-height:25px;
  padding:4px 8px;
  border-radius:999px;
  background:rgba(36,107,69,.10);
  color:var(--cmd-ok);
  font-size:.68rem;
  font-weight:900;
  white-space:nowrap;
}
.cmd-event-metrics{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:8px;
}
.cmd-event-metric{
  min-width:0;
  padding:10px;
  border:1px solid var(--cmd-line-soft);
  border-radius:11px;
  background:var(--cmd-surface-soft);
}
.cmd-event-metric span{ display:block; color:var(--cmd-muted); font-size:.72rem; font-weight:800; }
.cmd-event-metric strong{ display:block; margin-top:4px; color:var(--cmd-wine); font-size:1rem; overflow-wrap:anywhere; }
.cmd-event-metric.is-danger strong{ color:var(--cmd-danger); }
.cmd-event-card-actions{
  display:flex;
  gap:8px;
  padding:0 15px 15px;
}
.cmd-event-card-actions .cmd-pill-btn{ flex:1 1 0; min-width:0; white-space:normal; }
.cmd-event-detail{
  padding:14px 15px 15px;
  border-top:1px solid var(--cmd-line-soft);
  background:linear-gradient(180deg,var(--cmd-surface-soft),var(--cmd-surface));
}
.cmd-event-alert-list{ display:grid; gap:8px; }
.cmd-event-alert{
  min-width:0;
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  align-items:center;
  gap:10px;
  padding:10px 11px;
  border:1px solid var(--cmd-line-soft);
  border-radius:11px;
  background:var(--cmd-surface);
}
.cmd-event-alert.is-danger{ border-left:4px solid var(--cmd-danger); }
.cmd-event-alert.is-warning{ border-left:4px solid var(--cmd-warn); }
.cmd-event-alert strong{ display:block; font-size:.88rem; overflow-wrap:anywhere; }
.cmd-event-alert small{ display:block; margin-top:2px; color:var(--cmd-muted); font-size:.76rem; }
.cmd-event-alert .cmd-icon-action{ min-width:72px; }

.cmd-modal{
  position:fixed;
  inset:0;
  z-index:1000;
  display:grid;
  place-items:center;
  padding:20px;
}
.cmd-modal-overlay{ position:absolute; inset:0; background:var(--cmd-overlay); backdrop-filter:blur(3px); }
.cmd-modal-card{
  position:relative;
  width:min(520px,100%);
  border:1px solid rgba(184,138,53,.38);
  border-radius:20px;
  background:var(--cmd-card);
  box-shadow:0 28px 80px rgba(0,0,0,.28);
  overflow:hidden;
}
.cmd-modal-head{ display:flex; align-items:center; justify-content:space-between; gap:14px; padding:18px 20px; border-bottom:1px solid var(--cmd-border); }
.cmd-modal-head h2{ margin:0; font-size:1.2rem; }
.cmd-icon-btn{ width:40px; height:40px; border:0; border-radius:50%; background:var(--cmd-wine-soft); color:var(--cmd-wine); cursor:pointer; }
.cmd-modal-body{ padding:22px 20px; }
.cmd-modal-body p{ margin:0 0 12px; }
.cmd-modal-body strong{ display:block; font-size:1.35rem; color:var(--cmd-wine); margin-bottom:12px; }
.cmd-modal-actions{ display:grid; grid-template-columns:1fr 1fr; gap:10px; padding:0 20px 20px; }

.cmd-toast{
  position:fixed;
  z-index:1200;
  top:calc(18px + env(safe-area-inset-top));
  right:18px;
  max-width:min(420px,calc(100% - 36px));
  padding:13px 16px;
  border-radius:13px;
  background:var(--cmd-toast-bg);
  color:#fff;
  box-shadow:0 14px 40px rgba(0,0,0,.25);
  font-weight:750;
}
.cmd-toast.is-ok{ background:var(--cmd-ok); }
.cmd-toast.is-error{ background:var(--cmd-danger); }

@media (max-width:820px){
  .cmd-main{ width:min(100% - 20px,1500px); padding-top:14px; gap:12px; }
  .cmd-block{ padding:16px; border-radius:16px; }
  .cmd-block-head{ flex-direction:column; align-items:stretch; gap:10px; }
  .cmd-operational-status{ grid-template-columns:1fr 1fr; }
  .cmd-operational-status article:last-child{ grid-column:1 / -1; }
  .cmd-operational-grid{ grid-template-columns:1fr; }
  .cmd-metrics-grid{ grid-template-columns:repeat(2,minmax(0,1fr)); }
}

@media (max-width:560px){
  .cmd-operational-status,.cmd-metrics-grid,.cmd-order-metrics,.cmd-agenda-counts,.cmd-inventory-grid,.cmd-event-metrics{ grid-template-columns:1fr; }
  .cmd-operational-status article:last-child{ grid-column:auto; }
  .cmd-attention-item,.cmd-list-item,.cmd-operational-item,.cmd-inventory-risk,.cmd-event-alert{ grid-template-columns:1fr; }
  .cmd-attention-item .cmd-pill-btn{ width:100%; }
  .cmd-modal-actions{ grid-template-columns:1fr; }
  .cmd-toast{ left:50%; right:auto; transform:translateX(-50%); }
}

@media (min-width:821px) and (max-width:1180px){
  .cmd-metrics-grid{ grid-template-columns:repeat(2,minmax(0,1fr)); }
  .cmd-agenda-categories{ grid-template-columns:1fr; }
  .cmd-global-list{ grid-template-columns:1fr; }
}

@media (max-width:820px){
  .cmd-agenda-categories{ grid-template-columns:1fr; }
  .cmd-global-list{ grid-template-columns:1fr; }
  .cmd-operational-item{ grid-template-columns:minmax(0,1fr) auto; }
  .cmd-temporal-state{ justify-self:start; }
}

@media (max-width:560px){
  .cmd-category-head{ align-items:flex-start; }
  .cmd-category-metrics{ grid-template-columns:1fr; }
  .cmd-icon-action{ width:100%; }
  .cmd-event-card-actions{ flex-direction:column; }
}

/* Etapa 5/5 — responsive, tactilidad y hardening final */
html{
  width:100%;
  max-width:100%;
  overscroll-behavior-x:none;
  -webkit-text-size-adjust:100%;
  text-size-adjust:100%;
}
body{
  width:100%;
  max-width:100%;
  min-height:100dvh;
  overscroll-behavior-x:none;
}
img,svg,canvas,video{ max-width:100%; }
button,a,input{
  touch-action:manipulation;
  -webkit-tap-highlight-color:transparent;
}
button,a{ overflow-wrap:anywhere; }
button:focus-visible,a:focus-visible,input:focus-visible{
  outline:3px solid var(--cmd-focus-ring);
  outline-offset:2px;
}

.cmd-main{
  width:100%;
  max-width:1600px;
  padding:
    clamp(16px,2vw,28px)
    max(16px,env(safe-area-inset-right))
    calc(48px + env(safe-area-inset-bottom))
    max(16px,env(safe-area-inset-left));
}
.cmd-block,.cmd-block-head>*,.cmd-operational-grid>*,.cmd-metrics-grid>*,
.cmd-order-metrics>*,.cmd-agenda-categories>*,.cmd-inventory-grid>*,
.cmd-global-list>*,.cmd-event-card-actions>*{ min-width:0; }
.cmd-picker-list{
  max-height:min(320px,52dvh);
  overscroll-behavior:contain;
  -webkit-overflow-scrolling:touch;
}
.cmd-modal-card{
  max-height:calc(100dvh - 40px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  overflow-y:auto;
  overscroll-behavior:contain;
  -webkit-overflow-scrolling:touch;
}
.cmd-btn,.cmd-pill-btn,.cmd-category-link,.cmd-icon-action,.cmd-picker-btn,.cmd-icon-btn{
  transition:transform .12s ease,box-shadow .12s ease,filter .12s ease,border-color .12s ease;
}
.cmd-agenda-categories{
  grid-template-columns:repeat(auto-fit,minmax(min(100%,300px),1fr));
}
.cmd-global-list{
  grid-template-columns:repeat(auto-fit,minmax(min(100%,480px),1fr));
}
.cmd-operational-item-main,.cmd-attention-main,.cmd-global-card-title>div{ min-width:0; }

@media (hover:hover) and (pointer:fine){
  .cmd-btn:hover,.cmd-pill-btn:hover,.cmd-category-link:hover,.cmd-icon-action:hover{
    transform:translateY(-1px);
    box-shadow:0 8px 18px rgba(66,35,20,.10);
  }
}

@media (min-width:1440px){
  .cmd-main{ max-width:1680px; }
  .cmd-block{ padding:24px 26px; }
  .cmd-agenda-categories{ gap:16px; }
  .cmd-global-list{ grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; }
}

@media (min-width:821px) and (max-width:1180px){
  .cmd-agenda-categories{ grid-template-columns:repeat(2,minmax(0,1fr)); }
  .cmd-agenda-category:last-child{ grid-column:1 / -1; }
  .cmd-global-list{ grid-template-columns:1fr; }
}

@media (max-width:820px){
  .cmd-main{
    width:100%;
    padding:
      14px
      max(10px,env(safe-area-inset-right))
      calc(34px + env(safe-area-inset-bottom))
      max(10px,env(safe-area-inset-left));
  }
  .cmd-block-head{ align-items:flex-start; }
  .cmd-block-head>.cmd-pill-btn{ width:auto; max-width:100%; }
  .cmd-input{ font-size:16px; }
  .cmd-agenda-categories,.cmd-global-list{ grid-template-columns:1fr; }
  .cmd-modal{ padding:max(10px,env(safe-area-inset-top)) 10px max(10px,env(safe-area-inset-bottom)); }
}

@media (max-width:560px){
  .cmd-block{ padding:14px; }
  .cmd-block-head{ margin-bottom:14px; }
  .cmd-muted{ font-size:.88rem; }
  .cmd-btn,.cmd-pill-btn{ min-height:44px; }
  .cmd-category-link,.cmd-icon-action{ min-height:40px; width:auto; justify-self:start; }
  .cmd-category-head{ width:100%; }
  .cmd-category-head .cmd-category-link{ flex:0 0 auto; }
  .cmd-operational-item,.cmd-attention-item,.cmd-inventory-risk,.cmd-event-alert{
    grid-template-columns:minmax(0,1fr);
  }
  .cmd-temporal-state,.cmd-risk-chip{ justify-self:start; }
  .cmd-event-card-actions{ align-items:stretch; }
  .cmd-event-card-actions .cmd-pill-btn{ width:100%; }
  .cmd-toast{
    width:calc(100% - 20px);
    max-width:520px;
    top:calc(10px + env(safe-area-inset-top));
  }
}


@media (max-width:720px){
  .cmd-credit-toggle{ grid-template-columns:minmax(0,1fr); gap:10px; }
  .cmd-credit-action{ justify-self:start; }
  .cmd-credit-grid{ grid-template-columns:repeat(2,minmax(0,1fr)); }
  .cmd-credit-field.is-wide{ grid-column:1 / -1; }
}
@media (max-width:470px){
  .cmd-credit-detail{ padding:11px; }
  .cmd-credit-row{ padding:10px; }
  .cmd-credit-grid{ grid-template-columns:minmax(0,1fr); }
  .cmd-credit-field.is-wide{ grid-column:auto; }
  .cmd-credit-row-head{ align-items:flex-start; }
}

@media (max-width:390px){
  .cmd-main{ padding-left:max(8px,env(safe-area-inset-left)); padding-right:max(8px,env(safe-area-inset-right)); }
  .cmd-block{ padding:12px; border-radius:14px; }
  .cmd-operational-status article,.cmd-metric-card,.cmd-agenda-category{ padding:12px; }
  .cmd-global-card-head,.cmd-event-card-actions,.cmd-event-detail{ padding-left:12px; padding-right:12px; }
}

@media (orientation:landscape) and (max-height:560px){
  .cmd-main{ padding-top:10px; gap:10px; }
  .cmd-block{ padding-top:14px; padding-bottom:14px; }
  .cmd-block-head{ margin-bottom:12px; }
  .cmd-modal-card{ max-height:calc(100dvh - 20px); }
}

@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{
    scroll-behavior:auto !important;
    animation-duration:.01ms !important;
    animation-iteration-count:1 !important;
    transition-duration:.01ms !important;
  }
}


/* Reparación posterior Etapa 5 — coherencia completa con Apariencia global. */
html[data-theme="dark"] body{ color-scheme:dark; }
html[data-theme="light"] body{ color-scheme:light; }
html[data-theme="dark"] .cmd-input::placeholder{ color:rgba(246,242,232,.46); }
html[data-theme="dark"] .cmd-block,
html[data-theme="dark"] .cmd-modal-card{ backdrop-filter:saturate(115%); }
@media (prefers-reduced-motion:reduce){
  .cmd-btn,.cmd-pill-btn,.cmd-category-link,.cmd-icon-action,.cmd-picker-btn,.cmd-icon-btn{ transition:none; }
}
