/* SOG Operations Command Center
   Visuelle Ebene über der bestehenden Anwendung – keine Funktionslogik. */

:root {
  --brand-red: #e30513;
  --brand-red-dark: #b70813;
  --ink: #171a1f;
  --charcoal: #343a43;
  --muted: #667085;
  --line: #d9dfe7;
  --soft-line: #e9edf2;
  --band: #f2f4f7;
  --white: #ffffff;
  --green: #14875d;
  --yellow: #b97208;
  --blue: #2f6fb2;
  --success: #14875d;
  --danger: #c71925;
  --command-graphite: #181b20;
  --command-graphite-soft: #252a31;
  --command-canvas: #f4f6f8;
  --command-surface: #ffffff;
  --command-red-soft: #fff1f2;
  --command-blue-soft: #edf4fc;
  --command-green-soft: #eaf7f1;
  --command-yellow-soft: #fff6e5;
  --shadow: 0 14px 40px rgba(23, 26, 31, 0.08);
  --shadow-soft: 0 4px 18px rgba(23, 26, 31, 0.055);
  --radius: 12px;
}

.responsibility-grid{display:grid;grid-template-columns:minmax(0,1.45fr) minmax(280px,.55fr);gap:18px;margin:18px 0}.responsibility-form label{display:grid;gap:7px;font-weight:700;color:#30343b}.form-check-row{display:flex;flex-wrap:wrap;gap:10px 18px;margin:16px 0}.form-check-row label{display:flex;align-items:center;gap:8px;font-weight:600}.account-status-list{display:grid;gap:8px}.account-status-row{width:100%;display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px;border:1px solid #e0e4e8;border-radius:12px;background:#fff;text-align:left;cursor:pointer}.account-status-row span:first-child{display:grid;gap:3px}.account-status-row small{color:#737b86}.team-presence-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(190px,1fr));gap:9px;margin-bottom:16px}.team-presence-card{display:grid;gap:4px;padding:11px 12px;border-radius:12px;border:1px solid #dfe4e8;background:#f7f8fa}.team-presence-card.inside{border-color:#9bd1b6;background:#edf9f3}.team-presence-card.outside{border-color:#ef9b9b;background:#fff0f0;color:#a20f18}.team-presence-card.overdue{border-width:2px;border-color:#d80012;background:#ffe5e8;box-shadow:0 0 0 3px rgba(216,0,18,.08)}.team-presence-card.overdue span{font-weight:800}.team-presence-card small{color:#68717d;line-height:1.35}@media(max-width:980px){.responsibility-grid{grid-template-columns:1fr}}

.tool-credentials-form {
  margin: 18px 0;
}

.tool-config-band {
  display: grid;
  gap: 12px;
  padding: 14px 0;
  border-top: 1px solid var(--soft-line);
}

.tool-config-band:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.tool-config-band h4 {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
}

.tool-portal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}

.tool-portal-card {
  display: grid;
  gap: 9px;
  padding: 12px;
  border: 1px solid var(--soft-line);
  border-radius: 10px;
  background: #fff;
}

.tool-portal-card label,
.tool-credentials-form label {
  display: grid;
  gap: 7px;
  color: #30343b;
  font-weight: 700;
}

.tool-credentials-form .form-check-row label {
  display: flex;
}

.form-check-row.tight {
  margin: 0;
}

.tool-generated-paths,
.tool-status-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
  color: #667085;
  font-size: 12px;
}

.tool-generated-paths span,
.tool-status-line span,
.leon-category-strip span {
  padding: 8px 10px;
  border: 1px solid var(--soft-line);
  border-radius: 10px;
  background: #fff;
}

.leon-category-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 16px;
}

.leon-category-strip span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #667085;
}

.leon-category-strip strong {
  color: var(--ink);
}

html {
  background: var(--command-canvas);
}

body {
  color: var(--charcoal);
  background: var(--command-canvas);
  font-feature-settings: "tnum" 1, "cv02" 1, "cv03" 1;
  -webkit-font-smoothing: antialiased;
}

button,
a,
input,
select,
textarea {
  transition: border-color 0.16s ease, background-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease,
    transform 0.16s ease;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(227, 5, 19, 0.22);
  outline-offset: 2px;
}

/* Leitstellen-Navigation */

.admin-body {
  min-height: 100vh;
  padding-left: 244px;
}

.topbar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 50;
  width: 244px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  overflow: hidden;
  color: #fff;
  background: var(--command-graphite);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 12px 0 36px rgba(15, 18, 22, 0.12);
}

.brand-block {
  width: 100%;
  min-height: 118px;
  height: 118px;
  padding: 0;
  flex: 0 0 auto;
  color: #fff;
  background: #ff0000;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  overflow: hidden;
}

.brand-script {
  font-size: 27px;
  letter-spacing: -0.7px;
}

.brand-sub {
  margin-top: 8px;
  font-size: 12px;
  letter-spacing: 1.8px;
  opacity: 0.9;
}

.main-nav {
  min-width: 0;
  width: 100%;
  padding: 20px 14px;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  align-items: stretch;
  gap: 5px;
  overflow-x: hidden;
  overflow-y: auto;
}

.nav-item {
  width: 100%;
  min-height: 46px;
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  color: #b9c1cc;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 750;
  text-align: left;
}

.nav-item .icon {
  width: 19px;
  height: 19px;
  opacity: 0.88;
}

.nav-item:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.08);
}

.nav-item.active {
  color: #fff;
  background: rgba(227, 5, 19, 0.16);
  border-color: rgba(255, 92, 102, 0.22);
  box-shadow: inset 3px 0 0 var(--brand-red);
}

.nav-item.active .icon {
  color: #ff5b65;
}

.topbar-actions {
  width: 100%;
  margin-top: auto;
  padding: 14px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.12);
}

.user-badge {
  grid-column: 1 / -1;
  min-width: 0;
  padding: 12px 13px;
  display: grid;
  gap: 2px;
  color: #fff;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 9px;
}

.user-badge strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-badge small {
  color: #aeb7c3;
  font-size: 11px;
}

.topbar-actions .ghost-button,
.topbar-actions .outline-light {
  min-height: 40px;
  padding: 0 11px;
  color: #cbd2dc;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
}

.topbar-actions .ghost-button:hover,
.topbar-actions .outline-light:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.18);
}

.topbar-actions .outline-light {
  grid-column: 1 / -1;
  justify-content: center;
  font-size: 12px;
}

/* Arbeitsfläche und Seitenkopf */

.app-shell {
  width: min(1840px, 100%);
  margin: 0 auto;
  padding: 26px 28px 36px;
}

.workspace-toolbar {
  min-height: 84px;
  margin-bottom: 20px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.workspace-kicker {
  display: block;
  margin-bottom: 5px;
  color: var(--brand-red);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 1.8px;
  text-transform: uppercase;
}

.workspace-toolbar h1 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(25px, 2.25vw, 36px);
  line-height: 1.08;
  letter-spacing: -0.75px;
}

.workspace-toolbar p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.workspace-status {
  min-width: 230px;
  padding: 11px 14px;
  display: grid;
  gap: 2px;
  justify-items: end;
  color: var(--charcoal);
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.workspace-status span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 850;
}

