:root {
  --ink: #1f2528;
  --muted: #697277;
  --line: #dfe3e3;
  --paper: #f7f5f0;
  --surface: #ffffff;
  --accent: #df4b3f;
  --accent-2: #e9843a;
  --blue: #6f8793;
  --green: #507060;
  --gold: #b58b39;
  --shadow: 0 12px 28px rgba(31, 37, 40, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  cursor: pointer;
}

.sidebar {
  min-height: 100vh;
  padding: 24px;
  background: #111719;
  color: #f8f5ed;
  display: flex;
  flex-direction: column;
  gap: 28px;
  position: sticky;
  top: 0;
}

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

.brand img {
  width: 68px;
  height: 52px;
  object-fit: contain;
  background: #fff;
  border-radius: 6px;
  padding: 6px;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 1.15rem;
}

.brand span {
  color: #bcc6c5;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.main-nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  width: 100%;
  border: 0;
  border-radius: 8px;
  padding: 12px;
  background: transparent;
  color: #dce3df;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  background: #283235;
  color: #fff;
}

.nav-icon {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.09);
}

.domain-panel {
  margin-top: auto;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: #1b2326;
}

.domain-panel span,
.domain-panel small {
  display: block;
  color: #aab5b3;
}

.domain-panel strong {
  display: block;
  margin: 6px 0 10px;
}

.app-shell {
  min-width: 0;
  padding: 28px;
}

.topbar,
.section-toolbar,
.panel-header,
.modal-header,
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar {
  margin-bottom: 26px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.7rem, 4vw, 2.6rem);
}

h2 {
  margin-bottom: 4px;
  font-size: 1.05rem;
}

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

.search-box {
  min-width: min(360px, 38vw);
  height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
}

.primary-btn,
.ghost-btn,
.full-btn,
.segment,
.icon-btn {
  border-radius: 8px;
  border: 1px solid transparent;
  min-height: 40px;
}

.primary-btn {
  background: var(--ink);
  color: #fff;
  padding: 0 16px;
}

.ghost-btn,
.segment,
.full-btn {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
  padding: 0 14px;
}

.full-btn {
  width: 100%;
  margin-top: 16px;
}

.icon-btn {
  width: 36px;
  background: transparent;
  border-color: var(--line);
  font-size: 1.3rem;
}

.view {
  display: none;
}

.active-view {
  display: block;
}

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

.metric,
.panel,
.product-card,
.client-card,
.channel-card,
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric {
  padding: 18px;
}

.metric span,
.metric small {
  display: block;
  color: var(--muted);
}

.metric strong {
  display: block;
  margin: 6px 0;
  font-size: 1.8rem;
}

.metric.warning strong {
  color: var(--accent);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(320px, 0.85fr);
  gap: 16px;
}

.panel {
  padding: 18px;
}

.panel.wide {
  grid-row: span 2;
}

.panel-header p,
.section-toolbar p {
  color: var(--muted);
  margin-bottom: 0;
}

.bar-list,
.stack-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.bar-row {
  display: grid;
  grid-template-columns: 170px 1fr 92px;
  gap: 12px;
  align-items: center;
}

.bar-track {
  height: 12px;
  border-radius: 999px;
  background: #ece9e1;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--accent-2), var(--accent));
}

.stack-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 4px;
}

.stack-item small {
  color: var(--muted);
}

.arca-box {
  display: grid;
  grid-template-columns: 86px 1fr;
  gap: 14px;
  align-items: center;
  margin-top: 18px;
}

.arca-box img {
  width: 86px;
  height: 86px;
  object-fit: cover;
  border-radius: 8px;
}

.arca-box strong,
.arca-box span {
  display: block;
}

.arca-box strong {
  font-size: 1.6rem;
}

.arca-box span {
  color: var(--muted);
}

.section-toolbar {
  margin-bottom: 16px;
}

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

.segment.active {
  background: var(--ink);
  color: #fff;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: #fbfaf6;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 0.82rem;
  background: #edf1f1;
}

.status.Pendiente {
  color: #875b12;
  background: #fff3d1;
}

.status.Producción {
  color: #246174;
  background: #e3f3f7;
}

.status.Entregado {
  color: #2b6a42;
  background: #e3f4e8;
}

.product-grid,
.client-grid,
.channel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.product-card {
  overflow: hidden;
}

.product-card img {
  width: 100%;
  height: 172px;
  object-fit: cover;
  display: block;
}

.product-body,
.client-card,
.channel-card {
  padding: 16px;
}

.product-meta,
.client-meta,
.channel-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  background: #eef0ee;
  color: #465053;
  font-size: 0.78rem;
}

.chip.alert {
  color: #8b211d;
  background: #ffe5e2;
}

.channel-card {
  min-height: 180px;
  display: flex;
  flex-direction: column;
}

.channel-card strong {
  font-size: 1.1rem;
}

.channel-card p {
  color: var(--muted);
  margin: 8px 0 0;
}

.channel-card .channel-meta {
  margin-top: auto;
}

.modal {
  width: min(760px, calc(100vw - 24px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.28);
}

.modal::backdrop {
  background: rgba(17, 23, 25, 0.52);
}

.modal form {
  padding: 22px;
  display: grid;
  gap: 16px;
}

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

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.86rem;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
}

textarea {
  resize: vertical;
}

@media (max-width: 980px) {
  body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
    position: static;
  }

  .main-nav {
    grid-template-columns: repeat(3, 1fr);
  }

  .domain-panel {
    display: none;
  }

  .topbar,
  .top-actions,
  .section-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .search-box {
    min-width: 0;
  }

  .metric-grid,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .panel.wide {
    grid-row: auto;
  }
}

@media (max-width: 620px) {
  .app-shell {
    padding: 18px;
  }

  .main-nav {
    grid-template-columns: 1fr 1fr;
  }

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

  .bar-row {
    grid-template-columns: 1fr;
  }
}
