:root {
  --ink: #172033;
  --muted: #64748b;
  --line: #d9e2ec;
  --surface: #ffffff;
  --canvas: #f1f8fc;
  --primary: #0076b6;
  --primary-deep: #0a4f83;
  --secondary: #008bd2;
  --teal: #00a6cf;
  --amber: #f36b2a;
  --rose: #c2414b;
  --good: #16803c;
  --shadow: 0 14px 34px rgba(4, 88, 135, 0.1);
  --tooltip-bg: rgba(11,18,32,0.95);
  --tooltip-color: #ffffff;
  --tooltip-padding: 8px 10px;
  --tooltip-radius: 8px;
  --tooltip-shadow: 0 10px 30px rgba(11,18,32,0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 4px solid var(--amber);
  background: var(--primary);
  color: #fff;
  padding: 16px 32px;
}

.admin-header {
  align-items: center;
}

.eyebrow {
  margin: 0 0 4px;
  color: #d7efff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 26px;
  line-height: 1.15;
}

.brand-title {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.brand-title > div {
  min-width: 0;
}

.brand-title h1,
.brand-title .eyebrow {
  overflow-wrap: anywhere;
}

.brand-title h1 {
  max-width: 520px;
}

.brand-logo {
  display: block;
  width: 150px;
  max-width: 30vw;
  height: auto;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(0, 58, 102, 0.18);
  padding: 6px 8px;
}

h2 {
  font-size: 15px;
}

.header-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: end;
  gap: 12px;
}

html:not([data-theme="modern"]) .app-header {
  flex-wrap: wrap;
}

html:not([data-theme="modern"]) .brand-title {
  flex: 0 1 520px;
  min-width: min(420px, 100%);
}

html:not([data-theme="modern"]) .brand-title h1,
html:not([data-theme="modern"]) .brand-title .eyebrow {
  overflow-wrap: normal;
  word-break: normal;
}

html:not([data-theme="modern"]) .header-actions {
  flex: 1 1 720px;
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: min(720px, 100%);
}

.field {
  display: grid;
  gap: 6px;
  min-width: 310px;
  color: #dbeafe;
  font-size: 12px;
  font-weight: 700;
}

.field.compact {
  min-width: 170px;
}

.field.period-field {
  min-width: 250px;
}

input,
select {
  width: 100%;
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  outline: none;
  padding: 8px 10px;
}

input:focus,
select:focus {
  border-color: #7dd3fc;
  box-shadow: 0 0 0 3px rgba(125, 211, 252, 0.26);
}

.header-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 6px;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  padding: 8px 12px;
  text-decoration: none;
}

.header-link:hover,
.header-link:focus {
  border-color: rgba(255, 255, 255, 0.46);
  background: rgba(255, 255, 255, 0.12);
}

.header-link.current {
  border-color: rgba(255, 255, 255, 0.56);
  background: rgba(255, 255, 255, 0.18);
}

.session-user {
  align-self: center;
  color: #dbeafe;
  font-size: 12px;
  font-weight: 800;
  max-width: 112px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.login-body {
  position: relative;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    linear-gradient(95deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01) 36%, rgba(10, 32, 56, 0.18) 100%),
    radial-gradient(circle at 14% 18%, rgba(255, 255, 255, 0.72), transparent 18%),
    radial-gradient(circle at 82% 26%, rgba(8, 120, 193, 0.18), transparent 24%),
    url("login-portal-bg.png") center center / cover no-repeat,
    #dfe8ef;
}

.login-backdrop {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.login-backdrop::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.03) 28%, rgba(8, 36, 67, 0.18) 100%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent 52%, rgba(9, 24, 40, 0.08) 100%);
}

.login-backdrop-glow {
  position: absolute;
  border-radius: 999px;
  filter: blur(70px);
  opacity: 0.72;
}

.login-backdrop-glow-left {
  top: 12%;
  left: 7%;
  width: 240px;
  height: 240px;
  background: rgba(255, 255, 255, 0.7);
}

.login-backdrop-glow-right {
  right: 10%;
  bottom: 10%;
  width: 260px;
  height: 260px;
  background: rgba(0, 118, 182, 0.2);
}

.login-shell {
  position: relative;
  z-index: 1;
  display: grid;
  min-height: 100vh;
  align-items: center;
  justify-items: end;
  padding: clamp(20px, 5vw, 64px);
  padding-right: clamp(26px, 8vw, 130px);
}

.login-panel {
  width: min(350px, calc(100vw - 36px));
  border: 1px solid rgba(255, 255, 255, 0.48);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0.2));
  box-shadow:
    0 22px 56px rgba(8, 29, 49, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.56);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: clamp(22px, 3vw, 30px) clamp(20px, 2.8vw, 30px);
}

.login-company-logo {
  display: block;
  width: min(246px, 80%);
  height: auto;
  margin: 0 auto 28px;
  opacity: 1;
}

.login-logo {
  display: block;
  width: min(246px, 80%);
  max-width: 100%;
  height: auto;
  margin: 0 auto 28px;
}

.login-brand {
  display: flex;
  width: fit-content;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 0 auto;
  text-align: left;
}

.login-brand-mark {
  position: relative;
  display: grid;
  flex: 0 0 86px;
  width: 86px;
  min-height: 78px;
  place-items: center;
}

.login-growth-icon {
  display: block;
  width: 86px;
  height: auto;
  overflow: visible;
  filter: drop-shadow(0 7px 12px rgba(6, 33, 58, 0.14));
}

.login-brand-copy {
  display: grid;
  gap: 0;
  padding-top: 0;
  text-align: center;
}

.login-panel .eyebrow {
  order: -1;
  margin-bottom: 2px;
  color: #0e5f96;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.login-panel h1 {
  max-width: none;
  color: #0b5d95;
  font-size: 20px;
  line-height: 1;
  letter-spacing: 0;
  text-transform: uppercase;
}

.login-subtitle {
  margin-top: 9px;
  color: #1f2730;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.2;
  text-align: center;
  text-transform: uppercase;
}

.login-form {
  display: grid;
  gap: 10px;
  margin-top: 28px;
}

.login-field {
  min-width: 0;
  gap: 0;
  color: #1d2d3f;
  font-size: 13px;
}

.login-field-input {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-height: 50px;
  border-bottom: 1px solid rgba(23, 32, 51, 0.66);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04));
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.1);
  padding: 0 4px 0 0;
}

.login-field-icon {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  color: #1b1d20;
}

.login-field-icon svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.login-field input {
  min-height: 46px;
  border: 0;
  border-radius: 0;
  background: transparent !important;
  box-shadow: none !important;
  color: #111827;
  font-size: 14px;
  font-weight: 500;
  padding: 6px 0 4px;
  appearance: none;
  -webkit-appearance: none;
}

.login-field input:focus {
  box-shadow: none;
}

.login-field input::placeholder {
  color: rgba(17, 24, 39, 0.98);
  opacity: 1;
}

.login-field input:-webkit-autofill,
.login-field input:-webkit-autofill:hover,
.login-field input:-webkit-autofill:focus,
.login-field input:-webkit-autofill:active {
  border: 0;
  -webkit-text-fill-color: #111827;
  caret-color: #111827;
  box-shadow: 0 0 0 1000px rgba(255, 255, 255, 0.04) inset !important;
  transition: background-color 9999s ease-out;
}

.login-options {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.login-error {
  border: 1px solid rgba(153, 27, 27, 0.14);
  border-radius: 14px;
  background: rgba(254, 226, 226, 0.86);
  color: #991b1b;
  font-size: 13px;
  font-weight: 800;
  padding: 12px 14px;
}

.login-success {
  border: 1px solid #bbf7d0;
  border-radius: 14px;
  background: #dcfce7;
  color: #166534;
  font-size: 13px;
  font-weight: 800;
  padding: 10px 12px;
}

.login-support-link {
  color: #143d63;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.login-support-link:hover,
.login-support-link:focus {
  color: #0a5f98;
  text-decoration: underline;
}

.remember-login {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #506072;
  font-size: 12px;
  font-weight: 800;
  margin-right: auto;
}

.remember-login input {
  width: 16px;
  min-height: 16px;
  padding: 0;
}

.login-submit {
  min-height: 46px;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, #0a87d0 0%, #0a5fa2 54%, #1f4c85 100%);
  box-shadow: 0 10px 22px rgba(0, 84, 138, 0.24);
  color: #fff;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.05em;
}

.login-submit:hover,
.login-submit:focus {
  transform: translateY(-1px);
  box-shadow: 0 18px 32px rgba(0, 84, 138, 0.3);
}

.login-caption {
  color: #1d2732;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
  text-align: center;
  text-wrap: balance;
  padding-inline: 10px;
}

.login-version {
  color: rgba(29, 39, 50, 0.68);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  text-align: center;
}

.app-version-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 8px;
  background: #005f9e;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  padding: 6px 10px;
  white-space: nowrap;
}

html:not([data-theme="modern"]) .app-version-badge {
  min-height: 38px;
  border-color: rgba(255, 255, 255, 0.24);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: none;
  color: #fff;
}

.app-version-badge-classic {
  min-height: 38px;
  border-color: rgba(255, 255, 255, 0.24) !important;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08) !important;
  color: #fff !important;
}

.update-notice-backdrop {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.46);
}

.update-notice-dialog {
  width: min(540px, 100%);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  border: 1px solid rgba(217, 226, 236, 0.9);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(11, 18, 32, 0.28);
  color: var(--ink);
  padding: 24px;
}

.update-notice-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.update-notice-header h2 {
  color: var(--primary-deep);
  font-size: 24px;
  line-height: 1.2;
}

.update-notice-close {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--ink);
  cursor: pointer;
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
}

.update-notice-close:hover,
.update-notice-close:focus {
  border-color: var(--primary);
  color: var(--primary-deep);
}

.update-notice-intro {
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 12px;
}

.update-notice-section {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.update-notice-section h3 {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.25;
}

.update-notice-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 20px;
}

.update-notice-list li {
  line-height: 1.45;
}

.update-notice-note {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  margin: 0 0 16px;
  padding-top: 12px;
}

.update-notice-check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
}

.update-notice-check input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.update-notice-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 22px;
}

.update-notice-confirm {
  min-width: 112px;
}

.account-panel {
  max-width: 520px;
}

.account-form {
  max-width: 520px;
}

.shell {
  display: grid;
  gap: 18px;
  padding: 20px 32px 34px;
}

.admin-workspace {
  gap: 14px;
}

.orders-workspace {
  width: 100%;
}

.customers-workspace {
  width: 100%;
}

.admin-filters.orders-filters {
  grid-template-columns: minmax(280px, 1.4fr) minmax(180px, 0.75fr) minmax(200px, 0.75fr) minmax(180px, 0.65fr);
}

.admin-filters.customers-filters {
  grid-template-columns: minmax(280px, 1.4fr) repeat(3, minmax(170px, 0.7fr));
}

.admin-workbench.orders-workbench {
  grid-template-columns: minmax(280px, 330px) minmax(0, 1fr);
}

.admin-workbench.customers-workbench {
  grid-template-columns: minmax(280px, 330px) minmax(0, 1fr);
}