.workspace-status i {
  width: 8px;
  height: 8px;
  display: inline-block;
  background: var(--green);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(20, 135, 93, 0.12);
}

.workspace-status small {
  color: var(--muted);
  font-size: 10px;
}

.kpi-grid {
  gap: 14px;
  margin-bottom: 18px;
}

.kpi-tile {
  --metric-color: var(--brand-red);
  position: relative;
  min-height: 112px;
  padding: 18px 19px;
  overflow: hidden;
  background: var(--command-surface);
  border: 1px solid var(--line);
  border-radius: 13px;
  box-shadow: var(--shadow-soft);
}

.kpi-tile::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--metric-color);
}

.kpi-tile:nth-child(2) {
  --metric-color: var(--yellow);
}

.kpi-tile:nth-child(3) {
  --metric-color: var(--blue);
}

.kpi-tile:nth-child(4) {
  --metric-color: var(--green);
}

.kpi-tile span {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.8px;
}

.kpi-tile strong {
  margin: 7px 0 4px;
  font-size: 35px;
  letter-spacing: -1px;
}

.kpi-tile small {
  font-size: 12px;
}

.kpi-tile .kpi-icon {
  width: 46px;
  height: 46px;
  padding: 12px;
  color: var(--metric-color);
  background: color-mix(in srgb, var(--metric-color) 9%, white);
  border-radius: 12px;
}

.work-grid,
body[data-active-view="orders"] .work-grid {
  grid-template-columns: minmax(315px, 370px) minmax(0, 1fr);
  grid-template-areas: "tools stage";
  gap: 18px;
}

body:not([data-active-view="orders"]) .work-grid {
  grid-template-columns: minmax(0, 1fr);
}

.admin-rail,
.left-rail,
.right-rail,
.center-stage {
  gap: 18px;
}

.panel,
.tablet-card,
.tablet-section {
  min-width: 0;
  background: var(--command-surface);
  border: 1px solid var(--line);
  border-radius: 13px;
  box-shadow: var(--shadow-soft);
}

.panel {
  padding: 20px;
}

.panel-head,
.page-head {
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--soft-line);
}

.panel-head.tight {
  margin-bottom: 14px;
  padding-bottom: 12px;
}

.panel h2,
.page-head h2 {
  color: var(--ink);
  font-size: 18px;
  letter-spacing: -0.25px;
}

.panel h3 {
  color: var(--ink);
}

.panel p,
.page-head p {
  color: var(--muted);
  font-size: 13px;
}

/* Bedienelemente */

.red-button,
.outline-red,
.outline-light,
.ghost-button,
.tablet-action,
.route-button,
.call-button {
  border-radius: 8px;
  font-weight: 800;
}

