@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,600;9..144,700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  /* Dynamic Background */
  --bg-gradient: linear-gradient(135deg, #e0eafc 0%, #cfdef3 100%);
  --bg-shape-1: #b6cbfc;
  --bg-shape-2: #d8c1ff;
  
  /* Text & Lines */
  --ink: #0f172a;
  --muted: #64748b;
  --line: rgba(15, 23, 42, 0.08);
  --line-strong: rgba(15, 23, 42, 0.15);
  
  /* Accents */
  --accent: #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.1);
  --accent-hover: #1d4ed8;
  --accent-shadow: rgba(37, 99, 235, 0.3);
  
  --danger: #e11d48;
  --success: #10b981;
  --warning: #f59e0b;
  
  /* Panels & Glassmorphism */
  --panel-bg: rgba(255, 255, 255, 0.75);
  --panel-border: rgba(255, 255, 255, 0.6);
  --shadow-soft: 0 4px 20px -2px rgba(15, 23, 42, 0.05);
  --shadow-hover: 0 10px 30px -4px rgba(15, 23, 42, 0.08), 0 4px 10px -2px rgba(15, 23, 42, 0.04);
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: #f1f5f9;
  background-image: var(--bg-gradient);
  font-family: 'Sora', -apple-system, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ── Dynamic Abstract Background ── */
.bg-shape {
  position: fixed;
  z-index: 0;
  border-radius: 999px;
  filter: blur(100px);
  pointer-events: none;
}

@keyframes floatA {
  0% { transform: scale(1) translate(0, 0); }
  33% { transform: scale(1.1) translate(3vw, -4vh); }
  66% { transform: scale(0.9) translate(-2vw, 3vh); }
  100% { transform: scale(1) translate(0, 0); }
}

@keyframes floatB {
  0% { transform: scale(1) translate(0, 0); }
  33% { transform: scale(0.9) translate(-4vw, 4vh); }
  66% { transform: scale(1.1) translate(2vw, -2vh); }
  100% { transform: scale(1) translate(0, 0); }
}

.shape-a {
  width: 45vw;
  height: 45vw;
  background: var(--bg-shape-1);
  top: -10vw;
  right: -5vw;
  opacity: 0.6;
  animation: floatA 25s infinite ease-in-out;
}

.shape-b {
  width: 50vw;
  height: 50vw;
  background: var(--bg-shape-2);
  bottom: -15vw;
  left: -10vw;
  opacity: 0.5;
  animation: floatB 30s infinite ease-in-out reverse;
}

/* ── Typography & Spacing ── */
h1, h2, h3, h4 {
  margin: 0 0 16px;
  color: var(--ink);
  letter-spacing: -0.02em;
  font-weight: 700;
  font-family: 'Fraunces', 'Times New Roman', serif;
}

h3 { font-size: 1.25rem; }
h4 { font-size: 1rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; margin-bottom: 12px; }

p { margin: 0; }
.muted { color: var(--muted); }

.layout {
  position: relative;
  z-index: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: 30px 20px 80px;
}

.layout.layout--picker {
  max-width: 1540px;
}

.app {
  display: grid;
  gap: 20px;
}

/* ── Glassmorphism Panels ── */
.panel, .card {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft), inset 0 1px 0 rgba(255,255,255,0.8);
  padding: 24px;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.panel-login {
  max-width: 440px;
  margin: 12vh auto 0;
  text-align: center;
}

/* ── Layout Utilities ── */
.row { display: flex; gap: 12px; align-items: center; }
.row-wrap { flex-wrap: wrap; }
.stack { display: grid; gap: 12px; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}
.pick-form { grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: end; }
.wide { grid-column: 1 / -1; }

.inline-form { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ── Pick Workspace (2 bloques) ── */
.pick-ops-panel {
  padding: 18px;
}

.pick-ops-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: stretch;
}

.app--picker .pick-ops-grid {
  grid-template-columns: minmax(520px, 1.15fr) minmax(620px, 1.35fr);
  gap: 18px;
}

.app--picker .pick-ops-card {
  min-height: 480px;
}

.app--picker .pick-ops-card .pick-form input,
.app--picker .pick-ops-card .pick-form select,
.app--picker .pick-ops-card .pick-form button {
  min-height: 46px;
}

.pick-ops-card {
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.7);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.86);
  padding: 16px;
  height: 100%;
}

