:root {
  --bg: #eef6ff;
  --bg-soft: #f7fbff;
  --panel: #ffffff;
  --panel-2: #f8fbff;
  --line: #d7e3f3;
  --line-dark: #c4d3e8;
  --text: #102242;
  --muted: #667792;
  --muted-2: #8b9bb0;
  --blue: #1663ea;
  --blue-2: #0f56d4;
  --blue-soft: #eaf2ff;
  --teal: #0aa6a6;
  --amber: #f59e0b;
  --amber-soft: #fff3d9;
  --red: #ef4444;
  --red-soft: #fee6e8;
  --green: #22b36a;
  --green-soft: #e6f8ef;
  --violet: #6d45d9;
  --shadow: 0 18px 46px rgba(25, 50, 89, .10);
  --shadow-soft: 0 10px 24px rgba(25, 50, 89, .08);
  --radius: 18px;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  background:
    radial-gradient(circle at 88% 6%, rgba(22, 99, 234, .12), transparent 340px),
    radial-gradient(circle at 10% 100%, rgba(10, 166, 166, .09), transparent 420px),
    linear-gradient(135deg, #f9fcff 0%, var(--bg) 100%);
  color: var(--text);
}

.icon {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.shell {
  width: min(1100px, calc(100% - 32px));
  margin: 28px auto;
}

.auth-shell {
  min-height: 100vh;
  width: 100%;
  margin: 0;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    linear-gradient(120deg, rgba(255,255,255,.92), rgba(239,247,255,.84)),
    radial-gradient(circle at 18% 20%, rgba(22, 99, 234, .14), transparent 280px),
    radial-gradient(circle at 86% 82%, rgba(10, 166, 166, .12), transparent 320px);
}

.app-layout {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: rgba(255, 255, 255, .92);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  box-shadow: 10px 0 38px rgba(29, 60, 101, .05);
  overflow: hidden;
}

.side-brand {
  height: 68px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
}

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

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #174fbd, #1e7cff);
  color: #fff;
  font-weight: 950;
  font-size: 19px;
  letter-spacing: -.05em;
  box-shadow: 0 12px 28px rgba(22, 99, 234, .25);
}

.brand strong {
  display: block;
  font-size: 16px;
  letter-spacing: -.04em;
}

.brand small, .topbar small {
  display: block;
  color: var(--muted);
  margin-top: 2px;
}

.side-nav {
  display: grid;
  gap: 6px;
  padding: 14px 12px;
}

.side-nav small {
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 12px 8px 4px;
}

.side-nav a {
  min-height: 38px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  color: #243b5b;
  text-decoration: none;
  font-size: 14px;
  font-weight: 850;
  transition: .16s ease;
}

.side-nav a:hover {
  background: #f0f6ff;
  transform: translateX(2px);
}

.side-nav a.active {
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--blue-2));
  box-shadow: 0 13px 24px rgba(22, 99, 234, .26);
}

.side-nav a.active .icon { stroke-width: 2.15; }

.sync-card {
  margin: auto 16px 18px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #fff;
  padding: 16px;
  box-shadow: var(--shadow-soft);
  display: grid;
  gap: 7px;
}

.sync-card span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(34, 179, 106, .14);
}

.sync-card strong { font-size: 14px; }
.sync-card small { color: var(--muted); line-height: 1.55; }

.sidebar-foot {
  border-top: 1px solid var(--line);
  padding: 16px 20px;
  color: #60728a;
  font-size: 12px;
  line-height: 1.45;
}

.workspace {
  min-width: 0;
  padding: 0 16px 20px;
}

.topbar {
  height: 58px;
  margin: 0 -16px 14px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, .88);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.auth-shell > .topbar {
  display: none;
}

.branch-picker {
  display: flex;
  align-items: center;
  gap: 16px;
  color: #314766;
  font-weight: 850;
}

.branch-picker select {
  min-width: 250px;
  height: 42px;
  border-radius: 12px;
  background: #fff;
}

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

.user-chip {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border-left: 1px solid var(--line);
  color: #203657;
}

.logout-form { margin: 0; }

