:root {
  --bg: #08111f;
  --bg-2: #0b1323;
  --panel: #0f172a;
  --panel-2: #121b2d;
  --panel-3: #172338;
  --text: #e8eefc;
  --muted: #93a4bf;
  --line: #263246;
  --line-soft: rgba(148, 163, 184, .16);
  --blue: #3b82f6;
  --green: #22c55e;
  --orange: #f59e0b;
  --purple: #8b5cf6;
  --red: #ef4444;
  --surface-soft: rgba(15, 23, 42, .68);
  --surface-strong: rgba(15, 23, 42, .9);
  --shadow-soft: 0 10px 26px rgba(2, 6, 23, .22);
  --shadow-card: 0 12px 28px rgba(2, 6, 23, .26);
  --shadow: 0 18px 42px rgba(2, 6, 23, .34);
  --radius: 8px;
}

* { box-sizing: border-box; }
html {
  min-height: 100%;
  background: var(--panel);
}
body { min-height: 100vh; }
body {
  margin: 0;
  background: var(--panel);
  background-image: linear-gradient(180deg, rgba(59, 130, 246, .07), rgba(59, 130, 246, 0) 220px);
  background-attachment: fixed;
  background-repeat: no-repeat;
  background-size: 100% 360px;
  background-color: var(--panel);
  color: var(--text);
  font: 14px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
button, input, select, textarea { font: inherit; }
button {
  border: 1px solid rgba(96, 165, 250, .28);
  border-radius: var(--radius);
  padding: 9px 12px;
  background: linear-gradient(180deg, rgba(59,130,246,.96), rgba(37,99,235,.96));
  color: white;
  cursor: pointer;
  min-height: 36px;
  font-weight: 700;
}
button:hover { filter: brightness(1.07); }
button:disabled {
  opacity: .45;
  cursor: not-allowed;
}
button.secondary {
  background: rgba(30, 41, 59, .92);
  border-color: var(--line);
  color: var(--text);
}
button.danger {
  background: linear-gradient(180deg, rgba(239,68,68,.95), rgba(185,28,28,.95));
  border-color: rgba(248,113,113,.32);
}
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px 10px;
  background: rgba(15, 23, 42, .86);
  color: var(--text);
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: rgba(96, 165, 250, .86);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .14);
}
textarea { resize: vertical; }
label {
  display: block;
  margin: 10px 0 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}