.admin-filters {
  position: sticky;
  top: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: minmax(220px, 1.25fr) minmax(230px, 0.85fr) minmax(150px, 0.55fr) minmax(150px, 0.55fr);
  align-items: end;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
}

.dashboard-filters {
  grid-template-columns: minmax(220px, 1.25fr) minmax(210px, 0.78fr) minmax(145px, 0.48fr) minmax(180px, 0.65fr) minmax(145px, 0.48fr);
}

.admin-filters .field {
  position: relative;
  min-width: 0;
  color: var(--ink);
}

.admin-filters .field span {
  color: var(--muted);
}

.admin-filters input,
.admin-filters select {
  border-color: var(--line);
}

.search-control,
.customer-search-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 8px;
}

.search-clear,
.customer-search-clear {
  min-height: 44px;
  padding-inline: 14px;
}

.search-clear[hidden],
.customer-search-clear[hidden] {
  display: none;
}

.search-suggestions {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  z-index: 20;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.16);
}

.search-suggestions[hidden] {
  display: none;
}

.search-suggestions button {
  display: grid;
  width: 100%;
  gap: 3px;
  border: 0;
  border-bottom: 1px solid #e2e8f0;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  padding: 10px 12px;
  text-align: left;
}

.search-suggestions button:nth-child(even) {
  background: #f8fafc;
}

.search-suggestions button:last-child {
  border-bottom: 0;
}

.search-suggestions button:hover,
.search-suggestions button:focus {
  background: #edf6fb;
  outline: none;
}

.search-suggestions span {
  overflow: hidden;
  font-size: 12px;
  font-weight: 900;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.search-suggestions small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.active-filter-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid rgba(0, 139, 210, 0.24);
  border-radius: 8px;
  background: #e7f6fc;
  padding: 10px 14px;
}

.active-filter-strip[hidden] {
  display: none;
}

.active-filter-card {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.active-filter-items,
.active-filter-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.active-filter-items {
  flex: 1 1 auto;
  flex-wrap: wrap;
}

.active-filter-actions {
  flex: 0 0 auto;
}

.active-filter-card span,
.active-filter-card small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.active-filter-card strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-workbench {
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  align-items: start;
  gap: 18px;
}

.analysis-stack {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.admin-workbench .kpi-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}

.representative-shell {
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
}

.representative-kpis {
  grid-template-columns: repeat(12, minmax(0, 1fr));
}

.representative-kpis .kpi {
  grid-column: span 4;
}

.representative-kpis .kpi-wide {
  grid-column: span 3;
}

.representative-kpis .kpi strong {
  overflow-wrap: normal;
  word-break: normal;
  font-size: clamp(22px, 2vw, 30px);
  line-height: 1.08;
}

.open-orders-kpis {
  grid-template-columns: repeat(12, minmax(0, 1fr));
}

.open-orders-kpis .kpi {
  grid-column: span 4;
}

.open-orders-kpis .kpi span {
  min-width: 0;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.open-orders-kpis .kpi:nth-child(2),
.open-orders-kpis .kpi:nth-child(3) {
  grid-column: span 6;
  order: -1;
}

.open-orders-kpis .kpi strong {
  overflow-wrap: normal;
  word-break: normal;
  font-size: clamp(22px, 2.05vw, 30px);
  line-height: 1.08;
}

.open-orders-kpis .kpi:nth-child(2) strong,
.open-orders-kpis .kpi:nth-child(3) strong {
  font-size: clamp(26px, 2.4vw, 34px);
}

.open-orders-kpis[data-active-view="sales"] #ordersCountKpi {
  grid-column: span 6;
  order: -1;
}

.open-orders-kpis[data-active-view="sales"] #ordersNetSalesKpi {
  grid-column: span 6;
  order: -1;
}

.open-orders-kpis[data-active-view="sales"] #ordersValueKpi,
.open-orders-kpis[data-active-view="sales"] #ordersAuxKpi,
.open-orders-kpis[data-active-view="sales"] #ordersRepresentativesKpi,
.open-orders-kpis[data-active-view="sales"] #ordersUpdatedKpi {
  grid-column: span 3;
  order: 0;
}

.open-orders-kpis[data-active-view="sales"] #ordersCountKpi strong,
.open-orders-kpis[data-active-view="sales"] #ordersNetSalesKpi strong {
  font-size: clamp(26px, 2.4vw, 34px);
}

.open-orders-kpis[data-active-view="sales"] #ordersNetSalesKpi strong {
  color: #07866f;
}

.open-orders-kpis[data-active-view="sales"] #ordersValueKpi strong {
  font-size: clamp(22px, 2.05vw, 30px);
}