button, .button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid var(--line-dark);
  background: #fff;
  color: var(--text);
  text-decoration: none;
  border-radius: 11px;
  padding: 10px 15px;
  font: inherit;
  font-weight: 850;
  cursor: pointer;
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
}

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

.primary {
  border-color: transparent !important;
  background: linear-gradient(135deg, var(--blue), var(--blue-2)) !important;
  color: #fff !important;
  box-shadow: 0 14px 26px rgba(22, 99, 234, .22);
}

.muted-action { color: #37506f; }

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

.icon-button, .icon-action {
  width: 42px;
  height: 42px;
  min-height: 42px;
  padding: 0;
  border-radius: 12px;
  position: relative;
}

.icon-action {
  width: 36px;
  height: 34px;
  min-height: 34px;
}

.has-dot b {
  position: absolute;
  right: -5px;
  top: -6px;
  min-width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  border: 2px solid #fff;
}

.notice {
  margin: 0 0 16px;
  padding: 13px 15px;
  border-radius: 13px;
  font-weight: 850;
}

.notice.ok { background: #eafaf2; color: #137a4b; border: 1px solid #bcebd2; }
.notice.error { background: #fff0ef; color: #c52828; border: 1px solid #ffc3bf; }

.auth-card {
  width: min(480px, calc(100vw - 28px));
  margin: 0;
  background: rgba(255, 255, 255, .94);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 30px;
  box-shadow: 0 26px 80px rgba(28, 59, 99, .14);
}

.portal-login {
  position: relative;
  overflow: hidden;
}

.portal-login::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  background: linear-gradient(90deg, var(--blue), var(--teal));
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 26px;
}

.login-brand strong {
  display: block;
  font-size: 18px;
  letter-spacing: -.03em;
}

.login-brand small {
  color: var(--muted);
}

.panel {
  background: rgba(255, 255, 255, .94);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  margin-top: 18px;
  box-shadow: var(--shadow);
}

.section-head, .split-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.page-title { margin: 0 0 18px; }

h1 {
  margin: 0;
  font-size: clamp(23px, 2vw, 28px);
  letter-spacing: -.045em;
}

h2 {
  margin: 0 0 12px;
  font-size: 20px;
  letter-spacing: -.03em;
}

h3 {
  margin: 18px 0 11px;
  font-size: 15px;
}

p {
  color: var(--muted);
  line-height: 1.48;
  margin: 7px 0 0;
}

.orders-screen {
  display: block;
}

.orders-main { min-width: 0; }

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

.cards > div {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 12px;
  box-shadow: var(--shadow-soft);
}

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

.metric > .icon {
  width: 42px;
  height: 42px;
  padding: 10px;
  border-radius: 15px;
  stroke-width: 1.8;
}

.metric.blue > .icon { color: var(--blue); background: var(--blue-soft); }
.metric.amber > .icon { color: var(--amber); background: var(--amber-soft); }
.metric.red > .icon { color: var(--red); background: var(--red-soft); }
.metric.green > .icon { color: var(--green); background: var(--green-soft); }

.cards small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.45;
}

.cards strong {
  display: block;
  font-size: 22px;
  line-height: 1;
  letter-spacing: -.05em;
}

.form-grid, .filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
  align-items: end;
  margin: 18px 0;
}

.form-grid.one { grid-template-columns: 1fr; }
.span-2 { grid-column: span 2; }

.filter-panel {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) minmax(150px, .8fr) minmax(150px, .8fr);
  gap: 9px 12px;
  align-items: end;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 11px 12px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-soft);
}

label {
  display: grid;
  gap: 8px;
  color: #293c58;
  font-weight: 900;
  font-size: 12px;
}

label.check {
  display: flex;
  align-items: center;
  gap: 8px;
}

input, select, textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid #cbd9ec;
  border-radius: 12px;
  padding: 9px 12px;
  font: inherit;
  background: #fff;
  color: var(--text);
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: #77a7f5;
  box-shadow: 0 0 0 4px rgba(22, 99, 234, .11);
}

textarea { resize: vertical; }

.input-icon {
  position: relative;
}

.input-icon .icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #49637f;
}

.input-icon input { padding-left: 45px; }

.table-card, table {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  box-shadow: none;
}