.required-marker {
  color: #f87171;
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
}
h1, h2, h3 { margin: 0; }
.hidden { display: none !important; }

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(390px, 100%);
  background: linear-gradient(180deg, rgba(15,23,42,.97), rgba(15,23,42,.9));
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.login-mark, .brand-logo {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--blue), var(--green));
  color: white;
  font-weight: 900;
}
.login-card h1 {
  margin: 14px 0 4px;
  font-size: 24px;
}
.login-card p {
  margin: 0 0 14px;
  color: var(--muted);
}
.login-card button { width: 100%; margin-top: 14px; }
.error { min-height: 18px; color: #fca5a5; margin-top: 10px; }

.app {
  position: relative;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
}
.app::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 251px;
  width: 1px;
  min-height: 100%;
  background: rgba(148, 163, 184, .22);
  pointer-events: none;
  z-index: 4;
}
aside {
  position: sticky;
  top: 0;
  z-index: 5;
  height: 100vh;
  background:
    linear-gradient(180deg, rgba(8, 17, 31, .98), rgba(15, 23, 42, .94));
  color: white;
  padding: 16px 12px;
}
.brand {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 11px;
  align-items: center;
  border-bottom: 1px solid var(--line-soft);
  padding: 2px 4px 15px;
  margin-bottom: 12px;
}
.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  position: relative;
  background:
    linear-gradient(145deg, rgba(15, 23, 42, .94), rgba(30, 41, 59, .88));
  border: 1px solid rgba(125, 211, 252, .28);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 10px 22px rgba(2,6,23,.34);
}
.brand-logo::before {
  content: "";
  width: 19px;
  height: 14px;
  border: 2px solid #7dd3fc;
  border-radius: 3px 3px 10px 10px;
  border-top-color: #bfdbfe;
  box-shadow: 0 7px 0 -5px #22c55e;
}
.brand-logo::after {
  content: "";
  position: absolute;
  width: 7px;
  height: 7px;
  border: 2px solid #7dd3fc;
  border-left: 0;
  border-radius: 0 7px 7px 0;
  right: 7px;
  top: 15px;
}
.brand-copy {
  min-width: 0;
}
.brand strong,
.brand small,
.brand > span {
  display: block;
}
.brand strong {
  font-size: 16px;
  line-height: 1.1;
  font-weight: 850;
}
.brand small {
  color: #7dd3fc;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-top: 3px;
}
.brand > span {
  grid-column: 2;
  color: var(--muted);
  font-size: 11px;
  margin-top: -4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-group {
  --group-accent: #7dd3fc;
  --group-accent-rgb: 125, 211, 252;
  margin: 10px 0 12px;
  border: 1px solid rgba(var(--group-accent-rgb), .18);
  border-radius: 8px;
  padding: 6px;
  background: rgba(var(--group-accent-rgb), .045);
}
.nav-heading {
  margin: 2px 6px 6px;
  color: var(--group-accent);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.start-flow {
  --group-accent: #60a5fa;
  --group-accent-rgb: 96, 165, 250;
}
.primary-flow {
  --group-accent: #86efac;
  --group-accent-rgb: 34, 197, 94;
}
.stock-flow {
  --group-accent: #fbbf24;
  --group-accent-rgb: 245, 158, 11;
}
.economy-flow {
  --group-accent: #c084fc;
  --group-accent-rgb: 139, 92, 246;
}
.system-flow {
  --group-accent: #f87171;
  --group-accent-rgb: 239, 68, 68;
}
.nav, .logout {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  text-align: left;
  margin: 4px 0;
  background: transparent;
  border-color: transparent;
  color: #cbd5e1;
  min-height: 38px;
  text-decoration: none;
}
.nav-icon {
  width: 28px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(148, 163, 184, .2);
  border-radius: 6px;
  color: #9cc4ff;
  position: relative;
  flex: 0 0 auto;
}
.nav-group .nav-icon {
  color: var(--group-accent);
  border-color: rgba(var(--group-accent-rgb), .28);
  background: rgba(var(--group-accent-rgb), .055);
}
.nav-icon::before,
.nav-icon::after {
  content: "";
  position: absolute;
  box-sizing: border-box;
  border-color: currentColor;
}
.nav-icon-dashboard::before {
  width: 15px;
  height: 12px;
  border: 2px solid currentColor;
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
  border-bottom: 0;
  bottom: 5px;
}
.nav-icon-dashboard::after {
  width: 2px;
  height: 8px;
  background: currentColor;
  bottom: 5px;
  transform: rotate(42deg);
  transform-origin: bottom center;
}
.nav-icon-route::before {
  width: 16px;
  height: 12px;
  border: 2px solid currentColor;
  border-top: 0;
  border-left: 0;
  border-radius: 0 0 8px 0;
  transform: rotate(-10deg);
}
.nav-icon-route::after {
  width: 4px;
  height: 4px;
  background: currentColor;
  border-radius: 50%;
  box-shadow: -9px -5px 0 currentColor;
  right: 6px;
  bottom: 5px;
}
.nav-icon-todos::before {
  width: 15px;
  height: 16px;
  border: 2px solid currentColor;
  border-radius: 3px;
}
.nav-icon-todos::after {
  width: 9px;
  height: 5px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  top: 8px;
}
.nav-icon-leads::before {
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-radius: 50%;
}
.nav-icon-leads::after {
  width: 7px;
  height: 2px;
  background: currentColor;
  transform: rotate(45deg);
  right: 5px;
  bottom: 5px;
}
.nav-icon-customers::before {
  width: 7px;
  height: 7px;
  border: 2px solid currentColor;
  border-radius: 50%;
  top: 4px;
  left: 6px;
  box-shadow: 8px 2px 0 -1px currentColor;
}
.nav-icon-customers::after {
  width: 17px;
  height: 8px;
  border: 2px solid currentColor;
  border-radius: 9px 9px 2px 2px;
  bottom: 4px;
}
.nav-icon-intakes::before,
.nav-icon-invoices::before,
.nav-icon-contracts::before {
  width: 14px;
  height: 17px;
  border: 2px solid currentColor;
  border-radius: 2px;
}
.nav-icon-intakes::after {
  width: 8px;
  height: 2px;
  background: currentColor;
  box-shadow: 0 5px 0 currentColor;
}
.nav-icon-services::before {
  width: 16px;
  height: 4px;
  background: currentColor;
  border-radius: 3px;
  transform: rotate(-45deg);
}
.nav-icon-services::after {
  width: 6px;
  height: 6px;
  border: 2px solid currentColor;
  border-radius: 50%;
  right: 4px;
  top: 4px;
}
.nav-icon-contracts::after {
  width: 8px;
  height: 2px;
  background: currentColor;
  box-shadow: 0 4px 0 currentColor, 0 8px 0 currentColor;
}
.nav-icon-coffeePlans::before {
  width: 14px;
  height: 11px;
  border: 2px solid currentColor;
  border-radius: 2px 2px 8px 8px;
  bottom: 5px;
}
.nav-icon-coffeePlans::after {
  width: 6px;
  height: 6px;
  border: 2px solid currentColor;
  border-left: 0;
  border-radius: 0 6px 6px 0;
  right: 4px;
  bottom: 8px;
}
.nav-icon-items::before {
  width: 16px;
  height: 13px;
  border: 2px solid currentColor;
  border-radius: 2px;
  bottom: 4px;
}
.nav-icon-items::after {
  width: 16px;
  height: 2px;
  background: currentColor;
  top: 7px;
}
.nav-icon-sales::before {
  width: 16px;
  height: 11px;
  border: 2px solid currentColor;
  border-radius: 2px;
}
.nav-icon-sales::after {
  width: 12px;
  height: 2px;
  background: currentColor;
  top: 7px;
  box-shadow: 0 5px 0 currentColor;
}
.nav-icon-suppliers::before {
  width: 17px;
  height: 10px;
  border: 2px solid currentColor;
  border-radius: 2px;
  bottom: 6px;
}
.nav-icon-suppliers::after {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  bottom: 4px;
  box-shadow: 10px 0 0 currentColor;
}
.nav-icon-sellers::before {
  width: 8px;
  height: 8px;
  border: 2px solid currentColor;
  border-radius: 50%;
  top: 4px;
}
.nav-icon-sellers::after {
  width: 16px;
  height: 7px;
  border: 2px solid currentColor;
  border-radius: 9px 9px 2px 2px;
  bottom: 4px;
}
.nav-icon-invoices::after {
  width: 8px;
  height: 2px;
  background: currentColor;
  top: 7px;
  box-shadow: 0 5px 0 currentColor, 0 10px 0 currentColor;
}
.nav-icon-expenses::before {
  width: 15px;
  height: 15px;
  border: 2px solid currentColor;
  border-radius: 50%;
}
.nav-icon-expenses::after {
  width: 8px;
  height: 2px;
  background: currentColor;
  transform: rotate(-25deg);
}
.nav-icon-economy::before {
  width: 3px;
  height: 12px;
  background: currentColor;
  bottom: 5px;
  box-shadow: -6px 4px 0 currentColor, 6px -3px 0 currentColor;
}
.nav-icon-reports::before {
  width: 15px;
  height: 16px;
  border: 2px solid currentColor;
  border-radius: 2px;
}
.nav-icon-reports::after {
  width: 9px;
  height: 2px;
  background: currentColor;
  top: 8px;
  box-shadow: 0 5px 0 currentColor;
}
.nav-icon-admin::before {
  width: 14px;
  height: 14px;
  border: 3px dotted currentColor;
  border-radius: 50%;
}
.nav-icon-admin::after {
  width: 5px;
  height: 5px;
  border: 2px solid currentColor;
  border-radius: 50%;
}
.nav.active, .nav:hover, .logout:hover {
  background: rgba(var(--group-accent-rgb, 96, 165, 250), .13);
  border-color: rgba(var(--group-accent-rgb, 96, 165, 250), .32);
  color: white;
}
.nav.active .nav-icon {
  background: rgba(var(--group-accent-rgb, 96, 165, 250), .22);
  border-color: rgba(var(--group-accent-rgb, 96, 165, 250), .62);
}
.logout {
  margin-top: 18px;
  color: #fecaca;
}

main {
  min-width: 0;
  padding: 18px;
}
.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
  padding: 12px 18px;
  background: var(--surface-strong);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(12px);
}
.eyebrow {
  color: #93c5fd;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  margin-bottom: 3px;
}
header h1 { font-size: 24px; }
header p { margin: 2px 0 0; color: var(--muted); }
.grid { display: grid; gap: 12px; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.card {
  background:
    linear-gradient(180deg, rgba(18, 27, 45, .88), rgba(15, 23, 42, .82));
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow-card);
}
.card h2 {
  font-size: 16px;
  margin-bottom: 10px;
}
.kpi {
  position: relative;
  min-height: 104px;
  overflow: hidden;
}
.kpi::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg, var(--blue), var(--green));
}
.kpi .value {
  font-size: 30px;
  font-weight: 900;
  margin-top: 8px;
}
.admin-kpis,
.warehouse-kpis {
  gap: 8px;
}
.admin-kpis .kpi,
.warehouse-kpis .kpi {
  min-height: 72px;
  padding: 10px 12px;
}
.admin-kpis .kpi .value,
.warehouse-kpis .kpi .value {
  font-size: 21px;
  margin-top: 3px;
}
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  align-items: center;
}
.toolbar input { max-width: 420px; }
.toolbar select { max-width: 190px; }
.toolbar-count {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  padding: 0 4px;
}
.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 400px);
  gap: 14px;
  align-items: start;
}
.table-card {
  overflow: auto;
  border-radius: 10px;
  border: 1px solid var(--line-soft);
  background: rgba(15, 23, 42, .76);
}
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}
th, td {
  border-bottom: 1px solid rgba(148, 163, 184, .12);
  padding: 10px 11px;
  text-align: left;
  vertical-align: top;
}
th {
  color: #9fb0cc;
  font-size: 11px;
  text-transform: uppercase;
  background: rgba(18, 27, 45, .92);
  position: sticky;
  top: 0;
  z-index: 1;
}
td { color: #dce6f7; }
tr:hover td { background: rgba(59, 130, 246, .08); }
.status-row.urgent td { background: rgba(239, 68, 68, .055); }
.status-row.waiting td { background: rgba(245, 158, 11, .05); }
.status-row.done td { opacity: .78; }
.row-actions {
  display: flex;
  gap: 6px;
}
.row-actions button { padding: 5px 8px; min-height: 30px; }
.row-actions-mini {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  flex-wrap: wrap;
  white-space: nowrap;
}
.row-actions-mini button {
  padding: 4px 7px;
  min-height: 28px;
  font-size: 12px;
}
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.tag-chip {
  border: 1px solid rgba(148, 163, 184, .18);
  border-radius: 999px;
  padding: 3px 8px;
  background: rgba(15, 23, 42, .65);
  color: #bfdbfe;
  font-size: 11px;
  font-weight: 800;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 10px;
}
.form-grid .wide { grid-column: 1 / -1; }
.form-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.parts-hint {
  white-space: pre-line;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 9px;
  margin-top: 10px;
  background: rgba(18, 27, 45, .55);
}
.muted { color: var(--muted); }
.customer-workspace {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
.customer-sidebar {
  position: sticky;
  top: 18px;
  max-height: calc(100vh - 36px);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}
.customer-tools {
  display: grid;
  gap: 8px;
}
.filter-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}
.filter-grid label {
  margin: 0;
}
.customer-list {
  overflow: auto;
  display: grid;
  gap: 9px;
  margin-top: 12px;
  padding-right: 5px;
}
.customer-list-item {
  display: grid;
  gap: 6px;
  text-align: left;
  background: rgba(18, 27, 45, .78);
  border-color: var(--line-soft);
  padding: 12px;
  min-height: 92px;
  align-content: center;
  line-height: 1.25;
}
.customer-list-item.active {
  border-color: rgba(34, 197, 94, .55);
  background: rgba(34, 197, 94, .12);
}
.customer-list-item:hover {
  border-color: rgba(96, 165, 250, .45);
  background: rgba(59, 130, 246, .12);
}
.customer-name {
  color: white;
  font-size: 14px;
  font-weight: 900;
  overflow-wrap: anywhere;
}
.customer-contact {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}
.customer-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.customer-meta span {
  border: 1px solid rgba(148, 163, 184, .16);
  border-radius: 999px;
  padding: 2px 7px;
  color: #bfdbfe;
  background: rgba(15, 23, 42, .55);
  font-size: 11px;
  font-weight: 800;
}
.customer-main {
  display: grid;
  gap: 12px;
}
.customer-hero {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  background:
    linear-gradient(135deg, rgba(59, 130, 246, .16), transparent 42%),
    linear-gradient(180deg, rgba(15, 23, 42, .94), rgba(18, 27, 45, .86));
}
.customer-hero h2 {
  font-size: 26px;
}
.customer-hero p {
  margin: 4px 0 0;
}
.form-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 14px;
}
.form-head h2 {
  margin: 2px 0 4px;
}
.form-head p {
  margin: 0;
}
.form-section-title {
  color: #dbeafe;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .04em;
  text-transform: uppercase;
  margin: 18px 0 8px;
}
.customer-card-form {
  display: grid;
  gap: 4px;
}
.machine-editor {
  display: grid;
  gap: 10px;
}
.machine-edit-row {
  display: grid;
  grid-template-columns: minmax(190px, 1.3fr) minmax(140px, .9fr) minmax(140px, .8fr);
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(18, 27, 45, .78);
}
.machine-edit-row .wide {
  grid-column: 1 / -1;
}
.quote-line-editor {
  display: grid;
  gap: 10px;
}
.quote-line-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(90px, .32fr) minmax(110px, .4fr);
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(18, 27, 45, .78);
}
.quote-line-row .wide {
  min-width: 0;
}
.quote-table th,
.quote-table td {
  text-align: left;
}
.service-parts-panel {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}
.service-parts-card {
  margin-top: 14px;
  display: grid;
  gap: 10px;
}
.service-parts-search-results,
.service-parts-selected {
  display: grid;
  gap: 8px;
}
.service-part-result,
.service-part-line {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(18, 27, 45, .78);
}
.service-part-result.empty {
  opacity: .55;
}
.service-part-result-main,
.service-part-line-main {
  display: grid;
  gap: 2px;
}
.service-part-result-main span,
.service-part-line-main span {
  color: var(--muted);
  font-size: 12px;
}
.service-part-result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: #bfdbfe;
  font-size: 11px;
  font-weight: 800;
}
.service-part-result-actions,
.service-part-line-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.service-part-result-actions input,
.service-part-line-actions input {
  width: 88px;
}
.service-parts-total {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--line-soft);
  color: #e2e8f0;
  font-weight: 800;
}
.customer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}
.customer-kpis {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
.customer-sections {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.machine-grid {
  display: grid;
  gap: 8px;
}
.machine-card {
  display: grid;
  gap: 2px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 9px;
  background: rgba(18, 27, 45, .65);
}
.machine-card span,
.machine-card small {
  color: var(--muted);
}
.compact-table {
  min-width: 0;
  border: 0;
}
.compact-table td {
  padding: 7px 6px;
}
.compact-table .date-cell {
  white-space: nowrap;
}
.intake-workspace {
  display: grid;
  grid-template-columns: 390px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
.intake-board {
  position: sticky;
  top: 18px;
  max-height: calc(100vh - 36px);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}
.intake-toolbar {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}
.intake-toolbar input,
.intake-toolbar select {
  max-width: none;
}
.intake-list {
  overflow: auto;
  display: grid;
  gap: 9px;
  padding-right: 5px;
}
.intake-list-item {
  display: grid;
  gap: 6px;
  min-height: 96px;
  padding: 12px;
  text-align: left;
  background: rgba(18, 27, 45, .78);
  border-color: var(--line-soft);
}
.intake-list-item.active {
  border-color: rgba(34, 197, 94, .55);
  background: rgba(34, 197, 94, .12);
}
.intake-list-item:hover {
  border-color: rgba(96, 165, 250, .45);
  background: rgba(59, 130, 246, .12);
}
.service-list-item.active {
  border-color: rgba(96, 165, 250, .58);
  background: rgba(59, 130, 246, .14);
}
.service-order-panel {
  border-color: rgba(96, 165, 250, .26);
}
.warehouse-workspace {
  display: grid;
  grid-template-columns: minmax(480px, 540px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
.warehouse-board {
  position: sticky;
  top: 18px;
  max-height: calc(100vh - 36px);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
}
.warehouse-kpis {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 10px;
}
.warehouse-list {
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 8px;
  padding-right: 5px;
}
.warehouse-list-item {
  display: grid;
  gap: 5px;
  min-height: 82px;
  padding: 9px;
  text-align: left;
  background: rgba(18, 27, 45, .78);
  border-color: var(--line-soft);
  line-height: 1.2;
}
.warehouse-list-item.active {
  border-color: rgba(34, 197, 94, .55);
  background: rgba(34, 197, 94, .12);
}
.warehouse-list-item:hover {
  border-color: rgba(96, 165, 250, .45);
  background: rgba(59, 130, 246, .12);
}
.warehouse-main {
  display: grid;
  gap: 12px;
}
.warehouse-detail-grid,
.report-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
  gap: 14px;
  align-items: start;
}
.warehouse-workspace button {
  min-height: 32px;
  padding: 6px 9px;
}
.warehouse-workspace .form-actions button,
.warehouse-workspace .customer-actions button {
  min-height: 34px;
}
.stock-badge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  border: 1px solid var(--line-soft);
}
.stock-badge.ok {
  background: rgba(34, 197, 94, .15);
  color: #86efac;
  border-color: rgba(34, 197, 94, .36);
}
.stock-badge.low {
  background: rgba(245, 158, 11, .16);
  color: #fcd34d;
  border-color: rgba(245, 158, 11, .38);
}
.stock-badge.out {
  background: rgba(239, 68, 68, .15);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, .36);
}
.intake-main {
  display: grid;
  gap: 12px;
}
.intake-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}
.intake-header h2 {
  font-size: 25px;
}
.intake-header p {
  margin: 4px 0 0;
  color: var(--muted);
}
.intake-checklist {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
  gap: 8px;
  margin-top: 12px;
}
.intake-check {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 9px;
  background: rgba(18, 27, 45, .7);
}
.intake-check strong {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
}
.intake-check.ok strong { color: #86efac; }
.intake-check.missing strong { color: #fca5a5; }
.intake-check span {
  color: var(--muted);
}
.intake-doc-box {
  margin-bottom: 8mm;
}
.intake-doc-box table th {
  width: 36%;
}
.pill {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 8px;
  background: rgba(34, 197, 94, .12);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, .18);
  font-size: 12px;
}
.status-badge,
.priority-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 12px;
  font-weight: 900;
  border: 1px solid transparent;
  white-space: nowrap;
}
.status-badge::before,
.priority-badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  margin-right: 7px;
  background: currentColor;
}
.status-badge.urgent,
.priority-badge.urgent {
  color: #fecaca;
  background: rgba(239, 68, 68, .14);
  border-color: rgba(248, 113, 113, .26);
}
.status-badge.active,
.priority-badge.active {
  color: #93c5fd;
  background: rgba(59, 130, 246, .14);
  border-color: rgba(96, 165, 250, .26);
}
.status-badge.waiting,
.priority-badge.waiting {
  color: #fde68a;
  background: rgba(245, 158, 11, .14);
  border-color: rgba(251, 191, 36, .26);
}
.status-badge.done,
.priority-badge.done {
  color: #86efac;
  background: rgba(34, 197, 94, .14);
  border-color: rgba(74, 222, 128, .26);
}
.status-badge.neutral,
.priority-badge.neutral {
  color: #cbd5e1;
  background: rgba(148, 163, 184, .12);
  border-color: rgba(148, 163, 184, .2);
}
.date-cell {
  color: #bfdbfe;
  font-weight: 800;
  white-space: nowrap;
}
.pos-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(340px, .75fr);
  gap: 14px;
  align-items: start;
}
.pos-item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.pos-item {
  display: grid;
  gap: 3px;
  text-align: left;
  min-height: 92px;
  background: rgba(18, 27, 45, .92);
  border-color: var(--line-soft);
}
.pos-item strong {
  color: white;
}
.pos-item span {
  color: var(--muted);
  font-size: 12px;
}
.pos-item.empty {
  background: rgba(30, 41, 59, .66);
}
.pos-pay-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 8px;
}
.pos-cart-lines {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}
.pos-cart-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 9px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(18, 27, 45, .72);
}
.pos-cart-line span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}
.pos-line-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}
.pos-line-actions button {
  min-height: 30px;
  padding: 4px 8px;
}
.pos-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}
.pos-total strong {
  font-size: 22px;
}
.warn { color: var(--orange); font-weight: 800; }
.mt-md { margin-top: 12px; }
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}
.tab-btn {
  min-height: 34px;
  padding: 7px 11px;
  background: rgba(30, 41, 59, .9);
  border-color: var(--line);
  color: var(--text);
}
.tab-btn.active {
  background: rgba(59, 130, 246, .24);
  border-color: rgba(96, 165, 250, .58);
}
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.detail-grid div {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 9px;
  background: rgba(18, 27, 45, .62);
}
.detail-grid span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}
.detail-grid strong {
  display: block;
  margin-top: 3px;
  overflow-wrap: anywhere;
}
.pos-history-card,
.report-toolbar {
  margin-top: 14px;
}
.admin-notice {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  margin: 0 0 14px;
  padding: 11px 12px;
  border: 1px solid rgba(245, 158, 11, .35);
  border-radius: 8px;
  background: rgba(245, 158, 11, .1);
  color: #fde68a;
}
.admin-notice span {
  color: #f8e7bb;
}
.admin-users-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(390px, 480px);
  gap: 14px;
  align-items: start;
}
.admin-users-layout > *,
.warehouse-detail-grid > *,
.report-grid > *,
.split > *,
.pos-layout > * {
  min-width: 0;
}
.section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  margin-bottom: 10px;
}
.section-head p {
  margin: 3px 0 0;
}
.admin-user-table table {
  min-width: 620px;
}
.role-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 2px 9px;
  border: 1px solid rgba(96, 165, 250, .28);
  background: rgba(59, 130, 246, .12);
  color: #bfdbfe;
  font-size: 12px;
  font-weight: 900;
}
.maintenance-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}
.permission-grid {
  display: block;
  margin-top: 12px;
}
.permission-matrix-wrap {
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(18, 27, 45, .5);
}
.permission-matrix {
  min-width: 720px;
  border: 0;
}
.permission-matrix th,
.permission-matrix td {
  padding: 7px 8px;
  text-align: center;
}
.permission-matrix th:first-child,
.permission-matrix td:first-child {
  text-align: left;
  position: sticky;
  left: 0;
  background: rgba(18, 27, 45, .98);
  z-index: 2;
}
.permission-matrix input {
  width: 16px;
  height: 16px;
  accent-color: var(--green);
}
label.check {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 5px 0;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  text-transform: none;
}
label.check input {
  width: auto;
}
.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: #101a2d;
  border: 1px solid var(--line-soft);
  box-shadow: var(--shadow);
  color: white;
  padding: 10px 12px;
  border-radius: 8px;
}
@media (max-width: 980px) {
  .app {
    grid-template-columns: 1fr;
  }
  .app::before { display: none; }
  aside {
    position: sticky;
    top: 0;
    z-index: 10;
    height: auto;
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    align-items: center;
    overflow-x: auto;
    padding: 8px;
  }
  .brand {
    width: auto;
    min-width: 200px;
    border-bottom: 0;
    padding: 0;
    margin: 0 8px 0 0;
  }
  .brand-logo {
    width: 34px;
    height: 34px;
    border-radius: 8px;
  }
  .brand-logo::before {
    width: 16px;
    height: 12px;
  }
  .brand-logo::after {
    right: 5px;
    top: 12px;
  }
  .brand strong { font-size: 14px; }
  .brand small { font-size: 9px; }
  .brand > span { font-size: 10px; }
  .nav-group {
    display: flex;
    gap: 6px;
    margin: 0;
    padding: 3px;
    border-radius: 8px;
    flex: 0 0 auto;
  }
  .nav-heading { display: none; }
  .primary-flow {
    border: 1px solid rgba(var(--group-accent-rgb), .18);
    padding: 3px;
    background: rgba(var(--group-accent-rgb), .045);
  }
  .nav, .logout {
    width: auto;
    min-height: 34px;
    margin: 0;
    padding: 6px 9px;
    white-space: nowrap;
    flex: 0 0 auto;
  }
  .nav-icon {
    width: 24px;
    height: 22px;
  }
  .split { grid-template-columns: 1fr; }
  .admin-users-layout { grid-template-columns: 1fr; }
  .warehouse-detail-grid,
  .report-grid { grid-template-columns: 1fr; }
  .admin-notice { grid-template-columns: 1fr; }
  .pos-layout { grid-template-columns: 1fr; }
  .customer-workspace { grid-template-columns: 1fr; }
  .customer-sidebar { position: static; max-height: none; }
  .customer-sections { grid-template-columns: 1fr; }
  .warehouse-workspace { grid-template-columns: 1fr; }
  .warehouse-board { position: static; max-height: none; }
  .form-head { display: grid; }
  .form-head .customer-actions { justify-content: flex-start; }
  .machine-edit-row { grid-template-columns: 1fr; }
  .intake-workspace { grid-template-columns: 1fr; }
  .intake-board { position: static; max-height: none; }
  .form-grid { grid-template-columns: 1fr; }
  main { padding: 12px; }
  .topbar { align-items: flex-start; }
}
@media (max-width: 620px) {
  body { font-size: 13px; }
  aside {
    align-items: stretch;
  }
  .brand {
    min-width: 150px;
    grid-template-columns: 34px 1fr;
  }
  .nav, .logout {
    font-size: 12px;
    gap: 5px;
  }
  .nav-icon {
    display: none;
  }
  main { padding: 10px; }
  .topbar {
    display: grid;
    padding: 12px;
  }
  header h1 { font-size: 21px; }
  table { min-width: 620px; }
  .admin-user-table table,
  .permission-matrix { min-width: 560px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi { min-height: 76px; padding: 10px; }
  .kpi .value { font-size: 22px; }
  .detail-grid,
  .maintenance-grid,
  .pos-pay-buttons { grid-template-columns: 1fr; }
  .section-head {
    display: grid;
  }
}