.order-view-switch {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  align-self: start;
  width: min(100%, 680px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f3f6f8;
  padding: 4px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.order-view-button {
  flex: 1 0 120px;
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  padding: 8px 12px;
}

.order-view-button:hover,
.order-view-button:focus-visible {
  background: #ffffff;
  color: var(--ink);
  outline: none;
}

.order-view-button.active {
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.16);
  color: var(--brand);
}

.customer-kpis {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.customer-revenue-kpi {
  border-color: rgba(0, 118, 182, 0.35);
  background: linear-gradient(145deg, #ffffff, #eef8fd);
}

.customer-revenue-kpi strong {
  font-size: clamp(18px, 1.7vw, 28px);
}

.customers-table th:nth-child(3),
.customers-table td:nth-child(3),
.customers-table th:nth-child(5),
.customers-table td:nth-child(5) {
  min-width: 220px;
}

.customers-table td:nth-child(3) small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.customer-row {
  cursor: pointer;
}

.customer-row:hover td,
.customer-row:focus-visible td {
  background: #f2f9fd;
}

.customer-row.selected td {
  background: #e5f4fb;
}

.customer-row.selected td:first-child {
  box-shadow: inset 4px 0 0 var(--primary);
}

.customer-representative-item {
  height: auto;
  min-height: 156px;
  align-content: start;
  padding: 12px;
}

.customer-representative-item .rep-list-name,
.customer-representative-item .rep-list-company {
  display: -webkit-box;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
  -webkit-box-orient: vertical;
}

.customer-representative-item .rep-list-name {
  min-height: 32px;
  line-height: 1.25;
  -webkit-line-clamp: 2;
}

.customer-representative-item .rep-list-company {
  min-height: 27px;
  line-height: 1.25;
  -webkit-line-clamp: 2;
}

.customer-representative-values {
  display: grid;
  gap: 4px;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
  text-align: right;
}

.customer-representative-values span {
  white-space: nowrap;
}

.customer-representative-metrics {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
  align-items: start;
  justify-content: stretch;
  text-align: left;
}

.customer-representative-metrics > *,
.customer-representative-value {
  display: block;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  white-space: normal;
}

.customer-representative-value {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
}

.customer-ranking-panel {
  position: static;
}

.customer-comparison-panel {
  overflow: hidden;
}

.customer-comparison-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 14px 18px 0;
}

.customer-comparison-summary div {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 3px 8px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px 12px;
}

.customer-comparison-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.customer-comparison-summary strong {
  grid-column: 1 / -1;
  color: var(--ink);
  font-size: 18px;
}

.customer-comparison-summary strong.positive {
  color: #15803d;
}

.customer-comparison-summary strong.negative {
  color: #b91c1c;
}

.comparison-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.comparison-dot.previous,
.comparison-bar.previous {
  background: #ff5a0a;
}

.comparison-dot.current,
.comparison-bar.current {
  background: #0578c7;
}

.customer-comparison-chart {
  display: grid;
  grid-template-columns: repeat(12, minmax(42px, 1fr));
  align-items: stretch;
  gap: 8px;
  min-height: 300px;
  overflow-x: auto;
  padding: 48px 18px 18px;
}

.customer-comparison-chart.single-point {
  grid-template-columns: minmax(120px, 180px);
  justify-content: center;
}

.customer-comparison-chart.few-points {
  grid-template-columns: repeat(auto-fit, minmax(90px, 150px));
  justify-content: center;
}

.customer-comparison-chart > .empty-state {
  grid-column: 1 / -1;
  align-self: center;
}

.customer-risk-trend {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: stretch;
  margin: 0 18px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.customer-risk-trend-title {
  display: grid;
  align-content: center;
  gap: 5px;
  min-width: 0;
}

.customer-risk-trend-title span {
  color: #92400e;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.customer-risk-trend-title small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
}

.customer-risk-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 6px 10px;
  align-items: center;
  border: 1px solid #d8e2ec;
  border-left: 5px solid #d97706;
  border-radius: 8px;
  padding: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #fffaf0 100%);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.customer-risk-card:hover,
.customer-risk-card:focus-visible,
.customer-risk-card.active {
  border-color: #d97706;
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.14);
  outline: none;
}

.customer-risk-card.critical {
  border-left-color: #c62828;
  background: linear-gradient(180deg, #ffffff 0%, #fff5f5 100%);
}

.customer-risk-card.critical:hover,
.customer-risk-card.critical:focus-visible,
.customer-risk-card.critical.active {
  border-color: #c62828;
  box-shadow: 0 0 0 3px rgba(198, 40, 40, 0.12);
}

.customer-risk-card strong {
  color: #172033;
  font-size: 26px;
  line-height: 1;
}

.customer-risk-card span {
  color: #172033;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.comparison-month {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: minmax(220px, 1fr) auto;
  gap: 8px;
  min-width: 42px;
}

.comparison-month:has(.comparison-bar:hover),
.comparison-month:has(.comparison-bar:focus-visible) {
  z-index: 20;
}

.comparison-month > strong {
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.comparison-bars {
  position: relative;
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 4px;
  overflow: visible;
  border-bottom: 1px solid var(--line);
}

.comparison-bar {
  position: relative;
  z-index: 1;
  width: min(42%, 28px);
  min-height: 0;
  border-radius: 4px 4px 0 0;
  cursor: help;
  transition: filter 140ms ease, opacity 140ms ease;
}

.comparison-bar:hover,
.comparison-bar:focus-visible {
  z-index: 21;
  filter: brightness(0.92);
  outline: 2px solid rgba(0, 118, 182, 0.18);
  outline-offset: 2px;
}

.comparison-bar span {
  position: absolute;
  z-index: 30;
  bottom: calc(100% + 7px);
  left: 50%;
  display: none;
  width: max-content;
  max-width: 160px;
  transform: translateX(-50%);
  border-radius: 5px;
  background: #0f172a;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.24);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  pointer-events: none;
  padding: 5px 7px;
  white-space: nowrap;
}

.comparison-month:first-child .comparison-bar:first-child span {
  left: 0;
  transform: none;
}

.comparison-month:last-child .comparison-bar:last-child span {
  right: 0;
  left: auto;
  transform: none;
}

.comparison-bar:hover span,
.comparison-bar:focus-visible span {
  display: block;
}

.customer-top-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-height: none;
  overflow: auto;
}

.customer-top-row {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  padding: 0;
  text-align: left;
}

.customer-top-row.active {
  border-radius: 6px;
  background: #edf6fb;
  box-shadow: inset 3px 0 0 var(--secondary);
  padding: 8px;
}

.customer-top-row small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.customer-representative-item .rep-list-metrics {
  display: grid;
  align-items: start;
  justify-content: stretch;
  gap: 4px;
  min-height: 0;
  line-height: 1.25;
}

.rep-list-metrics.sales-rep-metrics {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-content: stretch;
  gap: 4px;
  text-align: left;
}

.rep-list-metrics.sales-rep-metrics > * {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.customer-status {
  display: inline-flex;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}

.customer-status.active {
  color: #146c43;
  background: #dff4e9;
}

.customer-status.inactive {
  color: #8a3c24;
  background: #f9e5dc;
}

.representative-grid {
  align-items: start;
  grid-template-columns: minmax(0, 1.35fr) minmax(420px, 0.85fr);
}

.representative-main-column,
.representative-side-column {
  display: grid;
  align-content: start;
  gap: 18px;
  min-width: 0;
}

.representative-grid .panel {
  align-self: start;
  min-width: 0;
}

.kpi,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.kpi {
  position: relative;
  min-height: 90px;
  padding: 14px 16px;
  text-align: center;
}

.kpi[data-kpi-help] {
  cursor: help;
  padding-right: 40px;
}

.kpi[data-kpi-help]::after {
  content: "i";
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border: 1px solid rgba(0, 118, 182, 0.34);
  border-radius: 50%;
  color: var(--blue);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

.kpi[data-kpi-help]:hover,
.kpi[data-kpi-help]:focus-visible {
  border-color: rgba(0, 118, 182, 0.42);
}

.kpi[data-kpi-help]:focus-visible {
  outline: 3px solid rgba(0, 118, 182, 0.18);
  outline-offset: 2px;
}

.kpi-help-tooltip {
  position: fixed;
  z-index: 10000;
  width: min(300px, calc(100vw - 24px));
  padding: 10px 12px;
  border-radius: var(--tooltip-radius);
  background: var(--tooltip-bg);
  box-shadow: var(--tooltip-shadow);
  color: var(--tooltip-color);
  font-size: 13px;
  line-height: 1.45;
  opacity: 0;
  pointer-events: none;
  transform: translateY(5px);
  transition: opacity 120ms ease, transform 120ms ease;
}

.kpi-help-tooltip[hidden] {
  display: none;
}

.kpi-help-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

body.modal-open {
  overflow: hidden;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9990;
  display: flex;
  background: rgba(15, 23, 42, 0.46);
}

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

.modal-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding: 16px 18px;
}

.modal-header span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.modal-header h2 {
  margin: 4px 0 0;
  color: var(--ink);
  font-size: 20px;
}

.icon-button {
  display: inline-grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

.icon-button:hover,
.icon-button:focus-visible {
  border-color: rgba(0, 118, 182, 0.42);
  box-shadow: 0 0 0 3px rgba(0, 118, 182, 0.12);
  outline: 0;
}

.kpi span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.kpi strong {
  display: block;
  margin-top: 12px;
  font-size: clamp(19px, 1.55vw, 23px);
  line-height: 1.08;
  min-width: 0;
  letter-spacing: -0.02em;
  text-align: center;
}

.kpi.kpi-cancelled strong,
.kpi.kpi-cancelled small,
#kpiCancelledOrdersValue,
#kpiCancelledOrdersCount,
#repCancelledOrdersValue,
#repCancelledOrdersCount {
  color: #c62828 !important;
}

.kpi.kpi-returned strong,
.kpi.kpi-returned small,
#kpiReturnedOrdersValue,
#kpiReturnedOrdersCount,
#repReturnedOrdersValue,
#repReturnedOrdersCount {
  color: #d97706 !important;
}

.kpi-updates {
  border-color: rgba(0, 118, 182, 0.24);
  background: #ffffff;
}

.kpi-updates strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-width: 0;
  margin: 10px auto 0;
  border-radius: 999px;
  background: #e9f8ec;
  color: #237a3b;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 850;
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
}

.kpi-updates small {
  display: block;
  margin-top: 9px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  line-height: 1.25;
  text-align: center;
}

.updates-title-row {
  display: flex !important;
  min-width: 0;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.updates-title-row > span {
  flex: 0 0 auto;
  color: #182235;
  font-weight: 850;
}

.updates-summary {
  display: block !important;
  min-width: 0;
  overflow: visible;
  max-width: 100%;
  flex: 1 1 auto;
  color: #6b7789;
  font-size: 10px;
  font-style: normal;
  font-weight: 650;
  line-height: 1.25;
  text-overflow: clip;
  white-space: normal;
}

.kpi-updates.kpi-updates-warning strong {
  background: #fff5e6;
  color: #b45309;
}

.kpi-updates.kpi-updates-failed strong {
  background: #fff0f0;
  color: #c62828;
}

@media (max-width: 420px) {
  .updates-title-row {
    align-items: center;
    flex-direction: column;
    gap: 4px;
  }
}

.negative-value {
  color: #c62828 !important;
}

[data-fit-value] {
  max-width: 100%;
  overflow: hidden;
  overflow-wrap: normal !important;
  text-overflow: clip;
  white-space: nowrap;
}

.kpi strong.company-name {
  overflow: hidden;
  font-size: clamp(16px, 1.5vw, 21px);
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kpi.accent {
  border-color: rgba(0, 139, 210, 0.28);
  background: #e7f6fc;
}

.layout-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.85fr);
  gap: 18px;
}

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

.panel {
  min-width: 0;
  overflow: hidden;
}

.panel.collapsed [data-collapsible-body] {
  display: none !important;
}

.orders-summary-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  padding: 14px 16px;
}

.orders-summary-strip div {
  position: relative;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px 12px;
}

.orders-summary-strip [data-kpi-help] {
  cursor: help;
  padding-right: 38px;
}

.orders-summary-strip [data-kpi-help]::after {
  content: "i";
  position: absolute;
  top: 9px;
  right: 10px;
  display: grid;
  width: 17px;
  height: 17px;
  place-items: center;
  border: 1px solid rgba(0, 118, 182, 0.34);
  border-radius: 50%;
  color: var(--blue);
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}

.orders-summary-strip [data-kpi-help]:hover,
.orders-summary-strip [data-kpi-help]:focus-visible {
  border-color: rgba(0, 118, 182, 0.42);
}

.orders-summary-strip [data-kpi-help]:focus-visible {
  outline: 3px solid rgba(0, 118, 182, 0.18);
  outline-offset: 2px;
}

.orders-summary-strip span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.orders-summary-strip strong {
  display: block;
  margin-top: 6px;
  color: var(--ink);
  font-size: clamp(15px, 1.25vw, 18px);
  line-height: 1.15;
  letter-spacing: -0.015em;
}

.open-orders-dashboard-panel {
  margin-top: 0;
}

.compact-orders-table table {
  min-width: 860px;
}

.orders-table th:nth-child(5),
.orders-table td:nth-child(5),
.orders-table th:nth-child(6),
.orders-table td:nth-child(6),
.compact-orders-table th:nth-child(5),
.compact-orders-table td:nth-child(5) {
  text-align: left;
}

.orders-table th:nth-child(4),
.orders-table td:nth-child(4),
.orders-table th:nth-child(7),
.orders-table td:nth-child(7),
.compact-orders-table th:nth-child(4),
.compact-orders-table td:nth-child(4),
.compact-orders-table th:nth-child(6),
.compact-orders-table td:nth-child(6) {
  text-align: right;
}

.order-document-link {
  appearance: none;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--primary, #0076b6);
  font: inherit;
  font-weight: 800;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  cursor: pointer;
}

.order-document-link:hover,
.order-document-link:focus-visible {
  color: #005b8d;
}

.load-order-expanded > td {
  background: #f3f8fc;
  border-bottom-color: transparent;
}

.orders-table .load-order-detail-row > td {
  padding: 0;
  text-align: left;
  background: #f7fafc;
  border-bottom: 1px solid #cbd9e5;
}

.load-order-detail-panel {
  padding: 14px 16px 18px;
  border-left: 3px solid var(--primary, #0076b6);
}

.load-order-detail-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.load-order-detail-heading span,
.load-order-detail-status {
  color: #64748b;
  font-size: 0.82rem;
  font-weight: 700;
}

.load-order-detail-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 54px;
  padding: 12px 16px;
  border-left: 3px solid var(--primary, #0076b6);
  background: #f7fafc;
}

.load-order-detail-status.error {
  color: #b42318;
  border-left-color: #d92d20;
}

.load-items-table-wrap {
  overflow-x: auto;
  border: 1px solid #d8e2eb;
  border-radius: 6px;
  background: #fff;
}

.orders-table .load-items-table {
  width: 100%;
  min-width: 960px;
  table-layout: fixed;
}

.orders-table .load-items-table th,
.orders-table .load-items-table td {
  padding: 9px 10px;
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

.orders-table .load-items-table th:nth-last-child(-n + 4),
.orders-table .load-items-table td:nth-last-child(-n + 4) {
  text-align: right;
}

.orders-table .load-items-table td:nth-child(3),
.orders-table .load-items-table td:nth-child(5) {
  white-space: normal;
}

.orders-table .load-items-table th:nth-child(1),
.orders-table .load-items-table td:nth-child(1) {
  width: 8%;
}

.orders-table .load-items-table th:nth-child(2),
.orders-table .load-items-table td:nth-child(2) {
  width: 9%;
}

.orders-table .load-items-table th:nth-child(3),
.orders-table .load-items-table td:nth-child(3) {
  width: 27%;
}

.orders-table .load-items-table th:nth-child(4),
.orders-table .load-items-table td:nth-child(4) {
  width: 7%;
}

.orders-table .load-items-table th:nth-child(5),
.orders-table .load-items-table td:nth-child(5) {
  width: 17%;
}

.orders-table .load-items-table th:nth-child(n + 6),
.orders-table .load-items-table td:nth-child(n + 6) {
  width: 8%;
}

#ordersTableWrap[data-active-view="load"] > table {
  width: 100%;
  min-width: 1180px;
  table-layout: fixed;
}

#ordersTableWrap[data-active-view="load"] > table > thead > tr > th:nth-child(1),
#ordersTableWrap[data-active-view="load"] > table > tbody > tr:not(.load-order-detail-row) > td:nth-child(1) {
  width: 90px;
}

#ordersTableWrap[data-active-view="load"] > table > thead > tr > th:nth-child(2),
#ordersTableWrap[data-active-view="load"] > table > tbody > tr:not(.load-order-detail-row) > td:nth-child(2) {
  width: 90px;
}

#ordersTableWrap[data-active-view="load"] > table > thead > tr > th:nth-child(3),
#ordersTableWrap[data-active-view="load"] > table > tbody > tr:not(.load-order-detail-row) > td:nth-child(3) {
  width: 105px;
}

#ordersTableWrap[data-active-view="load"] > table > thead > tr > th:nth-child(4),
#ordersTableWrap[data-active-view="load"] > table > tbody > tr:not(.load-order-detail-row) > td:nth-child(4) {
  width: 135px;
}