.pick-ops-card--input {
  background: linear-gradient(
    155deg,
    rgba(255, 255, 255, 0.85) 0%,
    rgba(235, 245, 255, 0.75) 100%
  );
}

.pick-ops-card--witness {
  background: linear-gradient(
    155deg,
    rgba(255, 255, 255, 0.86) 0%,
    rgba(239, 247, 255, 0.78) 100%
  );
}

.pick-selection-banner {
  margin-top: 12px;
  min-height: 42px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: rgba(255,255,255,0.82);
  padding: 10px 12px;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink);
  display: flex;
  align-items: center;
}

.witness-list {
  margin-top: 12px;
  display: grid;
  gap: 8px;
  max-height: 430px;
  overflow-y: auto;
  padding-right: 4px;
}

.witness-row {
  border: 1px solid var(--line-strong);
  border-left: 7px solid transparent;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.84);
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.86);
}

.witness-row__summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
}

.witness-row__name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
}

.witness-row__meta {
  margin-top: 4px;
  font-size: 0.76rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.witness-row__qty {
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.06);
  border: 1px solid var(--line);
  padding: 7px 12px;
  font-weight: 800;
  color: var(--ink);
  min-width: 68px;
  text-align: center;
}

.witness-row__state {
  font-size: 0.7rem;
  font-weight: 800;
  border-radius: 999px;
  padding: 6px 10px;
  border: 1px solid transparent;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
}

.witness-row__actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  padding: 0 12px 12px;
}

.witness-row__actions .btn-secondary {
  padding: 6px 12px;
  font-size: 0.76rem;
  min-height: 34px;
}

.witness-row__approved-banner {
  margin: 0 12px 8px;
  border-radius: 10px;
  border: 1px solid rgba(22, 163, 74, 0.35);
  background: linear-gradient(180deg, rgba(220, 252, 231, 0.95), rgba(187, 247, 208, 0.9));
  color: #166534;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 6px 10px;
  letter-spacing: 0.02em;
}

.witness-row--ok {
  border-left-color: #16a34a;
  background: color-mix(in oklab, #16a34a, white 94%);
}

.witness-row--ok .witness-row__state {
  background: rgba(22, 163, 74, 0.12);
  border-color: rgba(22, 163, 74, 0.32);
  color: #166534;
}

.witness-row--pending {
  border-left-color: #dc2626;
  background: color-mix(in oklab, #dc2626, white 94%);
}

.witness-row--pending .witness-row__state {
  background: rgba(220, 38, 38, 0.12);
  border-color: rgba(220, 38, 38, 0.32);
  color: #991b1b;
}

.witness-row--approved {
  border-left-color: #15803d;
  background: linear-gradient(145deg, rgba(240, 253, 244, 0.96), rgba(209, 250, 229, 0.92));
  box-shadow:
    0 0 0 1px rgba(16, 185, 129, 0.22),
    0 8px 20px -10px rgba(16, 185, 129, 0.45),
    inset 0 1px 0 rgba(255,255,255,0.9);
}

.witness-row--approved .witness-row__state {
  background: rgba(16, 185, 129, 0.14);
  border-color: rgba(16, 185, 129, 0.35);
  color: #065f46;
}

.witness-row--approved.witness-row--celebrate {
  animation: witnessCelebrateGlow 1.25s ease-in-out 2;
  position: relative;
}

.witness-row--approved.witness-row--celebrate::after {
  content: '🎉 ✨';
  position: absolute;
  right: 12px;
  top: 8px;
  font-size: 0.95rem;
  opacity: 0.9;
}

@keyframes witnessCelebrateGlow {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
  35% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0.08), 0 14px 26px -10px rgba(16, 185, 129, 0.45); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0), 0 8px 20px -10px rgba(16, 185, 129, 0.45); }
}

