:root {
  --ink: #333333;
  --muted: #607d8b;
  --line: #dce4e8;
  --paper: #f5f8fa;
  --surface: #ffffff;
  --brand: #76ff03;
  --brand-dark: #5fd600;
  --brand-navy: #0a192f;
  --brand-slate: #607d8b;
  --accent: #c83f36;
  --gold: #d79b22;
  --blue: #2677b8;
  --gray: #83909a;
  --green: #2f9d61;
  --shadow: 0 12px 32px rgba(24, 32, 38, 0.1);
}

.campaign-layout { display: grid; grid-template-columns: minmax(360px, 520px) minmax(0, 1fr); gap: 18px; align-items: start; }
.campaign-form { position: static; }
.campaign-api-status { padding: 8px 12px; border-radius: 999px; background: #fff3cd; color: #795c00; font-size: 12px; font-weight: 800; }
.campaign-api-status.connected { background: #dff7e7; color: #106b32; }
.campaign-mode-grid, .campaign-type-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.campaign-type-card { grid-template-columns: auto 1fr !important; align-items: start; padding: 12px; border: 1px solid var(--line); border-radius: 9px; cursor: pointer; }
.campaign-type-card input, .campaign-consent input, .campaign-client-row input { width: auto; margin-top: 3px; }
.campaign-type-card span, .campaign-type-card small, .campaign-client-row span, .campaign-client-row small { display: block; }
.campaign-type-card small, .campaign-client-row small, .campaign-help, .campaign-empty { color: var(--muted); }
.campaign-preview { padding: 14px; border-radius: 10px; background: #eaf8ee; border: 1px solid #c5e9cf; }
.campaign-preview p { margin: 7px 0 0; white-space: pre-wrap; }
.campaign-recipients-head, .campaign-history-head, .campaign-history-card > div, .campaign-result { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.campaign-recipients-head small { display: block; margin-top: 3px; color: var(--muted); }
.campaign-client-list { max-height: 260px; overflow: auto; display: grid; gap: 6px; border: 1px solid var(--line); border-radius: 9px; padding: 8px; }
.campaign-client-row { grid-template-columns: auto 1fr !important; align-items: center; padding: 8px; border-radius: 7px; background: #f8fafb; }
.campaign-client-row.not-authorized { background: #fff8df; border: 1px solid #f0d98a; opacity: .95; }
.campaign-client-row input:disabled { cursor: not-allowed; }
.campaign-client-row em { display: block; margin-top: 3px; color: #795c00; font-size: 11px; font-style: normal; font-weight: 800; }
.campaign-empty.warning { padding: 8px 10px; border-radius: 8px; background: #fff8df; border: 1px solid #f0d98a; color: #795c00; font-weight: 800; }
.campaign-consent { grid-template-columns: auto 1fr !important; align-items: start; padding: 12px; background: #fff8df; border: 1px solid #f0d98a; border-radius: 9px; }
.campaign-history-panel { padding: 18px; }
.campaign-history { display: grid; gap: 10px; margin-top: 15px; }
.campaign-history-card { padding: 14px; border: 1px solid var(--line); border-radius: 10px; }
.campaign-history-card h4 { margin: 10px 0 5px; }
.campaign-history-card p { margin: 0 0 12px; color: var(--muted); }
.campaign-kind { padding: 4px 8px; border-radius: 999px; background: #e8eefc; color: #284e9f; font-size: 11px; font-weight: 800; }
.campaign-kind.promotion { background: #e5f7ea; color: #167238; }
.campaign-result b { color: #167238; }
.campaign-image-preview { display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px dashed #9ac7d4; border-radius: 8px; background: #f6fbfd; }
.campaign-image-preview img { width: 96px; height: 64px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.campaign-image-preview span { color: var(--muted); font-size: 12px; font-weight: 800; }
.campaign-phone-preview { background: #e5ddd5; border-color: #d7c9bd; }
.campaign-phone-message { max-width: 360px; padding: 8px; border-radius: 8px; background: #ffffff; box-shadow: 0 1px 1px rgba(0,0,0,.12); }
.campaign-phone-image img { width: 100%; max-height: 190px; object-fit: cover; border-radius: 6px; margin-bottom: 8px; }
.campaign-button-preview { display: grid; gap: 6px; margin-top: 8px; }
.campaign-button-preview span { display: block; padding: 7px 8px; border-top: 1px solid #e4edf1; color: #0984c6; text-align: center; font-weight: 800; font-size: 12px; }
.campaign-history-image { width: 100%; max-height: 220px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); margin: 8px 0 10px; }
.campaign-manual-note { margin: 8px 0; padding: 8px 10px; border-radius: 8px; background: #fff8df; border: 1px solid #f0d98a; color: #795c00; font-size: 12px; font-weight: 800; }
.campaign-manual-list { display: grid; gap: 8px; margin-top: 12px; }
.campaign-manual-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: #f8fafb; }
.campaign-manual-row span, .campaign-manual-row small { display: block; }
.campaign-manual-row small { color: var(--muted); margin-top: 3px; }
.campaign-manual-row > div { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.campaign-manual-row a.ghost-button { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
@media (max-width: 900px) { .campaign-layout, .campaign-mode-grid, .campaign-type-grid, .campaign-manual-row { grid-template-columns: 1fr; } .campaign-manual-row > div { justify-content: stretch; } .campaign-manual-row button, .campaign-manual-row a.ghost-button { flex: 1 1 120px; } }

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  display: grid;
  grid-template-columns: 280px 1fr;
  grid-template-rows: minmax(100vh, auto);
  transition: grid-template-columns 160ms ease;
}

body.sidebar-collapsed {
  grid-template-columns: 78px 1fr;
}

body.logged-out {
  display: block;
}

body.logged-out .sidebar,
body.logged-out .app-shell {
  display: none;
}

body.supervision-presentation {
  display: block;
  background: #f5f8fa;
}

body.supervision-presentation .sidebar,
body.supervision-presentation .topbar,
body.supervision-presentation #supervision .section-head {
  display: none;
}

body.supervision-presentation .app-shell {
  display: block;
  width: 100%;
  min-height: 100vh;
  padding: 10px;
}

body.supervision-presentation .view {
  display: none;
}

body.supervision-presentation #supervision {
  display: block;
}

.login-screen {
  grid-column: 1 / -1;
  grid-row: 1;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top left, rgba(118, 255, 3, 0.18), transparent 30%),
    linear-gradient(135deg, #fbfcfc 0%, #eef3f5 100%);
}

.login-screen[hidden],
body:not(.logged-out) .login-screen {
  display: none !important;
}

.login-card {
  width: min(420px, 100%);
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 24px;
  display: grid;
  gap: 15px;
}

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

.brand-logo {
  display: block;
  object-fit: contain;
}

.login-logo {
  width: 240px;
  height: auto;
  max-height: 70px;
}

.login-brand small {
  display: block;
  color: var(--muted);
  margin-top: 3px;
}

.login-card h1 {
  font-size: 25px;
  margin-bottom: 0;
}

.login-card label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.login-error {
  min-height: 18px;
  color: var(--accent);
  font-weight: 800;
}

.login-help {
  display: grid;
  gap: 4px;
  background: #f6f8f9;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  padding: 12px;
}

.login-help strong {
  color: var(--ink);
}

.link-button {
  border: 0;
  background: transparent;
  color: var(--blue);
  font-weight: 800;
  padding: 0;
  text-align: left;
}

.login-recovery {
  display: grid;
  gap: 10px;
  margin-top: 4px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6f8f9;
}

.login-recovery p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

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

.recovery-actions button {
  flex: 1 1 150px;
}

.login-recovery-message {
  min-height: 18px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.login-recovery-message.ok {
  color: var(--green);
}

.login-recovery-message.error {
  color: var(--accent);
}

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

button {
  cursor: pointer;
}

.sidebar {
  grid-column: 1;
  grid-row: 1;
  min-height: 100vh;
  background: var(--brand-navy);
  color: white;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 26px;
  position: sticky;
  top: 0;
}

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

.sidebar-logo {
  width: 136px;
  height: auto;
  max-height: 46px;
}

.brand small,
.eyebrow,
.section-head p,
.panel label,
.order-meta,
.client-card small,
.activity-list span,
.stage small {
  color: var(--muted);
}

.brand small {
  display: block;
  color: #b7c4ca;
  margin-top: 3px;
}

.sidebar-toggle {
  margin-left: auto;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: white;
  font-size: 22px;
  line-height: 1;
}

body.sidebar-collapsed .sidebar {
  padding: 24px 12px;
}

body.sidebar-collapsed .brand {
  justify-content: center;
}

body.sidebar-collapsed .brand div,
body.sidebar-collapsed .role-box label,
body.sidebar-collapsed .role-box select,
body.sidebar-collapsed .session-scope,
body.sidebar-collapsed .logout-button {
  display: none;
}

body.sidebar-collapsed .sidebar-toggle {
  position: absolute;
  right: -2px;
  top: 50px;
  transform: rotate(180deg);
  background: var(--brand);
  color: var(--brand-navy);
}

body.sidebar-collapsed .nav-item {
  min-height: 46px;
  padding: 0;
  text-align: center;
  font-size: 0;
}

body.sidebar-collapsed .nav-item::first-letter {
  font-size: 0;
}

body.sidebar-collapsed .nav-item::before {
  font-size: 18px;
}

body.sidebar-collapsed .nav-item[data-view="dashboard"]::before {
  content: "T";
}

body.sidebar-collapsed .nav-item[data-view="branches"]::before {
  content: "S";
}

body.sidebar-collapsed .nav-item[data-view="supervision"]::before {
  content: "S";
}

body.sidebar-collapsed .nav-item[data-view="orders"]::before {
  content: "P";
}

body.sidebar-collapsed .nav-item[data-view="clients"]::before {
  content: "C";
}

body.sidebar-collapsed .nav-item[data-view="reports"]::before {
  content: "R";
}

body.sidebar-collapsed .nav-item[data-view="changeRequests"]::before {
  content: "S";
}

body.sidebar-collapsed .commercial-nav-item::before {
  content: "$";
}

body.sidebar-collapsed .role-box {
  min-height: 44px;
  padding: 0;
  background: transparent;
}

nav {
  display: grid;
  gap: 8px;
}

.nav-item,
.ghost-button,
.primary-button {
  border: 0;
  border-radius: 8px;
  min-height: 42px;
  padding: 0 14px;
  font-weight: 700;
}

.nav-item {
  display: flex;
  align-items: center;
  background: transparent;
  color: #d7e1e4;
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.role-box {
  margin-top: auto;
  background: rgba(255, 255, 255, 0.08);
  padding: 14px;
  border-radius: 8px;
}

.role-box label {
  display: block;
  font-size: 12px;
  color: #b7c4ca;
  margin-bottom: 8px;
}

.role-box select,
.logout-button,
.filters select,
input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  min-height: 42px;
  padding: 9px 11px;
}

.session-scope {
  display: grid;
  gap: 4px;
  margin: 8px 0;
  font-size: 11px;
  color: #dbe8ee;
}

.session-scope span {
  padding: 4px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  overflow-wrap: anywhere;
}

.session-scope .storage-warning {
  background: rgba(255, 28, 38, 0.2);
  color: #ffd6d9;
}

.session-action {
  width: 100%;
  min-height: 32px;
  border: 1px solid rgba(118, 255, 3, 0.55);
  border-radius: 6px;
  background: var(--brand);
  color: var(--brand-navy);
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
}

.logout-button {
  margin-top: 10px;
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.app-shell {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  padding: 24px;
}

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

.topbar {
  margin-bottom: 14px;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.topbar-logo {
  width: 190px;
  max-width: 100%;
  height: auto;
  display: block;
  max-height: 86px;
  object-fit: contain;
}

.topbar-title {
  min-width: 0;
}

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

h1 {
  font-size: 30px;
  margin-bottom: 0;
}

h2 {
  font-size: 24px;
  margin-bottom: 6px;
}

h3 {
  font-size: 17px;
}

.eyebrow {
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0;
  font-size: 12px;
  font-weight: 800;
}

.active-employee-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin: 8px 0 0;
  padding: 7px 11px;
  border: 1px solid #cfe4dc;
  border-radius: 999px;
  background: #effaf3;
  color: #087334;
  font-size: 13px;
  font-weight: 900;
}

.top-actions,
.filters,
.status-legend {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.report-downloads {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.report-downloads button {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}

.report-downloads button:hover {
  border-color: var(--brand);
  color: var(--brand-navy);
}

.primary-button {
  background: var(--brand);
  color: var(--brand-navy);
}

.primary-button:hover {
  background: var(--brand-dark);
}

.urgent-button {
  border: 0;
  border-radius: 8px;
  min-height: 42px;
  padding: 0 14px;
  background: #f31821;
  color: white;
  font-weight: 900;
}

.urgent-button:hover {
  background: #c81219;
}

.ghost-button {
  background: white;
  color: var(--ink);
  border: 1px solid var(--line);
}

.view {
  display: none;
}

.active-view {
  display: block;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: 10px;
  margin: 10px 0 12px;
}

.metric,
.panel,
.order-card,
.client-card,
.report-card,
.activity-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(24, 32, 38, 0.04);
}

.metric {
  min-height: 62px;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.metric strong {
  display: block;
  min-width: 28px;
  font-size: 26px;
  line-height: 1;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.metric p {
  margin: 2px 0 0;
  line-height: 1.2;
}

.board-layout,
.orders-layout,
.clients-layout {
  display: grid;
  gap: 16px;
}

.board-layout {
  grid-template-columns: minmax(0, 1fr) 340px;
}

.orders-layout,
.clients-layout,
.branches-layout {
  grid-template-columns: 360px minmax(0, 1fr);
  align-items: start;
}

#processConfigPanel {
  grid-column: 1;
}

#ordersList {
  grid-column: 2;
  grid-row: 1 / span 2;
}

.office-board,
.orders-list,
.clients-list,
.branches-list,
.supervision-list,
.reports-grid {
  display: grid;
  gap: 12px;
}

.office-board {
  grid-template-columns: repeat(auto-fit, minmax(460px, 1fr));
}

.form-panel,
.activity-panel {
  padding: 18px;
  align-self: start;
  position: sticky;
  top: 24px;
}

.employee-notices {
  grid-column: 1 / -1;
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 2px solid #ff1d25;
  border-radius: 8px;
  background: #fff3f3;
  box-shadow: 0 12px 28px rgba(255, 29, 37, 0.14);
}

.employee-notices-head,
.employee-notice {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.employee-notices-head strong {
  color: #9f1117;
  font-size: 16px;
}

.employee-notices-head span {
  min-width: 28px;
  min-height: 28px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #ff1d25;
  color: white;
  font-weight: 900;
}

.employee-notice {
  padding: 12px;
  border: 1px solid #ffc2c5;
  border-radius: 8px;
  background: white;
}

.employee-notice strong,
.employee-notice p,
.employee-notice small {
  display: block;
}

.employee-notice p {
  margin: 5px 0;
}

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

.employee-notice button {
  flex: 0 0 auto;
  border: 0;
  border-radius: 8px;
  min-height: 38px;
  padding: 0 14px;
  background: var(--brand);
  color: var(--brand-navy);
  font-weight: 900;
}

.form-panel {
  display: grid;
  gap: 13px;
}

.form-panel label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
}

.inline-check {
  display: flex !important;
  grid-template-columns: none;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfc;
}

.inline-check input {
  width: auto;
  margin-top: 3px;
}

.inline-check span {
  display: grid;
  gap: 3px;
  color: var(--muted);
  line-height: 1.25;
}

.inline-check strong {
  color: var(--text);
}

.two-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.order-card,
.client-card,
.supervision-row,
.report-card {
  padding: 16px;
}

.order-card {
  overflow: hidden;
}

.express-order-banner {
  display: grid;
  gap: 4px;
  margin: 12px 0;
  padding: 12px;
  border: 1px solid #b8efc8;
  border-radius: 8px;
  background: #ecfdf3;
  color: #087529;
}

.express-order-banner span {
  color: #456b7a;
}

.order-top,
.client-top,
.supervision-info,
.stage-row,
.order-actions,
.report-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.order-code {
  font-weight: 800;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  color: white;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.badge.paused,
.dot.paused {
  background: var(--gray);
}

.badge.process-yellow,
.dot.process-yellow,
.stage.process-yellow {
  background: #ffe923;
  color: #251f00;
}

.badge.process-orange,
.dot.process-orange,
.stage.process-orange {
  background: #ff9518;
  color: #271300;
}

.badge.process-red,
.dot.process-red,
.stage.process-red {
  background: #f31821;
  color: white;
}

.badge.process-transition,
.dot.process-transition,
.stage.process-transition {
  background: #c77832;
  color: white;
}

.badge.process-green,
.dot.process-green,
.stage.process-green {
  background: #16c84f;
  color: white;
}

.status-legend {
  font-size: 12px;
  color: var(--muted);
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
}

.order-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  font-size: 13px;
  margin: 12px 0;
}

.order-meta span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.supervision-list {
  margin-top: 12px;
  gap: 8px;
}

.presentation-exit {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 1000;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #07182d;
  color: white;
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 10px 26px rgba(7, 24, 45, 0.18);
}

body.supervision-presentation .presentation-exit {
  display: grid;
  place-items: center;
}

body.supervision-presentation .supervision-list {
  margin-top: 0;
  gap: 6px;
}

body.supervision-presentation .supervision-row {
  padding: 9px 12px;
}

body.supervision-presentation .supervision-info {
  display: block;
}

body.supervision-presentation .supervision-info .badge,
body.supervision-presentation .supervision-meta span:nth-child(n + 2) {
  display: none;
}

body.supervision-presentation .supervision-meta {
  grid-template-columns: minmax(160px, 1fr);
  margin: 4px 0 7px;
}

body.supervision-presentation .linear-progress {
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 4px;
}

body.supervision-presentation .linear-step {
  min-height: 38px;
}

.supervision-row {
  background: white;
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 1px 5px rgba(24, 32, 38, 0.035);
  padding: 10px 16px;
}

.supervision-info h3 {
  font-size: 15px;
  line-height: 1.08;
  margin-bottom: 0;
}

.supervision-info .order-code {
  font-size: 15px;
  line-height: 1.05;
}

.supervision-info .badge {
  min-height: 24px;
  padding: 0 8px;
  font-size: 11px;
}

.supervision-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 8px;
  margin: 8px 0;
  color: var(--muted);
  font-size: 12px;
}

.supervision-meta strong {
  display: block;
  color: var(--ink);
  margin-bottom: 1px;
  font-size: 11px;
}

.linear-progress {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 5px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.linear-step {
  position: relative;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px 6px 36px;
  background: #f9fbfb;
  color: var(--muted);
  display: grid;
  align-content: center;
}

.linear-step::after {
  content: "";
  position: absolute;
  top: 20px;
  left: calc(100% - 2px);
  width: 7px;
  height: 2px;
  background: var(--line);
  z-index: 1;
}

.linear-step:last-child::after {
  display: none;
}

.step-dot {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: white;
  border: 2px solid currentColor;
  font-size: 11px;
  font-weight: 900;
  position: absolute;
  left: 8px;
  top: 50%;
  margin: 0;
  transform: translateY(-50%);
}

.linear-step strong {
  display: block;
  color: inherit;
  font-size: 11px;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.linear-step.complete,
.linear-step.current {
  background: var(--stage-bg, #f9fbfb);
  color: var(--stage-text, #071418);
  border: 0;
}

.linear-step.complete .step-dot {
  background: #08a93b;
  border-color: #08a93b;
  color: white;
}

.linear-step.current {
  box-shadow: inset 0 0 0 3px rgba(0, 0, 0, 0.16);
  animation: supervisionPulse 1.35s ease-in-out infinite;
  outline: 3px solid #ffd12f;
  outline-offset: -3px;
}

.linear-step.current::before {
  content: "ETAPA ACTUAL";
  position: absolute;
  right: 6px;
  top: 4px;
  padding: 1px 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  color: #071418;
  font-size: 8px;
  font-weight: 900;
}

@keyframes supervisionPulse {
  0%,
  100% {
    box-shadow: 0 0 0 rgba(255, 205, 64, 0), inset 0 0 0 3px rgba(0, 0, 0, 0.16);
    filter: brightness(1);
  }

  50% {
    box-shadow: 0 0 24px rgba(255, 205, 64, 0.95), inset 0 0 0 2px rgba(255, 255, 255, 0.82);
    filter: brightness(1.12);
  }
}

.stage-track {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
  gap: 8px;
  margin: 14px 0;
}

.express-stage-track {
  grid-template-columns: repeat(2, minmax(140px, 1fr));
  max-width: 560px;
}

.stage-slot {
  display: grid;
  grid-template-rows: 54px minmax(62px, auto);
  align-items: end;
  position: relative;
}

.complete-mark,
.current-mark,
.next-mark,
.complete-spacer {
  min-height: 54px;
}

.complete-mark,
.current-mark,
.next-mark {
  display: grid;
  justify-items: center;
  align-content: end;
  gap: 1px;
  text-align: center;
}

.complete-mark .mark-icon,
.current-mark .mark-icon,
.next-mark .mark-icon {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #08a93b;
  color: white;
  font-size: 21px;
  font-weight: 900;
  line-height: 1;
}

.complete-mark .mark-icon {
  font-size: 10px;
}

.current-mark .mark-icon {
  position: relative;
  width: 28px;
  height: 34px;
  border-radius: 0;
  background: transparent;
}

.current-mark .mark-icon::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 0;
  width: 6px;
  height: 18px;
  border-radius: 6px;
  background: #ff1d25;
}

.current-mark .mark-icon::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 15px;
  width: 0;
  height: 0;
  border-left: 11px solid transparent;
  border-right: 11px solid transparent;
  border-top: 15px solid #ff1d25;
}

.next-mark .mark-icon {
  background: #ffd12f;
  color: #191100;
}

.complete-mark b,
.current-mark b,
.next-mark b {
  max-width: 98px;
  color: #0a1519;
  font-size: 9px;
  line-height: 0.9;
  text-transform: uppercase;
}

.current-mark b {
  color: #c41118;
}

.next-mark b {
  color: #8a5200;
}

.stage {
  min-height: 62px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: var(--stage-bg, #f9fbfb);
  color: var(--stage-text, #071418);
  min-width: 0;
  position: relative;
}

.stage strong {
  display: block;
  font-size: 12px;
}

.stage small {
  font-size: 11px;
}

.stage.current-active {
  position: relative;
  animation: currentStagePulse 1.35s ease-in-out infinite;
  outline: 4px solid rgba(255, 29, 37, 0.82);
  outline-offset: -4px;
}

.stage.has-chat-control {
  padding-bottom: 28px;
}

.stage.current-active::after {
  content: "ACTUAL";
  position: absolute;
  right: 7px;
  bottom: 7px;
  padding: 2px 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  color: #071418;
  font-size: 8px;
  font-weight: 900;
}

.stage.current-active.has-chat-control::after {
  right: auto;
  left: 7px;
}

.stage.next-waiting {
  position: relative;
  outline: 2px solid #ffd12f;
  outline-offset: -2px;
}

.stage.next-waiting::after {
  content: "SIGUIENTE";
  position: absolute;
  right: 7px;
  bottom: 7px;
  padding: 2px 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  color: #071418;
  font-size: 8px;
  font-weight: 900;
}

.stage-chat-toggle {
  position: absolute;
  right: 7px;
  bottom: 7px;
  z-index: 4;
  min-height: 18px;
  border: 1px solid rgba(7, 20, 24, 0.28);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #071418;
  font-size: 8px;
  font-weight: 900;
  line-height: 1;
  padding: 3px 7px;
  cursor: pointer;
}

.stage-chat-toggle.has-chat {
  background: #07182d;
  border-color: #07182d;
  color: white;
}

.stage-chat-panel {
  width: min(460px, 100%);
  margin: -2px 0 14px;
  padding: 8px;
  border: 2px solid #285d7a;
  border-radius: 8px;
  background: #67cdd7;
  color: #08202b;
  box-shadow: 0 18px 38px rgba(7, 24, 45, 0.24);
}

.stage-chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
}

.stage-chat-head strong {
  font-size: 12px;
}

.stage-chat-head button {
  border: 0;
  border-radius: 999px;
  background: #07182d;
  color: white;
  font-size: 8px;
  font-weight: 900;
  padding: 5px 8px;
  cursor: pointer;
}

.stage-chat-messages {
  display: grid;
  gap: 6px;
  max-height: 160px;
  overflow: auto;
  padding-right: 3px;
}

.stage-chat-message,
.stage-chat-empty {
  min-width: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  padding: 7px 8px;
  font-size: 12px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.stage-chat-message.own {
  justify-self: end;
  max-width: 92%;
  background: #eaf7ff;
  text-align: right;
}

.stage-chat-message strong {
  display: block;
  font-size: 11px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.stage-chat-message p {
  margin: 3px 0;
  color: #08202b;
  line-height: 1.25;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.stage-chat-message small {
  color: #486675;
  font-size: 10px;
}

.stage-chat-field {
  display: grid;
  gap: 5px;
  margin-top: 7px;
  font-size: 10px;
  font-weight: 900;
}

.stage-chat-field textarea {
  width: 100%;
  min-height: 46px;
  resize: vertical;
  border: 1px solid rgba(7, 24, 45, 0.28);
  border-radius: 8px;
  padding: 7px 8px;
  font: inherit;
  color: #071418;
  background: white;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.stage-chat-send {
  width: 100%;
  margin-top: 7px;
  border: 0;
  border-radius: 8px;
  background: #5cff00;
  color: #071418;
  font-weight: 900;
  padding: 8px 10px;
  cursor: pointer;
}

@keyframes currentStagePulse {
  0%,
  100% {
    box-shadow: 0 0 0 rgba(255, 29, 37, 0), inset 0 0 0 1px rgba(255, 255, 255, 0.28);
    filter: brightness(1);
  }

  50% {
    box-shadow: 0 0 24px rgba(255, 29, 37, 0.95), inset 0 0 0 2px rgba(255, 255, 255, 0.82);
    filter: brightness(1.12);
  }
}

.stage.pending,
.stage.process-yellow,
.stage.process-orange,
.stage.process-red,
.stage.process-transition,
.stage.process-green {
  background: var(--stage-bg, #f9fbfb);
  color: var(--stage-text, #071418);
  border: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28);
}

.stage small {
  color: rgba(0, 0, 0, 0.68);
}

.order-actions {
  margin-top: 12px;
}

.evidence-panel {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 120px auto;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid #c9e4df;
  border-radius: 8px;
  background: #eef7f5;
}

.evidence-panel p {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 0;
}

.stage-note-field {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.stage-note-field textarea {
  width: 100%;
  min-height: 58px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  color: var(--ink);
  background: white;
  font: inherit;
}

.stage-note-field textarea[readonly] {
  background: #f6faf9;
}

.stage-note-save {
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font-weight: 900;
  padding: 8px 12px;
  cursor: pointer;
}

.evidence-thumb,
.evidence-empty {
  width: 120px;
  height: 86px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: white;
}

.evidence-empty {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  padding: 8px;
}

.evidence-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.evidence-action-button {
  min-height: 40px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--brand);
  border-radius: 8px;
  padding: 0 12px;
  background: var(--brand);
  color: var(--brand-navy);
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.evidence-action-button.secondary {
  border-color: var(--line);
  background: #ffffff;
  color: var(--ink);
}

.evidence-action-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.evidence-native-field {
  display: grid;
  min-width: min(280px, 100%);
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.evidence-native-field input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: #ffffff;
  color: var(--ink);
  font-size: 12px;
}

.evidence-drop-zone {
  display: grid;
  min-height: 54px;
  margin-top: 8px;
  place-items: center;
  border: 1px dashed rgba(22, 194, 231, 0.72);
  border-radius: 8px;
  padding: 10px;
  color: #084557;
  background: rgba(22, 194, 231, 0.08);
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

.evidence-drop-zone:focus {
  outline: 3px solid rgba(22, 194, 231, 0.22);
}

.evidence-paste-button {
  min-height: 34px;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: #ffffff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
}

.evidence-upload-status {
  margin-top: 8px;
  border: 1px solid rgba(22, 194, 231, 0.36);
  border-radius: 8px;
  padding: 8px 10px;
  color: #084557;
  background: rgba(22, 194, 231, 0.1);
  font-size: 12px;
  font-weight: 800;
}

.evidence-upload-status.error {
  border-color: rgba(239, 68, 68, 0.38);
  color: #7f1d1d;
  background: rgba(239, 68, 68, 0.1);
}

.billing-summary {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin: 10px 0;
  padding: 9px 10px;
  border: 1px solid #d8e6de;
  border-radius: 8px;
  background: #f2fbf5;
  font-size: 13px;
}

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

.payment-proof-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.receipt-status {
  grid-column: 1 / -1;
  border: 1px solid #b9ebc7;
  border-radius: 8px;
  background: #eefbf2;
  color: #096b2c;
  font-weight: 800;
  padding: 10px 12px;
}

.receipt-status.error {
  border-color: #ffc7c7;
  background: #fff2f2;
  color: #b3261e;
}

.delivery-charge-preview {
  border: 1px solid #b9ebc7;
  border-radius: 8px;
  background: #eefbf2;
  color: #096b2c;
  font-size: 14px;
  font-weight: 900;
  padding: 10px 12px;
}

.payment-proof-button {
  min-height: 42px;
  margin-bottom: 0;
}

.panel-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-title-row p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.process-config {
  display: grid;
  gap: 12px;
}

.process-editor {
  display: grid;
  gap: 10px;
}

.process-row {
  display: grid;
  grid-template-columns: 28px 42px minmax(0, 1fr) 72px;
  gap: 8px;
  align-items: end;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbfb;
}

.process-index {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--nav);
  color: white;
  font-weight: 900;
  align-self: center;
}

.process-color {
  width: 42px;
  height: 38px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.process-row label {
  margin: 0;
  font-size: 11px;
}

.process-evidence-toggle {
  grid-column: 1 / -1;
  min-height: 34px;
  display: flex !important;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid #d7e4ea;
  border-radius: 8px;
  background: white;
  color: var(--brand-navy);
  font-weight: 900;
}

.process-evidence-toggle input {
  width: 18px;
  height: 18px;
}

.process-row-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.process-row-actions button {
  min-height: 30px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  font-weight: 800;
  cursor: pointer;
}

.process-row-actions button[data-action="remove-process"] {
  color: #c81219;
}

.process-row-actions button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.order-actions button,
.client-card button {
  min-height: 34px;
  border: 1px solid var(--line);
  background: white;
  border-radius: 8px;
  font-weight: 700;
}

.order-actions .advance {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--brand-navy);
  padding: 0 12px;
}

.order-actions .finalize {
  background: #0b8f55;
  border-color: #0b8f55;
}

.order-actions .pause {
  padding: 0 10px;
}

.order-actions button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.order-actions .whatsapp {
  color: var(--brand-dark);
  padding: 0 10px;
}

.activity-list {
  display: grid;
  gap: 10px;
}

.activity-list div {
  border-bottom: 1px solid var(--line);
  padding-bottom: 9px;
}

.activity-list div:last-child {
  border-bottom: 0;
}

.activity-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.activity-sale-note,
.activity-send-note {
  min-height: 32px;
  border-radius: 8px;
  font-weight: 900;
  padding: 0 10px;
  cursor: pointer;
}

.activity-sale-note {
  border: 1px solid rgba(80, 255, 0, 0.55);
  background: var(--brand);
  color: var(--ink);
}

.activity-send-note {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
}

.change-requests-list {
  display: grid;
  gap: 12px;
}

.change-notices-head {
  margin-top: 28px;
}

.change-request-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  display: grid;
  gap: 12px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 24px;
  padding: 3px 10px;
  border-radius: 999px;
  background: #e8eef3;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.status-pill.pending {
  background: #fff1dc;
  color: #8a5a00;
}

.status-pill.approved {
  background: #e4f8ea;
  color: #0b6b38;
}

.status-pill.rejected {
  background: #ffe6e8;
  color: #b70e15;
}

.change-request-card.pending {
  border-color: rgba(243, 24, 33, 0.35);
  background: #fffafa;
}

.change-request-card.approved {
  border-color: rgba(11, 143, 85, 0.3);
}

.change-request-diff {
  display: grid;
  gap: 6px;
  padding: 10px;
  border-radius: 8px;
  background: #f5f8fa;
  color: var(--muted);
}

.change-request-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.change-request-actions button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  font-weight: 900;
  padding: 0 14px;
}

.change-request-actions button[data-action="approve-change-request"] {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--brand-navy);
}

.change-request-actions button[data-action="reject-change-request"] {
  color: #c81219;
}

.change-request-summary {
  display: grid;
  gap: 4px;
  padding: 10px;
  border-radius: 8px;
  background: #f5f8fa;
  color: var(--muted);
}

.activity-sale-note:hover,
.activity-send-note:hover {
  filter: brightness(0.96);
}

.pos-layout {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(340px, 460px) minmax(260px, 1fr);
  grid-template-areas:
    "product inventory activity"
    "sales debts activity"
    "paid paid paid"
    ". sale .";
  gap: 16px;
  align-items: start;
}

.pos-product-panel {
  grid-area: product;
}

.pos-sale-panel {
  grid-area: sale;
  width: 100%;
  max-width: 460px;
  justify-self: center;
}

.pos-inventory-panel {
  grid-area: inventory;
}

.pos-sales-panel {
  grid-area: sales;
}

.pos-debt-panel {
  grid-area: debts;
}

.paid-history-panel {
  grid-area: paid;
}

.pos-activity-panel {
  grid-area: activity;
}

.pos-accordion {
  min-width: 0;
  padding: 0;
}

.pos-accordion summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 54px;
  padding: 14px 16px;
  color: var(--ink);
  cursor: pointer;
  font-weight: 900;
  list-style: none;
}

.pos-accordion summary::-webkit-details-marker {
  display: none;
}

.pos-accordion summary::after {
  content: "+";
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--accent);
  color: #071525;
  font-size: 18px;
  line-height: 1;
}

.pos-accordion[open] summary {
  border-bottom: 1px solid var(--line);
}

.pos-accordion[open] summary::after {
  content: "-";
}

.pos-accordion > p,
.pos-accordion > .panel-search,
.pos-accordion > .pos-summary-grid,
.pos-accordion > .stock-products-list,
.pos-accordion > .pos-sales-list,
.pos-accordion > .credit-debts-list,
.pos-accordion > .form-panel {
  margin-left: 16px;
  margin-right: 16px;
}

.pos-accordion > p {
  margin-top: 12px;
}

.pos-accordion > .form-panel {
  box-shadow: none;
  border: 0;
  padding: 16px 0;
}

.pos-accordion > .form-panel button:last-child {
  margin-bottom: 0;
}

.pos-accordion > :last-child {
  margin-bottom: 16px;
}

.pos-list-panel {
  grid-column: span 1;
  min-width: 0;
  overflow: hidden;
}

.stock-products-list,
.pos-sales-list,
.credit-debts-list {
  display: grid;
  gap: 10px;
}

.panel-search {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  margin: 10px 0 12px;
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  background: white;
}

.pos-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  margin: 8px 0 12px;
}

.pos-summary-chip {
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfd;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.pos-summary-chip b {
  color: var(--ink);
  font-size: 18px;
  line-height: 1;
}

.pos-summary-chip.success {
  background: #eefaf2;
  border-color: rgba(2, 189, 53, 0.25);
}

.pos-summary-chip.warning {
  background: #fff9e8;
  border-color: rgba(255, 205, 0, 0.55);
}

.pos-summary-chip.danger {
  background: #fff3f3;
  border-color: rgba(243, 24, 33, 0.45);
}

.pos-sale-items {
  display: grid;
  gap: 8px;
}

.pos-sale-cart-title,
.pos-sale-cart-empty {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.pos-sale-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fbfd;
}

.pos-sale-item span {
  font-weight: 900;
  overflow-wrap: anywhere;
}

.pos-sale-item b {
  white-space: nowrap;
}

.pos-sale-item button {
  min-height: 30px;
  border: 1px solid rgba(243, 24, 33, 0.35);
  border-radius: 8px;
  background: white;
  color: #b00020;
  font-weight: 900;
}

.stock-product-row,
.pos-sale-row,
.credit-debt-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.pos-sale-row,
.credit-debt-row {
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}

.stock-product-row {
  grid-template-columns: 64px minmax(180px, 1fr) auto auto;
}

.stock-product-thumb {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  border: 1px solid var(--line);
  object-fit: contain;
  background: white;
}

.stock-product-thumb.empty {
  display: grid;
  place-items: center;
  padding: 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-align: center;
  background: #f5f8fa;
}

.stock-product-row.empty {
  background: #fff8f2;
  border-color: rgba(255, 149, 24, 0.35);
}

.credit-debt-row.due-soon {
  background: #fff9e8;
  border-color: rgba(255, 205, 0, 0.55);
}

.credit-debt-row.due-today {
  background: #fff4df;
  border-color: rgba(255, 149, 24, 0.55);
}

.credit-debt-row.overdue {
  background: #fff3f3;
  border-color: rgba(243, 24, 33, 0.45);
}

.credit-debt-row.paid {
  background: #eefaf2;
  border-color: rgba(2, 189, 53, 0.25);
}

.stock-product-row strong,
.pos-sale-row strong,
.credit-debt-row strong {
  display: block;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.stock-product-row span,
.pos-sale-row span,
.credit-debt-row span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.stock-product-row button,
.pos-sale-row button,
.credit-debt-row button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  font-weight: 800;
  cursor: pointer;
}

.stock-product-row > div:last-child {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pos-sale-row button {
  background: var(--brand);
  border-color: var(--brand);
}

.pos-row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-start;
  width: 100%;
}

.pos-row-actions button {
  flex: 1 1 150px;
  white-space: nowrap;
}

.credit-note-button {
  background: white !important;
  border-color: rgba(176, 0, 32, 0.3) !important;
  color: #b00020;
}

.credit-note-pill {
  display: inline-flex !important;
  width: max-content;
  margin-top: 6px !important;
  padding: 4px 8px;
  border-radius: 999px;
  background: #fff3f3;
  color: #b00020 !important;
  font-weight: 900;
}

.credit-debt-meta {
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted);
}

.credit-debt-row button {
  background: #0b8f55;
  border-color: #0b8f55;
  color: white;
}

.client-card {
  display: grid;
  gap: 8px;
}

.branch-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  display: grid;
  gap: 12px;
}

.branch-card.suspended {
  border-color: rgba(243, 24, 33, 0.35);
  background: #fff8f8;
}

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

.branch-title img,
.branch-logo-empty {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--line);
}

.branch-logo-empty {
  display: grid;
  place-items: center;
  background: var(--brand);
  color: var(--brand-navy);
  font-size: 11px;
  font-weight: 900;
}

.branch-status {
  display: grid;
  gap: 7px;
  justify-items: end;
}

.branch-status span {
  border-radius: 999px;
  color: white;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 900;
}

.branch-status span.process-green {
  background: #16c84f;
}

.branch-status span.paused {
  background: #f31821;
}

.branch-editor {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6f8f9;
}

.branch-editor label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.branch-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.branch-actions button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  font-weight: 900;
  padding: 0 12px;
}

.branch-actions button[data-action="toggle-branch"] {
  color: #c81219;
}

.branch-card.suspended .branch-actions button[data-action="toggle-branch"] {
  color: #0b8f55;
}

.branch-admin-note {
  padding: 12px;
  border: 1px solid #d8e6de;
  border-radius: 8px;
  background: #f2fbf5;
  color: var(--ink);
  font-size: 13px;
  display: grid;
  gap: 4px;
}

.branch-admin-note strong {
  font-size: 15px;
}

.branch-admin-note span {
  color: #4f6f7f;
  line-height: 1.45;
}

.branch-fiscal-panel {
  border: 1px solid #cfe8dc;
  border-radius: 8px;
  background: #f7fffa;
  padding: 14px;
  display: grid;
  gap: 12px;
}

.branch-logo-field {
  display: grid;
  gap: 8px;
}

.branch-logo-preview-wrap {
  min-height: 72px;
  padding: 8px;
  border: 1px dashed #bfd4df;
  border-radius: 8px;
  background: repeating-conic-gradient(#f8fbfd 0% 25%, #eef5f8 0% 50%) 50% / 18px 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.branch-logo-preview {
  max-width: 180px;
  max-height: 64px;
  object-fit: contain;
  display: block;
}

.branch-logo-preview-empty {
  color: #587486;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.branch-section-title {
  display: grid;
  gap: 4px;
}

.branch-section-title strong {
  color: var(--brand-navy);
  font-size: 16px;
}

.branch-section-title span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.branch-summary summary {
  cursor: pointer;
  color: var(--brand-dark);
  font-weight: 900;
}

.branch-permissions {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 10px;
  padding: 14px;
  border: 1px solid #c9e4df;
  border-radius: 8px;
  background: #f1faf7;
}

.branch-permissions .branch-section-title {
  grid-column: 1 / -1;
}

.branch-permissions label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  min-height: 52px;
  padding: 10px;
  border: 1px solid #d4e6e2;
  border-radius: 8px;
  background: white;
}

.branch-audit {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.branch-audit summary {
  cursor: pointer;
  color: var(--brand-dark);
  font-weight: 900;
}

.branch-audit-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.branch-audit-list div {
  background: #f6f8f9;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.branch-audit-list span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin: 3px 0;
}

.branch-stats,
.branch-users {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.branch-stats span,
.branch-users span {
  background: #f6f8f9;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
}

.branch-health {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
}

.branch-health-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.branch-health-head strong {
  display: block;
  margin-bottom: 3px;
}

.branch-health-head span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.branch-health-badge {
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  white-space: nowrap;
}

.branch-health-badge.ok {
  background: #e8f8ee;
  color: #087334;
}

.branch-health-badge.warn {
  background: #fff1cc;
  color: #895500;
}

.branch-health-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 8px;
}

.branch-health-grid span {
  min-width: 0;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.branch-health-grid b {
  display: block;
  color: var(--ink);
  font-size: 15px;
  margin-bottom: 2px;
}

.branch-health-warning,
.branch-health-ok {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  border-radius: 8px;
  padding: 9px 10px;
  font-size: 12px;
  font-weight: 800;
}

.branch-health-warning {
  border: 1px solid #f2c75e;
  background: #fff8df;
  color: #7a4a00;
}

.branch-health-ok {
  border: 1px solid #bce8cd;
  background: #effaf3;
  color: #087334;
}

.branch-health-warning span::before {
  content: "!";
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  margin-right: 5px;
  border-radius: 999px;
  background: #ffcf33;
  color: #111827;
  font-size: 11px;
  font-weight: 900;
}

.branch-users span.user-disabled {
  background: #fff2f2;
  border-color: rgba(243, 24, 33, 0.25);
  color: #9c1016;
}

.employee-manager {
  display: grid;
  grid-template-columns: minmax(280px, 0.95fr) minmax(320px, 1.2fr);
  gap: 12px;
  align-items: start;
}

.employee-create-panel,
.branch-employees {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: white;
  box-shadow: 0 8px 22px rgba(10, 25, 47, 0.04);
}

.branch-employees summary {
  cursor: pointer;
  color: var(--brand-dark);
  font-weight: 900;
}

.branch-employee-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 14px;
}

.branch-employee-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.branch-employee-form button,
.branch-employee-row button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  font-weight: 900;
  padding: 0 10px;
}

.branch-employee-form button {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--brand-navy);
  min-height: 42px;
  margin-top: 2px;
}

.branch-employee-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.empty-employee-list {
  padding: 14px;
  border: 1px dashed #cbd8de;
  border-radius: 8px;
  color: var(--muted);
  background: #f8fafb;
}

.branch-employee-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: white;
}

.branch-employee-row span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.branch-employee-row > div:first-child {
  flex: 1;
  min-width: 240px;
}

.branch-employee-row.disabled {
  background: #fff7f7;
  border-color: rgba(243, 24, 33, 0.28);
}

.branch-employee-row.disabled strong {
  color: #9c1016;
}

.branch-employee-row > div:last-child {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.branch-employee-row button[data-action="delete-branch-user"] {
  color: #c81219;
}

.branch-employee-edit {
  margin-top: 10px;
}

.branch-employee-edit summary {
  cursor: pointer;
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
}

.branch-employee-edit-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(130px, 1fr)) auto;
  gap: 8px;
  align-items: end;
  margin-top: 8px;
  padding: 10px;
  border: 1px solid #d7e4ea;
  border-radius: 8px;
  background: #f8fbfc;
}

.branch-employee-edit-grid label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.branch-employee-edit-grid input {
  min-width: 0;
}

.branch-employee-edit-grid button {
  min-height: 40px;
  background: var(--brand);
  border-color: var(--brand);
  color: var(--brand-navy);
}

.client-history {
  margin-top: 6px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.client-history summary {
  cursor: pointer;
  color: var(--brand-dark);
  font-weight: 900;
}

.client-history-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.client-history-row {
  display: grid;
  grid-template-columns: 90px minmax(160px, 1fr) 80px 110px 130px 105px;
  gap: 8px;
  align-items: center;
  background: #f6f8f9;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  font-size: 13px;
}

.client-history-row b {
  justify-self: end;
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 11px;
}

.client-history-row b.process-yellow {
  background: #ffe923;
  color: #251f00;
}

.client-history-row b.process-orange {
  background: #ff9518;
  color: #271300;
}

.client-history-row b.process-red {
  background: #f31821;
  color: white;
}

.client-history-row b.process-transition {
  background: #c77832;
  color: white;
}

.client-history-row b.process-green {
  background: #16c84f;
  color: white;
}

.client-history-row b.paused {
  background: var(--gray);
  color: white;
}

.client-history-empty {
  color: var(--muted);
  background: #f6f8f9;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.reports-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.report-card strong {
  font-size: 28px;
}

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

.report-product-row {
  display: grid;
  align-items: center;
  grid-template-columns: 1fr auto auto;
}

.report-product-row.muted {
  color: var(--muted);
}

.mini-danger-button,
.mini-action-button {
  min-height: 30px;
  border-radius: 8px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 900;
}

.mini-danger-button {
  border: 1px solid #ffb4b8;
  background: #fff1f2;
  color: #b20f18;
}

.report-hidden-products {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}

.report-hidden-products > strong {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.productivity-card {
  grid-column: span 2;
}

.productivity-summary {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 16px;
  align-items: center;
  margin-top: 12px;
}

.productivity-pie {
  width: 150px;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 10px solid white;
  box-shadow: inset 0 0 0 1px var(--line), 0 10px 24px rgba(8, 24, 43, 0.12);
}

.productivity-summary p {
  margin: 6px 0 10px;
  color: var(--muted);
}

.productivity-insight {
  display: inline-block;
  border-radius: 8px;
  background: #ecfdf3;
  border: 1px solid #b8efc8;
  color: #087529;
  padding: 8px 10px;
  font-weight: 800;
}

.productivity-legend {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.productivity-row {
  display: grid;
  grid-template-columns: 14px 1fr auto;
  gap: 8px;
  align-items: center;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.productivity-row small {
  grid-column: 2 / -1;
  color: var(--muted);
}

.productivity-swatch {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  border: 1px solid rgba(8, 24, 43, 0.18);
}

@media (max-width: 780px) {
  .productivity-card {
    grid-column: auto;
  }

  .productivity-summary {
    grid-template-columns: 1fr;
  }

  .productivity-pie {
    width: min(180px, 70vw);
    justify-self: center;
  }
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: var(--brand-navy);
  color: white;
  padding: 12px 14px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  transition: 160ms ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(10, 18, 22, 0.56);
  padding: 18px;
  z-index: 20;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-card {
  width: min(520px, 100%);
  background: white;
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 20px;
  display: grid;
  gap: 14px;
}

.modal-card label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.modal-help {
  color: var(--muted);
  line-height: 1.45;
  margin: -4px 0 2px;
}

.modal-head,
.modal-actions {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.modal-head h2 {
  margin-bottom: 0;
}

.icon-button {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  font-size: 24px;
  line-height: 1;
}

.delivery-summary {
  background: #eef7f5;
  border: 1px solid #c9e4df;
  border-radius: 8px;
  color: var(--brand-dark);
  font-weight: 800;
  padding: 12px;
}

.urgent-alert-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(12, 5, 6, 0.62);
  padding: 20px;
  z-index: 40;
}

.urgent-alert-overlay[hidden] {
  display: none;
}

.urgent-alert-card {
  width: min(560px, 100%);
  background: white;
  border: 4px solid #f31821;
  border-radius: 8px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.28);
  padding: 28px;
  text-align: center;
  display: grid;
  justify-items: center;
  gap: 12px;
  animation: urgentCardPulse 1.2s ease-in-out infinite;
}

.urgent-alert-card h2 {
  color: #b70e15;
  font-size: 30px;
  margin-bottom: 0;
}

.urgent-alert-card p {
  max-width: 440px;
  font-size: 18px;
  line-height: 1.35;
  margin-bottom: 0;
}

.urgent-alert-card small {
  color: var(--muted);
}

.urgent-siren {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #f31821;
  color: white;
  font-size: 42px;
  font-weight: 900;
  animation: urgentSiren 0.8s ease-in-out infinite;
}

.new-order-alert-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(3, 16, 28, 0.68);
  padding: 20px;
  z-index: 45;
}

.new-order-alert-overlay[hidden] {
  display: none;
}

.new-order-alert-card {
  width: min(580px, 100%);
  background: white;
  border: 4px solid var(--brand);
  border-radius: 8px;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.32);
  padding: 30px;
  text-align: center;
  display: grid;
  justify-items: center;
  gap: 12px;
  animation: newOrderCardPulse 1.15s ease-in-out infinite;
}

.new-order-siren {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #f31821;
  color: white;
  font-size: 34px;
  font-weight: 900;
  animation: urgentSiren 0.8s ease-in-out infinite;
}

.new-order-alert-card h2 {
  margin: 0;
  color: #0a192f;
  font-size: 34px;
}

.new-order-alert-card strong {
  color: #f31821;
  font-size: 22px;
}

.new-order-alert-card p {
  display: grid;
  gap: 4px;
  margin: 0;
  color: var(--ink);
}

.new-order-alert-card p span,
.new-order-alert-card small {
  color: var(--muted);
}

.new-order-alert-card button {
  min-width: 190px;
  margin-top: 6px;
}

@keyframes urgentCardPulse {
  0%,
  100% {
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.28), 0 0 0 rgba(243, 24, 33, 0);
  }

  50% {
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.28), 0 0 32px rgba(243, 24, 33, 0.6);
  }
}

@keyframes newOrderCardPulse {
  0%,
  100% {
    box-shadow: 0 22px 70px rgba(0, 0, 0, 0.32), 0 0 0 rgba(118, 255, 3, 0);
  }

  50% {
    box-shadow: 0 22px 70px rgba(0, 0, 0, 0.32), 0 0 34px rgba(118, 255, 3, 0.55);
  }
}

@keyframes urgentSiren {
  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.12);
  }
}

@media (min-width: 760px) and (max-width: 1180px) {
  body {
    grid-template-columns: 220px 1fr;
  }

  body.sidebar-collapsed {
    grid-template-columns: 64px 1fr;
  }

  .sidebar {
    padding: 16px 12px;
    gap: 16px;
  }

  .sidebar-logo {
    width: 108px;
    max-height: 36px;
  }

  .brand {
    gap: 8px;
  }

  .brand strong {
    font-size: 14px;
  }

  .brand small {
    font-size: 11px;
    line-height: 1.2;
  }

  .nav-item {
    min-height: 38px;
    padding: 0 12px;
    font-size: 14px;
  }

  .role-box {
    padding: 12px;
  }

  .role-box select,
  .role-box .session-scope span,
  .logout-button {
    min-height: 34px;
    font-size: 13px;
  }

  .app-shell {
    padding: 16px;
  }

  .topbar {
    margin-bottom: 14px;
    gap: 12px;
  }

  .topbar-brand {
    gap: 12px;
  }

  .topbar-logo {
    width: 150px;
    max-height: 72px;
    object-fit: contain;
  }

  h1 {
    font-size: 25px;
  }

  h2 {
    font-size: 21px;
  }

  .section-head p {
    font-size: 14px;
  }

  .top-actions {
    gap: 8px;
    justify-content: flex-end;
  }

  .top-actions button,
  .urgent-button,
  .primary-button,
  .ghost-button {
    min-height: 38px;
    padding: 0 12px;
    font-size: 14px;
  }

  .status-legend {
    gap: 7px;
    font-size: 11px;
  }

  .metric-grid {
    grid-template-columns: repeat(5, minmax(90px, 1fr));
    gap: 8px;
    margin: 10px 0;
  }

  .metric {
    min-height: 58px;
    padding: 9px 11px;
    gap: 10px;
  }

  .metric strong {
    font-size: 22px;
  }

  .metric span,
  .metric p {
    font-size: 12px;
  }

  .board-layout {
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 10px;
  }

  .office-board {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .activity-panel,
  .order-card,
  .client-card,
  .report-card {
    padding: 12px;
  }

  .activity-panel {
    position: static;
  }

  .order-meta {
    gap: 8px;
  }

  .order-meta div,
  .order-card p,
  .activity-list li,
  .activity-item {
    font-size: 13px;
  }

  .stage-track {
    grid-template-columns: repeat(auto-fit, minmax(82px, 1fr));
    gap: 6px;
    margin: 10px 0;
  }

  .express-stage-track {
    grid-template-columns: repeat(2, minmax(96px, 1fr));
  }

  .stage-slot {
    grid-template-rows: 42px minmax(52px, auto);
  }

  .complete-mark,
  .current-mark,
  .next-mark,
  .complete-spacer {
    min-height: 42px;
  }

  .complete-mark .mark-icon,
  .next-mark .mark-icon {
    width: 22px;
    height: 22px;
  }

  .current-mark .mark-icon {
    width: 24px;
    height: 28px;
  }

  .current-mark .mark-icon::before {
    left: 9px;
    width: 5px;
    height: 15px;
  }

  .current-mark .mark-icon::after {
    left: 2px;
    top: 13px;
    border-left-width: 10px;
    border-right-width: 10px;
    border-top-width: 13px;
  }

  .complete-mark b,
  .current-mark b,
  .next-mark b {
    max-width: 78px;
    font-size: 8px;
  }

  .stage {
    min-height: 52px;
    padding: 7px;
  }

  .stage.has-chat-control {
    padding-bottom: 26px;
  }

  .stage strong {
    font-size: 11px;
  }

  .stage small {
    font-size: 10px;
  }

  .stage-chat-toggle {
    right: 6px;
    bottom: 6px;
    padding: 3px 6px;
    font-size: 7px;
  }

  .stage-chat-panel {
    bottom: 58px;
    width: min(270px, calc(100vw - 34px));
  }

  .stage-chat-messages {
    max-height: 130px;
  }

  .evidence-panel {
    grid-template-columns: minmax(0, 1fr) 92px;
    gap: 8px;
  }

  .evidence-button {
    grid-column: 1 / -1;
  }

  .evidence-thumb,
  .evidence-empty {
    width: 92px;
    height: 64px;
  }

  .orders-layout,
  .clients-layout,
  .branches-layout {
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 12px;
  }

  .pos-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "product"
      "inventory"
      "sales"
      "debts"
      "paid"
      "activity"
      "sale";
    gap: 12px;
  }

  .pos-sale-panel {
    max-width: 520px;
    justify-self: center;
  }

  .stock-product-row,
  .pos-sale-row,
  .credit-debt-row,
  .pos-sale-item {
    grid-template-columns: 1fr;
  }

  .stock-product-row {
    grid-template-columns: 56px minmax(0, 1fr);
  }

  .stock-product-row > b,
  .stock-product-row > div:last-child {
    grid-column: 1 / -1;
  }

  .stock-product-row > div:last-child {
    justify-content: flex-start;
  }

  .form-panel {
    padding: 14px;
    gap: 10px;
  }

  .form-panel input,
  .form-panel select,
  .form-panel textarea {
    min-height: 38px;
    font-size: 13px;
  }
}

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

  body.sidebar-collapsed {
    grid-template-columns: 1fr;
  }

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

  body.sidebar-collapsed .sidebar {
    padding: 16px;
  }

  body.sidebar-collapsed .brand div,
  body.sidebar-collapsed .role-box label,
  body.sidebar-collapsed .role-box select,
  body.sidebar-collapsed .logout-button {
    display: block;
  }

  body.sidebar-collapsed .nav-item {
    font-size: inherit;
    padding: 0 14px;
    text-align: left;
  }

  body.sidebar-collapsed .nav-item::before {
    content: none !important;
  }

  .board-layout,
  .orders-layout,
  .clients-layout,
  .branches-layout,
  .pos-layout {
    grid-template-columns: 1fr;
  }

  .pos-layout {
    grid-template-areas:
      "product"
      "inventory"
      "sales"
      "debts"
      "paid"
      "activity"
      "sale";
  }

  #processConfigPanel,
  #ordersList {
    grid-column: 1;
    grid-row: auto;
  }

  .supervision-meta {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(130px, 1fr));
  }

  .branch-health-grid {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .employee-manager {
    grid-template-columns: 1fr;
  }

  .branch-employee-edit-grid {
    grid-template-columns: 1fr 1fr;
  }
}

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

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

  .filters,
  .top-actions {
    width: 100%;
  }

  .filters > *,
  .top-actions > * {
    flex: 1;
  }

  .metric-grid,
  .order-meta,
  .supervision-meta,
  .branch-health-grid,
  .two-cols {
    grid-template-columns: 1fr;
  }

  .metric {
    align-items: flex-start;
  }

  .linear-progress {
    grid-template-columns: 1fr;
    overflow-x: visible;
  }

  .linear-step::after {
    left: 22px;
    top: calc(100% - 2px);
    width: 3px;
    height: 12px;
  }

  .stage-slot {
    grid-template-rows: auto auto;
  }

  .evidence-panel {
    grid-template-columns: 1fr;
  }

  .evidence-thumb,
  .evidence-empty {
    width: 100%;
    height: 180px;
  }

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

  .client-history-row b {
    justify-self: start;
  }

  .branch-editor {
    grid-template-columns: 1fr;
  }

  .branch-permissions {
    grid-template-columns: 1fr;
  }

  .employee-manager {
    grid-template-columns: 1fr;
  }

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

  .branch-employee-edit-grid {
    grid-template-columns: 1fr;
  }

  .branch-employee-row {
    align-items: stretch;
    flex-direction: column;
  }

  .branch-employee-row > div:last-child {
    justify-content: flex-start;
  }

  .branch-status {
    justify-items: start;
  }
}

.mobile-menu-toggle {
  display: none;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  place-items: center;
  gap: 4px;
  padding: 9px;
}

.mobile-menu-toggle span {
  display: block;
  width: 20px;
  height: 3px;
  border-radius: 999px;
  background: var(--brand-navy);
}

@media (max-width: 1180px) {
  body,
  body.sidebar-collapsed {
    grid-template-columns: 1fr;
    overflow-x: hidden;
  }

  body:not(.logged-out) .mobile-menu-toggle {
    display: grid;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1200;
    width: min(320px, 84vw);
    min-height: 100dvh;
    padding: 18px;
    overflow-y: auto;
    transform: translateX(0);
    transition: transform 180ms ease, box-shadow 180ms ease;
    box-shadow: 18px 0 42px rgba(7, 24, 45, 0.24);
  }

  body.sidebar-collapsed .sidebar {
    padding: 18px;
    transform: translateX(calc(-100% - 12px));
    box-shadow: none;
  }

  body.sidebar-collapsed .brand {
    justify-content: flex-start;
  }

  body.sidebar-collapsed .brand div,
  body.sidebar-collapsed .role-box label,
  body.sidebar-collapsed .role-box select,
  body.sidebar-collapsed .session-scope,
  body.sidebar-collapsed .logout-button {
    display: block;
  }

  body.sidebar-collapsed .sidebar-toggle {
    position: static;
    transform: none;
    margin-left: auto;
  }

  body.sidebar-collapsed .nav-item {
    min-height: 44px;
    padding: 0 14px;
    text-align: left;
    font-size: 15px;
  }

  body.sidebar-collapsed .nav-item::before {
    content: none !important;
  }

  .app-shell {
    grid-column: 1;
    width: 100%;
    max-width: 100vw;
    padding: 18px;
  }

  .topbar {
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
  }

  .topbar-brand {
    flex: 1 1 auto;
    gap: 10px;
  }

  .topbar-logo {
    width: clamp(180px, 23vw, 260px);
    max-height: 72px;
  }

  .topbar h1 {
    font-size: clamp(16px, 2.2vw, 22px);
    line-height: 1.05;
  }

  .top-actions {
    width: auto;
    flex: 1 1 360px;
    justify-content: flex-start;
    gap: 8px;
  }

  .top-actions button {
    flex: 1 1 118px;
    min-height: 40px;
    padding: 0 12px;
    white-space: normal;
  }

  .topbar .eyebrow {
    margin-bottom: 2px;
    font-size: 9px;
    line-height: 1;
  }

  .section-head {
    gap: 10px;
    margin-bottom: 8px;
  }

  .section-head h2 {
    margin-bottom: 3px;
    font-size: 22px;
    line-height: 1.08;
  }

  .section-head p {
    margin-bottom: 0;
    font-size: 14px;
    line-height: 1.25;
  }

  .board-layout,
  .orders-layout,
  .clients-layout,
  .branches-layout,
  .campaign-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  #processConfigPanel,
  #ordersList {
    grid-column: 1;
    grid-row: auto;
  }

  .office-board {
    grid-template-columns: minmax(0, 1fr);
  }

  .order-card,
  .client-card,
  .report-card,
  .panel,
  .activity-panel {
    min-width: 0;
  }

  .metric-grid {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  }

  .order-meta {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  }

  .stage-track {
    grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
    gap: 8px;
  }

  .express-stage-track {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .stage-chat-panel {
    position: fixed;
    left: 14px;
    right: 14px;
    bottom: 14px;
    width: auto;
    max-width: none;
  }
}

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

  .topbar {
    display: grid;
    grid-template-columns: 42px 1fr;
  }

  .top-actions {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  #newOrderShortcut {
    grid-column: 1 / -1;
  }

  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .filters {
    display: grid;
    grid-template-columns: 1fr;
  }
}