#ordersTableWrap[data-active-view="load"] > table > thead > tr > th:nth-child(5),
#ordersTableWrap[data-active-view="load"] > table > tbody > tr:not(.load-order-detail-row) > td:nth-child(5) {
  width: 160px;
}

#ordersTableWrap[data-active-view="load"] > table > thead > tr > th:nth-child(6),
#ordersTableWrap[data-active-view="load"] > table > tbody > tr:not(.load-order-detail-row) > td:nth-child(6) {
  width: 270px;
}

#ordersTableWrap[data-active-view="load"] > table > thead > tr > th:nth-child(7),
#ordersTableWrap[data-active-view="load"] > table > tbody > tr:not(.load-order-detail-row) > td:nth-child(7) {
  width: 220px;
}

#ordersTableWrap[data-active-view="load"] > table > thead > tr > th:nth-child(8),
#ordersTableWrap[data-active-view="load"] > table > tbody > tr:not(.load-order-detail-row) > td:nth-child(8) {
  width: 110px;
}

#ordersTableWrap[data-active-view="load"] .order-customer-cell,
#ordersTableWrap[data-active-view="load"] .order-representative-cell,
#ordersTableWrap[data-active-view="load"] .order-load-codes-cell {
  overflow: hidden;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.35;
  vertical-align: top;
}

#ordersTableWrap[data-active-view="load"] .order-load-codes-cell {
  color: #475569;
  font-size: 0.78rem;
}

#ordersTableWrap[data-active-view="load"] .order-customer-cell small {
  display: block;
  margin-top: 3px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.load-items-table small {
  display: block;
  margin-top: 2px;
  color: #64748b;
}

.load-items-table .load-item-pending {
  color: #b54708;
  font-weight: 800;
}

.order-age-ranges {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  border-top: 1px solid var(--line);
  padding: 0 16px 14px;
}

.order-age-range {
  display: grid;
  gap: 6px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: inherit;
  cursor: pointer;
  font: inherit;
  padding: 10px 12px;
  text-align: left;
}

.order-age-range:hover,
.order-age-range:focus,
.order-age-range.active {
  border-color: #7dd3fc;
  box-shadow: inset 3px 0 0 var(--secondary);
  outline: none;
}

.order-age-range.warning {
  background: #fff7ed;
}

.order-age-range.critical {
  background: #fff1f2;
}

.order-age-range.fresh.active {
  background: #edf6fb;
}

.order-age-range.warning.active {
  border-color: #f59e0b;
}

.order-age-range.critical.active {
  border-color: var(--rose);
}

.order-age-range span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.order-age-range strong {
  font-size: 18px;
}

.order-age-range small {
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
}

.order-age-range div {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e8f0;
}

.order-age-range i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
}

.order-age-range.warning i {
  background: var(--amber);
}

.order-age-range.critical i {
  background: var(--rose);
}

tbody tr.order-age-warning {
  background: #fff7ed;
}

tbody tr.order-age-critical {
  background: #fff1f2;
}

.company-order-insights {
  display: grid;
  gap: 14px;
}

.company-order-row {
  display: grid;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.company-order-row:nth-child(even) {
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px 12px 12px;
}

.company-order-row:last-child {
  border-bottom: 0;
}

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

.company-order-head strong,
.company-order-total strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.company-order-head span,
.company-order-metrics span,
.company-order-total span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.company-order-metrics {
  flex-wrap: wrap;
}

.company-order-metrics span:first-child {
  color: var(--ink);
  font-size: 16px;
}

.company-order-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e8f0;
}

.company-order-track div {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--teal));
}

.invoice-revenue-track div {
  background: linear-gradient(90deg, var(--teal), #16a34a);
}

.company-order-total {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px 12px;
}

/* Chart tooltip (moved from inline JS) */
.chart-tooltip {
  position: absolute;
  pointer-events: none;
  z-index: 9999;
  background: var(--tooltip-bg);
  color: var(--tooltip-color);
  padding: var(--tooltip-padding);
  border-radius: var(--tooltip-radius);
  box-shadow: var(--tooltip-shadow);
  font-size: 13px;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(6px);
  transition: transform 120ms ease, opacity 120ms ease;
}
.chart-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  border-bottom: 1px solid var(--line);
  padding: 12px 16px;
}

.panel-title span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.title-stack {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.title-stack h2,
.title-stack span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.text-button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  padding: 6px 10px;
}

.text-button:hover,
.text-button:focus {
  border-color: #7dd3fc;
  background: #edf6fb;
}

.text-button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.orders-load-more {
  display: flex;
  justify-content: center;
  padding: 14px 0 2px;
}

.orders-load-more[hidden] {
  display: none;
}