.witness-row--rejected {
  border-left-color: #b91c1c;
  background: color-mix(in oklab, #ef4444, white 93%);
}

.witness-row--rejected .witness-row__state {
  background: rgba(185, 28, 28, 0.12);
  border-color: rgba(185, 28, 28, 0.32);
  color: #7f1d1d;
}

/* ── Forms & Inputs ── */
label {
  display: grid;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink);
}

input, select, textarea, button { font: inherit; }

input, select, textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.02);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  background: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft), inset 0 1px 3px rgba(0,0,0,0.01);
}

textarea { resize: vertical; min-height: 80px; }

/* ── Buttons ── */
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px; /* Pill shape */
  background: var(--accent);
  color: #fff;
  padding: 10px 20px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px var(--accent-shadow);
  gap: 8px;
}

button:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px var(--accent-shadow);
}

button:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px var(--accent-shadow);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.8);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}
.btn-secondary:hover {
  background: #fff;
  color: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

/* ── Status & Feedback ── */
.status {
  margin-top: 12px;
  min-height: 20px;
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-sm);
  display: inline-block;
}
.status:empty { display: none; }

.status-ok {
  color: #065f46;
  background: rgba(16, 185, 129, 0.16);
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.status-warn {
  color: #9a3412;
  background: rgba(245, 158, 11, 0.18);
  border: 1px solid rgba(245, 158, 11, 0.42);
}

.status-error {
  color: #9f1239;
  background: rgba(225, 29, 72, 0.14);
  border: 1px solid rgba(225, 29, 72, 0.4);
}

@keyframes statusPulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.12); }
  40% { transform: scale(1.01); box-shadow: 0 0 0 10px rgba(37, 99, 235, 0.0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.0); }
}

.status-pulse {
  animation: statusPulse 0.9s ease;
}

.pick-result-valorizado {
  color: #065f46;
  font-weight: 500;
  display: inline-block;
  padding: 4px 8px;
  background: rgba(16, 185, 129, 0.16);
  border-radius: 4px;
  margin-top: 4px;
}
.pick-result-contingencia {
  color: #9a3412;
  font-weight: 500;
  display: inline-block;
  padding: 4px 8px;
  background: rgba(245, 158, 11, 0.18);
  border-radius: 4px;
  margin-top: 4px;
}

.error-text {
  color: var(--danger);
  font-weight: 600;
  background: rgba(225, 29, 72, 0.05);
}

#pickNoBarcodeModal.pick-suggestion-modal--warning {
  border-color: rgba(225, 29, 72, 0.45) !important;
  background:
    linear-gradient(180deg, rgba(225, 29, 72, 0.08) 0%, rgba(225, 29, 72, 0.02) 45%, rgba(255, 255, 255, 0.86) 100%),
    rgba(255, 255, 255, 0.82);
}

#pickNoBarcodeModal.pick-suggestion-modal--warning h3 {
  color: #9f1239;
}

#pickNoBarcodeModal.pick-suggestion-modal--warning #pickNoBarcodeMeta {
  color: #7f1d1d;
}

/* ── Custom Data Grids (Cards instead of classic tables) ── */
.table-wrap {
  overflow-x: auto;
  margin-top: 16px;
  padding-bottom: 8px; /* Room for shadow */
}

table {
  border-collapse: separate;
  border-spacing: 0 8px; /* space between rows */
  width: 100%;
  min-width: 960px;
}

th {
  position: sticky;
  top: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0 16px 8px;
  border: none;
  z-index: 10;
}

td {
  background: rgba(255, 255, 255, 0.6);
  padding: 16px;
  font-size: 0.85rem;
  border-top: 1px solid rgba(255,255,255,0.8);
  border-bottom: 1px solid rgba(0,0,0,0.02);
  transition: background 0.2s;
}

td:first-child { border-radius: var(--radius-md) 0 0 var(--radius-md); border-left: 1px solid rgba(255,255,255,0.8); }
td:last-child { border-radius: 0 var(--radius-md) var(--radius-md) 0; border-right: 1px solid rgba(255,255,255,0.8); }

.grid-row-clickable {
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s;
}

.grid-row-clickable:hover {
  transform: scale(1.005);
  box-shadow: var(--shadow-hover);
  z-index: 5;
  position: relative;
}
.grid-row-clickable:hover td {
  background: rgba(255,255,255,0.95);
}