th, td {
  padding: 9px 10px;
  border-bottom: 1px solid #e4edf7;
  text-align: left;
  vertical-align: middle;
  font-size: 13px;
}

th {
  background: #edf4fb;
  color: #364b68;
  font-size: 13px;
  font-weight: 950;
}

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

.row-accent td:first-child { border-left: 4px solid var(--blue); }
.row-accent.en_proceso td:first-child, .row-accent.asignado td:first-child { border-left-color: var(--amber); }
.row-accent.espera_cliente td:first-child, .row-accent.cancelado td:first-child { border-left-color: var(--red); }
.row-accent.terminado td:first-child, .row-accent.entregado td:first-child { border-left-color: var(--green); }

.actions {
  display: flex;
  gap: 8px;
}

.table-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  color: var(--muted);
  font-size: 13px;
}

.pager {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pager button {
  min-height: 34px;
  padding: 7px 12px;
}

.pager b {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: #fff;
  background: var(--blue);
}

code {
  display: inline-block;
  max-width: 420px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
  background: #f2f6fb;
  padding: 7px 9px;
  border-radius: 8px;
  color: #243b5b;
}

.token-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 160px;
  gap: 10px;
}

.api-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
  margin: 16px 0;
}

.api-grid > div {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 15px;
  background: linear-gradient(135deg, #fff, #f5f9ff);
}

.api-grid b {
  display: block;
  margin-bottom: 8px;
}

.api-grid code { max-width: 100%; }

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

.settings-card {
  min-width: 0;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: linear-gradient(135deg, #fff, #f8fbff);
  padding: 17px;
  box-shadow: var(--shadow-soft);
}

.settings-card > span {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 15px;
}

.settings-card .icon {
  width: 23px;
  height: 23px;
}

.settings-card small {
  display: block;
  color: var(--muted);
  font-weight: 900;
  font-size: 12px;
  margin-bottom: 5px;
}

.settings-card strong {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: clamp(17px, 1.5vw, 21px);
  line-height: 1.15;
  letter-spacing: -.035em;
}

.settings-card p {
  font-size: 13px;
  margin-top: 7px;
}

.settings-card.accent-blue > span { background: var(--blue-soft); color: var(--blue); }
.settings-card.accent-green > span { background: var(--green-soft); color: var(--green); }
.settings-card.accent-amber > span { background: var(--amber-soft); color: var(--amber); }

.api-section {
  margin-top: 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 15px;
  background: #fbfdff;
}

.compact-api {
  margin-bottom: 0;
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.config-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 12px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #f8fbff;
}

.config-tabs a {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 9px 13px;
  border-radius: 12px;
  color: #314766;
  text-decoration: none;
  font-weight: 900;
  font-size: 13px;
}

.config-tabs a.active {
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--blue-2));
  box-shadow: 0 10px 20px rgba(22, 99, 234, .18);
}