.primary-action {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.primary-action:hover,
.primary-action:focus {
  background: var(--primary-deep);
  color: #fff;
}

.line-chart,
.bar-chart {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 12px;
  height: 300px;
  padding: 12px 16px 16px;
  overflow: visible;
}

.line-chart svg,
.bar-chart svg {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.legend {
  display: flex;
  align-items: center;
  gap: 18px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.legend-swatch {
  width: 30px;
  height: 8px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(23, 32, 51, 0.08);
}

.legend-swatch.actual {
  background: var(--primary);
}

.legend-swatch.target {
  background: var(--amber);
}

.legend-swatch.revenue {
  background: var(--teal);
}

.legend-swatch.open {
  background: #7c3aed;
}

.dashboard-flow-grid {
  width: 100%;
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.85fr);
}

.dashboard-flow-grid > .chart-panel {
  min-width: 0;
}

.goal-diagnosis-panel {
  align-self: stretch;
}

.goal-diagnosis {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.goal-diagnosis-metrics {
  display: grid;
  gap: 10px;
}

.goal-diagnosis-metrics div {
  display: grid;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.goal-diagnosis-metrics span,
.goal-diagnosis-read span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.goal-diagnosis-metrics strong {
  color: var(--ink);
  font-size: 18px;
}

.goal-diagnosis-read {
  display: grid;
  gap: 6px;
  border-left: 5px solid var(--primary);
  border-radius: 8px;
  background: #f4f9fc;
  padding: 12px;
}

.goal-diagnosis-read.good {
  border-left-color: #15803d;
  background: #f0fdf4;
}

.goal-diagnosis-read.warning {
  border-left-color: #d97706;
  background: #fffaf0;
}

.goal-diagnosis-read.risk {
  border-left-color: #c62828;
  background: #fff5f5;
}

.goal-diagnosis-read strong {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.35;
}

.status-list {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.status-legend {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding: 12px 16px 0;
}

.legend-chip {
  display: grid;
  min-width: 0;
  gap: 2px;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.2;
}

.legend-chip strong {
  color: var(--ink);
  font-size: 12px;
}

.legend-chip.meta-batida {
  background: #dcfce7;
  color: #166534;
}

.legend-chip.proximo {
  background: #fef3c7;
  color: #92400e;
}

.legend-chip.acompanhar {
  background: #e0f2fe;
  color: #075985;
}

.legend-chip.critico {
  background: #fee2e2;
  color: #991b1b;
}

.status-row,
.top-row {
  display: grid;
  gap: 8px;
}

.status-row:nth-child(even),
.top-row:nth-child(even) {
  background: #f8fafc;
}

.status-row {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  padding: 8px;
  text-align: left;
}

.status-row:hover,
.status-row:focus {
  border-color: #7dd3fc;
  background: #f7fbfe;
  outline: none;
}

.status-row.active {
  border-color: rgba(23, 107, 135, 0.42);
  background: #edf6fb;
}

.status-meta,
.top-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  font-weight: 700;
}

.track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e6edf3;
}

.fill {
  height: 100%;
  border-radius: inherit;
  background: var(--secondary);
}

.fill.good {
  background: var(--good);
}

.fill.near {
  background: var(--amber);
}

.fill.watch {
  background: var(--teal);
}

.fill.risk {
  background: var(--rose);
}

.fill.no-target {
  background: #64748b;
}

.top-list {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.top-name {
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.representative-list-panel {
  position: sticky;
  top: 16px;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 32px);
}

.representative-panel-toggle {
  display: none;
}

@media (min-width: 901px) {
  html:not([data-theme="modern"]) .representative-panel-toggle {
    display: grid;
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    place-items: center;
    margin-left: auto;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
    color: var(--primary);
    cursor: pointer;
    padding: 0;
  }

  html:not([data-theme="modern"]) .representative-panel-toggle:hover,
  html:not([data-theme="modern"]) .representative-panel-toggle:focus-visible {
    border-color: rgba(0, 118, 182, 0.45);
    background: #eef8fc;
    outline: none;
  }

  html:not([data-theme="modern"]) .representative-panel-toggle svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
    transition: transform 160ms ease;
  }

  html:not([data-theme="modern"]) body.representative-panel-collapsed .orders-workbench,
  html:not([data-theme="modern"]) body.representative-panel-collapsed .customers-workbench {
    grid-template-columns: 50px minmax(0, 1fr);
  }

  html:not([data-theme="modern"]) body.representative-panel-collapsed .representative-list-panel {
    min-width: 50px;
    overflow: hidden;
  }

  html:not([data-theme="modern"]) body.representative-panel-collapsed .representative-list-panel .panel-title {
    min-height: 50px;
    justify-content: center;
    border-bottom: 0;
    padding: 10px;
  }

  html:not([data-theme="modern"]) body.representative-panel-collapsed .representative-list-panel .panel-title h2,
  html:not([data-theme="modern"]) body.representative-panel-collapsed .representative-list-panel .panel-title > span,
  html:not([data-theme="modern"]) body.representative-panel-collapsed .representative-list-panel .representatives-list {
    display: none;
  }

  html:not([data-theme="modern"]) body.representative-panel-collapsed .representative-panel-toggle {
    margin: 0;
  }

  html:not([data-theme="modern"]) body.representative-panel-collapsed .representative-panel-toggle svg {
    transform: rotate(180deg);
  }
}

.representatives-list {
  display: grid;
  gap: 8px;
  overflow: auto;
  padding: 12px;
}

.rep-list-item {
  display: grid;
  position: relative;
  width: 100%;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  padding: 11px;
  text-align: left;
}

.rep-list-item:nth-child(even) {
  background: #f8fafc;
}

.orders-representative-item {
  min-height: 44px;
  align-content: center;
}

.orders-workbench .open-orders-kpis {
  grid-template-columns: repeat(12, minmax(0, 1fr));
}

.orders-workbench .open-orders-kpis .kpi {
  grid-column: span 4;
}

.orders-workbench .open-orders-kpis .kpi:nth-child(2),
.orders-workbench .open-orders-kpis .kpi:nth-child(3) {
  grid-column: span 6;
}

.representative-tooltip {
  position: fixed;
  z-index: 1000;
  width: min(218px, calc(100vw - 24px));
  border: 1px solid rgba(23, 107, 135, 0.18);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.16);
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.45;
  opacity: 0;
  padding: 9px 10px;
  pointer-events: none;
  transform: translateX(-4px);
  transition: opacity 0.16s ease, transform 0.16s ease;
  white-space: pre-line;
}

.representative-tooltip[hidden] {
  display: none;
}

.representative-tooltip.visible {
  opacity: 1;
  transform: translateX(0);
}

.rep-list-item:hover,
.rep-list-item:focus {
  border-color: #7dd3fc;
  background: #f7fbfe;
  outline: none;
}

.rep-list-item.active {
  border-color: rgba(23, 107, 135, 0.5);
  background: #edf6fb;
  box-shadow: inset 3px 0 0 var(--secondary);
}

.rep-list-name {
  overflow: hidden;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rep-list-company {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rep-list-metrics {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.rep-list-metrics strong {
  color: var(--secondary);
  font-size: 15px;
}

.orders-workbench .representatives-list .rep-list-metrics,
.customers-workbench .representatives-list .rep-list-metrics {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-content: stretch;
  gap: 4px;
  text-align: left;
}

.orders-workbench .representatives-list .rep-list-metrics > *,
.customers-workbench .representatives-list .rep-list-metrics > * {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.customers-workbench .customer-representative-values {
  text-align: left;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  padding: 18px;
  text-align: center;
}

.detail-chart {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.month-row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 74px;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 700;
}

.month-row > span:first-child {
  min-width: 0;
  white-space: nowrap;
}

.month-row:nth-child(even) {
  border-radius: 6px;
  background: #f8fafc;
  padding: 6px 8px;
}

.month-bars {
  display: grid;
  gap: 4px;
}

.bar {
  height: 8px;
  border-radius: 999px;
}

.bar.actual {
  background: var(--secondary);
}

.bar.target {
  background: #cbd5e1;
}

.breakdown {
  display: grid;
  gap: 1px;
  margin-top: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--line);
}

.breakdown-head,
.breakdown-row {
  display: grid;
  grid-template-columns: minmax(96px, 1.2fr) repeat(3, minmax(72px, 1fr));
  gap: 1px;
  background: #fff;
  font-size: 12px;
}

.breakdown-row:nth-child(even) {
  background: #f8fafc;
}

.representative-breakdown .breakdown-head,
.representative-breakdown .breakdown-row {
  grid-template-columns: minmax(148px, 1.45fr) repeat(3, minmax(68px, 1fr));
}

.monthly-values {
  margin-top: 8px;
}

.company-sections {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.company-detail {
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.company-detail-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.company-detail-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.company-detail-title h3 {
  margin: 0;
  font-size: 13px;
  line-height: 1.2;
}

.company-detail-title span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.company-month-row {
  grid-template-columns: 58px minmax(0, 1fr) 70px;
}

.company-detail.sales-collapsed .monthly-values,
.company-detail.sales-collapsed .company-month-row {
  display: none !important;
}

.breakdown-head {
  background: #f8fafc;
  color: var(--muted);
  font-weight: 800;
}

.breakdown-head span,
.breakdown-row span {
  padding: 8px;
  text-align: right;
}

.breakdown-head span:first-child,
.breakdown-row span:first-child {
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-panel {
  margin-top: 2px;
}

.table-wrap {
  overflow: auto;
  max-height: 520px;
}

.table-panel.collapsed .table-wrap {
  display: none;
}

.admin-shell {
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
}

.admin-form {
  display: grid;
  gap: 16px;
  padding: 16px;
}

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

.admin-field {
  min-width: 0;
  color: var(--ink);
}

.admin-field span {
  color: var(--muted);
}

.admin-field input {
  border-color: var(--line);
}

.button-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-grid {
  grid-template-columns: minmax(0, 1.35fr) minmax(340px, 0.65fr);
}

.report-filters {
  grid-template-columns: minmax(190px, 0.48fr) minmax(140px, 0.25fr) minmax(180px, 0.42fr) minmax(220px, 0.55fr) auto auto auto;
}

.report-grid {
  grid-template-columns: minmax(0, 1.25fr) minmax(360px, 0.55fr);
}

.report-grid.email-config-collapsed {
  grid-template-columns: minmax(0, 1fr);
}

.report-search-field {
  min-width: 240px;
}

#reportPeriod {
  font-size: 16px;
  line-height: 1.18;
  overflow-wrap: anywhere;
  white-space: normal;
}

.report-preview-table table {
  min-width: 1180px;
}

.report-batch-table table {
  min-width: 640px;
}

.report-email-table table {
  min-width: 720px;
}

.report-preview-table th:first-child,
.report-preview-table td:first-child {
  width: 46px;
  text-align: center;
}

.report-preview-table input[type="checkbox"],
#selectAllReports {
  width: 16px;
  min-height: 16px;
  padding: 0;
}

.report-preview-table th:nth-child(2),
.report-preview-table td:nth-child(2),
.report-preview-table th:nth-child(3),
.report-preview-table td:nth-child(3),
.report-preview-table th:nth-child(4),
.report-preview-table td:nth-child(4) {
  text-align: left;
}

.report-preview-table th:nth-child(5),
.report-preview-table td:nth-child(5),
.report-preview-table th:nth-child(6),
.report-preview-table td:nth-child(6),
.report-preview-table th:nth-child(7),
.report-preview-table td:nth-child(7) {
  text-align: right;
}

.report-preview-table th:nth-child(8),
.report-preview-table td:nth-child(8),
.report-preview-table th:nth-child(9),
.report-preview-table td:nth-child(9) {
  text-align: center;
}

.email-config-form {
  gap: 12px;
}

.users-kpis {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.interactive-kpi {
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.interactive-kpi:hover,
.interactive-kpi:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.14);
  outline: none;
}

.users-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 180px 210px;
  align-items: end;
  gap: 12px;
  padding: 16px;
}

.users-filter-toolbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--surface);
}

.users-toolbar .field {
  min-width: 0;
  color: var(--muted);
}

.users-toolbar input,
.users-toolbar select {
  border-color: var(--line);
}

.password-notice {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  margin: 0 16px 16px;
  border: 1px solid #7dd3fc;
  border-radius: 8px;
  background: #e7f6fc;
  padding: 12px;
}

.password-notice[hidden] {
  display: none;
}

.password-notice div {
  display: grid;
  gap: 4px;
}

.password-notice span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.password-notice code {
  border-radius: 6px;
  background: #fff;
  color: var(--primary-deep);
  font-size: 14px;
  font-weight: 900;
  padding: 8px 10px;
}

.users-table td:first-child strong,
.users-table td:first-child small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.users-table td:first-child small,
.muted-note {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.users-access-table {
  min-width: 960px;
  table-layout: fixed;
}

.users-column-identity {
  width: 27%;
}

.users-column-profile {
  width: 19%;
}

.users-column-status {
  width: 22%;
}

.users-column-permissions {
  width: 18%;
}

.users-column-actions {
  width: 14%;
}

.users-access-table th,
.users-access-table td {
  text-align: left;
  vertical-align: middle;
}

.users-access-table tbody tr {
  cursor: default;
}

.users-access-table td:first-child {
  max-width: none;
}

.users-access-table td:first-child strong {
  color: var(--ink);
  line-height: 1.35;
  white-space: normal;
}

.user-login,
.user-binding,
.last-seen,
.permission-summary small {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.35;
  text-overflow: ellipsis;
}

.user-login {
  margin-top: 4px;
  overflow-wrap: anywhere;
  white-space: normal;
}

.role-badge {
  display: inline-flex;
  max-width: 100%;
  border-radius: 999px;
  background: #e8eef5;
  color: #334155;
  font-size: 11px;
  font-weight: 900;
  padding: 4px 9px;
}

.role-badge.admin {
  background: #dbeafe;
  color: #1d4ed8;
}

.role-badge.manager,
.role-badge.supervisor {
  background: #ede9fe;
  color: #6d28d9;
}

.user-binding {
  margin-top: 5px;
  white-space: nowrap;
}

.user-status-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.users-access-table .access-badge,
.users-access-table .presence-badge {
  min-width: 0;
  padding: 4px 9px;
  font-size: 11px;
}

.users-access-table .last-seen {
  margin-top: 5px;
  white-space: nowrap;
}

.permission-summary {
  display: grid;
  width: 100%;
  min-width: 0;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--primary-deep);
  cursor: pointer;
  font: inherit;
  padding: 7px 9px;
  text-align: left;
}

.permission-summary:hover,
.permission-summary:focus-visible {
  border-color: #38bdf8;
  background: #f0f9ff;
  outline: none;
}

.permission-summary > span {
  font-size: 12px;
  font-weight: 900;
}

.permission-summary small {
  white-space: nowrap;
}

.warning-note {
  color: #92400e;
}

.user-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
}

.permission-checklist {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 8px;
  padding: 10px 0;
}

.permission-option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  padding: 10px 12px;
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.permission-option:hover {
  border-color: #7dd3fc;
  background: #f8fcff;
}

.permission-option:has(input:checked) {
  border-color: #38bdf8;
  background: #eef9ff;
  box-shadow: inset 3px 0 0 var(--primary);
}

.permission-option input[type="checkbox"] {
  flex: 0 0 auto;
  width: 18px;
  min-height: 18px;
  height: 18px;
  margin: 0;
  padding: 0;
  accent-color: var(--primary);
}

.permission-option span {
  min-width: 0;
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
}

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

#createManagerForm > .primary-action {
  justify-self: end;
}

#permissionsNotice {
  display: block;
  padding: 18px;
}

#permissionsNotice[hidden] {
  display: none;
}

#permissionsNotice > .permissions-editor {
  display: grid;
  width: min(780px, 100%);
  gap: 14px;
  margin: 0 auto;
}

#permissionsNotice .permissions-editor-header,
#permissionsNotice .permissions-quick-actions,
#permissionsNotice .permissions-editor-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

#permissionsNotice .permissions-editor-header > div {
  display: grid;
  gap: 3px;
}

#permissionsNotice .permissions-editor-header strong {
  color: var(--ink);
  font-size: 16px;
}

#permissionsNotice .permissions-quick-actions {
  border-top: 1px solid rgba(14, 116, 144, 0.16);
  padding-top: 12px;
}

#permissionsNotice .permissions-quick-actions > div {
  display: flex;
  gap: 12px;
}

#permissionsNotice .permissions-editor-footer {
  justify-content: flex-end;
  border-top: 1px solid rgba(14, 116, 144, 0.16);
  padding-top: 14px;
}

#permissionsNotice .permissions-editor-footer .text-button {
  width: auto;
  min-width: 130px;
}

.permissions-close {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: rgba(14, 116, 144, 0.08);
  color: var(--ink);
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

@media (max-width: 900px) {
  .permission-checklist {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }
}

@media (max-width: 600px) {
  .permission-checklist {
    grid-template-columns: 1fr;
  }

  #permissionsNotice .permissions-quick-actions,
  #permissionsNotice .permissions-editor-footer {
    align-items: stretch;
    flex-direction: column;
  }

  #permissionsNotice .permissions-quick-actions > div,
  #permissionsNotice .permissions-editor-footer .text-button {
    width: 100%;
  }
}