.red-button {
  color: #fff;
  background: linear-gradient(180deg, #ed0b1b 0%, #d90413 100%);
  border-color: #cc0411;
  box-shadow: 0 4px 12px rgba(227, 5, 19, 0.17);
}

.red-button:hover {
  background: var(--brand-red-dark);
  box-shadow: 0 6px 16px rgba(227, 5, 19, 0.23);
  transform: translateY(-1px);
}

.outline-red {
  color: var(--brand-red);
  background: #fff;
  border-color: #e6a7ac;
}

.outline-red:hover {
  background: var(--command-red-soft);
  border-color: #df6d76;
}

/* Vertriebsauswertung / Management Cockpit */

.reports-page {
  padding: 0;
  overflow: hidden;
  background: #f4f6f8;
  border: 0;
  box-shadow: none;
}

.sales-page-head,
.sales-head-actions,
.sales-filter-panel,
.sales-target-card,
.sales-card-head,
.sales-mix-content,
.sales-customer-row {
  display: flex;
  align-items: center;
}

.sales-page-head {
  justify-content: space-between;
  gap: 24px;
  padding: 26px 28px;
  color: #fff;
  background: linear-gradient(126deg, #1c2228 0%, #303942 70%, #5a151c 100%);
}

.sales-page-head h2 {
  margin: 4px 0 5px;
  color: #fff;
  font-size: clamp(25px, 3vw, 34px);
}

.sales-page-head p { margin: 0; color: #d9dee2; }
.sales-page-head .eyebrow { color: #ff8e97; }
.sales-head-actions { gap: 10px; flex-wrap: wrap; }
.sales-head-actions .red-button,
.sales-head-actions .outline-button { min-height: 40px; padding: 10px 15px; text-decoration: none; }
.sales-upload-button { color: #fff; border: 1px solid rgba(255,255,255,.45); border-radius: 8px; cursor: pointer; font-weight: 800; }
.sales-upload-button:hover { border-color: #fff; background: rgba(255,255,255,.08); }
.sales-upload-button input { display: none; }

.sales-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 18px 20px 0;
}

.sales-kpi-grid article {
  position: relative;
  min-height: 112px;
  padding: 16px 17px;
  overflow: hidden;
  border: 1px solid #e0e4e7;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 5px 18px rgba(25, 33, 40, .05);
}

.sales-kpi-grid article::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: #2b333b; }
.sales-kpi-grid article.success::before { background: #199554; }
.sales-kpi-grid article.warning::before { background: #e38a00; }
.sales-kpi-grid article.danger::before { background: #c8102e; }
.sales-kpi-grid span,
.sales-executive-card article span { display: block; color: #6d7780; font-size: 11px; font-weight: 900; letter-spacing: .07em; text-transform: uppercase; }
.sales-kpi-grid strong { display: block; margin: 10px 0 5px; color: #1e252b; font-size: clamp(18px, 2vw, 25px); line-height: 1.05; }
.sales-kpi-grid small { color: #77818a; }

.sales-definition-note {
  margin: 12px 20px 0;
  padding: 11px 14px;
  color: #6c353a;
  background: #fff5f6;
  border: 1px solid #efc5c9;
  border-radius: 10px;
  font-size: 11px;
  line-height: 1.5;
}

.sales-target-card {
  position: relative;
  justify-content: space-between;
  gap: 20px;
  margin: 14px 20px 0;
  padding: 17px 19px 21px;
  overflow: hidden;
  border: 1px solid #d9dde1;
  border-radius: 12px;
  background: #fff;
}
.sales-target-card h3 { margin: 3px 0; font-size: 19px; }
.sales-target-card p { margin: 0; }
.sales-target-control { display: flex; align-items: end; gap: 8px; }
.sales-target-control label { color: #66717b; font-size: 11px; font-weight: 800; }
.sales-target-control input { display: block; width: 165px; margin-top: 4px; }
.sales-target-control button { min-height: 40px; }
.sales-target-progress { position: absolute; inset: auto 0 0; height: 5px; background: #e5e8ea; }
.sales-target-progress i { display: block; height: 100%; background: linear-gradient(90deg, #d90413, #f36b75); }

.sales-filter-panel {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) repeat(3, minmax(145px, 1fr)) auto;
  gap: 10px;
  margin: 14px 20px;
  padding: 13px;
  border: 1px solid #dfe3e6;
  border-radius: 12px;
  background: #fff;
}
.sales-filter-panel label span { display: block; margin-bottom: 5px; color: #69737c; font-size: 10px; font-weight: 900; letter-spacing: .07em; text-transform: uppercase; }
.sales-filter-panel input,
.sales-filter-panel select { width: 100%; min-height: 40px; }
.sales-clear { align-self: end; min-height: 40px; padding: 8px 12px; border: 1px solid #dfe3e6; }

.sales-dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.22fr);
  gap: 14px;
  padding: 0 20px 14px;
}
.sales-dashboard-grid.executive-grid { grid-template-columns: minmax(0, 1.3fr) minmax(300px, .7fr); }
.sales-card { min-width: 0; border: 1px solid #dfe3e6; border-radius: 12px; background: #fff; box-shadow: 0 5px 18px rgba(25, 33, 40, .04); }
.sales-card-head { justify-content: space-between; padding: 16px 17px 11px; }
.sales-card-head h3 { margin: 0 0 3px; color: #222a31; font-size: 17px; }
.sales-card-head p { margin: 0; color: #79838b; font-size: 12px; }
.sales-breakdown-list,
.sales-customer-list { padding: 2px 17px 15px; }
.sales-breakdown-row {
  display: grid;
  grid-template-columns: minmax(115px, .7fr) minmax(100px, 1fr) minmax(95px, auto);
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid #eef0f2;
}
.sales-breakdown-row > div:first-child strong,
.sales-breakdown-row > div:first-child small { display: block; }
.sales-breakdown-row small,
.sales-customer-row small { margin-top: 2px; color: #889199; font-size: 10px; }
.sales-breakdown-row > strong,
.sales-customer-row > strong { text-align: right; font-size: 12px; }
.sales-bar { height: 8px; overflow: hidden; border-radius: 999px; background: #e8ebed; }
.sales-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #c80012, #ee4f5d); }

.sales-table-wrap { max-width: 100%; overflow: auto; border-top: 1px solid #e8ebed; }
.sales-table-wrap table { width: 100%; min-width: 980px; border-collapse: collapse; }
.sales-table-wrap.compact table { min-width: 580px; }
.sales-table-wrap th { position: sticky; top: 0; z-index: 1; padding: 10px 11px; color: #fff; background: #293139; font-size: 10px; letter-spacing: .04em; text-align: left; text-transform: uppercase; }
.sales-table-wrap td { max-width: 290px; padding: 9px 11px; border-bottom: 1px solid #edf0f2; color: #444e57; font-size: 12px; vertical-align: top; }
.sales-table-wrap tbody tr:hover td { background: #fff8f8; }
.sales-table-wrap .money-cell { white-space: nowrap; text-align: right; }
.sales-status { display: inline-flex; padding: 4px 7px; border-radius: 999px; color: #8c101b; background: #fdebed; font-size: 10px; font-weight: 900; white-space: nowrap; }
.sales-detail-card { margin: 0 20px 20px; }
.empty-cell { padding: 30px !important; text-align: center; }

.sales-customer-row { display: grid; grid-template-columns: 25px minmax(125px, .7fr) minmax(100px, 1fr) minmax(90px, auto); gap: 9px; padding: 8px 0; border-top: 1px solid #eef0f2; }
.sales-rank { display: grid; width: 24px; height: 24px; place-items: center; border-radius: 7px; color: #fff; background: #2c343b; font-size: 10px; font-weight: 900; }
.sales-mix-content { justify-content: center; gap: 28px; min-height: 230px; padding: 12px 20px 25px; }
.sales-donut { display: grid; width: 150px; height: 150px; flex: 0 0 auto; place-items: center; border-radius: 50%; }
.sales-donut::before { content: ""; grid-area: 1/1; width: 94px; height: 94px; border-radius: 50%; background: #fff; }
.sales-donut > span { z-index: 1; grid-area: 1/1; color: #222a31; font-size: 24px; font-weight: 900; text-align: center; }
.sales-donut small { display: block; color: #7a848c; font-size: 10px; text-transform: uppercase; }
.sales-mix-content ul { min-width: 150px; margin: 0; padding: 0; list-style: none; }
.sales-mix-content li { display: grid; grid-template-columns: 10px 1fr auto; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid #eef0f2; font-size: 12px; }
.sales-mix-content li i { width: 9px; height: 9px; border-radius: 50%; }

.sales-executive-card { margin: 0 20px 14px; }
.sales-insight-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; border-top: 1px solid #e8ebed; }
.sales-insight-grid article { min-height: 140px; padding: 16px; border-right: 1px solid #e8ebed; }
.sales-insight-grid article:last-child { border-right: 0; }
.sales-insight-grid article strong { display: block; margin: 9px 0; font-size: 18px; }
.sales-insight-grid article p { margin: 0; font-size: 12px; line-height: 1.5; }
.sales-insight-grid article.attention { box-shadow: inset 0 3px #e38a00; }
.sales-insight-grid article.positive { box-shadow: inset 0 3px #199554; }

.sales-empty-import,
.sales-loading { display: grid; min-height: 430px; place-items: center; align-content: center; gap: 8px; padding: 40px; text-align: center; }
.sales-empty-import { cursor: pointer; }
.sales-empty-import input { display: none; }
.sales-empty-import small { max-width: 580px; color: #737e87; }

@media (max-width: 1250px) {
  .sales-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sales-filter-panel { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sales-dashboard-grid,
  .sales-dashboard-grid.executive-grid { grid-template-columns: 1fr; }
  .sales-insight-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .sales-page-head,
  .sales-target-card { align-items: stretch; flex-direction: column; }
  .sales-kpi-grid,
  .sales-filter-panel,
  .sales-insight-grid { grid-template-columns: 1fr; }
  .sales-mix-content { align-items: center; flex-direction: column; }
  .sales-customer-row { grid-template-columns: 25px 1fr auto; }
  .sales-customer-row .sales-bar { display: none; }
}

input,
select,
textarea,
.search-line,
.customer-search,
.personnel-search,
.employee-hours-search {
  color: var(--ink);
  background: #fff;
  border-color: #cfd6df;
  border-radius: 8px;
  box-shadow: inset 0 1px 2px rgba(20, 24, 29, 0.025);
}

input:hover,
select:hover,
textarea:hover {
  border-color: #aeb8c5;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand-red);
  box-shadow: 0 0 0 3px rgba(227, 5, 19, 0.1);
}

.search-line {
  min-height: 44px;
  border: 1px solid #cfd6df;
}

.drop-zone {
  min-height: 180px;
  color: var(--charcoal);
  background: #fafbfc;
  border: 1.5px dashed #b8c1cc;
  border-radius: 11px;
}

.drop-zone:hover,
.drop-zone.dragging {
  background: var(--command-red-soft);
  border-color: var(--brand-red);
  box-shadow: inset 0 0 0 1px rgba(227, 5, 19, 0.08);
}

.file-icon {
  color: var(--brand-red);
  background: #fff;
  border: 1px solid #ef9da4;
  border-radius: 9px;
}

/* Master-Detail: Aufträge */

.left-rail > .panel:last-child {
  padding: 0;
  overflow: hidden;
}

.left-rail > .panel:last-child > .panel-head,
.left-rail > .panel:last-child > .order-ai-panel,
.left-rail > .panel:last-child > .search-line {
  margin-left: 18px;
  margin-right: 18px;
}

.left-rail > .panel:last-child > .panel-head {
  margin-top: 18px;
}

.order-list {
  gap: 0;
  border-top: 1px solid var(--soft-line);
}

.order-row {
  position: relative;
  min-height: 94px;
  padding: 16px 18px 16px 21px;
  background: #fff;
  border: 0;
  border-bottom: 1px solid var(--soft-line);
  border-radius: 0;
}

.order-row::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: transparent;
}

.order-row:hover {
  background: #f8fafc;
  transform: none;
}

.order-row.active {
  background: #fff7f7;
  border-color: var(--soft-line);
  box-shadow: none;
}

.order-row.active::before {
  background: var(--brand-red);
}

.order-row strong {
  color: var(--ink);
  font-size: 14px;
}

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

.order-detail {
  padding: 0;
  overflow: hidden;
}

.order-detail > *:not(.order-hero) {
  margin-left: 22px;
  margin-right: 22px;
}

.order-hero {
  min-height: 122px;
  padding: 23px 24px;
  color: var(--charcoal);
  background: #fff;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
}

.order-hero h1 {
  color: var(--ink);
  font-size: clamp(23px, 2vw, 31px);
  letter-spacing: -0.6px;
}

.order-no {
  color: var(--brand-red);
  font-size: 10px;
  letter-spacing: 1.3px;
  text-transform: uppercase;
}

.status-pill,
.mini-pill,
.service-type-chip,
.customer-meta-pill {
  border-radius: 999px;
  font-weight: 850;
}

.detail-grid,
.split-detail,
.customer-facts,
.delivery-facts {
  gap: 12px;
}

.detail-block,
.customer-site-detail,
.delivery-subsection,
.worktime-gps-card,
.security-detail-box {
  background: #f8fafc;
  border: 1px solid var(--soft-line);
  border-radius: 10px;
  box-shadow: none;
}

.detail-block {
  padding: 16px;
}

.block-head,
.section-head {
  border-bottom-color: var(--soft-line);
}

.data-table,
.service-line-table,
.delivery-time-table,
.editor-table {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.data-table th,
.service-line-table th,
.delivery-time-table th,
.editor-table th {
  color: #667085;
  background: #f5f7f9;
  font-size: 10px;
  letter-spacing: 0.7px;
  text-transform: uppercase;
}

.data-table td,
.service-line-table td,
.delivery-time-table td,
.editor-table td {
  border-color: var(--soft-line);
}

.timeline-row {
  border-color: var(--soft-line);
}

.timeline-mark {
  box-shadow: 0 0 0 5px var(--command-red-soft);
}

/* Fachseiten */

.customer-browser,
.article-page,
.tablet-page,
.notes-page,
.tender-monitor-page,
.leon-page,
.ai-page,
.users-page,
.organization-page,
.manual-entry {
  min-height: 560px;
}

.customer-directory-stats,
.workspace-metrics,
.security-status-grid,
.db-metrics {
  gap: 12px;
}

.customer-directory-stats > *,
.workspace-metrics > *,
.security-status-grid > *,
.db-metrics > * {
  background: #f8fafc;
  border: 1px solid var(--soft-line);
  border-radius: 10px;
  box-shadow: none;
}

.customer-record,
.customer-row,
.article-group-card,
.delivery-row,
.note-card,
.tablet-card,
.user-request,
.user-row,
.personnel-management-row,
.organization-employee-row {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: none;
}

.customer-record:hover,
.customer-row:hover,
.article-group-card:hover,
.delivery-row:hover {
  border-color: #adb7c3;
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.customer-record.active,
.customer-row.active,
.article-group-card.active,
.delivery-row.active {
  background: #fff7f7;
  border-color: #e98990;
  box-shadow: inset 3px 0 0 var(--brand-red);
}

.customer-record-head,
.site-row,
.contact-row,
.employee-app-hours-row,
.personnel-management-row,
.organization-employee-row,
.user-row {
  border-color: var(--soft-line);
}

.article-table-wrap,
.service-line-table-wrap,
.editor-table-wrap {
  border: 1px solid var(--line);
  border-radius: 10px;
}

.employee-app-online,
.employee-app-hours-panel,
.worktime-gps-panel,
.delivery-detail,
.customer-detail-panel,
.customer-list-panel {
  border-color: var(--line);
  border-radius: 11px;
  box-shadow: none;
}

.employee-app-hours-head {
  color: var(--muted);
  background: #f5f7f9;
  font-size: 10px;
  letter-spacing: 0.65px;
  text-transform: uppercase;
}

.worktime-file-button {
  border-radius: 8px;
}

.organization-diagram-switch {
  background: #eef1f4;
  border: 1px solid var(--line);
}

.organization-node,
.org-reference-box,
.org-support-cell,
.org-department-column {
  border-color: var(--line);
  border-radius: 9px;
  box-shadow: none;
}

.org-reference-diagram {
  background: #f7f8fa;
  border-color: var(--line);
}

.edit-dialog {
  border: 0;
  border-radius: 14px;
  box-shadow: 0 28px 80px rgba(18, 22, 28, 0.24);
}

.edit-dialog::backdrop {
  background: rgba(17, 21, 26, 0.62);
  backdrop-filter: blur(3px);
}

.offer-editor-dialog,
.customer-dossier-dialog {
  width: min(1500px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100vh - 32px);
}

.offer-position-scroll {
  overflow: auto;
  border: 1px solid var(--cc-border, #d9dde1);
  border-radius: 14px;
}

.offer-position-table {
  min-width: 1180px;
}

.offer-position-table input,
.offer-position-table select,
.offer-position-table textarea {
  width: 100%;
  min-width: 82px;
  margin: 2px 0;
}

.offer-position-table td:nth-child(2) {
  min-width: 300px;
}

.source-responsibility-note {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid #d9dde1;
  border-left: 4px solid var(--cc-red, #e52620);
  border-radius: 12px;
  background: #f7f8f9;
}

.source-responsibility-note span,
.source-responsibility-note strong,
.source-responsibility-note small {
  display: block;
}

.source-responsibility-note small {
  margin-bottom: 4px;
  color: var(--cc-muted, #667085);
}

.offer-positions-head,
.offer-totals,
.customer-dossier-tabs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.offer-totals {
  justify-content: flex-end;
  flex-wrap: wrap;
  padding: 16px;
  background: #f5f6f7;
  border-radius: 12px;
}

.offer-totals span {
  padding-left: 16px;
  border-left: 1px solid #d9dde1;
}

.customer-dossier-tabs {
  justify-content: flex-start;
  overflow-x: auto;
  border-bottom: 1px solid #d9dde1;
}

.customer-dossier-tab {
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  padding: 13px 16px;
  color: #66717d;
  font-weight: 750;
  cursor: pointer;
  white-space: nowrap;
}

.customer-dossier-tab.active {
  color: #20252b;
  border-bottom-color: #e30613;
}

.customer-dossier-tab span {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  margin-left: 7px;
  border-radius: 999px;
  background: #eef0f2;
  font-size: 11px;
}

.customer-dossier-content {
  min-height: 360px;
}

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

.customer-dossier-grid section {
  padding: 18px;
  border: 1px solid #dde1e5;
  border-radius: 14px;
  background: #fff;
}

.customer-dossier-grid dl {
  display: grid;
  grid-template-columns: minmax(110px, .4fr) 1fr;
  gap: 9px 14px;
}

.customer-dossier-grid dt { color: #78828c; }
.customer-dossier-grid dd { margin: 0; font-weight: 650; }
.dossier-contact { display: flex; flex-direction: column; padding: 9px 0; border-top: 1px solid #edf0f2; }
.dossier-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}
.dossier-entity-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 7px;
  padding: 17px;
  border: 1px solid #dfe3e7;
  border-radius: 14px;
  background: #fff;
  color: #20252b;
  text-align: left;
}
.dossier-entity-card.interactive { cursor: pointer; transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease; }
.dossier-entity-card.interactive:hover { border-color: #e30613; box-shadow: 0 12px 28px rgba(30, 38, 46, .1); transform: translateY(-1px); }
.dossier-entity-card small { color: #737f8b; }
.dossier-entity-card p { margin: 4px 0; color: #3f4851; }
.entity-card-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.entity-card-head em, .relation-chip {
  border-radius: 999px;
  background: #fbe9ea;
  color: #b80712;
  padding: 4px 9px;
  font-size: 11px;
  font-style: normal;
  font-weight: 750;
}
.entity-card-metrics { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 5px; }
.entity-card-metrics i { padding: 4px 7px; border-radius: 7px; background: #f1f3f5; color: #59636d; font-size: 11px; font-style: normal; }
.crm-notes-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, .7fr); gap: 18px; }
.crm-notes-layout > section { padding: 18px; border: 1px solid #dde1e5; border-radius: 14px; background: #fff; }
.crm-note { padding: 13px 14px; border-top: 1px solid #edf0f2; }
.crm-note.pinned { border-left: 3px solid #e30613; background: #fff9f9; }
.crm-note div { display: flex; justify-content: space-between; gap: 12px; }
.crm-note p { margin-bottom: 0; white-space: pre-wrap; }
.crm-note-form { display: grid; gap: 12px; }
.crm-note-form label { display: grid; gap: 6px; font-weight: 700; }
.crm-note-form input, .crm-note-form select, .crm-note-form textarea { width: 100%; }
.crm-note-form .checkbox-line { display: flex; align-items: center; font-weight: 600; }
.crm-note-form .checkbox-line input { width: auto; }
.article-image-strip { display: flex; gap: 12px; overflow-x: auto; padding: 8px 0 18px; }
.article-image-strip img { width: 150px; height: 120px; object-fit: contain; border: 1px solid #dde1e5; border-radius: 12px; background: #fff; }
.article-image-strip figure { flex: 0 0 150px; margin: 0; }
.article-image-strip figcaption { margin-top: 5px; overflow: hidden; color: #667085; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.article-commercial-section { margin-top: 22px; }
.article-commercial-section > h4 { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; }
.article-commercial-section > h4 span { padding: 3px 8px; border-radius: 999px; background: #f0f2f5; color: #525b66; font-size: 12px; }
.article-commercial-dialog .modal-form { width: min(1240px, calc(100vw - 40px)); }
.article-fusion-stats { grid-template-columns: repeat(5, minmax(150px, 1fr)); margin-bottom: 18px; }
.article-fusion-stats .needs-review { border-color: #f2a2a7; background: #fff7f7; }

@media (max-width: 850px) {
  .customer-dossier-grid { grid-template-columns: 1fr; }
  .crm-notes-layout { grid-template-columns: 1fr; }
  .article-fusion-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .article-commercial-dialog .modal-form { width: calc(100vw - 20px); }
}

.modal-head {
  background: #f8fafc;
  border-bottom-color: var(--line);
}

.order-head-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.order-head-actions .outline-red,
.order-head-actions .red-button {
  white-space: nowrap;
}

.crm-orders-dialog .modal-form,
.crm-order-detail-dialog .modal-form {
  gap: 18px;
}

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

.crm-order-stats article,
.crm-detail-hero > div,
.crm-price-grid article {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 13px 14px;
  border: 1px solid #e3e7ea;
  border-radius: 10px;
  background: #f8fafb;
}

.crm-order-stats strong {
  color: #22282e;
  font-size: 20px;
}

.crm-order-stats span,
.crm-detail-hero span,
.crm-price-grid span,
.crm-source-grid span {
  color: #69737c;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .035em;
  text-transform: uppercase;
}

.crm-archive-filters {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 230px;
  gap: 10px;
}

.crm-archive-filters > label {
  display: grid;
  gap: 5px;
  color: #69737c;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .035em;
  text-transform: uppercase;
}

.crm-search-field {
  position: relative;
}

.crm-search-field .icon {
  position: absolute;
  bottom: 12px;
  left: 12px;
}

.crm-search-field input {
  padding-left: 36px;
}

.crm-orders-table-wrap {
  max-height: min(56vh, 650px);
  overflow: auto;
  border: 1px solid #e3e7ea;
  border-radius: 10px;
}

.crm-orders-table {
  min-width: 1160px;
}

.crm-orders-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  color: #fff;
  background: #293139;
}

.crm-orders-table tbody tr {
  cursor: pointer;
}

.crm-orders-table tbody tr:hover td,
.crm-orders-table tbody tr:focus td {
  background: #fff5f5;
}

.crm-orders-table td > strong,
.crm-orders-table td > span,
.crm-orders-table td > small {
  display: block;
}

.crm-orders-table td > small {
  margin-top: 3px;
  color: #737d85;
}

.crm-orders-table .money-cell {
  white-space: nowrap;
  text-align: right;
}

.crm-row-actions {
  display: flex;
  gap: 6px;
  white-space: nowrap;
}

.order-search-summary {
  padding: 8px 18px;
  color: #69737c;
  background: #f4f6f8;
  border-bottom: 1px solid var(--soft-line);
  font-size: 11px;
  font-weight: 800;
}

.order-position-table-wrap {
  max-width: 100%;
  overflow-x: auto;
}

.order-position-table-wrap table {
  min-width: 850px;
}

.order-position-table-wrap .money-cell {
  white-space: nowrap;
  text-align: right;
}

.order-position-table-wrap .money-cell small {
  display: block;
  margin-top: 3px;
  color: #6c757d;
}

.crm-operational-detail {
  grid-column: 1 / -1;
}

.crm-operational-detail .block-head > div {
  display: grid;
  gap: 3px;
}

.crm-operational-detail .block-head small {
  color: #69737c;
}

.crm-price-grid.compact {
  margin-bottom: 10px;
}

.crm-source-details summary {
  cursor: pointer;
  color: var(--brand-red);
  font-weight: 800;
}

.crm-source-details[open] summary {
  margin-bottom: 10px;
}

.crm-pager,
.crm-pager > div,
.crm-section-title,
.crm-detail-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.crm-pager > span {
  color: #69737c;
  font-size: 12px;
}

.crm-detail-hero {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: stretch;
}

.crm-detail-hero strong {
  overflow: hidden;
  color: #20262c;
  text-overflow: ellipsis;
}

.crm-detail-hero small {
  color: #69737c;
}

.crm-price-panel,
.crm-source-panel {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid #e3e7ea;
  border-radius: 11px;
  background: #fff;
}

.crm-section-title h3,
.crm-section-title small {
  margin: 0;
}

.crm-section-title h3 {
  color: #20262c;
}

.crm-section-title small,
.crm-section-title > span {
  color: #69737c;
}

.crm-price-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
}

.crm-price-grid article.total {
  color: #fff;
  background: #293139;
  border-color: #293139;
}

.crm-price-grid article.total span,
.crm-price-grid article.total strong {
  color: #fff;
}

.crm-price-grid strong {
  font-size: 18px;
}

.crm-price-note {
  margin: 0;
  padding: 10px 12px;
  color: #784b00;
  background: #fff5dc;
  border-left: 3px solid #f0a500;
  border-radius: 6px;
}

.crm-source-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-height: 38vh;
  overflow: auto;
  border: 1px solid #edf0f2;
  border-radius: 9px;
}

.crm-source-grid > div {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px 12px;
  border-right: 1px solid #edf0f2;
  border-bottom: 1px solid #edf0f2;
}

.crm-source-grid strong {
  overflow-wrap: anywhere;
  color: #30383f;
  font-size: 12px;
}

@media (max-width: 900px) {
  .crm-order-stats,
  .crm-detail-hero,
  .crm-price-grid,
  .crm-source-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .crm-archive-filters {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .order-head-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  .crm-order-stats,
  .crm-detail-hero,
  .crm-price-grid,
  .crm-source-grid {
    grid-template-columns: 1fr;
  }
}

.management-orders-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 340px);
  gap: 16px;
  align-items: end;
  margin-bottom: 18px;
}

.management-orders-head input {
  width: 100%;
}

.management-order-card {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
}

.tablet-management-document-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  grid-column: 1 / -1;
}

.tablet-management-document-links .tablet-card-action {
  flex: 1 1 180px;
  text-align: center;
}

.management-work-order-context {
  border-left: 5px solid var(--sog-red, #ed1c24);
}

.management-work-order-context h2 {
  margin: 4px 0;
}

@media (max-width: 720px) {
  .management-orders-head,
  .management-order-card {
    grid-template-columns: minmax(0, 1fr);
  }

  .management-order-card > strong,
  .management-order-card > button {
    width: 100%;
  }
}

.toast {
  right: 24px;
  bottom: 24px;
  color: #fff;
  background: var(--command-graphite-soft);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  box-shadow: 0 18px 48px rgba(18, 22, 28, 0.24);
}

/* Login und Registrierung */

.login-body {
  position: relative;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 85% 15%, rgba(227, 5, 19, 0.18), transparent 32%),
    linear-gradient(145deg, #15181d 0%, #252a31 100%);
}

.login-body::before {
  content: "";
  position: fixed;
  inset: 0 auto 0 0;
  width: 8px;
  background: var(--brand-red);
}

.login-shell {
  width: min(100%, 540px);
}

.login-card {
  background: #fff;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 15px;
  box-shadow: 0 34px 100px rgba(0, 0, 0, 0.34);
}

.login-brand {
  min-height: 168px;
  height: 168px;
  padding: 0;
  background: #ff0000;
  border-bottom: 5px solid var(--brand-red);
}

.login-brand .brand-logo {
  object-fit: contain;
  object-position: center;
}

.login-form {
  gap: 16px;
  padding: 30px;
}

.login-form h1 {
  font-size: 29px;
  letter-spacing: -0.6px;
}

.login-form label {
  color: #59616d;
  font-size: 10px;
  letter-spacing: 0.75px;
}

.login-form input,
.login-form textarea {
  min-height: 47px;
}

/* Mitarbeiter-App */

.tablet-body {
  background:
    radial-gradient(circle at 10% 10%, rgba(227, 5, 19, 0.09), transparent 28%),
    #dfe4ea;
}

.tablet-frame {
  border: 12px solid var(--command-graphite);
  border-radius: 25px;
  box-shadow: 0 30px 90px rgba(17, 21, 26, 0.25);
}

.tablet-topbar {
  min-height: 76px;
  background: var(--command-graphite);
  border-bottom: 4px solid var(--brand-red);
}

.tablet-topbar small {
  color: #b8c1cc;
}

.tablet-menu {
  border-radius: 8px;
}

.tablet-menu:hover {
  background: rgba(255, 255, 255, 0.08);
}

.tablet-content {
  background: #f4f6f8;
}

.tablet-section {
  box-shadow: var(--shadow-soft);
}

.tablet-drawer {
  background: #fff;
  border-right: 0;
  box-shadow: 30px 0 80px rgba(17, 21, 26, 0.25);
}

.tablet-drawer-head {
  color: #fff;
  background: var(--command-graphite);
  border-bottom: 4px solid var(--brand-red);
}

.tablet-menu.close {
  color: #fff;
}

.tablet-drawer-user {
  background: #f4f6f8;
}

.tablet-drawer-nav button {
  border-radius: 8px;
}

.tablet-drawer-nav button.active,
.tablet-drawer-nav button:hover {
  color: var(--brand-red);
  background: var(--command-red-soft);
  border-color: #efc1c5;
  box-shadow: inset 3px 0 0 var(--brand-red);
}

.tablet-action,
.route-button,
.call-button {
  min-height: 48px;
}

.timeclock-hero,
.tablet-history-card,
.calendar-day,
.month-total {
  border-radius: 10px;
  box-shadow: none;
}

.timeclock-hero {
  background: var(--command-graphite);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media (max-width: 1120px) and (min-width: 821px) {
  .admin-body {
    padding-left: 88px;
  }

  .topbar {
    width: 88px;
  }

  .brand-block {
    min-height: 88px;
    height: 88px;
    padding: 0;
    align-items: center;
  }

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

  .brand-script {
    font-size: 0;
  }

  .brand-script::after {
    content: "SOG";
    font-size: 19px;
    font-style: normal;
    letter-spacing: 0.4px;
  }

  .brand-sub,
  .user-badge,
  .topbar-actions .outline-light {
    display: none;
  }

  .main-nav {
    padding: 16px 10px;
  }

  .nav-item {
    min-height: 48px;
    padding: 0;
    justify-content: center;
    gap: 0;
    overflow: hidden;
    font-size: 0;
  }

  .nav-item .icon {
    width: 21px;
    height: 21px;
  }

  .topbar-actions {
    grid-template-columns: 1fr;
    padding: 10px;
  }

  .app-shell {
    padding-inline: 20px;
  }

  .work-grid,
  body[data-active-view="orders"] .work-grid {
    grid-template-columns: minmax(285px, 330px) minmax(0, 1fr);
  }
}

@media (max-width: 820px) {
  .admin-body {
    padding-left: 0;
  }

  .topbar {
    position: sticky;
    inset: 0 auto auto;
    width: 100%;
    min-height: 0;
    display: flex;
    flex-flow: row wrap;
    overflow: visible;
    box-shadow: 0 8px 28px rgba(17, 21, 26, 0.18);
  }

  .brand-block {
    width: 190px;
    min-height: 72px;
    height: 72px;
    padding: 0;
    border: 0;
    border-right: 5px solid #fff;
  }

  .login-brand {
    width: 100%;
    min-height: 148px;
    height: 148px;
    border-right: 0;
  }

  .brand-script {
    font-size: 21px;
  }

  .brand-sub {
    margin-top: 4px;
    font-size: 9px;
  }

  .main-nav {
    order: 3;
    width: 100%;
    padding: 7px 10px 9px;
    flex: 0 0 auto;
    flex-direction: row;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }

  .nav-item {
    width: auto;
    min-height: 38px;
    padding: 0 12px;
    flex: 0 0 auto;
    gap: 7px;
    font-size: 11px;
  }

  .nav-item .icon {
    width: 16px;
    height: 16px;
  }

  .topbar-actions {
    width: auto;
    margin: 0 8px 0 auto;
    padding: 8px 0;
    display: flex;
    align-items: center;
    border: 0;
    background: transparent;
  }

  .user-badge {
    display: none;
  }

  .topbar-actions .ghost-button {
    width: 39px;
    min-height: 39px;
    padding: 0;
  }

  .topbar-actions .outline-light {
    min-height: 39px;
    padding: 0 10px;
    font-size: 0;
  }

  .topbar-actions .outline-light .icon {
    margin: 0;
  }

  .app-shell {
    padding: 18px 14px 28px;
  }

  .workspace-toolbar {
    min-height: 70px;
    margin-bottom: 16px;
    align-items: center;
  }

  .workspace-status {
    display: none;
  }

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

  .work-grid,
  body[data-active-view="orders"] .work-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "tools" "stage";
  }

  .order-detail > *:not(.order-hero) {
    margin-left: 14px;
    margin-right: 14px;
  }
}

@media (max-width: 560px) {
  .brand-block {
    width: 160px;
  }

  .login-brand {
    width: 100%;
    min-height: 136px;
    height: 136px;
  }

  .tablet-topbar {
    grid-template-columns: 44px 74px minmax(0, 1fr) 44px;
    gap: 8px;
    padding: 0 10px;
  }

  .tablet-brand-logo {
    width: 74px;
    height: 46px;
  }

  .offer-brand-banner {
    align-items: flex-start;
    flex-direction: column;
  }

  .workspace-toolbar h1 {
    font-size: 26px;
  }

  .workspace-toolbar p {
    font-size: 12px;
  }

  .kpi-grid {
    gap: 9px;
  }

  .kpi-tile {
    min-height: 100px;
    padding: 14px;
  }

  .kpi-tile strong {
    font-size: 29px;
  }

  .kpi-tile small {
    display: none;
  }

  .kpi-tile .kpi-icon {
    width: 36px;
    height: 36px;
    padding: 9px;
  }

  .panel {
    padding: 15px;
    border-radius: 10px;
  }

  .left-rail > .panel:last-child {
    padding: 0;
  }

  .order-hero {
    padding: 18px;
  }

  .tablet-body {
    background: #fff;
  }

  .tablet-frame {
    border: 0;
    border-radius: 0;
  }

  .tablet-topbar {
    border-bottom-width: 3px;
  }
}
/* LEON central opportunity workspace */
.leon-kpis { grid-template-columns: repeat(6, minmax(118px, 1fr)); }
.leon-research-card { display: grid; grid-template-columns: minmax(220px, .8fr) minmax(320px, 1.8fr) auto; gap: 14px; align-items: center; margin: 18px 0; padding: 18px; border: 1px solid #dce2e8; border-radius: 14px; background: linear-gradient(120deg, #171d23, #27313a); color: #fff; }
.leon-research-card div { display: grid; gap: 3px; }
.leon-research-card small { color: #c9d0d7; }
.leon-research-card input { min-height: 44px; border: 1px solid #59636c; border-radius: 9px; padding: 0 13px; background: #fff; color: #171d23; }
.leon-workspace-section { margin-top: 20px; padding-top: 2px; }
.leon-workspace-section > .section-head { margin-bottom: 10px; }
.leon-content-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.leon-content-grid article { padding: 16px; border: 1px solid #dce2e8; border-radius: 12px; background: #fff; }
.leon-content-grid h4 { margin: 10px 0 6px; }
.leon-content-grid p { min-height: 42px; color: #586574; }
.leon-feedback-actions { display: flex; gap: 5px; }
.leon-feedback-actions button { width: 32px; height: 32px; border: 1px solid #d4dbe2; border-radius: 8px; background: #fff; cursor: pointer; font-weight: 800; }
.leon-feedback-actions button:hover { color: #e5231b; border-color: #e5231b; }
.leon-shell { min-width: 0; }
.leon-shell-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding-bottom: 18px; }
.leon-shell-head h2 { margin: 0 0 5px; font-size: clamp(24px, 2.3vw, 34px); }
.leon-shell-head p { margin: 0; color: #647083; }
.leon-subnav { display: flex; gap: 4px; overflow-x: auto; padding: 5px; margin: 0 -2px 20px; border: 1px solid #d8dee5; border-radius: 12px; background: #f2f4f6; scrollbar-width: thin; }
.leon-subnav button { flex: 0 0 auto; min-height: 42px; padding: 0 14px; border: 0; border-radius: 8px; background: transparent; color: #4d5967; font-family: inherit; font-size: 13px; font-weight: 700; line-height: 1.2; white-space: nowrap; cursor: pointer; }
.leon-subnav button:hover { background: #fff; color: #171d23; }
.leon-subnav button.active { background: #e5231b; color: #fff; box-shadow: 0 5px 14px rgba(229,35,27,.2); }
.leon-subview { min-width: 0; min-height: 460px; }
.leon-view-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin: 2px 0 18px; }
.leon-view-head h3 { margin: 0 0 5px; font-size: 23px; }
.leon-view-head p { margin: 0; color: #687485; }
.leon-section-kpis { grid-template-columns: repeat(4, minmax(130px, 1fr)); margin-bottom: 18px; }
.leon-dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, .7fr); gap: 18px; align-items: start; }
.leon-dashboard-grid > section { min-width: 0; }
.leon-activity-panel { padding: 18px; border: 1px solid #dce2e8; border-radius: 13px; background: #fff; }
.leon-activity-panel > h3 { margin-top: 0; }
.leon-activity-panel article { display: grid; grid-template-columns: 9px minmax(0, 1fr) auto; gap: 11px; align-items: start; padding: 12px 0; border-bottom: 1px solid #e7ebef; }
.leon-activity-panel article:last-child { border-bottom: 0; }
.leon-activity-panel article i { width: 9px; height: 9px; margin-top: 5px; border-radius: 50%; background: #e5231b; box-shadow: 0 0 0 4px #fee9e7; }
.leon-activity-panel article div { display: grid; gap: 3px; min-width: 0; }
.leon-activity-panel article span, .leon-activity-panel time { color: #748091; font-size: 12px; }
.leon-title-button { display: grid; gap: 4px; width: 100%; padding: 0; border: 0; background: transparent; color: inherit; text-align: left; cursor: pointer; }
.leon-title-button:hover strong { color: #e5231b; }
.leon-row-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.leon-opportunity-table select, [data-leon-signal-status] { min-height: 34px; padding: 4px 28px 4px 8px; border: 1px solid #cfd7df; border-radius: 7px; background: #fff; font-family: inherit; font-size: 12px; font-weight: 700; line-height: 1.2; }
.leon-evidence-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 14px; }
.leon-evidence-list article { display: grid; align-content: start; gap: 10px; padding: 18px; border: 1px solid #dce2e8; border-radius: 12px; background: #fff; }
.leon-evidence-list h4, .leon-evidence-list p { margin: 0; }
.leon-evidence-list p { color: #566274; line-height: 1.55; }
.leon-evidence-list small { color: #778292; }
.leon-evidence-list a { color: #d8211a; font-weight: 800; text-decoration: none; }
.leon-evidence-meta, .leon-content-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.leon-evidence-meta span { color: #6c7786; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.leon-evidence-meta b { color: #178455; font-size: 12px; }
.leon-review-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(310px, .68fr); gap: 18px; align-items: start; }
.leon-review-layout > section { min-width: 0; }
.leon-review-detail { position: sticky; top: 18px; display: grid; gap: 14px; padding: 20px; border: 1px solid #d4dbe2; border-radius: 14px; background: #fff; box-shadow: 0 12px 34px rgba(29,38,47,.08); }
.leon-detail-title { display: flex; justify-content: space-between; gap: 12px; }
.leon-detail-title span { color: #778292; font-size: 12px; font-weight: 800; text-transform: uppercase; }
.leon-detail-title h3 { margin: 4px 0 0; }
.leon-detail-title > b { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: #e5231b; color: #fff; }
.leon-fit-strip { display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; }
.leon-fit-strip span { display: flex; justify-content: space-between; padding: 8px 10px; border-radius: 7px; background: #f1f3f5; color: #5c6877; font-size: 12px; }
.leon-review-detail section { padding-top: 12px; border-top: 1px solid #e5e9ed; }
.leon-review-detail section p { margin: 6px 0 0; color: #586576; line-height: 1.5; }
.leon-detail-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.leon-content-head button { padding: 0; border: 0; background: transparent; color: #d8211a; font-family: inherit; font-size: 12px; font-weight: 800; line-height: 1.2; cursor: pointer; }
.leon-source-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 310px), 1fr)); gap: 13px; min-width: 0; }
.leon-source-grid article, .leon-source-grid article > * { min-width: 0; overflow-wrap: anywhere; }
.leon-source-grid article { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(145px, .7fr) auto; gap: 14px; align-items: center; padding: 17px; border: 1px solid #dce2e8; border-radius: 12px; background: #fff; }
.leon-source-grid article.inactive { opacity: .58; background: #f4f5f6; }
.leon-source-grid article h4 { margin: 4px 0 6px; }
.leon-source-grid article > div > span { color: #758091; font-size: 11px; font-weight: 800; text-transform: uppercase; }
.leon-source-grid article a { display: block; overflow: hidden; color: #d8211a; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.leon-source-grid dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 8px; margin: 0; font-size: 12px; }
.leon-source-grid dt { color: #7b8592; }
.leon-source-grid dd { margin: 0; font-weight: 800; }
.leon-source-toggle { display: grid; justify-items: center; gap: 4px; color: #626e7c; font-size: 11px; font-weight: 800; }
.leon-source-toggle input { width: 20px; height: 20px; accent-color: #e5231b; }
.leon-history-layout { display: grid; grid-template-columns: minmax(280px, .65fr) minmax(0, 1.35fr); gap: 18px; align-items: start; }
.leon-history-layout > section { min-width: 0; }
.leon-admin-grid { display: grid; grid-template-columns: repeat(4, minmax(180px, 1fr)); gap: 12px; }
.leon-admin-grid article { display: grid; gap: 6px; padding: 18px; border: 1px solid #dce2e8; border-top: 3px solid #e5231b; border-radius: 10px; background: #fff; }
.leon-admin-grid span { color: #758091; font-size: 11px; font-weight: 800; text-transform: uppercase; }
.leon-admin-grid strong { font-size: 21px; }
.leon-admin-grid p { margin: 0; color: #687485; font-size: 12px; }
.leon-editor-dialog { max-width: min(820px, calc(100vw - 28px)); }
.compact-actions { flex-wrap: wrap; min-width: 190px; }

/* 0.10.1: readable workspaces and explicit connection/focus states. */
:where(button, a, input, select, textarea):focus-visible {
  outline: 3px solid #e5231b;
  outline-offset: 3px;
}
.workspace-status[data-connection="offline"] { border-color: #e5231b; background: #fff1ef; }
.workspace-status[data-connection="offline"] i { background: #e5231b; box-shadow: 0 0 0 4px #ffe1dd; }
.workspace-status[data-connection="offline"] span { color: #a52520; }
.nav-item { white-space: normal; height: auto; }
.offer-brand-banner { padding: 12px 18px; margin-bottom: 18px; border-radius: 12px; }
.offer-brand-banner img { height: 88px; width: auto; max-width: 110px; object-fit: contain; }
.offer-brand-banner span { min-width: 0; }
.offer-brand-banner small { max-width: 64ch; }
.data-table tbody tr:hover { background: #fff8f7; }
.data-table .money-cell { font-variant-numeric: tabular-nums; }
.service-row { grid-template-columns: repeat(4, minmax(0, 1fr)); position: relative; padding-top: 52px; }
.service-row > label { min-width: 0; }
.service-row .remove-service { position: absolute; top: 8px; right: 10px; }
.delivery-time-table { display: block; max-width: 100%; overflow-x: auto; }
@media (max-width: 720px) {
  .leon-source-grid { grid-template-columns: minmax(0, 1fr); }
  .leon-source-grid article { grid-template-columns: minmax(0, 1fr); }
  .workspace-toolbar { flex-wrap: wrap; }
  .workspace-status[data-connection="offline"] { display: grid; width: 100%; justify-items: start; min-width: 0; }
  .service-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .offer-brand-banner { gap: 12px; }
  .offer-brand-banner img { height: 72px; max-width: 76px; }
  .offer-brand-banner strong { font-size: 17px; }
  .offer-brand-banner small { font-size: 11px; }
}
@media (max-width: 1200px) { .leon-kpis { grid-template-columns: repeat(3, 1fr); } .leon-research-card { grid-template-columns: 1fr; } .leon-dashboard-grid, .leon-review-layout, .leon-history-layout { grid-template-columns: 1fr; } .leon-review-detail { position: static; } .leon-admin-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 720px) { .leon-shell-head, .leon-view-head { display: grid; } .leon-shell-head .customer-search { width: 100%; } .leon-subnav { margin-inline: -10px; border-radius: 0; } .leon-kpis, .leon-section-kpis { grid-template-columns: repeat(2, 1fr); } .leon-research-card { padding: 14px; } .leon-source-grid { grid-template-columns: 1fr; } .leon-source-grid article { grid-template-columns: 1fr; } .leon-source-toggle { grid-auto-flow: column; justify-content: start; align-items: center; } .leon-admin-grid { grid-template-columns: 1fr; } .leon-evidence-list { grid-template-columns: 1fr; } }