.config-tab-panel {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.config-block {
  min-width: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 16px;
  box-shadow: none;
}

.config-block h2 {
  font-size: 17px;
  margin-bottom: 4px;
}

.compact-table {
  margin-top: 12px;
  border-radius: 14px;
}

.compact-table th,
.compact-table td {
  padding: 8px 10px;
  font-size: 12.5px;
}

.role-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.role-list article,
.data-counts,
.permission-note article {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid #e3ecf7;
  border-radius: 12px;
  background: #f8fbff;
  padding: 10px 11px;
}

.role-list span,
.data-counts span,
.permission-note span {
  color: var(--muted);
  font-size: 13px;
}

.permission-note {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.danger-zone {
  border-color: #ffd0d0;
  background: linear-gradient(135deg, #fff, #fff7f7);
}

.data-counts {
  margin: 10px 0;
}

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

.danger-button {
  border-color: #ffc2c2 !important;
  background: #fff1f1 !important;
  color: #b42323 !important;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 950;
  background: #edf3fb;
  color: #33445f;
}

.badge.nuevo { background: #eaf1ff; color: var(--blue-2); }
.badge.asignado, .badge.en_proceso { background: var(--amber-soft); color: #b86200; }
.badge.espera_cliente { background: #f0e9ff; color: var(--violet); }
.badge.terminado, .badge.entregado { background: var(--green-soft); color: #137a4b; }
.badge.cancelado { background: #eceff4; color: #6b7280; }

.danger-text { color: var(--red); font-weight: 900; }

.progress {
  display: inline-block;
  width: 96px;
  height: 7px;
  margin-right: 8px;
  border-radius: 999px;
  background: #e0e7f1;
  overflow: hidden;
  vertical-align: middle;
}

.progress i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--blue), #37a4ff);
}

.detail-drawer {
  position: sticky;
  top: 72px;
  background: rgba(255,255,255,.96);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 22px 54px rgba(23, 49, 86, .13);
}

.drawer-head, .order-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.drawer-head {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}

.order-title strong {
  font-size: 21px;
  letter-spacing: -.04em;
}

.detail-list {
  display: grid;
  gap: 12px;
  margin: 16px 0;
}

.detail-list article {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  color: #48617e;
}

.detail-list small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.detail-list b {
  color: var(--text);
  font-size: 14px;
}

.drawer-progress {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 18px;
}

.side-detail { align-self: start; }

.timeline {
  display: grid;
  gap: 11px;
}

.timeline article {
  position: relative;
  background: #f8fbff;
  border-left: 4px solid var(--teal);
  border-radius: 13px;
  padding: 13px;
}

.timeline.compact article {
  background: transparent;
  border: 0;
  border-left: 2px solid #d7e3f3;
  border-radius: 0;
  padding: 4px 0 12px 18px;
}

.timeline.compact article::before {
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--blue);
  left: -7px;
  top: 6px;
  box-shadow: 0 0 0 4px rgba(22, 99, 234, .12);
}

.timeline p {
  color: var(--text);
  margin: 7px 0;
}

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

.empty-detail {
  min-height: 210px;
  display: grid;
  align-content: center;
  text-align: center;
}

@media (max-width: 1280px) {
  .orders-screen { grid-template-columns: 1fr; }
  .detail-drawer { position: static; }
}

@media (max-width: 1040px) {
  .app-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .side-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sync-card, .sidebar-foot { display: none; }
  .workspace { padding: 0 16px 24px; }
  .topbar { margin: 0 -16px 20px; padding: 12px 16px; height: auto; flex-wrap: wrap; }
  .cards, .filter-panel, .form-grid, .detail-grid, .settings-dashboard { grid-template-columns: 1fr; }
  .config-tabs { display: grid; }
  .token-row, .api-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
}

@media (max-width: 760px) {
  .shell { width: auto; padding: 12px; margin: 0; }
  .section-head, .topbar, .top-actions, .branch-picker { align-items: stretch; flex-direction: column; }
  .branch-picker select { min-width: 0; }
  .cards { gap: 12px; }
  .metric > .icon { width: 54px; height: 54px; }
  .table-card { overflow-x: auto; }
  table { min-width: 900px; }
  .auth-shell { padding: 16px; place-items: start center; }
  .auth-card { padding: 24px; margin-top: 28px; }
  .settings-card { grid-template-columns: 42px minmax(0, 1fr); padding: 14px; }
  .settings-card > span { width: 40px; height: 40px; border-radius: 13px; }
}

@media print {
  body { background: #fff; }
  .sidebar, .topbar, form, .button, button, .notice, .detail-drawer { display: none !important; }
  .app-layout { display: block; }
  .workspace { padding: 0; }
  .panel, .table-card { box-shadow: none; border: 0; }
}

/* Approved console layout */
body {
  background: #eef3f8;
}

.app-layout {
  display: block;
  min-height: 100vh;
  background: #eef3f8;
  color: #102242;
}

.console-topbar {
  min-height: 54px;
  display: grid;
  grid-template-columns: 250px minmax(420px, 1fr) minmax(480px, auto);
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  background: linear-gradient(180deg, #10223e, #0c1a31);
  color: #fff;
  box-shadow: 0 3px 12px rgba(3, 15, 33, .22);
}

.console-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
}

.console-brand .brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: linear-gradient(135deg, #dfe9f6, #ffffff);
  color: #174fbd;
  box-shadow: none;
  font-size: 16px;
}

.console-brand strong {
  font-size: 14px;
  letter-spacing: .02em;
}

.console-brand em {
  color: #20c7bd;
  font-style: normal;
}

.console-nav {
  min-width: 0;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 2px;
  overflow: hidden;
}

.console-nav a {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  padding: 0 9px;
  color: #d7e4f5;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 800;
  text-decoration: none;
}

.console-nav a.active {
  background: #1663ea;
  color: #fff;
  box-shadow: inset 0 -2px 0 #f59e0b;
}

.console-tools {
  min-width: 0;
  justify-content: flex-end;
  display: flex;
  align-items: center;
  gap: 8px;
}

.top-search {
  width: 145px;
  height: 34px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 8px;
  background: #0f203b;
  color: #9fb2cc;
}

.top-search input {
  min-height: 30px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #fff;
  box-shadow: none;
}

.console-topbar .icon-button,
.console-topbar .logout-form button {
  min-height: 34px;
  height: 34px;
  border-color: transparent;
  background: transparent;
  color: #fff;
  box-shadow: none;
}

.console-topbar .user-chip {
  min-height: 34px;
  padding: 0 8px;
  border-left: 1px solid rgba(255,255,255,.12);
  color: #fff;
  font-size: 12px;
}

.console-topbar .user-chip strong {
  max-width: 92px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace {
  padding: 10px 10px 42px;
}

.console-board {
  height: calc(100vh - 130px);
  min-height: 580px;
  display: grid;
  grid-template-columns: 305px minmax(0, 1fr);
  gap: 10px;
}

.queue-panel,
.worklist-panel,
.case-panel {
  min-width: 0;
  border: 1px solid #d8e2ef;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 3px 10px rgba(16, 34, 66, .06);
  overflow: hidden;
}

.panel-title,
.worklist-head,
.drawer-head {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 14px;
  border-bottom: 1px solid #dfe8f4;
  background: #fbfdff;
}

.panel-title h2,
.worklist-head h1,
.drawer-head h2 {
  margin: 0;
  font-size: 17px;
  letter-spacing: -.02em;
}

.queue-panel {
  overflow-y: auto;
}

.queue-lane {
  margin: 0 12px;
  padding: 12px 0;
  border-bottom: 1px solid #e6edf6;
  border-left: 4px solid #1663ea;
}

.queue-lane.amber { border-left-color: #f59e0b; }
.queue-lane.violet { border-left-color: #7c3aed; }
.queue-lane.red { border-left-color: #ef4444; }
.queue-lane.green { border-left-color: #22b36a; }

.queue-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-left: 10px;
  margin-bottom: 8px;
  color: #1663ea;
  font-size: 13px;
  font-weight: 950;
}

.queue-lane.amber .queue-head { color: #b86200; }
.queue-lane.violet .queue-head { color: #6d45d9; }
.queue-lane.red .queue-head { color: #d11e1e; }
.queue-lane.green .queue-head { color: #138a50; }

.queue-head span {
  min-width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 7px;
  background: #fff;
}

.queue-item {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 34px;
  gap: 8px;
  align-items: center;
  padding: 5px 0 5px 10px;
  color: #213957;
  text-decoration: none;
  font-size: 12px;
}

.queue-item span {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.queue-item em {
  color: #435a78;
  font-style: normal;
  text-align: right;
}

.queue-more {
  display: inline-flex;
  margin: 5px 0 0 10px;
  color: #1663ea;
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
}

.worklist-tools {
  display: flex;
  gap: 7px;
  align-items: center;
}

.worklist-tools select {
  min-height: 32px;
  min-width: 165px;
  padding: 6px 10px;
  font-size: 12px;
}

.ticket-list {
  height: calc(100% - 91px);
  overflow-y: auto;
}

.ticket-head,
.ticket-row {
  display: grid;
  grid-template-columns: minmax(210px, 1.45fr) 115px 130px 120px 105px 112px 150px;
  align-items: center;
  gap: 10px;
}

.ticket-head {
  height: 34px;
  padding: 0 14px 0 22px;
  border-bottom: 1px solid #dfe8f4;
  background: #f5f8fc;
  color: #435a78;
  font-size: 11px;
  font-weight: 950;
}

.ticket-row {
  position: relative;
  min-height: 62px;
  padding: 8px 14px 8px 22px;
  border-bottom: 1px solid #e5edf7;
  color: #102242;
  text-decoration: none;
  font-size: 12.5px;
}

.ticket-row::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: #1663ea;
}

.ticket-row.en_proceso::before,
.ticket-row.asignado::before { background: #f59e0b; }
.ticket-row.espera_cliente::before { background: #7c3aed; }
.ticket-row.terminado::before,
.ticket-row.entregado::before { background: #22b36a; }
.ticket-row.cancelado::before { background: #94a3b8; }

.ticket-row:hover {
  background: #f8fbff;
}

.ticket-main b {
  display: block;
  margin-bottom: 3px;
  font-size: 13px;
}

.ticket-main small {
  color: #425a78;
  line-height: 1.25;
}

.mini-progress {
  display: block;
  width: 78px;
  height: 6px;
  margin-top: 4px;
  border-radius: 999px;
  background: #dfe6ef;
  overflow: hidden;
}

.mini-progress em {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: #1663ea;
}

.console-pagination {
  height: 46px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border-top: 1px solid #dfe8f4;
  color: #526984;
  font-size: 12px;
}

.console-pagination span:last-child {
  display: flex;
  gap: 6px;
}

.console-pagination button {
  min-height: 30px;
  padding: 5px 10px;
  border-radius: 7px;
  font-size: 12px;
}

.case-panel {
  overflow-y: auto;
}

.case-panel .order-title,
.case-panel .detail-list,
.case-panel .drawer-progress,
.case-panel h3,
.case-panel .timeline,
.case-panel label,
.case-panel .button {
  margin-left: 14px;
  margin-right: 14px;
}

.case-panel .order-title {
  margin-top: 12px;
}

.case-panel .order-title strong {
  font-size: 21px;
}

.case-panel .detail-list {
  gap: 8px;
  margin-top: 12px;
  margin-bottom: 12px;
}

.case-panel .detail-list article {
  gap: 10px;
  font-size: 12px;
}

.case-panel .detail-list select {
  min-height: 32px;
  padding: 5px 8px;
  font-size: 12px;
}

.case-panel textarea {
  min-height: 70px;
}

.case-panel .full {
  min-height: 36px;
}

.settings-modal-page {
  width: min(1420px, calc(100vw - 24px));
  max-width: none;
  margin: 12px auto 0;
  padding: 0;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 24px 70px rgba(16, 34, 66, .22);
}

.settings-modal-page > .section-head {
  padding: 12px 18px;
  border-bottom: 1px solid #dfe8f4;
}

.settings-modal-page > .section-head h1 {
  font-size: 22px;
}

.settings-modal-page .config-tabs {
  margin: 0;
  padding: 0 18px;
  border: 0;
  border-radius: 0;
  background: #fff;
  border-bottom: 1px solid #dfe8f4;
}

.settings-modal-page .config-tabs a {
  border: 1px solid #dfe8f4;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  margin-top: 8px;
  min-height: 36px;
}

.settings-modal-page .config-tabs a.active {
  background: #fff;
  color: #1663ea;
  box-shadow: inset 0 -2px 0 #1663ea;
}

.settings-modal-page .config-tab-panel {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.settings-modal-page .compact-table th,
.settings-modal-page .compact-table td {
  font-size: 12px;
}

.empty-row {
  padding: 18px;
  color: #526984;
  font-size: 13px;
}

.console-statusbar {
  position: sticky;
  bottom: 0;
  height: 32px;
  display: grid;
  grid-template-columns: 1.2fr 1fr .8fr .8fr 1fr;
  align-items: center;
  gap: 14px;
  padding: 0 16px;
  background: #0c1a31;
  color: #d7e4f5;
  font-size: 12px;
  z-index: 40;
}

.console-statusbar span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.console-statusbar i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #22b36a;
}

.order-toast {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 520px;
  margin: 0 0 10px auto;
  padding: 10px 12px;
  border: 1px solid #bfdbfe;
  border-left: 4px solid #1663ea;
  border-radius: 9px;
  background: #eff6ff;
  box-shadow: 0 8px 24px rgba(22, 99, 234, .12);
}

.order-toast > div {
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.order-toast small {
  color: #526984;
  font-size: 12px;
  margin-top: 2px;
}

.order-toast .button {
  min-height: 32px;
  padding: 6px 12px;
  white-space: nowrap;
}

.compact-action {
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
  white-space: nowrap;
  box-shadow: none;
}

.order-modal {
  width: min(720px, calc(100vw - 38px));
  max-height: min(610px, calc(100vh - 38px));
  padding: 0;
  border: 1px solid #cbd9ec;
  border-radius: 12px;
  background: #fff;
  color: #102242;
  box-shadow: 0 28px 80px rgba(5, 18, 38, .35);
  overflow: hidden;
}

.order-modal::backdrop {
  background: rgba(7, 18, 34, .48);
  backdrop-filter: blur(3px);
}

.order-modal-head {
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 12px;
  border-bottom: 1px solid #dfe8f4;
  background: linear-gradient(180deg, #fbfdff, #f3f7fc);
}

.order-modal-head h2 {
  margin: 0;
  font-size: 17px;
}

.order-modal-head p {
  margin-top: 3px;
  font-size: 12px;
}

.order-modal-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 215px;
  gap: 0;
  max-height: calc(min(610px, 100vh - 38px) - 50px);
  overflow: hidden;
}

.order-review {
  min-width: 0;
  padding: 10px;
  overflow-y: auto;
}

.order-actions-panel {
  min-width: 0;
  padding: 10px;
  border-left: 1px solid #dfe8f4;
  background: #f8fbff;
  overflow-y: auto;
}

.order-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-bottom: 8px;
}

.order-summary-grid article {
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid #e1eaf5;
  border-radius: 10px;
  background: #fff;
}

.order-summary-grid small {
  display: block;
  color: #667792;
  font-size: 11px;
  font-weight: 900;
  margin-bottom: 3px;
}

.order-summary-grid strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 12.5px;
}

.modal-progress {
  margin: 4px 0 10px;
  padding: 9px 10px;
  border: 1px solid #e1eaf5;
  border-radius: 10px;
  background: #fff;
}

.work-order-comment {
  margin: 8px 0 10px;
  padding: 9px 10px;
  border: 1px solid #dfe8f4;
  border-left: 3px solid #1663ea;
  border-radius: 10px;
  background: #f8fbff;
}

.work-order-comment strong {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
}

.work-order-comment p {
  margin: 0;
  color: #102242;
  font-size: 12.5px;
  line-height: 1.35;
  white-space: pre-wrap;
}

.order-items-table {
  margin: 8px 0 10px;
  border: 1px solid #dfe8f4;
  border-radius: 10px;
  background: #fff;
  overflow: auto;
  max-height: 132px;
}

.order-items-table table {
  min-width: 0;
  width: 100%;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.order-items-table th,
.order-items-table td {
  padding: 7px 8px;
  font-size: 11.5px;
}

.order-items-table th:first-child,
.order-items-table td:first-child {
  max-width: 70px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-items-table th:nth-child(2),
.order-items-table td:nth-child(2) {
  max-width: 210px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-items-table td:nth-child(3),
.order-items-table td:nth-child(4),
.order-items-table td:nth-child(5) {
  white-space: nowrap;
  text-align: right;
}

.status-button-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
  margin-top: 8px;
}

.order-actions-panel h3 {
  margin-top: 8px;
  margin-bottom: 8px;
  font-size: 14px;
}

.order-actions-panel label {
  gap: 5px;
}

.order-actions-panel input,
.order-actions-panel select,
.order-actions-panel textarea {
  min-height: 34px;
  padding: 7px 9px;
  font-size: 12.5px;
}

.order-actions-panel textarea {
  min-height: 62px;
}

.order-actions-panel button,
.order-actions-panel .button {
  min-height: 36px;
  padding: 7px 9px;
  border-radius: 9px;
  font-size: 13px;
  line-height: 1.15;
  white-space: normal;
}

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

.modal-action-form {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.modal-action-form + .modal-action-form {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #dfe8f4;
}

.modal-action-form .full,
.order-actions-panel .full {
  margin-top: 0;
}

.take-form .button {
  border-color: #b9d4ff;
  background: #eef5ff;
  color: #0f56d4;
}

.admin-page {
  max-width: 1180px;
  margin: 22px auto;
  padding: 16px;
  border-radius: 10px;
}

.admin-page .section-head h1 {
  font-size: 22px;
}

.admin-page .section-head p {
  font-size: 13px;
}

.admin-page .form-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0;
  align-items: end;
}

.admin-page .form-grid .span-2 {
  grid-column: span 3;
}

.admin-page input,
.admin-page select {
  min-height: 36px;
  padding: 7px 10px;
  font-size: 13px;
}

.admin-page button,
.admin-page .button {
  min-height: 36px;
  padding: 7px 12px;
  font-size: 13px;
}

.admin-page table {
  margin-top: 10px;
}

.admin-page th,
.admin-page td {
  padding: 8px 10px;
  font-size: 12.5px;
}

.admin-page .token-row {
  grid-template-columns: minmax(0, 1fr) 130px;
}

.admin-page label.check {
  justify-content: center;
  min-height: 36px;
}

.admin-page label.check input {
  width: 18px;
  min-height: 18px;
}

.settings-inline-form {
  display: grid;
  grid-template-columns: 135px minmax(190px, 1fr) minmax(290px, 1.4fr) 110px 110px 120px;
  gap: 8px;
  align-items: end;
  margin: 10px 0 12px;
  padding: 12px;
  border: 1px solid #dfe8f4;
  border-radius: 9px;
  background: #f8fbff;
}

.settings-inline-form.users-form {
  grid-template-columns: 170px minmax(210px, 1fr) 170px minmax(210px, 1fr);
}

.settings-inline-form.users-form label:nth-of-type(5) {
  grid-column: span 2;
}

.settings-inline-form label {
  gap: 5px;
  font-size: 12px;
}

.settings-inline-form input,
.settings-inline-form select {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  padding: 8px 10px;
  font-size: 13px;
}

.settings-inline-form button {
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 7px;
  font-size: 12.5px;
}

.settings-inline-form.users-form button {
  align-self: end;
}

.compact-check {
  min-height: 38px;
  display: flex !important;
  justify-content: center;
  align-items: center;
  gap: 7px;
  padding: 0 8px;
  border: 1px solid #d7e3f3;
  border-radius: 8px;
  background: #fff;
}

.compact-check input {
  width: 16px;
  min-height: 16px;
}

.permissions-matrix {
  margin-top: 14px;
}

.permissions-matrix h3 {
  margin: 0;
  font-size: 16px;
}

.permissions-matrix p {
  margin-top: 3px;
  font-size: 12.5px;
}

@media (max-width: 1200px) {
  .console-topbar {
    height: auto;
    grid-template-columns: 210px minmax(0, 1fr);
    padding: 8px 10px;
  }
  .console-nav { overflow-x: auto; height: 38px; }
  .console-tools {
    grid-column: 1 / -1;
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    background: #0c1a31;
  }
  .console-board {
    height: auto;
    grid-template-columns: 250px minmax(0, 1fr);
  }
  .settings-inline-form,
  .settings-inline-form.users-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .settings-modal-page {
    width: calc(100vw - 20px);
    margin-top: 8px;
  }
}

@media (max-width: 860px) {
  .console-topbar {
    height: auto;
    grid-template-columns: 1fr;
    padding: 10px;
  }
  .console-nav,
  .console-tools {
    overflow-x: auto;
  }
  .console-board {
    grid-template-columns: 1fr;
  }
  .ticket-head,
  .ticket-row {
    grid-template-columns: minmax(210px, 1fr) 100px 110px 105px 90px 105px 140px;
    min-width: 900px;
  }
  .ticket-list {
    overflow-x: auto;
  }
  .order-modal-body {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }
  .order-review,
  .order-actions-panel {
    overflow: visible;
  }
  .order-actions-panel {
    border-left: 0;
    border-top: 1px solid #dfe8f4;
  }
  .order-summary-grid {
    grid-template-columns: 1fr;
  }
  .status-button-grid {
    grid-template-columns: 1fr;
  }
  .settings-inline-form,
  .settings-inline-form.users-form {
    grid-template-columns: 1fr;
  }
}