@media (max-width: 760px) {
  .table-wrap.users-table {
    max-height: none;
    overflow: visible;
    padding: 10px;
  }

  .table-wrap .users-access-table {
    display: block;
    min-width: 0;
  }

  .users-access-table colgroup,
  .users-access-table thead {
    display: none;
  }

  .users-access-table tbody {
    display: grid;
    gap: 10px;
  }

  .users-access-table tbody tr {
    display: grid;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
  }

  .users-access-table tbody td {
    display: grid;
    grid-template-columns: minmax(92px, 0.38fr) minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--line);
    padding: 10px 12px;
    white-space: normal;
  }

  .users-access-table tbody td:last-child {
    border-bottom: 0;
  }

  .users-access-table tbody td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .users-access-table .empty-cell {
    display: block;
    text-align: center;
  }

  .users-access-table .empty-cell::before {
    content: none;
  }
}

.action-button {
  border: 0;
  background: transparent;
  cursor: pointer;
  font: inherit;
  padding: 0;
}

.danger-action {
  color: #b91c1c;
}

.danger-action:hover,
.danger-action:focus-visible {
  color: #7f1d1d;
}

.access-badge {
  display: inline-flex;
  justify-content: center;
  min-width: 118px;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 900;
}

.access-badge.enabled {
  background: #dcfce7;
  color: #166534;
}

.access-badge.blocked {
  background: #fee2e2;
  color: #991b1b;
}

.access-badge.inactive {
  background: #e2e8f0;
  color: #334155;
}

.presence-badge,
.event-badge {
  display: inline-flex;
  justify-content: center;
  min-width: 78px;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 900;
}

.presence-badge.online,
.event-badge.login {
  background: #dcfce7;
  color: #166534;
}

.presence-badge.offline,
.event-badge.logout {
  background: #e2e8f0;
  color: #334155;
}

.event-badge.failed {
  min-width: 132px;
  background: #fee2e2;
  color: #991b1b;
}

.last-seen,
.audit-table td:nth-child(2) small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.audit-panel {
  margin-top: 18px;
}

.audit-toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 190px 160px 160px auto;
  align-items: end;
  gap: 12px;
  padding: 16px;
}

.audit-table {
  max-height: 520px;
}

.audit-table table {
  min-width: 980px;
}

.audit-table td:nth-child(1),
.audit-table td:nth-child(5),
.audit-table td:nth-child(7) {
  white-space: nowrap;
}

.audit-table td:nth-child(6) {
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-cell {
  padding: 22px;
  text-align: center;
  color: var(--muted);
  font-weight: 800;
}

.compact-table {
  max-height: 420px;
}

.compact-table table {
  min-width: 100%;
  table-layout: fixed;
}

.compact-table th:nth-child(1),
.compact-table td:nth-child(1) {
  width: 92px;
}

.compact-table th:nth-child(2),
.compact-table td:nth-child(2) {
  width: 58px;
}

.compact-table th:nth-child(3),
.compact-table td:nth-child(3) {
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
}

.compact-table th:nth-child(4),
.compact-table td:nth-child(4) {
  width: 186px;
}

.compact-table th:nth-child(5),
.compact-table td:nth-child(5) {
  width: 126px;
}

.import-history-table table {
  min-width: 1040px;
}

.import-history-table th:nth-child(1),
.import-history-table td:nth-child(1) {
  width: 70px;
}

.import-history-table th:nth-child(4),
.import-history-table td:nth-child(4) {
  width: 136px;
}

.import-history-table th:nth-child(7),
.import-history-table td:nth-child(7) {
  overflow: hidden;
  max-width: 420px;
  text-align: left;
  text-overflow: ellipsis;
}

.import-summary {
  padding: 16px;
}

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

.summary-list div {
  display: grid;
  gap: 4px;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 10px;
}

.summary-list div:nth-child(even) {
  border-radius: 6px;
  background: #f8fafc;
  padding: 8px 10px 10px;
}

.summary-list span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.summary-list strong {
  font-size: 13px;
}

.source-paths-list {
  margin-top: 10px;
}

.source-paths-list strong {
  overflow-wrap: anywhere;
  font-size: 12px;
}

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

.automation-log-list div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.automation-log-list div:nth-child(even) {
  padding: 10px;
}

.automation-log-list .muted-note + .muted-note {
  display: none;
}

.automation-log-list pre {
  overflow: auto;
  max-height: 74px;
  margin: 6px 0 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 11px;
  line-height: 1.45;
  padding: 8px;
  white-space: pre-wrap;
}

.file-name,
.file-name + .muted-note {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
}

.file-name + .muted-note {
  margin-top: 3px;
  white-space: normal;
}

.interactive-summary {
  gap: 0;
}

.summary-action {
  display: grid;
  width: 100%;
  gap: 4px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  padding: 10px 0;
  text-align: left;
}

.summary-action:nth-child(even) {
  background: #f8fafc;
}

.summary-action:last-child {
  border-bottom: 0;
}

.summary-action:hover,
.summary-action:focus,
.summary-action.active {
  background: #edf6fb;
  outline: none;
}

.summary-action span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.summary-action strong {
  color: var(--ink);
  font-size: 13px;
}

.summary-action small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.invoice-revenue-ranking .summary-action.active {
  box-shadow: inset 3px 0 0 var(--teal);
  padding-left: 10px;
}

.table-link {
  color: var(--secondary);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.table-link:hover,
.table-link:focus {
  text-decoration: underline;
}

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

table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  border-bottom: 1px solid #e2e8f0;
  padding: 10px 12px;
  text-align: right;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
  color: #475569;
  font-size: 12px;
  text-transform: uppercase;
}

td:first-child,
th:first-child {
  max-width: 420px;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
}

td:nth-child(2),
th:nth-child(2),
td:nth-child(7),
th:nth-child(7),
td:nth-child(8),
th:nth-child(8) {
  text-align: left;
}

tbody tr {
  cursor: pointer;
}

tbody tr:nth-child(even) {
  background: #f8fafc;
}

tbody tr:hover {
  background: #edf6fb;
}

th.sortable {
  cursor: pointer;
  user-select: none;
}

th.sortable::after {
  content: " ↕";
  color: #94a3b8;
  font-weight: 900;
}

th.sortable.sorted::after {
  content: " ↓";
  color: var(--primary);
}

th.sortable.sorted[data-direction="asc"]::after {
  content: " ↑";
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-width: 96px;
  justify-content: center;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 800;
}

.status-pill.meta-batida {
  background: #dcfce7;
  color: #166534;
}

.status-pill.proximo {
  background: #fef3c7;
  color: #92400e;
}

.status-pill.acompanhar {
  background: #e0f2fe;
  color: #075985;
}

.status-pill.critico {
  background: #fee2e2;
  color: #991b1b;
}

.status-pill.sem-meta {
  background: #e2e8f0;
  color: #334155;
}

@media (max-width: 1180px) {
  .app-header {
    align-items: stretch;
    flex-direction: column;
  }

  .brand-title {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .brand-logo {
    max-width: 240px;
    width: 62vw;
  }

  .header-actions,
  .admin-filters,
  .active-filter-strip,
  .admin-workbench,
  .layout-grid,
  .bottom-grid,
  .source-fields,
  .users-toolbar,
  .audit-toolbar,
  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .header-actions {
    display: grid;
    width: 100%;
    justify-content: stretch;
  }

  .open-orders-kpis .kpi,
  .open-orders-kpis .kpi:nth-child(2),
  .open-orders-kpis .kpi:nth-child(3),
  .open-orders-kpis[data-active-view="sales"] #ordersCountKpi,
  .open-orders-kpis[data-active-view="sales"] #ordersValueKpi,
  .open-orders-kpis[data-active-view="sales"] #ordersNetSalesKpi,
  .open-orders-kpis[data-active-view="sales"] #ordersAuxKpi,
  .open-orders-kpis[data-active-view="sales"] #ordersRepresentativesKpi,
  .open-orders-kpis[data-active-view="sales"] #ordersUpdatedKpi {
    grid-column: 1;
  }

  .order-view-switch {
    width: 100%;
  }

  .active-filter-strip,
  .active-filter-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .header-actions {
    display: grid;
  }

  .admin-workbench .kpi-grid {
    grid-template-columns: 1fr;
  }

  .admin-filters.orders-filters,
  .admin-filters.customers-filters,
  .admin-workbench.orders-workbench,
  .admin-workbench.customers-workbench {
    grid-template-columns: 1fr;
  }

  .representative-list-panel {
    position: static;
    max-height: none;
  }

  .representatives-list {
    max-height: 420px;
  }

  .password-notice {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .login-body {
    background-position: center;
    background-size: cover;
  }

  .login-shell {
    justify-items: center;
  }

  .login-panel {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.38), rgba(255, 255, 255, 0.24));
  }
}