.grid-row-clickable.expanded {
  transform: none;
  box-shadow: none;
}
.grid-row-clickable.expanded td {
  background: #fff;
  border-bottom: 1px solid var(--line);
  border-radius: 0; /* Attach to expanded panel */
}
.grid-row-clickable.expanded td:first-child { border-radius: var(--radius-md) 0 0 0; }
.grid-row-clickable.expanded td:last-child { border-radius: 0 var(--radius-md) 0 0; }

.row-expanded td {
  padding: 0;
  background: #fff;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  box-shadow: inset 0 2px 10px rgba(0,0,0,0.02);
}

.row-content {
  padding: 24px;
  display: grid;
  gap: 24px;
  grid-template-columns: 1fr 340px;
}

/* Numbers tuning */
td strong {
  font-size: 1.1em;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* ── Live Feed & Logs ── */
.feed {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 280px;
  overflow: auto;
  padding-right: 8px;
}

.feed-item {
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 0.8rem;
  background: rgba(255, 255, 255, 0.6);
  box-shadow: 0 2px 8px rgba(0,0,0,0.02);
  display: flex;
  flex-direction: column;
  gap: 4px;
  animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.code-box {
  margin: 12px 0 0;
  background: rgba(15, 23, 42, 0.03);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.75rem;
  color: var(--ink);
  max-height: 300px;
  overflow: auto;
}

/* ── Topbar / Nav ── */
.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  background: var(--panel-bg);
  padding: 16px 24px;
  border-radius: 999px; /* pill shape nav */
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: var(--shadow-soft), inset 0 1px 0 rgba(255,255,255,0.8);
  border: 1px solid var(--panel-border);
  margin-bottom: 10px;
  position: sticky;
  top: 10px;
  z-index: 40;
}

/* ── Tabs (Main Grid Navigation) ── */
.tabs {
  display: inline-flex;
  background: rgba(15, 23, 42, 0.05);
  padding: 6px;
  border-radius: 999px;
  gap: 6px;
  overflow-x: auto;
  max-width: 100%;
}

.tab-btn {
  background: transparent;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 8px 20px;
  border-radius: 999px;
  box-shadow: none;
}

.tab-btn:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.4);
}
.has-tooltip {
  position: relative;
}

.tooltip-panel {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: rgba(15, 23, 42, 0.9);
  color: #fff;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  white-space: nowrap;
  z-index: 100;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
  min-width: 180px;
  text-align: left;
}

.tooltip-panel::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -6px;
  border-width: 6px;
  border-style: solid;
  border-color: rgba(15, 23, 42, 0.9) transparent transparent transparent;
}

.has-tooltip:hover .tooltip-panel {
  visibility: visible;
  opacity: 1;
  transform: translateX(-50%) translateY(-8px);
}
.tab-btn.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

/* ── Split Layout (Sidebar + Main) ── */
.split-layout {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  margin-top: 16px;
}

.sidebar {
  width: 280px;
  flex-shrink: 0;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  max-height: 600px;
  overflow-y: auto;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.8);
}

.main-content {
  flex: 1;
  min-width: 0;
}

.group-item {
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: all 0.2s ease;
}
.group-item:last-child { border-bottom: 0; }
.group-item:hover { background: rgba(255, 255, 255, 0.8); padding-left: 24px; }
.group-item.active {
  background: #fff;
  border-left: 4px solid var(--accent);
  padding-left: 16px;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.02);
}

/* ── Dashboards & KPIs ── */
.dashboard-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
}

.dashboard-kpis {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.kpi {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.8);
}