@media (max-width: 760px) {
  .customer-risk-trend {
    grid-template-columns: 1fr;
    margin: 0 14px 14px;
  }

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

  .customer-comparison-chart {
    grid-template-columns: repeat(12, minmax(52px, 1fr));
    min-height: 360px;
    padding: 40px 14px 18px;
  }

  .customer-comparison-chart.single-point {
    grid-template-columns: minmax(112px, 148px);
    justify-content: center;
  }

  .customer-comparison-chart.few-points {
    grid-template-columns: repeat(auto-fit, minmax(96px, 132px));
    justify-content: center;
  }

  .customer-comparison-chart .comparison-bar span {
    max-width: min(190px, calc(100vw - 56px));
    white-space: normal;
  }

  .customer-comparison-chart.single-point .comparison-bar span {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
  }

  body {
    overflow-x: hidden;
  }

  .update-notice-backdrop {
    align-items: start;
    padding: 10px;
  }

  .update-notice-dialog {
    max-height: calc(100vh - 20px);
    padding: 18px;
  }

  .update-notice-header h2 {
    font-size: 19px;
  }

  .update-notice-actions {
    position: sticky;
    bottom: -18px;
    justify-content: stretch;
    margin: 16px -18px -18px;
    border-top: 1px solid var(--line);
    background: #fff;
    padding: 12px 18px 18px;
  }

  .update-notice-confirm {
    width: 100%;
  }

  .app-header {
    gap: 14px;
    padding: 14px 14px 16px;
  }

  .brand-title {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
  }

  .brand-logo {
    width: 96px;
    max-width: 96px;
    padding: 5px 6px;
  }

  .eyebrow {
    font-size: 11px;
  }

  h1 {
    font-size: 22px;
  }

  h2 {
    font-size: 14px;
  }

  .session-user {
    max-width: none;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    padding: 8px 10px;
    text-align: center;
  }

  .header-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .header-link {
    min-height: 42px;
    padding: 9px 10px;
  }

  .shell {
    gap: 14px;
    padding: 14px 10px 24px;
  }

  .admin-filters {
    position: static;
    top: auto;
    z-index: auto;
    gap: 10px;
    border-radius: 8px;
    padding: 12px;
  }

  .users-filter-toolbar {
    position: static;
    top: auto;
    z-index: auto;
  }

  .field,
  .field.compact,
  .field.period-field {
    min-width: 0;
  }

  input,
  select {
    min-height: 44px;
    font-size: 14px;
  }

  .active-filter-strip {
    padding: 10px;
  }

  .active-filter-items {
    grid-template-columns: 1fr;
  }

  .active-filter-card strong {
    white-space: normal;
  }

  .kpi-grid,
  .representative-kpis,
  .open-orders-kpis {
    gap: 10px;
  }

  .kpi {
    min-height: 82px;
    padding: 12px 14px;
  }

  .kpi span {
    font-size: 11px;
    text-transform: uppercase;
  }

  .kpi strong,
  .representative-kpis .kpi strong,
  .open-orders-kpis .kpi strong,
  .open-orders-kpis .kpi:nth-child(2) strong,
  .open-orders-kpis .kpi:nth-child(3) strong {
    margin-top: 8px;
    font-size: clamp(20px, 7vw, 28px);
    line-height: 1.08;
    overflow-wrap: anywhere;
  }

  .representative-kpis .kpi,
  .representative-kpis .kpi-wide {
    grid-column: 1;
  }

  .representative-grid > .representative-summary-panel,
  .representative-grid > .representative-goal-flow-panel,
  .representative-grid > .representative-goal-diagnosis-panel {
    grid-column: 1;
    grid-row: auto;
  }

  .panel {
    border-radius: 8px;
  }

  .panel-title {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 10px;
    padding: 14px;
  }

  .panel-title .panel-actions {
    width: 100%;
    justify-content: space-between;
  }

  .title-stack {
    gap: 4px;
  }

  .title-stack span,
  .panel-title > span {
    font-size: 12px;
    line-height: 1.35;
  }

  .orders-summary-strip {
    grid-template-columns: 1fr 1fr;
    padding: 12px;
  }

  .orders-summary-strip div {
    padding: 10px;
  }

  .orders-summary-strip strong {
    font-size: 16px;
    line-height: 1.15;
  }

  .order-age-ranges {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 0 12px 12px;
  }

  .order-age-range {
    padding: 10px;
  }

  .order-age-range small {
    font-size: 11px;
  }

  .import-summary {
    padding: 12px;
  }

  .company-order-row:nth-child(even),
  .summary-list div:nth-child(even) {
    padding: 9px 10px;
  }

  .company-order-head,
  .company-order-metrics {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .summary-action {
    padding: 11px 10px;
  }

  .summary-action span,
  .summary-list span {
    font-size: 11px;
  }

  .summary-action strong,
  .summary-list strong {
    font-size: 12px;
    line-height: 1.3;
  }

  .line-chart,
  .bar-chart {
    height: 280px;
    padding: 8px 8px 14px;
  }

  .legend {
    flex-wrap: wrap;
    gap: 8px 12px;
    padding: 0 4px;
    font-size: 12px;
  }

  .legend-swatch {
    width: 22px;
    height: 7px;
  }

  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .table-wrap table,
  .orders-table table,
  .compact-orders-table table {
    min-width: 760px;
  }

  .customers-workbench {
    gap: 14px;
  }

  .customers-workbench .representative-list-panel {
    min-width: 0;
    overflow: hidden;
  }

  .customers-workbench .representatives-list {
    display: grid;
    grid-auto-columns: minmax(250px, 82vw);
    grid-auto-flow: column;
    grid-template-columns: none;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 10px 12px 12px;
    scroll-snap-type: x proximity;
  }

  .customers-workbench .rep-list-item {
    min-height: 108px;
    scroll-snap-align: start;
  }

  .customers-workbench .analysis-stack {
    gap: 14px;
    width: 100%;
  }

  .admin-workbench .customer-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .customer-kpis .kpi:nth-child(n + 4) {
    grid-column: 1 / -1;
  }

  .customer-revenue-kpi strong {
    font-size: clamp(20px, 7vw, 28px);
  }

  .customers-table {
    max-width: 100%;
    overscroll-behavior-inline: contain;
  }

  .customers-table table {
    min-width: 980px;
  }

  .customer-top-list {
    grid-template-columns: 1fr;
  }

  th,
  td {
    padding: 9px 10px;
    font-size: 12px;
  }

  .search-suggestions {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    bottom: auto;
    left: 0;
    z-index: 50;
    max-height: min(320px, 44vh);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .search-suggestions button {
    padding: 12px;
  }

  .search-clear,
  .customer-search-clear {
    min-width: 78px;
    font-size: 13px;
  }

  .login-shell {
    align-items: center;
    padding: 18px;
  }

  .login-panel {
    padding: 20px;
  }
}

@media (max-width: 420px) {
  .brand-title {
    grid-template-columns: 82px minmax(0, 1fr);
  }

  .brand-logo {
    width: 82px;
    max-width: 82px;
  }

  h1 {
    font-size: 20px;
  }

  .header-actions {
    grid-template-columns: 1fr;
  }

  .orders-summary-strip,
  .order-age-ranges {
    grid-template-columns: 1fr;
  }

  .admin-workbench .customer-kpis {
    grid-template-columns: 1fr;
  }

  .customer-kpis .kpi {
    grid-column: 1;
  }
}

/* Optional modern layout. The classic theme remains the default. */
.theme-switcher {
  display: grid;
  gap: 4px;
  min-width: 118px;
  color: #dbeafe;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.theme-switcher select {
  min-height: 38px;
  border-color: rgba(255, 255, 255, 0.24);
  background-color: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  padding: 7px 28px 7px 10px;
}

.theme-switcher select option {
  background: #ffffff;
  color: var(--ink);
}

html[data-theme="modern"] {
  --ink: #14213a;
  --muted: #66758f;
  --line: #e2e8f1;
  --surface: #ffffff;
  --canvas: #f5f7fb;
  --primary: #087db9;
  --primary-deep: #075985;
  --secondary: #0d92cf;
  --teal: #0ea5a8;
  --amber: #f36b2a;
  --shadow: 0 8px 24px rgba(22, 42, 77, 0.06);
}

html[data-theme="modern"] body {
  min-height: 100vh;
  padding-left: 252px;
  background:
    radial-gradient(circle at 100% 0, rgba(8, 125, 185, 0.06), transparent 28%),
    var(--canvas);
}

html[data-theme="modern"] .app-header {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 100;
  width: 252px;
  height: 100vh;
  align-items: stretch;
  justify-content: flex-start;
  flex-direction: column;
  gap: 22px;
  overflow-y: auto;
  border: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  background: #10233f;
  box-shadow: 10px 0 30px rgba(15, 35, 63, 0.08);
  padding: 22px 16px;
}

html[data-theme="modern"] .brand-title {
  flex: 0 0 auto;
  align-items: flex-start;
  flex-direction: column;
  gap: 14px;
}

html[data-theme="modern"] .brand-logo {
  width: 184px;
  max-width: 100%;
  border-radius: 10px;
  box-shadow: none;
  padding: 7px 10px;
}

html[data-theme="modern"] .brand-title h1 {
  max-width: none;
  font-size: 19px;
  line-height: 1.25;
}

html[data-theme="modern"] .eyebrow {
  color: #8ed8f7;
  font-size: 10px;
  letter-spacing: 0.08em;
}

html[data-theme="modern"] .header-actions {
  display: flex;
  flex: 1 1 auto;
  align-items: stretch;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

html[data-theme="modern"] .session-user {
  order: -2;
  max-width: none;
  margin-bottom: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: #dbeafe;
  padding: 10px 12px;
  text-align: left;
}

html[data-theme="modern"] .header-link {
  min-height: 40px;
  justify-content: flex-start;
  border-color: transparent;
  border-radius: 9px;
  color: #cbd8e8;
  font-size: 13px;
  font-weight: 700;
  padding: 9px 12px;
}

html[data-theme="modern"] .header-link:hover,
html[data-theme="modern"] .header-link:focus {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.07);
  color: #ffffff;
}

html[data-theme="modern"] .header-link.current {
  border-color: rgba(66, 192, 239, 0.18);
  background: linear-gradient(
    90deg,
    rgba(8, 125, 185, 0.34),
    rgba(8, 125, 185, 0.12)
  );
  box-shadow: inset 3px 0 0 #42c0ef;
  color: #ffffff;
}

html[data-theme="modern"] .theme-switcher {
  order: 20;
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 14px;
}

html[data-theme="modern"] .theme-switcher select {
  border-color: rgba(255, 255, 255, 0.12);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

html[data-theme="modern"] .theme-switcher option {
  background: #ffffff;
  color: var(--ink);
}

html[data-theme="modern"] .shell {
  width: 100%;
  max-width: 1680px;
  margin: 0 auto;
  gap: 18px;
  padding: 26px 28px 40px;
}

html[data-theme="modern"] .admin-filters {
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 16px;
}

html[data-theme="modern"] input,
html[data-theme="modern"] select {
  min-height: 42px;
  border-color: var(--line);
  border-radius: 9px;
}

html[data-theme="modern"] input:focus,
html[data-theme="modern"] select:focus {
  border-color: rgba(8, 125, 185, 0.65);
  box-shadow: 0 0 0 3px rgba(8, 125, 185, 0.12);
}

html[data-theme="modern"] .kpi,
html[data-theme="modern"] .panel {
  border-color: rgba(226, 232, 241, 0.92);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

html[data-theme="modern"] .kpi {
  min-height: 104px;
  overflow: hidden;
  padding: 17px 18px;
}

html[data-theme="modern"] .kpi::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: rgba(8, 125, 185, 0.28);
}

html[data-theme="modern"] .kpi.accent {
  border-color: rgba(8, 125, 185, 0.18);
  background: linear-gradient(145deg, #eff9fd, #ffffff);
}

html[data-theme="modern"] .kpi.accent::before {
  width: 4px;
  background: var(--primary);
}

html[data-theme="modern"] .kpi strong {
  margin-top: 14px;
  font-size: clamp(20px, 1.5vw, 27px);
}

html[data-theme="modern"] .panel-title {
  min-height: 54px;
  border-bottom-color: #edf1f6;
  padding: 14px 18px;
}

html[data-theme="modern"] .panel-title h2 {
  color: #1d2c48;
  font-size: 14px;
  letter-spacing: 0.01em;
}

html[data-theme="modern"] .text-button,
html[data-theme="modern"] .table-link {
  border-radius: 8px;
}

html[data-theme="modern"] .rep-list-item,
html[data-theme="modern"] .orders-summary-strip div,
html[data-theme="modern"] .order-age-range,
html[data-theme="modern"] .company-order-total {
  border-radius: 10px;
  box-shadow: none;
}

html[data-theme="modern"] .rep-list-item:hover,
html[data-theme="modern"] .rep-list-item:focus,
html[data-theme="modern"] .rep-list-item.active {
  border-color: rgba(8, 125, 185, 0.36);
  background: #f3f9fc;
}

html[data-theme="modern"] .representative-list-panel {
  top: 26px;
  max-height: calc(100vh - 52px);
}

html[data-theme="modern"] th {
  background: #f6f8fb;
  color: #52617a;
  font-size: 11px;
  letter-spacing: 0.04em;
}

html[data-theme="modern"] th,
html[data-theme="modern"] td {
  border-bottom-color: #edf1f6;
  padding: 11px 13px;
}

html[data-theme="modern"] tbody tr:nth-child(even) {
  background: #fafbfd;
}

html[data-theme="modern"] tbody tr:hover {
  background: #f0f8fc;
}

.radar-workspace {
  gap: 18px;
}

.radar-kpis {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.radar-title-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.radar-title-line h1 {
  margin: 0;
}

.radar-guide-button {
  min-height: 34px;
  white-space: nowrap;
  padding: 7px 12px;
}

.radar-guide-modal {
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.radar-guide-card {
  width: min(960px, calc(100vw - 40px));
  max-height: min(760px, calc(100vh - 40px));
  overflow: hidden;
}

.radar-guide-content {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  max-height: calc(100vh - 170px);
  overflow-y: auto;
  padding: 18px;
}

.radar-guide-content article {
  padding: 12px;
  border: 1px solid #d8e2ec;
  border-radius: 8px;
  background: #f8fbfe;
}

.radar-guide-content h3 {
  margin: 0;
  color: #172033;
  font-size: 14px;
}

.radar-guide-content p,
.radar-guide-content ul {
  margin: 6px 0 0;
  color: #52617a;
  font-size: 13px;
  line-height: 1.45;
}

.radar-guide-content ul {
  padding-left: 18px;
}

.radar-guide-content li + li {
  margin-top: 4px;
}

.radar-matrix {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
}

.radar-matrix-card {
  position: relative;
  min-height: 128px;
  border: 1px solid #d8e2ec;
  border-radius: 8px;
  background: #fff;
  color: #172033;
  cursor: pointer;
  padding: 12px;
  text-align: left;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.radar-matrix-card:hover,
.radar-matrix-card:focus-visible,
.radar-matrix-card.active {
  border-color: #0b7fab;
  box-shadow: 0 12px 26px rgba(0, 118, 182, 0.12);
  transform: translateY(-1px);
}

.radar-matrix-card:focus-visible {
  outline: 3px solid rgba(0, 118, 182, 0.18);
  outline-offset: 2px;
}

.radar-matrix-card strong {
  display: block;
  font-size: 15px;
}

.radar-matrix-card small {
  display: block;
  margin-top: 3px;
  color: #64748b;
  font-size: 12px;
}

.radar-matrix-card .matrix-count {
  display: block;
  margin-top: 12px;
  color: #0f172a;
  font-size: 24px;
  font-weight: 800;
}

.radar-matrix-card .matrix-metrics {
  display: grid;
  gap: 3px;
  margin-top: 8px;
  color: #475569;
  font-size: 12px;
}

.radar-matrix-card.recover_now {
  background: #fff5f5;
}

.radar-matrix-card.protect {
  background: #fffaf0;
}

.radar-matrix-card.reactivate {
  background: #f0f9ff;
}

.radar-matrix-card.monitor {
  background: #f8fbfe;
}

.radar-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

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

.radar-panel .panel-title h2 {
  margin: 4px 0 0;
  font-size: 18px;
}

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

.radar-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(220px, 0.9fr);
  gap: 14px;
  align-items: center;
  padding: 12px;
  border: 1px solid #d8e2ec;
  border-radius: 8px;
  background: #fff;
}

.radar-row[data-radar-help] {
  cursor: help;
}

.radar-row[data-radar-help]:hover,
.radar-row[data-radar-help]:focus-visible {
  border-color: #9bcfe8;
  box-shadow: 0 10px 24px rgba(0, 118, 182, 0.11);
}

.radar-row[data-radar-help]:focus-visible {
  outline: 3px solid rgba(0, 118, 182, 0.18);
  outline-offset: 2px;
}

.radar-row-tooltip {
  white-space: pre-line;
  max-width: min(360px, calc(100vw - 24px));
}

.radar-touch-tooltip {
  width: auto;
  max-width: none;
  max-height: min(58vh, 420px);
  overflow: auto;
  white-space: pre-line;
}

.radar-help-button {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  display: none;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid rgba(0, 118, 182, 0.34);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.94);
  color: var(--blue);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
}

.radar-help-button:focus-visible {
  outline: 3px solid rgba(0, 118, 182, 0.2);
  outline-offset: 2px;
}

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

.radar-row-main {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.radar-row-main strong,
.radar-row-main small,
.radar-row-metrics span {
  overflow-wrap: anywhere;
}

.radar-row-main strong {
  display: block;
  color: #172033;
}

.radar-row-main small {
  display: block;
  margin-top: 3px;
  color: #64748b;
}

.radar-priority {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  color: #fff;
  font-weight: 800;
  background: #0b7fab;
}

.radar-priority.warning {
  background: #d97706;
}

.radar-priority.critical {
  background: #c62828;
}

.radar-row-metrics {
  display: grid;
  gap: 4px;
  color: #475569;
  font-size: 13px;
  text-align: right;
}

.radar-row-metrics span:first-child {
  color: #172033;
  font-weight: 700;
}

@media (max-width: 980px) {
  .radar-matrix-card,
  .radar-row {
    padding-right: 48px;
  }

  .radar-help-button {
    display: grid;
  }

  .radar-kpis,
  .radar-grid {
    grid-template-columns: 1fr;
  }

  .radar-matrix {
    grid-template-columns: 1fr;
  }

  .radar-guide-content {
    grid-template-columns: 1fr;
  }

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

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

  .radar-row-metrics {
    text-align: left;
  }

  .radar-matrix-panel .panel-title {
    align-items: flex-start;
  }

  .radar-matrix-panel .panel-title small {
    width: 100%;
    min-width: 0;
    white-space: normal;
  }
}

@media (pointer: coarse) {
  .radar-matrix-card,
  .radar-row {
    padding-right: 48px;
  }

  .radar-help-button {
    display: grid;
  }
}

@media (min-width: 901px) and (max-width: 1180px) {
  html[data-theme="modern"] .admin-workbench .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  html[data-theme="modern"] body {
    padding-left: 0;
  }

  html[data-theme="modern"] .app-header {
    position: static;
    width: auto;
    height: auto;
    gap: 14px;
    overflow: visible;
    border-right: 0;
    border-bottom: 3px solid var(--amber);
    box-shadow: none;
    padding: 14px;
  }

  html[data-theme="modern"] .brand-title {
    display: grid;
    grid-template-columns: 104px minmax(0, 1fr);
    align-items: center;
    flex-direction: initial;
    gap: 12px;
  }

  html[data-theme="modern"] .brand-logo {
    width: 104px;
  }

  html[data-theme="modern"] .brand-title h1 {
    font-size: 20px;
  }

  html[data-theme="modern"] .header-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  html[data-theme="modern"] .session-user,
  html[data-theme="modern"] .theme-switcher {
    grid-column: 1 / -1;
  }

  html[data-theme="modern"] .theme-switcher {
    margin-top: 4px;
  }

  html[data-theme="modern"] .header-link {
    justify-content: center;
  }

  html[data-theme="modern"] .shell {
    padding: 16px 12px 28px;
  }
}

@media (max-width: 520px) {
  html[data-theme="modern"] .header-actions {
    grid-template-columns: 1fr;
  }

  html[data-theme="modern"] .brand-title {
    grid-template-columns: 86px minmax(0, 1fr);
  }

  html[data-theme="modern"] .brand-logo {
    width: 86px;
  }
}

.orders-page .orders-client-ranking,
.orders-page .orders-range-stack,
.orders-page .orders-priority-grid {
  display: grid;
  gap: 10px;
}

.orders-page .orders-client-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) minmax(130px, auto);
  align-items: center;
  gap: 12px;
  border: 1px solid #dfe7ef;
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
}

.orders-page .orders-client-row.is-leader {
  border-color: rgba(0, 118, 182, 0.3);
  background: linear-gradient(135deg, #f3fbff, #ffffff);
}

.orders-page .orders-rank-badge {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 999px;
  background: #e8f1f8;
  color: var(--primary-deep);
  font-size: 12px;
  font-weight: 900;
}

.orders-page .orders-client-row.is-leader .orders-rank-badge {
  background: var(--primary);
  color: #fff;
}

.orders-page .orders-client-main {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.orders-page .orders-client-name {
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.orders-page .orders-client-main small,
.orders-page .orders-client-metrics span,
.orders-page .orders-range-foot,
.orders-page .orders-priority-card small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.orders-page .orders-client-track,
.orders-page .orders-range-track,
.orders-page .orders-priority-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7edf3;
}

.orders-page .orders-client-track i,
.orders-page .orders-range-track i,
.orders-page .orders-priority-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--teal));
}

.orders-page .orders-client-metrics {
  display: grid;
  gap: 3px;
  text-align: right;
}

.orders-page .orders-client-metrics strong,
.orders-page .orders-range-head strong,
.orders-page .orders-priority-card strong {
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
  line-height: 1.15;
}

.orders-page .orders-range-row,
.orders-page .orders-priority-card,
.orders-page .orders-range-total {
  display: grid;
  gap: 8px;
  border: 1px solid #dfe7ef;
  border-radius: 8px;
  background: #fff;
  padding: 11px 12px;
}

.orders-page .orders-range-head,
.orders-page .orders-range-foot,
.orders-page .orders-range-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.orders-page .orders-range-head span,
.orders-page .orders-range-total span,
.orders-page .orders-priority-card span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.orders-page .orders-range-total {
  border-color: rgba(0, 118, 182, 0.24);
  background: #f3f9fd;
}

.orders-page .orders-priority-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.orders-page .orders-priority-card {
  min-width: 0;
  min-height: 76px;
  align-content: start;
  overflow: hidden;
}

.orders-page .orders-priority-card[data-kpi-help] {
  position: relative;
  cursor: help;
  padding-right: 38px;
}

.orders-page .orders-priority-card[data-kpi-help]::after {
  content: "i";
  position: absolute;
  top: 10px;
  right: 11px;
  display: grid;
  width: 17px;
  height: 17px;
  place-items: center;
  border: 1px solid rgba(0, 118, 182, 0.34);
  border-radius: 50%;
  color: var(--blue);
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}

.orders-page .orders-priority-card[data-kpi-help]:hover,
.orders-page .orders-priority-card[data-kpi-help]:focus-visible {
  border-color: rgba(0, 118, 182, 0.42);
}

.orders-page .orders-priority-card[data-kpi-help]:focus-visible {
  outline: 3px solid rgba(0, 118, 182, 0.18);
  outline-offset: 2px;
}

.orders-page .orders-priority-card span,
.orders-page .orders-priority-card strong,
.orders-page .orders-priority-card small {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.orders-page .orders-priority-card strong {
  line-height: 1.18;
}

.orders-page .orders-priority-card.is-concentration {
  grid-column: 1 / -1;
  border-color: rgba(243, 107, 42, 0.24);
  background: #fffaf6;
}

.orders-page .orders-priority-card.is-concentration .orders-priority-track i {
  background: linear-gradient(90deg, var(--amber), var(--primary));
}

@media (max-width: 760px) {
  .orders-page .orders-client-row {
    grid-template-columns: 30px minmax(0, 1fr);
  }

  .orders-page .orders-client-metrics {
    grid-column: 2;
    text-align: left;
  }

  .orders-page .orders-priority-grid {
    grid-template-columns: 1fr;
  }

  .orders-page .orders-range-head,
  .orders-page .orders-range-foot,
  .orders-page .orders-range-total {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }
}