.kpi-value {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.kpi span:first-child {
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.team-progress-bar {
  height: 8px;
  border-radius: 99px;
  background: rgba(15, 23, 42, 0.05);
  margin-top: 6px;
  overflow: hidden;
}
.team-progress-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ── Chips ── */
.chips-wrap { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.chip-btn, .chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 6px 12px;
  min-height: 30px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.15;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.chip-btn:hover { background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,0.05); }
.chip-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.chip { cursor: default; }

.status-chip {
  font-weight: 700;
}

.status-chip--pending {
  background: rgba(245, 158, 11, 0.18);
  border-color: rgba(245, 158, 11, 0.46);
  color: #7c4d00;
}

.status-chip--critical {
  background: rgba(225, 29, 72, 0.14);
  border-color: rgba(225, 29, 72, 0.44);
  color: #9f1239;
}

.status-chip--done {
  background: rgba(16, 185, 129, 0.16);
  border-color: rgba(16, 185, 129, 0.42);
  color: #065f46;
}

/* ── Compact Resolutions (Admin) ── */
.resolution-row {
  border: 1px solid var(--line-strong);
  border-left: 6px solid transparent;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.72);
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.85);
}

.resolution-row + .resolution-row {
  margin-top: 8px;
}

.resolution-row--pending {
  border-left-color: #f59e0b;
  background: color-mix(in oklab, #f59e0b, white 93%);
}

.resolution-row--critical {
  border-left-color: #ef4444;
  background: color-mix(in oklab, #ef4444, white 93%);
}

.resolution-row--done {
  border-left-color: #22c55e;
  background: color-mix(in oklab, #22c55e, white 92%);
}

.resolution-row--open {
  border-left-color: #f59e0b;
  background: color-mix(in oklab, #f59e0b, white 93%);
}

.resolution-row--resolved {
  border-left-color: #22c55e;
  background: color-mix(in oklab, #22c55e, white 92%);
}

.resolution-row--neutral {
  border-left-color: #94a3b8;
}

.resolution-row__summary {
  list-style: none;
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  cursor: pointer;
}

.resolution-row__summary::-webkit-details-marker {
  display: none;
}

.resolution-row__main {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.resolution-row__id {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.78rem;
  color: var(--muted);
  background: rgba(255,255,255,0.7);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
}

.resolution-row__title {
  font-size: 0.92rem;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.resolution-row__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.76rem;
  color: var(--muted);
}

.resolution-row__toggle {
  justify-self: end;
  font-size: 0.75rem;
  color: var(--accent);
  background: rgba(255,255,255,0.8);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 3px 10px;
}

.resolution-row[open] .resolution-row__toggle {
  color: var(--ink);
}

.resolution-row__panel {
  border-top: 1px solid var(--line);
  padding: 12px;
  background: rgba(255,255,255,0.82);
}

.resolution-row__done {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.8rem;
}

.ops-inbox-summary .chip {
  background: rgba(255, 255, 255, 0.82);
}

#opsInboxList {
  max-height: 420px;
  overflow-y: auto;
  padding-right: 4px;
}

.suggestion-row td {
  border-top: 1px solid rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid rgba(15, 23, 42, 0.05);
}

.suggestion-row--pending td {
  background: color-mix(in oklab, #f59e0b, white 93%);
}

.suggestion-row--critical td {
  background: color-mix(in oklab, #ef4444, white 93%);
}

.suggestion-row--done td {
  background: color-mix(in oklab, #22c55e, white 92%);
}

.emergency-collapsible {
  padding: 16px 18px;
}

.emergency-collapsible__summary {
  list-style: none;
  cursor: pointer;
}

.emergency-collapsible__summary::-webkit-details-marker {
  display: none;
}

.emergency-collapsible__content {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.emergency-table-wrap {
  max-height: 320px;
  overflow: auto;
  margin-top: 10px;
}

.emergency-table-wrap table {
  min-width: 780px;
}

/* ── Workflow + Action Rail ─────────────────────────────────────────────── */
.ops-workflow {
  background: linear-gradient(145deg, rgba(255,255,255,0.82), rgba(232,244,255,0.72));
}

.ops-workflow__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.ops-steps {
  margin-top: 10px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.step-pill {
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(255,255,255,0.7);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.01em;
}

.step-pill--active {
  border-color: var(--accent);
  background: color-mix(in oklab, var(--accent), white 86%);
  color: var(--ink);
}

.action-rail-panel {
  position: sticky;
  top: 96px;
  z-index: 35;
  padding: 14px 16px;
  background: linear-gradient(145deg, rgba(14, 58, 122, 0.82), rgba(37, 99, 235, 0.78));
  border: 1px solid rgba(255,255,255,0.28);
}

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

.btn-action-primary,
.btn-action-warning,
.btn-action-secondary {
  min-height: 44px;
  border-radius: 14px;
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
}

.btn-action-primary {
  background: linear-gradient(180deg, #ffffff, #ecf4ff);
  color: #123150;
  box-shadow: 0 6px 18px rgba(8, 25, 55, 0.25);
}

.btn-action-primary:hover {
  background: #fff;
  color: #0b3b72;
}

.btn-action-warning {
  background: linear-gradient(180deg, #ffefcf, #ffe5b0);
  color: #874900;
  border-color: rgba(135, 73, 0, 0.2);
  box-shadow: 0 6px 18px rgba(95, 53, 0, 0.2);
}

.btn-action-warning:hover {
  background: #fff3da;
  color: #6f3c00;
}

.btn-action-secondary {
  background: rgba(255,255,255,0.15);
  color: #f6faff;
  border-color: rgba(255,255,255,0.35);
  box-shadow: none;
}

.btn-action-secondary:hover {
  background: rgba(255,255,255,0.26);
  color: #ffffff;
}

.inbox-card {
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  padding: 14px;
  background: rgba(255,255,255,0.72);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.85);
  display: grid;
  gap: 10px;
}

.inbox-card__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.inbox-card__meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pill-severity,
.pill-sla {
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  border: 1px solid transparent;
}

.pill-severity--critical {
  background: #fde7ee;
  color: #9a1740;
  border-color: #f6c6d3;
}

.pill-severity--high {
  background: #ffeedc;
  color: #8f4c00;
  border-color: #ffd5aa;
}

.pill-severity--medium {
  background: #fff6d7;
  color: #715400;
  border-color: #f2df9f;
}

.pill-severity--low {
  background: #edf8f2;
  color: #15643b;
  border-color: #cfead9;
}

.pill-sla--breach {
  background: #fde7ee;
  color: #9a1740;
  border-color: #f6c6d3;
}

.pill-sla--warning {
  background: #fff6d7;
  color: #715400;
  border-color: #f2df9f;
}

.pill-sla--ok {
  background: #edf8f2;
  color: #15643b;
  border-color: #cfead9;
}

.annual-stat-line {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.86rem;
  border-bottom: 1px dashed var(--line);
  padding: 6px 0;
}

.annual-stat-line:last-child {
  border-bottom: none;
}

/* ── Utils ── */
.hidden { display: none !important; }
.limited-list {
  max-height: 250px; 
  overflow-y: auto; 
  background: rgba(255,255,255,0.5); 
  border-radius: var(--radius-md); 
  padding: 12px 16px; 
  border: 1px solid var(--panel-border);
  margin-top: 12px;
}

.alert-ok { color: var(--success); font-weight: 600; }
.alert-warn { color: var(--warning); font-weight: 600; }
.alert-error { color: var(--danger); font-weight: 600; }

/* ── Responsive ── */
@media (max-width: 880px) {
  .layout { padding: 20px 12px 60px; }
  .topbar { flex-direction: column; border-radius: var(--radius-lg); padding: 16px; align-items: stretch; }
  .form-grid, .pick-form, .row-content { grid-template-columns: 1fr; }
  .pick-ops-grid { grid-template-columns: 1fr; }
  .app--picker .pick-ops-grid { grid-template-columns: 1fr; }
  .witness-row__summary { grid-template-columns: 1fr; gap: 8px; }
  .split-layout { flex-direction: column; }
  .sidebar { width: 100%; max-height: 260px; }
  
  .table-wrap {
    padding: 0 4px;
  }

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

  .action-rail-panel {
    top: 72px;
  }
}

/* Nuevas clases para origen del pick (Valorizado vs Contingencia) */
.pick-result-valorizado {
  color: var(--success);
  font-weight: 500;
  display: inline-block;
  padding: 4px 8px;
  background: rgba(76, 175, 80, 0.1);
  border-radius: 4px;
}
.pick-result-contingencia {
  color: var(--warning);
  font-weight: 500;
  display: inline-block;
  padding: 4px 8px;
  background: rgba(255, 152, 0, 0.1);
  border-radius: 4px;
}
