:root {
  --bg: #eef3f7;
  --surface: #ffffff;
  --surface-soft: #eef2f7;
  --ink: #101828;
  --muted: #667085;
  --line: #d6dce6;
  --navy: #202a62;
  --navy-2: #151b40;
  --red: #cf1f3d;
  --red-soft: #f8dfe5;
  --blue: #2358a6;
  --blue-soft: #dfeafa;
  --teal: #08766f;
  --teal-soft: #d8f0ed;
  --amber: #a96300;
  --amber-soft: #f6ead5;
  --green: #287a42;
  --green-soft: #def1e5;
  --purple: #635b9f;
  --purple-soft: #e7e4f6;
  --shadow: 0 14px 32px rgba(16, 24, 40, 0.08);
  --shadow-soft: 0 6px 18px rgba(16, 24, 40, 0.06);
  --focus: 0 0 0 3px rgba(35, 88, 166, 0.16);
  --radius: 8px;
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-width: 320px;
  background-color: var(--bg);
  background-image:
    linear-gradient(135deg, rgba(255, 255, 255, 0.72), rgba(235, 241, 248, 0.88)),
    repeating-linear-gradient(90deg, rgba(32, 42, 98, 0.05) 0 1px, transparent 1px 48px),
    repeating-linear-gradient(0deg, rgba(8, 118, 111, 0.035) 0 1px, transparent 1px 48px),
    linear-gradient(116deg, transparent 0 68%, rgba(207, 31, 61, 0.045) 68% 68.35%, transparent 68.35% 100%),
    linear-gradient(24deg, transparent 0 56%, rgba(169, 99, 0, 0.045) 56% 56.3%, transparent 56.3% 100%);
  background-attachment: fixed;
  background-size: auto, 48px 48px, 48px 48px, 320px 320px, 420px 420px;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

[hidden] { display: none !important; }

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
  transform: none !important;
}

body.is-widget-dragging {
  cursor: grabbing;
  overscroll-behavior: contain;
  touch-action: none;
  user-select: none;
}

body.is-widget-dragging * {
  cursor: grabbing !important;
}

.login-screen {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background-color: #eaf0f7;
  background-image:
    linear-gradient(135deg, rgba(248, 251, 254, 0.92), rgba(219, 228, 239, 0.9)),
    repeating-linear-gradient(90deg, rgba(32, 42, 98, 0.09) 0 1px, transparent 1px 72px),
    repeating-linear-gradient(0deg, rgba(32, 42, 98, 0.06) 0 1px, transparent 1px 72px),
    repeating-linear-gradient(135deg, transparent 0 42px, rgba(207, 31, 61, 0.07) 42px 43px, transparent 43px 96px);
  background-size: auto, 72px 72px, 72px 72px, 160px 160px;
}

.login-screen::before {
  content: "";
  position: absolute;
  inset: -20%;
  z-index: -1;
  background:
    linear-gradient(118deg, transparent 0 42%, rgba(32, 42, 98, 0.08) 42% 42.4%, transparent 42.4% 100%),
    linear-gradient(62deg, transparent 0 62%, rgba(207, 31, 61, 0.06) 62% 62.4%, transparent 62.4% 100%);
  transform: rotate(-4deg);
}

.login-panel {
  position: relative;
  z-index: 1;
  width: min(920px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.92fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.startup-panel {
  display: grid;
  justify-items: center;
  gap: 18px;
  padding: 32px;
  color: var(--muted);
  font-weight: 800;
}

.startup-panel img {
  width: min(280px, 70vw);
  height: auto;
}

.timeout-panel {
  position: relative;
  z-index: 1;
  width: min(760px, 100%);
  display: grid;
  grid-template-columns: minmax(220px, 0.85fr) minmax(320px, 1.15fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.timeout-brand {
  display: grid;
  place-items: center;
  min-height: 380px;
  padding: 34px;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(241, 246, 252, 0.96)),
    repeating-linear-gradient(135deg, rgba(32, 42, 98, 0.07) 0 1px, transparent 1px 24px);
}

.timeout-brand img {
  width: min(320px, 100%);
  height: auto;
}

.timeout-copy {
  display: grid;
  align-content: center;
  gap: 14px;
  padding: 38px;
}

.timeout-icon {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: var(--radius);
  background: var(--amber-soft);
  color: var(--amber);
}

.timeout-icon svg {
  width: 23px;
  height: 23px;
}

.timeout-copy h1 {
  margin: 0;
  font-size: 2rem;
  line-height: 1.08;
}

.timeout-copy p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.timeout-details {
  display: grid;
  gap: 10px;
  margin: 8px 0 2px;
}

.timeout-details div {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 10px;
  align-items: baseline;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.timeout-details dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.timeout-details dd {
  margin: 0;
  font-weight: 800;
}

.timeout-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

.login-brand {
  display: grid;
  align-content: center;
  gap: 18px;
  min-height: 480px;
  padding: 38px;
  border-right: 1px solid var(--line);
  background: #ffffff;
}

.login-brand img {
  width: min(420px, 100%);
  height: auto;
}

.login-brand p {
  max-width: 420px;
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.login-form {
  display: grid;
  align-content: center;
  gap: 16px;
  padding: 38px;
}

.mobile-api-settings {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid #ccd6e4;
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(242, 246, 251, 0.96)),
    repeating-linear-gradient(135deg, rgba(35, 88, 166, 0.06) 0 1px, transparent 1px 20px);
}

.mobile-api-head {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.mobile-api-head strong {
  display: block;
  margin-bottom: 2px;
  font-size: 0.88rem;
}

.mobile-api-head small {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}

.mobile-api-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: var(--radius);
  background: var(--blue-soft);
  color: var(--blue);
}

.mobile-api-icon svg {
  width: 18px;
  height: 18px;
}

.mobile-api-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
  white-space: nowrap;
}

.mobile-api-field {
  gap: 6px;
}

.mobile-api-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.mobile-api-row input {
  min-width: 0;
  width: 100%;
}

.mobile-api-settings .ghost-button {
  justify-self: start;
  min-height: 32px;
  padding: 0;
  color: var(--blue);
  font-size: 0.8rem;
  font-weight: 850;
}

.login-note {
  margin: 2px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.86rem;
}

.login-legal-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.login-legal-links button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfe;
  color: var(--navy);
  font-size: 0.78rem;
  font-weight: 900;
}

.login-legal-links button:hover,
.login-legal-links button:focus-visible {
  border-color: rgba(35, 88, 166, 0.34);
  background: var(--blue-soft);
  color: var(--blue);
  outline: none;
  box-shadow: var(--focus);
}

.login-legal-links svg {
  width: 16px;
  height: 16px;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 18px;
  background: var(--navy-2);
  color: #ffffff;
}

.brand {
  display: grid;
  place-items: center start;
  min-height: 76px;
  padding: 10px;
  border-radius: var(--radius);
  background: #ffffff;
}

.brand img {
  max-width: 190px;
  width: 100%;
  height: auto;
}

.nav-list { display: grid; gap: 6px; }

.nav-item {
  display: grid;
  grid-template-columns: 22px 1fr;
  align-items: center;
  min-height: 42px;
  gap: 10px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: #d7dcea;
  text-align: left;
  transition: background 140ms ease, color 140ms ease, transform 140ms ease;
}

.nav-item span {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.nav-item strong,
.nav-item small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-item strong { font-size: 0.9rem; }

.nav-item small {
  color: #aeb8d8;
  font-size: 0.69rem;
  font-weight: 800;
  text-transform: uppercase;
}

.nav-item:hover,
.nav-item:focus-visible,
.nav-item.is-active {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  outline: none;
}

.nav-item:hover,
.nav-item:focus-visible {
  transform: translateX(2px);
}

.nav-item svg,
.icon-button svg,
.primary-button svg,
.secondary-button svg,
.ghost-button svg,
.search-box svg,
.metric-icon svg,
.empty-state svg,
.widget-control svg,
.drag-handle svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

.sidebar-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
}

.workspace {
  position: relative;
  min-width: 0;
  padding: 24px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 68px;
  margin: -10px -4px 18px;
  padding: 10px 4px 14px;
  background:
    linear-gradient(90deg, rgba(248, 250, 253, 0.92), rgba(239, 246, 248, 0.86)),
    repeating-linear-gradient(90deg, rgba(32, 42, 98, 0.055) 0 1px, transparent 1px 32px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(214, 220, 230, 0.72);
}

.topbar-controls,
.toolbar,
.toolbar-group,
.form-actions,
.row-actions,
.inline-actions,
.widget-actions,
.part-actions,
.timer-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-controls {
  justify-content: flex-end;
  flex-wrap: wrap;
  row-gap: 8px;
}

.live-summary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 24px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.live-summary strong,
.live-pill {
  color: var(--ink);
}

.live-pulse-dot {
  position: relative;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(40, 122, 66, 0.14);
}

.live-pulse-dot::after {
  content: "";
  position: absolute;
  inset: -7px;
  border: 1px solid rgba(40, 122, 66, 0.34);
  border-radius: inherit;
  animation: livePulse 1.8s ease-out infinite;
}

.live-clock {
  min-width: 142px;
  justify-content: center;
  border-color: #b9dcc4;
  background: var(--green-soft);
  color: var(--green);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 2.12rem;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 12px;
  font-size: 1.06rem;
}

h3 {
  margin-bottom: 6px;
  font-size: 0.96rem;
}

.search-box {
  display: grid;
  grid-template-columns: 18px minmax(150px, 240px);
  align-items: center;
  gap: 9px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
}

.search-box input {
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.field { display: grid; gap: 7px; }

.field span,
.field label,
.field-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.field input,
.field select,
.field textarea,
.filter-select {
  min-height: 40px;
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.filter-select:focus,
.search-box:focus-within {
  border-color: #8ca6cf;
  box-shadow: var(--focus);
  outline: none;
}

.field textarea {
  min-height: 96px;
  resize: vertical;
}

.primary-button,
.secondary-button,
.ghost-button,
.icon-button,
.mini-button,
.widget-control {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

.primary-button {
  padding: 0 14px;
  background: var(--navy);
  color: #ffffff;
}

.primary-button:hover,
.primary-button:focus-visible { background: #141a49; }

.secondary-button {
  padding: 0 13px;
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}

.ghost-button {
  padding: 0 10px;
  background: transparent;
  color: var(--navy);
}

.icon-button,
.widget-control {
  width: 38px;
  height: 38px;
  padding: 0;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.workspace .icon-button,
.workspace-only,
.widget-control {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}

.mini-button {
  min-height: 31px;
  padding: 0 10px;
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 800;
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.icon-button:hover,
.mini-button:hover,
.widget-control:hover,
.primary-button:focus-visible,
.secondary-button:focus-visible,
.ghost-button:focus-visible,
.icon-button:focus-visible,
.mini-button:focus-visible,
.widget-control:focus-visible {
  transform: translateY(-1px);
  outline: none;
}

.secondary-button:hover,
.secondary-button:focus-visible,
.workspace .icon-button:hover,
.workspace .icon-button:focus-visible,
.mini-button:hover,
.mini-button:focus-visible,
.widget-control:hover,
.widget-control:focus-visible { border-color: #aab4c2; }

.danger { color: #ffdce3; }
.workspace .danger, .danger-text { color: var(--red); }

.user-pill,
.badge,
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.user-pill {
  min-height: 38px;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

.current-user-copy {
  display: grid;
  gap: 1px;
  text-align: left;
}

.current-user-copy strong,
.current-user-copy small {
  max-width: 230px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.current-user-copy small {
  color: var(--muted);
  font-size: 0.68rem;
  text-transform: uppercase;
}

.status-pill {
  min-height: 38px;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
}

.status-pill svg {
  width: 16px;
  height: 16px;
}

.status-pill.online {
  border-color: #b9dcc4;
  background: var(--green-soft);
  color: var(--green);
}

.status-pill.warning {
  border-color: #efc781;
  background: var(--amber-soft);
  color: var(--amber);
}

.status-pill.offline {
  border-color: #efb2bf;
  background: var(--red-soft);
  color: var(--red);
}

.status-pill.saving,
.status-pill.muted {
  background: var(--surface);
  color: var(--muted);
}

.status-pill.green {
  border-color: #b9dcc4;
  background: var(--green-soft);
  color: var(--green);
}

.status-pill.blue {
  border-color: #c1d9f5;
  background: var(--blue-soft);
  color: var(--blue);
}

.status-pill.amber {
  border-color: #efc781;
  background: var(--amber-soft);
  color: var(--amber);
}

.status-pill.red {
  border-color: #efb2bf;
  background: var(--red-soft);
  color: var(--red);
}

.status-pill.saving svg {
  animation: spin 900ms linear infinite;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--muted);
  box-shadow: 0 0 0 4px rgba(102, 112, 133, 0.1);
}

.status-dot.online { background: var(--green); box-shadow: 0 0 0 4px rgba(40, 122, 66, 0.12); }
.status-dot.warning { background: var(--amber); box-shadow: 0 0 0 4px rgba(169, 99, 0, 0.12); }
.status-dot.offline { background: var(--red); box-shadow: 0 0 0 4px rgba(207, 31, 61, 0.12); }
.status-dot.muted { background: #aeb8c7; box-shadow: 0 0 0 4px rgba(102, 112, 133, 0.1); }

.badge.navy { background: #e1e6fb; color: var(--navy); }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.blue { background: var(--blue-soft); color: var(--blue); }
.badge.teal { background: var(--teal-soft); color: var(--teal); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.purple { background: var(--purple-soft); color: var(--purple); }

.view-region {
  display: grid;
  gap: 18px;
  animation: fadeIn 140ms ease;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(170px, 1fr));
  gap: 14px;
}

.metric-card,
.panel,
.widget,
.floor-column,
.part-card,
.empty-state,
.clock-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.metric-card {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  align-items: center;
  min-height: 112px;
  padding: 18px;
}

.detail-clickable {
  cursor: pointer;
}

.detail-clickable:hover,
.detail-clickable:focus-visible {
  border-color: #aab4c2;
  box-shadow: var(--shadow);
  outline: none;
}

tbody tr:has([data-open-record]) {
  cursor: pointer;
}

tbody tr:has([data-open-record]):focus-within,
tbody tr:has([data-open-record]):hover {
  background: #eef4fb;
}

.metric-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: var(--radius);
}

.metric-icon.navy { background: #e1e6fb; color: var(--navy); }
.metric-icon.red { background: var(--red-soft); color: var(--red); }
.metric-icon.teal { background: var(--teal-soft); color: var(--teal); }
.metric-icon.amber { background: var(--amber-soft); color: var(--amber); }
.metric-icon.green { background: var(--green-soft); color: var(--green); }
.metric-icon.blue { background: var(--blue-soft); color: var(--blue); }
.metric-icon.purple { background: var(--purple-soft); color: var(--purple); }

.metric-label {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.metric-value {
  margin: 0;
  font-size: 1.48rem;
  font-weight: 900;
  letter-spacing: 0;
}

.metric-sub {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.shift-stat {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  align-items: center;
  min-width: 0;
}

.toolbar {
  justify-content: space-between;
  flex-wrap: wrap;
}

.toolbar-group { flex-wrap: wrap; }

.panel {
  min-width: 0;
  padding: 18px;
}

.panel-header,
.table-head,
.widget-header,
.clock-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.panel-header p,
.table-head p,
.widget-header p,
.clock-card-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

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

.access-command-panel {
  display: grid;
  grid-template-columns: minmax(280px, 1.1fr) minmax(260px, 0.9fr);
  gap: 14px;
  align-items: stretch;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.97), rgba(244, 247, 252, 0.97)),
    repeating-linear-gradient(135deg, rgba(32, 42, 98, 0.06) 0 1px, transparent 1px 18px);
  box-shadow: var(--shadow-soft);
}

.access-command-main {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 13px;
  min-width: 0;
}

.access-command-main h2 {
  margin-bottom: 6px;
  font-size: 1.24rem;
}

.access-command-main p:not(.eyebrow),
.access-group-card p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.45;
}

.access-chip-row,
.access-scope-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.access-command-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.quick-tile {
  display: grid;
  grid-template-columns: 20px 1fr;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  font-weight: 850;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.quick-tile:hover,
.quick-tile:focus-visible {
  border-color: #aab4c2;
  box-shadow: var(--shadow-soft);
  outline: none;
  transform: translateY(-1px);
}

.quick-tile svg,
.access-scope-list svg {
  width: 18px;
  height: 18px;
}

.access-scope-list {
  grid-column: 1 / -1;
  margin-top: 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.access-scope-list span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.access-scope-list svg {
  color: var(--green);
}

.dashboard-grid.is-dashboard-editing {
  align-items: start;
}

.dashboard-grid.is-dashboard-editing .widget.is-draggable {
  border-color: rgba(35, 88, 166, 0.34);
  outline: 1px dashed rgba(35, 88, 166, 0.26);
  outline-offset: 4px;
}

.dashboard-grid.is-reordering {
  touch-action: none;
  user-select: none;
}

.dashboard-grid.is-drag-outside {
  outline: 2px dashed rgba(207, 31, 61, 0.52);
  outline-offset: 6px;
}

.dashboard-grid.is-reordering .widget {
  border-color: rgba(35, 88, 166, 0.44);
  outline: 1px solid rgba(35, 88, 166, 0.24);
  outline-offset: 4px;
}

.dashboard-grid.is-reordering .widget:not(.is-dragging) {
  transition: border-color 0.12s ease, transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease, outline-color 0.12s ease;
}

.widget {
  position: relative;
  grid-column: span 4;
  min-width: 0;
  padding: 16px;
  transition: transform 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease, outline-color 0.16s ease;
  contain: layout paint;
}

.widget:hover,
.panel:hover,
.metric-card:hover,
.module-card:hover,
.part-card:hover {
  box-shadow: var(--shadow);
}

.widget.large { grid-column: span 8; }
.widget.full { grid-column: 1 / -1; }
.widget-header h2 { margin-bottom: 0; }

.widget-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.widget-control {
  width: 32px;
  height: 32px;
  min-height: 32px;
}

.drag-handle {
  display: inline-grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #ffffff, #f7f9fc);
  color: var(--navy);
  cursor: grab;
  touch-action: none;
  user-select: none;
  transition: border-color 140ms ease, box-shadow 140ms ease, color 140ms ease, transform 140ms ease;
}

.widget.is-draggable .widget-header[data-widget-drag-zone] {
  cursor: grab;
}

.widget.is-draggable .widget-header[data-widget-drag-zone]:hover {
  background: linear-gradient(90deg, rgba(35, 88, 166, 0.055), transparent);
}

.drag-handle:hover,
.drag-handle:focus-visible {
  border-color: rgba(207, 31, 61, 0.58);
  color: var(--red);
  box-shadow: var(--focus);
  outline: none;
}

.drag-handle:active,
.widget.is-dragging {
  cursor: grabbing;
}

.widget.is-drag-armed {
  border-color: rgba(207, 31, 61, 0.58);
  outline-color: rgba(207, 31, 61, 0.4);
}

.widget.is-draggable {
  outline-offset: 4px;
}

.widget.is-draggable:hover {
  border-color: rgba(35, 88, 166, 0.48);
  outline-color: rgba(35, 88, 166, 0.38);
}

.widget.is-dragging {
  border-color: rgba(207, 31, 61, 0.72);
  opacity: 0.78;
  transform: scale(0.985);
  box-shadow: 0 0 0 2px rgba(207, 31, 61, 0.28), var(--shadow);
  pointer-events: none;
}

.widget.drop-before,
.widget.drop-after {
  contain: layout;
  border-color: rgba(207, 31, 61, 0.8);
  outline: 2px solid rgba(207, 31, 61, 0.72);
  outline-offset: 6px;
}

.widget.drop-before::before,
.widget.drop-after::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  height: 4px;
  border-radius: 999px;
  background: var(--red);
  box-shadow: 0 0 0 4px rgba(207, 31, 61, 0.12);
}

.widget.drop-before::before { top: -9px; }
.widget.drop-after::after { bottom: -9px; }

.dashboard-config {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px dashed #aeb8c7;
  border-radius: var(--radius);
  background: #fbfcfe;
}

.dashboard-empty {
  grid-column: 1 / -1;
}

.config-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
}

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

.config-item strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.config-rank {
  display: inline-grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
}

.access-matrix-panel {
  display: grid;
  gap: 14px;
}

.panel-header.compact {
  margin-bottom: 8px;
}

.access-matrix-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.65fr);
  gap: 14px;
}

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

.access-group-card {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  align-items: center;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.compliance-banner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.compliance-banner.is-ready { border-left-color: var(--green); }
.compliance-banner.is-warning { border-left-color: var(--amber); }

.compliance-banner-main {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-width: 0;
}

.compliance-banner h2,
.controlled-record-notice h3 {
  margin: 2px 0 5px;
  font-size: 1rem;
}

.compliance-banner p,
.controlled-record-notice p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.compliance-banner-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.controlled-record-notice {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 14px;
  border: 1px solid #efb2bf;
  border-left: 4px solid var(--red);
  border-radius: var(--radius);
  background: #fff7f9;
}

.compliance-posture-panel {
  display: grid;
  gap: 14px;
}

.compliance-posture-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 10px;
}

.compliance-posture-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.compliance-posture-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.compliance-posture-row p,
.compliance-posture-row small {
  display: block;
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.4;
}

.department-access-matrix {
  display: grid;
  gap: 10px;
}

.department-access-cell {
  display: grid;
  gap: 7px;
  min-width: 210px;
}

.department-access-cell p {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.42;
}

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

.department-load-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.department-load-row div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.department-load-row strong,
.department-load-row span:not(.badge) {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.department-load-row span:not(.badge) {
  color: var(--muted);
  font-size: 0.82rem;
}

.department-panel {
  display: grid;
  gap: 12px;
}

.department-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
}

.department-card {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.department-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.department-card h3 {
  margin-bottom: 0;
}

.department-card p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.45;
}

.department-card-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.department-card-stats span {
  min-width: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.department-card-stats strong {
  color: var(--ink);
  font-size: 0.94rem;
}

.machine-optimizer-panel {
  display: grid;
  gap: 12px;
}

.machine-stat-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.machine-stat-strip span,
.machine-spec-chips span {
  display: inline-grid;
  min-height: 28px;
  align-items: center;
}

.machine-stat-strip span {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.machine-stat-strip strong {
  color: var(--ink);
}

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

.machine-optimizer-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.machine-optimizer-row div {
  min-width: 0;
}

.machine-optimizer-row strong {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.machine-optimizer-row p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.42;
}

.machine-spec-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
}

.machine-camera-panel {
  display: grid;
  gap: 12px;
}

.machine-camera-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.machine-camera-card {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.machine-camera-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.machine-camera-head div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.machine-camera-head strong,
.machine-camera-head span:not(.badge) {
  min-width: 0;
  overflow-wrap: anywhere;
}

.machine-camera-head span:not(.badge) {
  color: var(--muted);
  font-size: 0.8rem;
}

.machine-camera-preview,
.machine-camera-placeholder {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0f172a;
  color: #d7dcea;
}

.machine-camera-preview {
  display: block;
  object-fit: cover;
}

.machine-camera-placeholder {
  display: grid;
  place-items: center;
  gap: 8px;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 800;
}

.machine-camera-placeholder svg {
  width: 24px;
  height: 24px;
}

.machine-camera-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.machine-camera-meta span {
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}

.machine-camera-meta strong {
  display: block;
  margin-bottom: 2px;
  color: var(--ink);
}

.machine-camera-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.machine-camera-actions .muted {
  min-width: 0;
  overflow-wrap: anywhere;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}

.erp-command-panel {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(244, 247, 251, 0.96)),
    repeating-linear-gradient(135deg, rgba(32, 42, 98, 0.06) 0 1px, transparent 1px 18px);
}

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

.erp-benchmark-panel {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(248, 251, 255, 0.96)),
    repeating-linear-gradient(0deg, rgba(20, 94, 124, 0.045) 0 1px, transparent 1px 32px);
}

.benchmark-score,
.commercial-score {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  min-width: 150px;
  gap: 9px;
  padding: 9px 11px;
  border: 1px solid rgba(219, 228, 238, 0.92);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow-soft);
}

.benchmark-score span:last-child,
.commercial-score span:last-child {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.benchmark-score strong,
.commercial-score strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.benchmark-score small,
.commercial-score small {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.benchmark-card {
  display: grid;
  gap: 11px;
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(219, 228, 238, 0.95);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.045);
}

.benchmark-card header,
.commercial-watch-card header {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.benchmark-card header > span:nth-child(2),
.commercial-watch-card header > span:nth-child(2) {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.benchmark-card strong,
.benchmark-card small,
.commercial-watch-card strong,
.commercial-watch-card small {
  overflow: hidden;
  text-overflow: ellipsis;
  overflow-wrap: anywhere;
  white-space: normal;
}

.benchmark-card strong,
.commercial-watch-card strong {
  font-size: 0.9rem;
  font-weight: 950;
  line-height: 1.18;
}

.benchmark-card small,
.commercial-watch-card small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.2;
}

.benchmark-card p,
.commercial-watch-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.benchmark-meter {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #dce5ef;
}

.benchmark-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--green));
}

.benchmark-signal-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.benchmark-signal-list span {
  display: grid;
  min-width: 0;
  gap: 2px;
  padding: 7px;
  border: 1px solid rgba(219, 228, 238, 0.86);
  border-radius: 8px;
  background: #f8fbff;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 850;
  overflow-wrap: anywhere;
}

.benchmark-signal-list strong {
  color: var(--ink);
  font-size: 0.82rem;
}

.exception-board {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.exception-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
}

.exception-item {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.exception-item div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.exception-item strong,
.exception-item span:not(.metric-icon) {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.erp-process-panel,
.erp-workflow-panel {
  position: relative;
  overflow: hidden;
}

.erp-process-panel::before,
.erp-workflow-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(120deg, transparent 0 58%, rgba(29, 95, 188, 0.06) 58% 58.4%, transparent 58.4%),
    repeating-linear-gradient(90deg, rgba(23, 36, 90, 0.035) 0 1px, transparent 1px 56px);
}

.erp-process-panel > *,
.erp-workflow-panel > * {
  position: relative;
}

.erp-process-map,
.workflow-grid,
.traveler-list,
.warehouse-bin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 12px;
}

.erp-process-lane,
.workflow-card,
.traveler-card,
.warehouse-bin-card {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(219, 228, 238, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.055);
}

.erp-process-head,
.workflow-card-head {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.erp-process-head div,
.workflow-card-head div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.erp-process-head strong,
.workflow-card-head strong,
.erp-process-head span,
.workflow-card-head span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.erp-process-head span,
.workflow-card-head span {
  color: var(--muted);
  font-size: 0.82rem;
}

.erp-process-stats,
.warehouse-bin-stats,
.workflow-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.erp-process-stats span,
.warehouse-bin-stats span,
.workflow-meta span {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 8px;
  border: 1px solid rgba(219, 228, 238, 0.82);
  border-radius: 8px;
  background: #f8fbff;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.erp-process-stats strong,
.warehouse-bin-stats strong {
  color: var(--ink);
  font-size: 0.98rem;
}

.erp-process-flow {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(74px, 1fr));
  gap: 6px;
}

.erp-process-flow span {
  min-height: 28px;
  display: grid;
  place-items: center;
  padding: 4px 6px;
  border: 1px solid rgba(219, 228, 238, 0.9);
  border-radius: 8px;
  background: #eef4fb;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-align: center;
}

.erp-process-flow span.is-active {
  border-color: rgba(29, 95, 188, 0.34);
  background: var(--blue-soft);
  color: var(--blue);
}

.workflow-progress {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(20px, 1fr));
  gap: 5px;
}

.workflow-progress span {
  height: 8px;
  border-radius: 999px;
  background: #dce5ef;
}

.workflow-progress span.is-active {
  background: linear-gradient(90deg, var(--blue), var(--teal));
}

.workflow-card p,
.traveler-card p,
.warehouse-bin-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.erp-control-grid {
  align-items: start;
}

.exception-item span:not(.metric-icon) {
  color: var(--muted);
  font-size: 0.82rem;
}

.helpdesk-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.9fr);
  gap: 18px;
  align-items: center;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(239, 244, 250, 0.96)),
    repeating-linear-gradient(135deg, rgba(32, 42, 98, 0.08) 0 1px, transparent 1px 18px);
  box-shadow: var(--shadow);
}

.helpdesk-hero h2 {
  margin-bottom: 8px;
  font-size: 1.54rem;
}

.helpdesk-hero p {
  margin-bottom: 0;
  max-width: 760px;
  color: var(--muted);
  line-height: 1.5;
}

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

.support-tile {
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-weight: 900;
  text-align: left;
  text-decoration: none;
}

.support-tile:hover,
.support-tile:focus-visible {
  border-color: #aab4c2;
  outline: none;
  transform: translateY(-1px);
}

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

.settings-note {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 0.86rem;
  font-weight: 800;
}

.settings-note svg {
  width: 18px;
  height: 18px;
}

.settings-note.warning {
  border-color: #efc781;
  background: var(--amber-soft);
  color: var(--amber);
}

.settings-note.success {
  border-color: #aad8b9;
  background: var(--green-soft);
  color: var(--green);
}

.settings-note a {
  color: inherit;
  font-weight: 950;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.email-settings-form .full,
.email-settings-form .form-actions {
  grid-column: 1 / -1;
}

.reports-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(241, 245, 251, 0.96)),
    repeating-linear-gradient(90deg, rgba(32, 42, 98, 0.08) 0 1px, transparent 1px 28px);
  box-shadow: var(--shadow);
}

.reports-hero h2 {
  margin: 4px 0 8px;
  font-size: 1.55rem;
}

.reports-hero p {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.knowledge-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(241, 246, 251, 0.96)),
    repeating-linear-gradient(135deg, rgba(35, 88, 166, 0.07) 0 1px, transparent 1px 24px);
  box-shadow: var(--shadow);
}

.knowledge-hero h2 {
  margin: 4px 0 8px;
  font-size: 1.55rem;
}

.knowledge-hero p {
  max-width: 780px;
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.knowledge-hero-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(82px, 1fr));
  gap: 10px;
  min-width: min(100%, 520px);
}

.knowledge-hero-stats span {
  display: grid;
  gap: 2px;
  min-height: 72px;
  align-content: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.78);
}

.knowledge-hero-stats strong {
  font-size: 1.45rem;
}

.knowledge-hero-stats small {
  color: var(--muted);
  font-weight: 900;
  text-transform: uppercase;
}

.knowledge-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.knowledge-command {
  display: grid;
  gap: 14px;
}

.knowledge-command-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: end;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(238, 246, 245, 0.94)),
    repeating-linear-gradient(90deg, rgba(33, 115, 130, 0.08) 0 1px, transparent 1px 28px);
  box-shadow: var(--shadow-soft);
}

.knowledge-command-head h2 {
  margin: 4px 0 8px;
  font-size: 1.25rem;
}

.knowledge-command-head p {
  max-width: 820px;
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.knowledge-command-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

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

.knowledge-path-button {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 74px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  box-shadow: var(--shadow-soft);
  cursor: pointer;
}

.knowledge-path-button:hover {
  transform: translateY(-1px);
  border-color: #b5c6d8;
  background: #fff;
}

.knowledge-path-button strong,
.knowledge-feature-item strong,
.knowledge-review-item strong {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.knowledge-path-button small,
.knowledge-feature-item small,
.knowledge-review-item small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-weight: 800;
  line-height: 1.35;
}

.knowledge-ops-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 14px;
  align-items: start;
}

.knowledge-ops-panel {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-soft);
}

.knowledge-feature-list,
.knowledge-review-list {
  display: grid;
  gap: 8px;
}

.knowledge-feature-item,
.knowledge-review-item {
  display: grid;
  gap: 8px;
  align-items: center;
  width: 100%;
  min-width: 0;
  min-height: 54px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.knowledge-feature-item {
  grid-template-columns: 28px minmax(0, 1fr);
}

.knowledge-review-item {
  grid-template-columns: auto minmax(0, 1fr);
}

.knowledge-review-item small {
  grid-column: 2;
}

.knowledge-feature-item:hover,
.knowledge-review-item:hover {
  border-color: #b5c6d8;
  background: #fff;
}

.knowledge-training-hub {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(244, 248, 252, 0.94)),
    repeating-linear-gradient(0deg, rgba(11, 31, 51, 0.05) 0 1px, transparent 1px 28px);
  box-shadow: var(--shadow-soft);
}

.knowledge-training-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: end;
}

.knowledge-training-head h2 {
  margin: 4px 0 8px;
  font-size: 1.25rem;
}

.knowledge-training-head p {
  max-width: 780px;
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.knowledge-training-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.knowledge-video-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(260px, 1fr));
  gap: 12px;
}

.knowledge-video-card {
  display: grid;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.knowledge-video-player {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  background: #071320;
}

.knowledge-video-body {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 12px;
}

.knowledge-video-title {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.knowledge-video-title h3 {
  margin: 2px 0 0;
  font-size: 1rem;
  overflow-wrap: anywhere;
}

.knowledge-video-body p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.knowledge-video-chapters {
  display: grid;
  gap: 6px;
}

.knowledge-video-chapters span {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  color: var(--muted);
  line-height: 1.35;
}

.knowledge-video-chapters strong {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 0.74rem;
}

.knowledge-video-links {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding-top: 4px;
}

.knowledge-toolbar h2 {
  margin: 0 0 4px;
}

.knowledge-toolbar p {
  margin: 0;
  color: var(--muted);
}

.knowledge-layout {
  display: grid;
  grid-template-columns: minmax(240px, 0.28fr) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.knowledge-toc {
  position: sticky;
  top: 14px;
  display: grid;
  gap: 14px;
}

.knowledge-category-list {
  display: grid;
  gap: 8px;
}

.knowledge-category-list a {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 42px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--ink);
  text-decoration: none;
}

.knowledge-category-list a:hover {
  border-color: #b9c5d8;
  background: #ffffff;
}

.knowledge-category-list strong {
  display: grid;
  min-width: 28px;
  min-height: 26px;
  place-items: center;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 0.82rem;
}

.knowledge-note {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--muted);
}

.knowledge-note svg {
  width: 18px;
  height: 18px;
  color: var(--blue);
}

.knowledge-note p {
  margin: 0;
  line-height: 1.45;
}

.knowledge-results {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.knowledge-category {
  display: grid;
  gap: 12px;
  min-width: 0;
  scroll-margin-top: 16px;
}

.knowledge-category-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 2px 0;
}

.knowledge-category-head h2 {
  margin: 0;
}

.knowledge-article {
  display: grid;
  gap: 14px;
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  scroll-margin-top: 16px;
  cursor: pointer;
}

.knowledge-article-head {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
}

.knowledge-article-head h3 {
  margin: 2px 0 6px;
  font-size: 1.2rem;
}

.knowledge-article-head p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.knowledge-article-actions,
.knowledge-widget-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 7px;
}

.knowledge-widget {
  display: grid;
  gap: 12px;
}

.knowledge-widget-actions {
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.knowledge-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.knowledge-tags span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.knowledge-article-videos {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.knowledge-article-videos-head {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.knowledge-article-videos-head h4 {
  margin: 0 0 2px;
}

.knowledge-article-videos-head p {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}

.knowledge-related-video-list {
  display: grid;
  gap: 8px;
}

.knowledge-related-video-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 48px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.knowledge-related-video-item:hover {
  border-color: #b5c6d8;
  background: #fff;
}

.knowledge-related-video-item svg {
  width: 18px;
  height: 18px;
  color: var(--blue);
}

.knowledge-related-video-item strong,
.knowledge-related-video-item small {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.knowledge-related-video-item small {
  margin-top: 2px;
  color: var(--muted);
  font-weight: 800;
}

.knowledge-sections {
  display: grid;
  gap: 14px;
}

.knowledge-section {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.knowledge-section h4 {
  margin: 0 0 8px;
  font-size: 0.98rem;
}

.knowledge-section ul {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.5;
}

.report-actions,
.report-builder-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.report-actions {
  min-width: min(100%, 440px);
}

.report-builder-panel {
  overflow: hidden;
}

.report-builder {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  align-items: end;
}

.report-builder label {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.report-builder label span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.report-builder input,
.report-builder select {
  width: 100%;
}

.report-query {
  grid-column: span 2;
}

.report-builder-actions {
  grid-column: 1 / -1;
  padding-top: 2px;
}

.report-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(170px, 1fr));
  gap: 14px;
}

.report-output-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: 18px;
  align-items: start;
}

.chart-panel,
.report-table-panel {
  min-width: 0;
}

.report-chart {
  display: grid;
  min-height: 330px;
  overflow-x: auto;
  place-items: center;
  padding: 8px;
  border: 1px solid #e3e8f0;
  border-radius: var(--radius);
  background: #fbfcfe;
  scrollbar-color: #b9c3d2 transparent;
  scrollbar-width: thin;
}

.report-svg {
  width: 100%;
  min-width: 680px;
  height: auto;
}

.chart-axis {
  stroke: #c7cfdd;
  stroke-width: 1;
}

.chart-fill.navy,
.chart-dot.navy { fill: var(--navy); }
.chart-fill.red,
.chart-dot.red { fill: var(--red); }
.chart-fill.blue,
.chart-dot.blue { fill: var(--blue); }
.chart-fill.teal,
.chart-dot.teal { fill: var(--teal); }
.chart-fill.amber,
.chart-dot.amber { fill: var(--amber); }
.chart-fill.green,
.chart-dot.green { fill: var(--green); }
.chart-fill.purple,
.chart-dot.purple { fill: var(--purple); }

.chart-remainder {
  fill: #e8edf5;
}

.chart-area {
  opacity: 0.18;
}

.chart-area.navy,
.radar-fill.navy,
.chart-bubble.navy,
.chart-heat-cell.navy { fill: var(--navy); }
.chart-area.red,
.radar-fill.red,
.chart-bubble.red,
.chart-heat-cell.red { fill: var(--red); }
.chart-area.blue,
.radar-fill.blue,
.chart-bubble.blue,
.chart-heat-cell.blue { fill: var(--blue); }
.chart-area.teal,
.radar-fill.teal,
.chart-bubble.teal,
.chart-heat-cell.teal { fill: var(--teal); }
.chart-area.amber,
.radar-fill.amber,
.chart-bubble.amber,
.chart-heat-cell.amber { fill: var(--amber); }
.chart-area.green,
.radar-fill.green,
.chart-bubble.green,
.chart-heat-cell.green { fill: var(--green); }
.chart-area.purple,
.radar-fill.purple,
.chart-bubble.purple,
.chart-heat-cell.purple { fill: var(--purple); }

.chart-bubble {
  opacity: 0.78;
  stroke: #ffffff;
  stroke-width: 2;
}

.chart-line {
  fill: none;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-line.navy { stroke: var(--navy); }
.chart-line.red { stroke: var(--red); }
.chart-line.blue { stroke: var(--blue); }
.chart-line.teal { stroke: var(--teal); }
.chart-line.amber { stroke: var(--amber); }
.chart-line.green { stroke: var(--green); }
.chart-line.purple { stroke: var(--purple); }

.chart-label {
  fill: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.chart-value {
  fill: var(--ink);
  font-size: 12px;
  font-weight: 900;
}

.radar-svg,
.heatmap-svg,
.gauge-svg {
  width: 100%;
  min-width: 680px;
  height: auto;
}

.radar-grid {
  fill: none;
  stroke: #e1e7f0;
  stroke-width: 1;
}

.radar-fill {
  opacity: 0.16;
}

.heatmap-label {
  fill: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.heatmap-value {
  fill: var(--ink);
  font-size: 18px;
  font-weight: 950;
}

.gauge-chart-wrap {
  display: grid;
  width: 100%;
  max-width: 760px;
  gap: 12px;
}

.gauge-track,
.gauge-fill {
  fill: none;
  stroke-width: 30;
  stroke-linecap: round;
}

.gauge-track {
  stroke: #e3e8f0;
}

.gauge-fill.navy { stroke: var(--navy); }
.gauge-fill.red { stroke: var(--red); }
.gauge-fill.blue { stroke: var(--blue); }
.gauge-fill.teal { stroke: var(--teal); }
.gauge-fill.amber { stroke: var(--amber); }
.gauge-fill.green { stroke: var(--green); }
.gauge-fill.purple { stroke: var(--purple); }

.gauge-percent {
  fill: var(--ink);
  font-size: 44px;
  font-weight: 950;
}

.gauge-label {
  fill: var(--ink);
  font-size: 15px;
  font-weight: 900;
}

.gauge-subtitle {
  fill: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.pie-chart-wrap {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 20px;
  align-items: center;
  width: 100%;
  max-width: 720px;
}

.pie-svg {
  width: 220px;
  height: 220px;
}

.pie-base {
  fill: none;
  stroke: #e6ebf3;
  stroke-width: 24;
}

.pie-slice {
  fill: none;
  stroke-width: 24;
  transform: rotate(-90deg);
  transform-origin: 90px 90px;
}

.slice-0 { stroke: var(--navy); background: var(--navy); }
.slice-1 { stroke: var(--red); background: var(--red); }
.slice-2 { stroke: var(--teal); background: var(--teal); }
.slice-3 { stroke: var(--blue); background: var(--blue); }
.slice-4 { stroke: var(--amber); background: var(--amber); }
.slice-5 { stroke: var(--purple); background: var(--purple); }

.pie-total {
  fill: var(--ink);
  font-size: 20px;
  font-weight: 950;
}

.pie-caption {
  fill: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.chart-legend {
  display: grid;
  gap: 9px;
  min-width: 0;
}

.chart-legend div {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 0.86rem;
}

.chart-legend strong {
  min-width: 0;
  color: var(--ink);
  overflow-wrap: anywhere;
}

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

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

.report-table td {
  max-width: 280px;
  overflow-wrap: anywhere;
}

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

.audit-detail summary {
  cursor: pointer;
  color: var(--navy);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.audit-detail-json {
  max-width: 520px;
  max-height: 260px;
  overflow: auto;
  margin: 8px 0 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 0.76rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

.hr-master-table {
  min-width: 1120px;
}

.hr-master-table td {
  vertical-align: top;
}

.live-ops-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(241, 245, 250, 0.98)),
    repeating-linear-gradient(90deg, rgba(8, 118, 111, 0.08) 0 1px, transparent 1px 46px);
  box-shadow: var(--shadow);
}

.live-ops-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.live-ops-head h2 {
  margin-bottom: 0;
  font-size: 1.26rem;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid #b9dcc4;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 0.8rem;
  font-weight: 900;
  white-space: nowrap;
}

.live-ops-grid {
  display: grid;
  grid-template-columns: minmax(250px, 0.9fr) minmax(240px, 0.75fr) minmax(320px, 1.1fr);
  gap: 14px;
  align-items: stretch;
}

.live-lane,
.live-activity-list,
.live-activity-compact {
  display: grid;
  gap: 9px;
  min-width: 0;
}

.live-lane {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.live-lane-item,
.live-now-card,
.live-activity-item {
  border: 1px solid #e1e7ef;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.82);
}

.live-lane-item {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-height: 46px;
  padding: 10px;
  font-size: 0.84rem;
}

.live-lane-item strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.live-lane-item span:last-child {
  color: var(--muted);
  font-weight: 800;
}

.live-now-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 14px;
}

.live-activity-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 58px;
  padding: 10px;
}

.live-activity-item .metric-icon {
  width: 34px;
  height: 34px;
  border-radius: 7px;
}

.live-activity-item strong {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.live-activity-item p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
}

.live-activity-item time {
  align-self: start;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  white-space: nowrap;
}

.module-card {
  display: grid;
  align-content: start;
  gap: 11px;
  min-height: 210px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.module-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.module-card h2 {
  margin: 0;
  font-size: 1rem;
}

.module-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.section-divider {
  height: 12px;
}

.floor-board {
  display: grid;
  grid-template-columns: repeat(5, minmax(210px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.floor-counts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.floor-count-card {
  display: grid;
  align-content: center;
  min-height: 54px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfe;
}

.floor-column {
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 210px;
  padding: 12px;
  box-shadow: none;
  background: #fbfcfe;
}

.floor-column-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.floor-column-title {
  margin: 0;
  font-size: 0.86rem;
  font-weight: 900;
}

.part-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  box-shadow: none;
}

.part-card-title {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-weight: 900;
}

.part-card-meta,
.muted {
  color: var(--muted);
  font-size: 0.84rem;
}

.part-actions {
  justify-content: space-between;
  flex-wrap: wrap;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  scrollbar-color: #b9c3d2 transparent;
  scrollbar-width: thin;
}

table {
  width: 100%;
  min-width: 780px;
  border-collapse: collapse;
}

th, td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
  background: #f8fafc;
}

.sort-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  min-height: 24px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: inherit;
  text-transform: inherit;
  text-align: left;
}

.sort-button:hover,
.sort-button:focus-visible,
.sort-button.is-active {
  color: var(--navy);
}

.sort-button:focus-visible {
  outline: 0;
  box-shadow: var(--focus);
  border-radius: 6px;
}

.sort-indicator {
  display: inline-grid;
  place-items: center;
  width: 10px;
  min-width: 10px;
  color: var(--blue);
  font-size: 0.72rem;
  line-height: 1;
}

td { font-size: 0.9rem; }
tbody tr { transition: background 120ms ease; }
tbody tr:nth-child(even) { background: #fcfdff; }
tbody tr:hover { background: #f4f7fb; }
tbody tr:last-child td { border-bottom: 0; }

.identity {
  display: grid;
  gap: 3px;
}

.identity strong { overflow-wrap: anywhere; }

.identity span {
  color: var(--muted);
  font-size: 0.82rem;
  overflow-wrap: anywhere;
}

.row-actions { justify-content: flex-end; }

.row-actions .icon-button {
  width: 34px;
  height: 34px;
  min-height: 34px;
}

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

.sales-command-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 18px;
  border: 1px solid #d6deea;
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(244, 248, 252, 0.96)),
    repeating-linear-gradient(90deg, rgba(32, 42, 98, 0.055) 0 1px, transparent 1px 26px);
  box-shadow: var(--shadow-soft);
}

.sales-command-panel h2 {
  margin: 4px 0 6px;
  font-size: 1.26rem;
}

.sales-command-panel p {
  margin: 0;
  color: var(--muted);
  max-width: 820px;
}

.sales-action-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.commercial-decision-panel {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(247, 250, 253, 0.97)),
    repeating-linear-gradient(135deg, rgba(26, 127, 91, 0.045) 0 1px, transparent 1px 28px);
}

.commercial-flow {
  display: grid;
  grid-template-columns: repeat(5, minmax(145px, 1fr));
  align-items: center;
  gap: 8px;
}

.commercial-flow-step {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  min-width: 0;
  min-height: 62px;
  gap: 9px;
  padding: 10px;
  border: 1px solid rgba(219, 228, 238, 0.92);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 7px 18px rgba(15, 23, 42, 0.045);
}

.commercial-flow-step .metric-icon {
  width: 34px;
  height: 34px;
}

.commercial-flow-step div {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.commercial-flow-step strong,
.commercial-flow-step span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.commercial-flow-step strong {
  font-size: 0.82rem;
  font-weight: 950;
}

.commercial-flow-step span {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
}

.commercial-flow-step em {
  color: var(--navy);
  font-size: 0.84rem;
  font-style: normal;
  font-weight: 950;
}

.commercial-flow-link {
  display: none;
}

.commercial-watch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}

.commercial-watch-card {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 13px;
  border: 1px solid rgba(219, 228, 238, 0.95);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.045);
}

.sales-pipeline-panel {
  overflow: hidden;
}

.sales-pipeline-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(178px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.sales-stage-card {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border: 1px solid #dce3ed;
  border-radius: var(--radius);
  background: #fbfcfe;
}

.sales-stage-card header {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.sales-stage-card .metric-icon {
  width: 38px;
  height: 38px;
}

.sales-stage-card h3 {
  margin: 0;
  font-size: 0.96rem;
}

.sales-stage-card p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.sales-stage-total {
  font-weight: 800;
  font-size: 1.06rem;
  color: var(--ink);
}

.sales-stage-list {
  display: grid;
  gap: 7px;
}

.sales-stage-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  padding: 8px;
  border: 1px solid #e3e9f1;
  border-radius: calc(var(--radius) - 2px);
  background: var(--surface);
  color: inherit;
  text-align: left;
}

.sales-stage-item:hover,
.sales-stage-item:focus-visible {
  border-color: #aab4c2;
  box-shadow: var(--shadow-soft);
  outline: none;
}

.sales-stage-item span {
  display: grid;
  min-width: 0;
}

.sales-stage-item strong,
.sales-stage-item small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sales-stage-item small {
  color: var(--muted);
  font-size: 0.76rem;
}

.sales-stage-item em {
  color: var(--green);
  font-style: normal;
  font-weight: 800;
  white-space: nowrap;
}

.full-span { grid-column: 1 / -1; }

.clock-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(0, 1.2fr);
  gap: 18px;
}

.clock-card { padding: 18px; }

.clock-state {
  display: grid;
  gap: 8px;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.clock-state strong { font-size: 1.36rem; }

.time-admin-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.85fr) minmax(0, 1.15fr);
  gap: 16px;
  align-items: start;
}

.clock-roster {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfe;
}

.roster-head,
.roster-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
}

.roster-head {
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.roster-row {
  min-height: 56px;
  padding: 9px;
  border: 1px solid #e5eaf2;
  border-radius: var(--radius);
  background: var(--surface);
}

.time-exception-list {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.time-exception-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid #e5eaf2;
  border-radius: var(--radius);
  background: #fbfcfe;
}

.time-exception-card strong,
.time-exception-card p {
  overflow-wrap: anywhere;
}

.time-exception-card p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.time-review-grid {
  margin-top: 16px;
}

.metric-grid.compact {
  grid-template-columns: repeat(2, minmax(150px, 1fr));
  margin-bottom: 12px;
}

.metric-grid.compact .metric-card {
  min-height: 88px;
  padding: 14px;
}

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

.field.full { grid-column: 1 / -1; }

.form-actions {
  justify-content: flex-end;
  padding: 16px 20px 20px;
}

.modal-root {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 18px;
  overflow: auto;
  background: rgba(16, 24, 40, 0.58);
  backdrop-filter: blur(5px);
}

.modal {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(780px, 100%);
  max-height: min(880px, calc(100vh - 36px));
  max-height: min(880px, calc(100dvh - 36px));
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 24px 72px rgba(16, 24, 40, 0.24);
  animation: modalIn 150ms ease;
}

.modal > form {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 0;
  overflow: hidden;
}

.detail-modal {
  width: min(940px, 100%);
}

.modal-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfe;
}

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

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

.modal-title-stack h2,
.modal-subtitle {
  min-width: 0;
  overflow-wrap: anywhere;
}

.modal-subtitle {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.35;
}

.modal-body {
  display: grid;
  gap: 14px;
  min-height: 0;
  padding: 20px;
  overflow: auto;
}

.modal-actions {
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  background: #ffffff;
}

.detail-body {
  gap: 18px;
}

.legal-modal {
  width: min(980px, 100%);
}

.legal-body {
  gap: 18px;
  padding: 20px;
  background: linear-gradient(180deg, #f8fbff 0%, #ffffff 42%);
}

.legal-hero {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  padding: 18px;
  border: 1px solid #d8e2ef;
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(40, 111, 199, 0.1), rgba(35, 92, 68, 0.08)),
    #ffffff;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.07);
}

.legal-hero-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.72);
}

.legal-hero-icon.navy { background: #e1e6fb; color: var(--navy); }
.legal-hero-icon.blue { background: var(--blue-soft); color: var(--blue); }
.legal-hero-icon.green { background: var(--green-soft); color: var(--green); }
.legal-hero-icon.amber { background: var(--amber-soft); color: var(--amber); }
.legal-hero-icon.red { background: var(--red-soft); color: var(--red); }
.legal-hero-icon.purple { background: var(--purple-soft); color: var(--purple); }

.legal-hero-copy {
  min-width: 0;
}

.legal-kicker {
  display: inline-flex;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.legal-hero h3 {
  margin: 0;
  font-size: 1.24rem;
}

.legal-hero p {
  max-width: 76ch;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
}

.legal-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.legal-updated {
  display: inline-flex;
  width: fit-content;
  min-height: 26px;
  align-items: center;
  padding: 0 9px;
  border: 1px solid rgba(214, 220, 230, 0.8);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.legal-document-layout {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.legal-nav {
  position: sticky;
  top: 0;
  display: grid;
  gap: 7px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.88);
}

.legal-nav-label {
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.legal-nav a {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 34px;
  padding: 7px;
  border-radius: 8px;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.25;
}

.legal-nav a:hover,
.legal-nav a:focus-visible {
  background: var(--surface-soft);
  outline: none;
}

.legal-nav a span,
.legal-section-number {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #e8eef8;
  color: var(--navy);
  font-size: 0.72rem;
  font-weight: 900;
}

.legal-section-list {
  display: grid;
  gap: 12px;
}

.legal-section {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-left: 4px solid #bfd0e6;
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
  scroll-margin-top: 14px;
}

.legal-section h3 {
  margin: 0;
  font-size: 1rem;
}

.legal-section p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.62;
}

@media (max-width: 900px) {
  .legal-document-layout {
    grid-template-columns: 1fr;
  }

  .legal-nav {
    position: static;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }

  .legal-nav-label {
    grid-column: 1 / -1;
  }
}

@media (max-width: 560px) {
  .legal-body {
    padding: 14px;
  }

  .legal-hero {
    grid-template-columns: 1fr;
  }

  .legal-hero-icon {
    width: 48px;
    height: 48px;
  }

  .legal-nav {
    grid-template-columns: 1fr;
  }

  .legal-section {
    grid-template-columns: 1fr;
  }

  .legal-section-number {
    width: fit-content;
    padding: 0 10px;
  }
}

.detail-summary {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #ffffff 0%, #f7f9fc 100%);
}

.detail-summary h3,
.detail-section h3 {
  margin: 0;
  font-size: 1rem;
}

.detail-summary p {
  margin: 3px 0 0;
  color: var(--muted);
  line-height: 1.4;
}

.detail-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
}

.detail-field {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.detail-field.wide {
  grid-column: 1 / -1;
}

.detail-field.is-empty {
  background: #f8fafc;
}

.detail-field span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.detail-field strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 0.92rem;
  line-height: 1.4;
}

.detail-field.is-empty strong {
  color: var(--muted);
}

.detail-section {
  display: grid;
  gap: 10px;
}

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

.detail-link-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.detail-link {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfe;
  color: var(--ink);
  text-align: left;
}

.detail-link:hover,
.detail-link:focus-visible {
  border-color: #aab4c2;
  box-shadow: var(--shadow-soft);
  outline: none;
}

.detail-link span,
.detail-link small {
  min-width: 0;
  overflow-wrap: anywhere;
}

.detail-link span {
  font-weight: 900;
}

.detail-link small {
  color: var(--muted);
  font-size: 0.78rem;
}

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

.audit-detail-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfe;
}

.audit-detail-row strong,
.audit-detail-row p {
  min-width: 0;
  overflow-wrap: anywhere;
}

.audit-detail-row strong {
  display: block;
  font-weight: 900;
}

.audit-detail-row p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

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

.qr-box {
  display: grid;
  place-items: center;
  width: 260px;
  min-width: 260px;
  min-height: 260px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.qr-svg {
  display: grid;
  place-items: center;
  width: 240px;
  height: 240px;
  background: #ffffff;
}

.qr-svg svg {
  display: block;
  width: 240px;
  height: 240px;
}

.qr-svg path {
  fill: var(--navy);
}

.fake-qr {
  display: grid;
  grid-template-columns: repeat(21, 10px);
  gap: 1px;
  padding: 12px;
  background: #ffffff;
}

.fake-qr span {
  width: 10px;
  height: 10px;
  background: #ffffff;
}

.fake-qr span.on { background: var(--navy); }

.empty-state {
  display: grid;
  place-items: center;
  min-height: 260px;
  padding: 26px;
  text-align: center;
}

.empty-state svg {
  width: 34px;
  height: 34px;
  margin-bottom: 12px;
  color: var(--muted);
}

.empty-state p {
  margin-bottom: 0;
  color: var(--muted);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 40;
  max-width: min(420px, calc(100vw - 36px));
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--navy-2);
  color: #ffffff;
  box-shadow: var(--shadow);
  animation: toastIn 160ms ease;
}

@keyframes fadeIn {
  from { opacity: 0.82; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(8px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes livePulse {
  0% {
    opacity: 0.68;
    transform: scale(0.64);
  }
  100% {
    opacity: 0;
    transform: scale(1.65);
  }
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 1180px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .widget, .widget.large { grid-column: span 6; }
  .split-grid, .clock-grid, .time-admin-grid, .helpdesk-hero, .knowledge-layout, .knowledge-command-head, .knowledge-training-head, .knowledge-ops-grid, .report-output-grid, .live-ops-grid, .access-command-panel, .access-matrix-grid, .sales-command-panel, .commercial-flow { grid-template-columns: 1fr; }
  .knowledge-path-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .knowledge-video-grid { grid-template-columns: repeat(2, minmax(260px, 1fr)); }
  .knowledge-command-actions,
  .knowledge-training-actions { justify-content: flex-start; }
  .sales-action-row { justify-content: flex-start; }
  .sales-pipeline-grid { grid-template-columns: repeat(3, minmax(178px, 1fr)); }
  .time-exception-card { grid-template-columns: auto minmax(0, 1fr); }
  .time-exception-card > .mini-button,
  .time-exception-card > .row-actions { grid-column: 1 / -1; justify-self: start; }
  .report-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-builder { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  .login-panel { grid-template-columns: 1fr; }

  .login-brand {
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .app-shell { grid-template-columns: 1fr; }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    height: auto;
    min-height: 0;
    gap: 12px;
    overflow-x: hidden;
    padding: 12px;
  }

  .brand {
    grid-column: 1;
    grid-row: 1;
    width: 74px;
    min-height: 48px;
    padding: 6px;
  }

  .nav-list {
    grid-column: 1 / -1;
    grid-row: 2;
    display: flex;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    contain: layout paint;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .nav-item {
    grid-template-columns: 1fr;
    justify-items: center;
    flex: 0 0 74px;
    gap: 4px;
    min-height: 56px;
    padding: 6px;
    font-size: 0.72rem;
  }

  .sidebar-actions {
    grid-column: 3;
    grid-row: 1;
    position: static;
    justify-self: end;
    margin-top: 0;
  }

  .workspace { padding: 18px 14px; }

  .topbar {
    position: static;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 8px;
    min-height: 0;
    margin: -6px -4px 12px;
    padding: 7px 4px 9px;
  }

  .topbar > div {
    min-width: 0;
    width: 100%;
  }

  .topbar .eyebrow {
    margin-bottom: 2px;
    font-size: 0.7rem;
  }

  .topbar h1 {
    font-size: 1.45rem;
    line-height: 1.12;
  }

  .topbar-controls {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 6px;
    align-items: center;
    width: 100%;
    justify-content: stretch;
  }

  .topbar-controls #live-clock {
    grid-column: 1;
  }

  .search-box {
    grid-column: 2 / 4;
    min-height: 34px;
    padding: 0 10px;
  }

  .topbar-controls #quick-add-button {
    grid-column: 1;
    padding: 0 10px;
  }

  .topbar-controls #system-status {
    grid-column: 2;
  }

  .topbar-controls #save-status {
    grid-column: 3;
  }

  .user-pill {
    grid-column: 1 / 3;
    min-width: 0;
  }

  .topbar-controls .primary-button,
  .topbar-controls .status-pill,
  .topbar-controls .user-pill,
  .topbar-controls .icon-button {
    min-height: 34px;
    padding-left: 7px;
    padding-right: 7px;
    gap: 6px;
    font-size: 0.74rem;
  }

  .topbar-controls .icon-button {
    width: 34px;
    height: 34px;
  }

  .topbar-controls > [data-action="signout"] {
    grid-column: 3;
    justify-self: end;
  }

  .search-box { grid-template-columns: 18px minmax(0, 1fr); }
  .metric-grid, .form-grid, .qr-layout, .email-settings-form, .support-actions, .report-builder, .report-summary, .pie-chart-wrap, .access-command-actions, .detail-grid, .detail-link-list, .sales-pipeline-grid, .benchmark-grid, .commercial-watch-grid, .knowledge-path-grid, .knowledge-video-grid { grid-template-columns: 1fr; }
  .widget, .widget.large, .widget.full { grid-column: 1 / -1; }
  .access-command-panel {
    padding: 14px;
  }
  .sales-command-panel {
    padding: 14px;
  }
  .sales-action-row .primary-button,
  .sales-action-row .secondary-button {
    flex: 1 1 132px;
  }
  .benchmark-card header,
  .commercial-watch-card header {
    grid-template-columns: 38px minmax(0, 1fr);
  }
  .benchmark-card header > .badge,
  .commercial-watch-card header > .badge {
    grid-column: 1 / -1;
    justify-self: start;
  }
  .benchmark-signal-list {
    grid-template-columns: 1fr;
  }
  .benchmark-score,
  .commercial-score {
    width: 100%;
  }
  .access-command-main {
    grid-template-columns: 1fr;
  }
  .live-summary {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    min-height: 0;
    max-width: 100%;
    margin-top: 5px;
    overflow-x: auto;
    padding-bottom: 2px;
    white-space: nowrap;
    font-size: 0.72rem;
  }
  .live-summary span,
  .live-summary strong {
    flex: 0 0 auto;
  }
  .live-ops-head {
    display: grid;
    justify-items: start;
  }
  .live-clock {
    min-width: 0;
    justify-content: center;
  }
  .live-activity-item {
    grid-template-columns: 34px minmax(0, 1fr);
  }
  .live-activity-item time {
    grid-column: 2;
  }
  .reports-hero {
    display: grid;
    align-items: stretch;
  }
  .report-actions,
  .knowledge-toolbar,
  .knowledge-hero,
  .report-builder-actions {
    display: grid;
    justify-content: stretch;
    min-width: 0;
  }

  .knowledge-hero-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    min-width: 0;
  }

  .knowledge-command-head,
  .knowledge-training-hub,
  .knowledge-ops-panel {
    padding: 14px;
  }

  .knowledge-review-item {
    grid-template-columns: 1fr;
  }

  .knowledge-review-item small {
    grid-column: auto;
  }

  .knowledge-toc {
    position: static;
  }

  .knowledge-article-head {
    grid-template-columns: 40px minmax(0, 1fr);
  }

  .knowledge-article-actions {
    grid-column: 2;
    justify-content: flex-start;
  }

  .knowledge-article-head .badge {
    grid-column: 2;
    justify-self: start;
  }
  .report-query,
  .report-builder-actions {
    grid-column: 1;
  }
  .pie-svg {
    justify-self: center;
  }
}

@media (max-width: 520px) {
  .login-screen { padding: 12px; }
  .login-brand, .login-form { padding: 22px; }
  .timeout-panel {
    grid-template-columns: 1fr;
  }
  .timeout-brand {
    min-height: 180px;
    padding: 26px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .timeout-copy {
    padding: 24px;
  }
  .timeout-copy h1 {
    font-size: 1.68rem;
  }
  .timeout-details div {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .knowledge-hero-stats {
    grid-template-columns: 1fr;
  }
  .mobile-api-head,
  .mobile-api-row {
    grid-template-columns: 1fr;
  }

  .mobile-api-pill,
  .mobile-api-settings .ghost-button {
    justify-self: start;
  }

  .nav-item {
    flex-basis: 52px;
    min-height: 48px;
    padding: 8px;
  }

  .nav-item span {
    display: none;
  }

  .toolbar,
  .toolbar-group,
  .inline-actions,
  .roster-head,
  .roster-row {
    display: grid;
    width: 100%;
    align-items: stretch;
  }

  .primary-button,
  .secondary-button,
  .filter-select { width: 100%; }

  .roster-head,
  .roster-row,
  .metric-grid.compact {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 360px) {
  .topbar-controls {
    grid-template-columns: minmax(0, 1fr) auto auto;
  }

  .topbar-controls #live-clock,
  .search-box {
    grid-column: 1 / -1;
  }

  .topbar-controls #quick-add-button {
    grid-column: 1;
  }

  .topbar-controls #system-status {
    grid-column: 2;
  }

  .topbar-controls #save-status {
    grid-column: 3;
  }

  .user-pill {
    grid-column: 1 / 3;
  }

  .topbar-controls > [data-action="signout"] {
    grid-column: 3;
  }
}

/* Modern shell refresh */
:root {
  --bg: #eef3f8;
  --surface: #ffffff;
  --surface-soft: #f6f9fc;
  --ink: #0c1526;
  --muted: #5c6b82;
  --line: #dbe4ee;
  --navy: #17245a;
  --navy-2: #0f172a;
  --blue: #1d5fbc;
  --blue-soft: #e8f1ff;
  --red: #c31d3a;
  --red-soft: #fee7ed;
  --teal: #087a72;
  --teal-soft: #dcf5f2;
  --amber: #a45d00;
  --amber-soft: #fff1da;
  --green: #247a46;
  --green-soft: #e5f6eb;
  --purple: #6957b7;
  --purple-soft: #eeeafb;
  --shadow: 0 22px 60px rgba(15, 23, 42, 0.12);
  --shadow-soft: 0 10px 30px rgba(15, 23, 42, 0.07);
  --shadow-hover: 0 18px 46px rgba(15, 23, 42, 0.14);
  --focus: 0 0 0 3px rgba(29, 95, 188, 0.18);
  --radius: 8px;
}

body {
  background-color: #edf3f8;
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(237, 243, 248, 0.93) 260px, rgba(231, 239, 247, 0.96)),
    repeating-linear-gradient(90deg, rgba(23, 36, 90, 0.055) 0 1px, transparent 1px 88px),
    repeating-linear-gradient(0deg, rgba(23, 36, 90, 0.04) 0 1px, transparent 1px 88px),
    linear-gradient(128deg, transparent 0 38%, rgba(29, 95, 188, 0.07) 38% 38.25%, transparent 38.25% 100%),
    linear-gradient(53deg, transparent 0 61%, rgba(195, 29, 58, 0.045) 61% 61.25%, transparent 61.25% 100%),
    linear-gradient(180deg, #f8fbff 0%, #e7eff7 100%);
  background-attachment: fixed;
  background-size: auto, 88px 88px, 88px 88px, auto, auto, auto;
}

.login-screen {
  background:
    linear-gradient(120deg, rgba(10, 21, 38, 0.08), transparent 40%),
    linear-gradient(180deg, #f8fbff, #eaf0f7);
}

.login-screen::before {
  opacity: 0.45;
}

.login-panel,
.startup-panel {
  border: 1px solid rgba(219, 228, 238, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.login-brand {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(246, 249, 252, 0.98));
}

.login-form {
  background: #ffffff;
}

.app-shell {
  grid-template-columns: 286px minmax(0, 1fr);
  background: transparent;
}

.sidebar {
  gap: 14px;
  padding: 16px;
  border-right: 1px solid rgba(219, 228, 238, 0.86);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(244, 248, 252, 0.96));
  color: var(--ink);
  box-shadow: 10px 0 36px rgba(15, 23, 42, 0.06);
}

.brand {
  min-height: 74px;
  padding: 12px;
  border: 1px solid rgba(219, 228, 238, 0.9);
  background: #ffffff;
  box-shadow: var(--shadow-soft);
}

.brand img {
  max-width: 205px;
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-height: 0;
  overflow-y: auto;
  padding: 2px 4px 8px 0;
  scrollbar-color: #c8d3e0 transparent;
  scrollbar-width: thin;
}

.nav-section {
  display: block;
  margin: 14px 8px 5px;
  color: #8190a5;
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.nav-section:first-child {
  margin-top: 2px;
}

.nav-item {
  position: relative;
  grid-template-columns: 36px minmax(0, 1fr);
  min-height: 48px;
  padding: 0 10px 0 8px;
  border: 1px solid transparent;
  background: transparent;
  color: #334155;
}

.nav-item i {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  background: #eef4fb;
  color: #52647d;
}

.nav-item small {
  color: #7a8aa1;
}

.nav-item:hover,
.nav-item:focus-visible {
  background: #ffffff;
  color: var(--ink);
  border-color: rgba(219, 228, 238, 0.95);
  box-shadow: var(--shadow-soft);
}

.nav-item.is-active {
  background: #ffffff;
  color: var(--navy);
  border-color: rgba(29, 95, 188, 0.2);
  box-shadow: 0 12px 32px rgba(29, 95, 188, 0.13);
}

.nav-item.is-active::before {
  content: "";
  position: absolute;
  left: -4px;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 999px;
  background: var(--blue);
}

.nav-item.is-active i {
  background: var(--blue-soft);
  color: var(--blue);
}

.sidebar-actions {
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.sidebar-actions .icon-button {
  background: #ffffff;
  color: var(--ink);
  border-color: var(--line);
}

.workspace {
  position: relative;
  isolation: isolate;
  padding: 24px 28px 32px;
}

.topbar {
  gap: 22px;
  min-height: 86px;
  margin: -10px -8px 22px;
  padding: 14px 8px 16px;
  background:
    linear-gradient(180deg, rgba(248, 251, 255, 0.86), rgba(238, 244, 250, 0.76));
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(219, 228, 238, 0.76);
}

.topbar h1 {
  font-size: 2.24rem;
  line-height: 1;
}

.topbar-controls {
  gap: 8px;
}

.search-box {
  grid-template-columns: 18px minmax(220px, 320px);
  min-height: 42px;
  border-color: transparent;
  background: #ffffff;
  box-shadow: var(--shadow-soft);
}

.search-box:focus-within {
  border-color: rgba(29, 95, 188, 0.35);
  background: #ffffff;
}

.primary-button,
.secondary-button,
.ghost-button,
.icon-button,
.mini-button,
.widget-control,
.quick-tile {
  font-weight: 850;
}

.primary-button {
  background: linear-gradient(180deg, #25347a, #17245a);
  box-shadow: 0 10px 24px rgba(23, 36, 90, 0.22);
}

.primary-button:hover,
.primary-button:focus-visible {
  background: linear-gradient(180deg, #1e2d6f, #101c4e);
}

.secondary-button,
.mini-button,
.workspace .icon-button,
.workspace-only,
.widget-control {
  background: #ffffff;
  border-color: var(--line);
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.04);
}

.secondary-button:hover,
.secondary-button:focus-visible,
.workspace .icon-button:hover,
.workspace .icon-button:focus-visible,
.mini-button:hover,
.mini-button:focus-visible,
.widget-control:hover,
.widget-control:focus-visible,
.quick-tile:hover,
.quick-tile:focus-visible {
  border-color: #b7c5d6;
  box-shadow: var(--shadow-soft);
}

.user-pill,
.status-pill {
  min-height: 40px;
  border-color: rgba(219, 228, 238, 0.9);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.05);
}

.current-user-copy strong {
  font-size: 0.86rem;
}

.current-user-copy small {
  color: #728197;
}

.view-region {
  gap: 20px;
}

.metric-grid {
  gap: 16px;
}

.metric-card,
.panel,
.widget,
.floor-column,
.part-card,
.empty-state,
.clock-card,
.module-card,
.table-wrap,
.access-command-panel,
.department-card,
.access-group-card,
.department-load-row,
.machine-camera-card,
.live-now-card {
  border-color: rgba(219, 228, 238, 0.9);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(250, 253, 255, 0.93));
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(10px);
}

.metric-card,
.module-card,
.panel,
.widget,
.clock-card {
  overflow: hidden;
}

.metric-card {
  min-height: 116px;
  padding: 18px;
}

.metric-icon {
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.56);
}

.metric-value {
  font-size: 1.62rem;
}

.panel,
.widget,
.module-card,
.clock-card {
  padding: 18px;
}

.panel-header,
.table-head,
.widget-header,
.clock-card-header {
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(219, 228, 238, 0.84);
}

.panel-header h2,
.table-head h2,
.widget-header h2,
.clock-card-header h2,
.module-card h2 {
  font-size: 1.02rem;
}

.access-command-panel {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(244, 249, 253, 0.98));
}

.quick-tile {
  background: #ffffff;
}

.widget {
  border-radius: 8px;
}

.widget:hover,
.panel:hover,
.metric-card:hover,
.module-card:hover,
.part-card:hover,
.department-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-hover);
}

.widget.is-dragging {
  transform: scale(0.985);
}

.dashboard-config {
  border-style: solid;
  background: rgba(255, 255, 255, 0.78);
}

.module-card {
  min-height: 198px;
}

.floor-count-card,
.floor-column,
.access-group-card,
.department-card,
.department-load-row,
.clock-state {
  background: var(--surface-soft);
}

.part-card {
  background: #ffffff;
}

.erp-intelligence {
  display: grid;
  gap: 14px;
}

.erp-intelligence-score {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(219, 228, 238, 0.88);
  border-radius: 8px;
  background: linear-gradient(135deg, #ffffff 0%, #f5f9fd 100%);
}

.erp-report-button {
  min-height: 38px;
  padding: 0 12px;
}

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

.erp-readiness-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(110px, 0.55fr) auto;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(219, 228, 238, 0.72);
  border-radius: 8px;
  background: #ffffff;
}

.erp-readiness-main {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.erp-readiness-main strong,
.erp-readiness-main span,
.erp-readiness-row p {
  overflow-wrap: anywhere;
}

.erp-readiness-main span,
.erp-readiness-row p {
  color: var(--muted);
  font-size: 0.82rem;
}

.erp-readiness-meter {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7edf5;
}

.erp-readiness-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--teal));
}

.erp-readiness-row p {
  grid-column: 1 / -1;
  margin: 0;
}

.table-wrap {
  border-radius: 8px;
}

table {
  min-width: 820px;
}

th {
  color: #65748a;
  background: #f4f8fc;
}

th,
td {
  padding: 13px 15px;
}

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

tbody tr:hover,
tbody tr:has([data-open-record]):hover {
  background: #eef6ff;
}

.sort-button:hover,
.sort-button:focus-visible,
.sort-button.is-active {
  color: var(--blue);
}

.badge,
.status-pill,
.user-pill {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.36);
}

.modal-root {
  background: rgba(15, 23, 42, 0.52);
  backdrop-filter: blur(10px);
}

.modal {
  border: 1px solid rgba(219, 228, 238, 0.9);
  box-shadow: var(--shadow);
}

.modal-header {
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
}

.toast {
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: var(--shadow);
}

/* Large-screen quality pass: keeps dense ERP work usable from HD through 4K. */
img,
svg,
canvas,
video {
  max-width: 100%;
}

img {
  image-rendering: auto;
}

svg {
  shape-rendering: geometricPrecision;
  text-rendering: geometricPrecision;
}

.brand img,
.login-brand img,
.startup-panel img,
.timeout-brand img,
.ai-assistant-launcher img {
  object-fit: contain;
}

.workspace,
.view-region,
.panel,
.widget,
.module-card,
.metric-card,
.table-wrap,
.modal,
.ai-assistant-panel {
  min-width: 0;
}

@media (min-width: 1600px) {
  .login-panel {
    width: min(1080px, calc(100vw - 96px));
    grid-template-columns: minmax(0, 1.08fr) minmax(380px, 0.92fr);
  }

  .startup-panel {
    padding: 44px;
  }

  .login-brand {
    min-height: 560px;
    padding: 48px;
  }

  .login-brand img,
  .startup-panel img,
  .timeout-brand img {
    width: min(500px, 100%);
  }

  .login-form,
  .timeout-copy {
    gap: 18px;
    padding: 48px;
  }

  .timeout-panel {
    width: min(920px, calc(100vw - 96px));
  }

  .app-shell {
    grid-template-columns: 306px minmax(0, 1fr);
  }

  .workspace {
    width: 100%;
    max-width: 2320px;
    margin-inline: auto;
    padding: 32px 36px 44px;
  }

  .sidebar {
    padding: 18px;
  }

  .brand img {
    max-width: 224px;
  }

  .nav-item {
    min-height: 50px;
  }

  .topbar {
    min-height: 94px;
    margin: -12px -8px 26px;
    padding: 18px 8px 18px;
  }

  .topbar h1 {
    font-size: 2.36rem;
  }

  .view-region {
    gap: 24px;
  }

  .metric-grid,
  .report-summary {
    grid-template-columns: repeat(6, minmax(180px, 1fr));
    gap: 18px;
  }

  .metric-card,
  .panel,
  .widget,
  .module-card,
  .clock-card {
    padding: 20px;
  }

  .metric-card {
    min-height: 124px;
  }

  .dashboard-grid {
    gap: 18px;
  }

  .widget {
    grid-column: span 3;
  }

  .widget.large {
    grid-column: span 6;
  }

  .widget.full {
    grid-column: 1 / -1;
  }

  .module-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 18px;
  }

  .module-card {
    min-height: 220px;
  }

  .report-output-grid {
    grid-template-columns: minmax(520px, 0.9fr) minmax(680px, 1.1fr);
    gap: 22px;
  }

  .report-chart {
    min-height: 390px;
    padding: 14px;
  }

  .report-svg,
  .radar-svg,
  .heatmap-svg,
  .gauge-svg {
    min-width: 900px;
  }

  .pie-chart-wrap {
    max-width: 820px;
  }

  table {
    min-width: 960px;
  }

  .report-table {
    min-width: 1120px;
  }

  .audit-table,
  .hr-master-table {
    min-width: 1240px;
  }

  .modal {
    width: min(920px, calc(100vw - 64px));
    max-height: min(940px, calc(100dvh - 64px));
  }

  .detail-modal {
    width: min(1180px, calc(100vw - 64px));
  }

  .legal-modal {
    width: min(1220px, calc(100vw - 64px));
  }

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

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

  .qr-box {
    width: 300px;
    min-width: 300px;
    min-height: 300px;
  }

  .qr-svg,
  .qr-svg svg,
  #qr-canvas {
    width: 276px;
    height: 276px;
  }

  .ai-assistant {
    right: 28px;
    bottom: 28px;
  }

  .ai-assistant-launcher {
    width: 74px;
    height: 64px;
  }

  .ai-assistant-panel {
    width: min(520px, calc(100vw - 56px));
    max-height: min(780px, calc(100vh - 120px));
  }
}

@media (min-width: 2200px) {
  .login-panel {
    width: min(1240px, calc(100vw - 128px));
  }

  .login-brand {
    min-height: 620px;
    padding: 56px;
  }

  .login-brand img,
  .startup-panel img,
  .timeout-brand img {
    width: min(560px, 100%);
  }

  .login-form,
  .timeout-copy {
    padding: 56px;
  }

  .timeout-panel {
    width: min(1040px, calc(100vw - 128px));
  }

  .app-shell {
    grid-template-columns: 318px minmax(0, 1fr);
  }

  .workspace {
    max-width: 3000px;
    padding: 40px 48px 56px;
  }

  .topbar h1 {
    font-size: 2.48rem;
  }

  .search-box {
    grid-template-columns: 18px minmax(260px, 380px);
  }

  .metric-grid,
  .report-summary {
    grid-template-columns: repeat(8, minmax(180px, 1fr));
  }

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

  .widget {
    grid-column: span 4;
  }

  .widget.large {
    grid-column: span 8;
  }

  .widget.full {
    grid-column: 1 / -1;
  }

  .module-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
  }

  .module-card {
    min-height: 232px;
  }

  .report-output-grid {
    grid-template-columns: minmax(620px, 0.82fr) minmax(860px, 1.18fr);
    gap: 26px;
  }

  .report-chart {
    min-height: 450px;
  }

  .report-svg,
  .radar-svg,
  .heatmap-svg,
  .gauge-svg {
    min-width: 1120px;
  }

  .gauge-chart-wrap {
    max-width: 900px;
  }

  .pie-chart-wrap {
    grid-template-columns: 260px minmax(0, 1fr);
    max-width: 920px;
  }

  .pie-svg {
    width: 260px;
    height: 260px;
  }

  table {
    min-width: 1040px;
  }

  .report-table {
    min-width: 1280px;
  }

  .audit-table,
  .hr-master-table {
    min-width: 1360px;
  }

  .modal {
    width: min(980px, calc(100vw - 96px));
    max-height: min(980px, calc(100dvh - 96px));
  }

  .detail-modal {
    width: min(1360px, calc(100vw - 96px));
  }

  .legal-modal {
    width: min(1400px, calc(100vw - 96px));
  }
}

@media (min-width: 3200px) {
  .login-panel {
    width: min(1380px, calc(100vw - 160px));
  }

  .login-brand {
    min-height: 680px;
    padding: 64px;
  }

  .login-brand img,
  .startup-panel img,
  .timeout-brand img {
    width: min(620px, 100%);
  }

  .login-form,
  .timeout-copy {
    padding: 64px;
  }

  .timeout-panel {
    width: min(1140px, calc(100vw - 160px));
  }

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

  .workspace {
    max-width: 3440px;
    padding: 48px 64px 72px;
  }

  .topbar {
    min-height: 104px;
    margin-bottom: 30px;
  }

  .topbar h1 {
    font-size: 2.58rem;
  }

  .view-region {
    gap: 28px;
  }

  .metric-grid,
  .report-summary {
    grid-template-columns: repeat(10, minmax(180px, 1fr));
    gap: 20px;
  }

  .dashboard-grid {
    gap: 22px;
  }

  .metric-card,
  .panel,
  .widget,
  .module-card,
  .clock-card {
    padding: 22px;
  }

  .module-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 22px;
  }

  .report-chart {
    min-height: 520px;
  }

  .report-svg,
  .radar-svg,
  .heatmap-svg,
  .gauge-svg {
    min-width: 1280px;
    max-width: 1900px;
  }

  .modal {
    width: min(1040px, calc(100vw - 128px));
  }

  .detail-modal {
    width: min(1540px, calc(100vw - 128px));
  }

  .legal-modal {
    width: min(1560px, calc(100vw - 128px));
  }

  .ai-assistant-panel {
    width: min(560px, calc(100vw - 64px));
    max-height: min(840px, calc(100vh - 128px));
  }
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    height: auto;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 10px;
    padding: 10px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .brand {
    min-height: 48px;
    width: 112px;
    padding: 8px;
  }

  .nav-list {
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 2px 4px;
  }

  .nav-section {
    display: none;
  }

  .nav-item {
    flex: 0 0 auto;
    min-width: 142px;
  }

  .sidebar-actions {
    align-self: center;
    padding-top: 0;
    border-top: 0;
  }

  .workspace {
    padding: 18px;
  }
}

@media (max-width: 760px) {
  .topbar {
    position: static;
    margin: -4px -2px 16px;
    padding: 8px 2px 14px;
  }

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

  .search-box {
    grid-column: 1 / -1;
    grid-template-columns: 18px minmax(0, 1fr);
  }

  .topbar-controls #quick-add-button,
  .topbar-controls #system-status,
  .topbar-controls #save-status,
  .user-pill {
    grid-column: auto;
  }

  .user-pill {
    grid-column: 1 / 3;
  }

  .metric-card,
  .panel,
  .widget,
  .module-card,
  .clock-card {
    padding: 15px;
  }

  .erp-intelligence-score,
  .erp-readiness-row {
    grid-template-columns: 1fr;
  }

  .erp-report-button {
    justify-self: start;
  }
}

@media (max-width: 520px) {
  .compliance-banner,
  .compliance-banner-main,
  .controlled-record-notice,
  .compliance-posture-row {
    grid-template-columns: 1fr;
  }

  .compliance-banner-pills,
  .compliance-posture-title {
    justify-content: flex-start;
  }

  .compliance-posture-title {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .brand {
    min-height: 50px;
    width: 100%;
    justify-items: center;
  }

  .brand img {
    max-width: 172px;
  }

  .nav-item {
    grid-template-columns: 32px minmax(0, 1fr);
    min-width: 142px;
    min-height: 44px;
    padding: 0 9px 0 7px;
  }

  .nav-item i {
    width: 32px;
    height: 32px;
  }

  .nav-item span {
    display: grid;
  }

  .nav-item strong {
    font-size: 0.78rem;
  }

  .nav-item small {
    font-size: 0.58rem;
  }

  .sidebar-actions {
    justify-content: flex-start;
    overflow-x: auto;
  }
}

@media (max-width: 760px) {
  .topbar-controls {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
  }

  .topbar-controls .search-box {
    flex: 1 0 100%;
    order: 1;
  }

  .topbar-controls #live-clock {
    order: 0;
  }

  .topbar-controls #quick-add-button {
    order: 2;
  }

  .topbar-controls .legal-topbar-button {
    order: 3;
  }

  .topbar-controls #system-status,
  .topbar-controls #save-status {
    order: 4;
  }

  .topbar-controls .user-pill {
    flex: 1 1 180px;
    order: 5;
  }

  .topbar-controls > [data-action="signout"] {
    order: 6;
    margin-left: auto;
  }
}

@media (max-width: 420px) {
  .login-legal-links {
    display: grid;
    grid-template-columns: 1fr;
  }

  .login-legal-links button {
    justify-content: center;
  }

  .topbar-controls #system-status,
  .topbar-controls #save-status {
    flex: 1 1 calc(50% - 6px);
  }
}

.ai-assistant {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 80;
  display: grid;
  justify-items: end;
  gap: 10px;
  pointer-events: none;
}

.ai-assistant-launcher,
.ai-assistant-panel {
  pointer-events: auto;
}

.ai-assistant-launcher {
  position: relative;
  display: grid;
  width: 66px;
  height: 58px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  filter: drop-shadow(0 14px 24px rgba(15, 23, 42, 0.24));
}

.ai-assistant-launcher:hover,
.ai-assistant-launcher:focus-visible {
  filter: drop-shadow(0 16px 28px rgba(15, 23, 42, 0.32));
}

.ai-assistant-launcher:focus-visible {
  outline: 3px solid rgba(29, 95, 188, 0.34);
  outline-offset: 4px;
}

.ai-assistant-launcher img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.ai-assistant-dot {
  position: absolute;
  top: 4px;
  right: 6px;
  width: 11px;
  height: 11px;
  border: 2px solid #ffffff;
  border-radius: 999px;
  background: var(--green);
}

.ai-assistant-panel {
  display: none;
  width: min(448px, calc(100vw - 28px));
  max-height: min(700px, calc(100vh - 94px));
  overflow: hidden;
  border: 1px solid rgba(219, 228, 238, 0.96);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.ai-assistant.is-open .ai-assistant-panel {
  display: grid;
  grid-template-rows: auto auto auto auto minmax(160px, 1fr) auto auto;
}

.ai-assistant-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  background: #f7fafd;
}

.ai-assistant-header div:first-child {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.ai-assistant-header strong {
  font-size: 0.94rem;
}

.ai-assistant-header span {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-assistant-header-actions {
  display: flex;
  gap: 6px;
}

.ai-assistant-header-actions .icon-button {
  width: 32px;
  height: 32px;
}

.ai-assistant-pulse {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.ai-pulse-card {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  min-height: 50px;
  gap: 8px;
  padding: 7px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--ink);
  text-align: left;
}

.ai-pulse-card:hover,
.ai-pulse-card:focus-visible {
  border-color: rgba(29, 95, 188, 0.34);
  background: #ffffff;
  box-shadow: var(--shadow-soft);
  outline: none;
}

.ai-pulse-card .metric-icon {
  width: 28px;
  height: 28px;
}

.ai-pulse-card .metric-icon svg {
  width: 15px;
  height: 15px;
}

.ai-pulse-card span:last-child {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.ai-pulse-card strong,
.ai-pulse-card small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-pulse-card strong {
  font-size: 0.75rem;
  font-weight: 900;
}

.ai-pulse-card small {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
}

.ai-mode-section {
  display: grid;
  gap: 9px;
  padding: 10px 12px 11px;
  border-bottom: 1px solid var(--line);
  background: #fbfcff;
}

.ai-mode-head {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.ai-mode-head .metric-icon {
  width: 30px;
  height: 30px;
}

.ai-mode-head > span:nth-child(2) {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.ai-mode-head strong,
.ai-mode-head small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-mode-head strong {
  font-size: 0.8rem;
  font-weight: 950;
}

.ai-mode-head small {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
}

.ai-mode-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 78px;
  min-height: 24px;
  padding: 0 9px;
  border: 1px solid rgba(29, 95, 188, 0.16);
  border-radius: 999px;
  background: #ffffff;
  color: var(--navy);
  font-size: 0.68rem;
  font-weight: 950;
}

.ai-mode-lanes {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.ai-mode-lane {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  align-items: center;
  min-width: 0;
  min-height: 46px;
  gap: 6px;
  padding: 7px;
  overflow: hidden;
  border: 1px solid rgba(29, 95, 188, 0.16);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  text-align: left;
}

.ai-mode-lane svg {
  width: 16px;
  height: 16px;
  color: var(--blue);
}

.ai-mode-lane span {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.ai-mode-lane strong,
.ai-mode-lane small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-mode-lane strong {
  font-size: 0.7rem;
  font-weight: 950;
}

.ai-mode-lane small {
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 800;
}

.ai-mode-lane:hover,
.ai-mode-lane:focus-visible {
  border-color: rgba(29, 95, 188, 0.38);
  background: var(--blue-soft);
  box-shadow: var(--shadow-soft);
  outline: none;
}

.ai-command-deck {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
  padding: 9px 12px 11px;
  border-bottom: 1px solid var(--line);
  background: #f7fafd;
}

.ai-command-button {
  display: grid;
  justify-items: center;
  align-content: center;
  min-width: 0;
  min-height: 46px;
  gap: 4px;
  padding: 6px 4px;
  overflow: hidden;
  border: 1px solid rgba(29, 95, 188, 0.16);
  border-radius: 8px;
  background: #ffffff;
  color: var(--navy);
  font-size: 0.68rem;
  font-weight: 900;
  text-align: center;
}

.ai-command-button svg {
  width: 16px;
  height: 16px;
}

.ai-command-button span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-command-button:hover,
.ai-command-button:focus-visible {
  border-color: rgba(29, 95, 188, 0.38);
  background: var(--blue-soft);
  box-shadow: var(--shadow-soft);
  outline: none;
}

.ai-assistant-messages {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 0;
  overflow-y: auto;
  padding: 14px;
  background: linear-gradient(180deg, #ffffff, #f7fafd);
}

.ai-message {
  display: grid;
  max-width: 88%;
  gap: 5px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 5px 14px rgba(15, 23, 42, 0.05);
}

.ai-message.user {
  justify-self: end;
  border-color: rgba(29, 95, 188, 0.22);
  background: var(--blue-soft);
}

.ai-message.assistant {
  justify-self: start;
}

.ai-message p {
  margin: 0;
  line-height: 1.42;
  overflow-wrap: anywhere;
}

.ai-plan-card {
  display: grid;
  gap: 9px;
  margin-top: 4px;
  padding: 10px;
  border: 1px solid rgba(29, 95, 188, 0.18);
  border-radius: 8px;
  background: #f8fbff;
}

.ai-plan-head {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.ai-plan-head .metric-icon {
  width: 30px;
  height: 30px;
}

.ai-plan-head span:last-child {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.ai-plan-head strong,
.ai-plan-head small {
  overflow: hidden;
  text-overflow: ellipsis;
}

.ai-plan-head strong {
  font-size: 0.8rem;
  font-weight: 950;
}

.ai-plan-head small {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  line-height: 1.25;
}

.ai-plan-steps {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ai-plan-steps li {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) 30px;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 6px;
  border: 1px solid rgba(219, 228, 238, 0.95);
  border-radius: 8px;
  background: #ffffff;
}

.ai-plan-index {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 0.68rem;
  font-weight: 950;
}

.ai-plan-steps li > span:nth-child(2) {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.ai-plan-steps strong,
.ai-plan-steps small {
  overflow: hidden;
  text-overflow: ellipsis;
}

.ai-plan-steps strong {
  font-size: 0.74rem;
  font-weight: 900;
}

.ai-plan-steps small {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 750;
  line-height: 1.2;
}

.ai-plan-step-action {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid rgba(29, 95, 188, 0.18);
  border-radius: 8px;
  background: #ffffff;
  color: var(--navy);
}

.ai-plan-step-action svg {
  width: 15px;
  height: 15px;
}

.ai-plan-step-action:hover,
.ai-plan-step-action:focus-visible {
  border-color: rgba(29, 95, 188, 0.38);
  background: var(--blue-soft);
  outline: none;
}

.ai-message-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}

.ai-message-actions button {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  max-width: 180px;
  gap: 5px;
  padding: 0 9px;
  overflow: hidden;
  border: 1px solid rgba(29, 95, 188, 0.18);
  border-radius: 999px;
  background: #ffffff;
  color: var(--navy);
  font-size: 0.74rem;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-message-actions button svg {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
}

.ai-message-actions button span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.ai-message-actions button:hover,
.ai-message-actions button:focus-visible {
  border-color: rgba(29, 95, 188, 0.36);
  background: var(--blue-soft);
}

.ai-thinking::after {
  content: "...";
  animation: assistantThinking 1.1s steps(3, end) infinite;
}

.ai-assistant-suggestions {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  background: #ffffff;
}

.ai-assistant-suggestions button {
  flex: 0 0 auto;
  min-height: 30px;
  max-width: 220px;
  padding: 0 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--navy);
  font-size: 0.76rem;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-assistant-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 8px;
  padding: 12px 14px 14px;
  border-top: 1px solid var(--line);
  background: #ffffff;
}

.ai-assistant-form input {
  min-width: 0;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
}

.ai-assistant-form input:focus {
  border-color: #8ca6cf;
  box-shadow: var(--focus);
}

.ai-assistant-form .primary-button {
  width: 42px;
  min-height: 40px;
  padding: 0;
}

@keyframes assistantThinking {
  0% { opacity: 0.3; }
  100% { opacity: 1; }
}

@keyframes assistantPulse {
  0% { box-shadow: 0 0 0 0 rgba(31, 122, 67, 0.34); }
  100% { box-shadow: 0 0 0 9px rgba(31, 122, 67, 0); }
}

.ai-assistant-dot {
  animation: assistantPulse 1.8s ease-out infinite;
}

.subpanel {
  display: grid;
  align-content: start;
  gap: 14px;
}

.mini-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.mini-stats span,
.tag-row .badge {
  white-space: normal;
}

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

.detail-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 10px 12px;
}

.detail-panel summary {
  cursor: pointer;
  color: var(--navy);
  font-weight: 850;
}

.detail-panel p {
  margin: 8px 0 0;
}

.callout {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid #cfe0f4;
  border-radius: 8px;
  background: #f7fbff;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

@media (max-width: 520px) {
  .ai-assistant {
    right: 10px;
    bottom: 10px;
  }

  .ai-assistant-panel {
    width: calc(100vw - 20px);
    max-height: calc(100vh - 84px);
  }

  .ai-message {
    max-width: 94%;
  }

  .ai-assistant-pulse {
    grid-template-columns: 1fr;
  }

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

  .ai-command-deck {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Visual and navigation upgrade pass: responsive ERP cockpit from phones through 8K displays. */
:root {
  --content-gutter: 24px;
  --nav-width: 286px;
  --nav-icon-size: 34px;
  --touch-target: 44px;
  --surface-glass: rgba(255, 255, 255, 0.94);
  --line-strong: #c5cfdd;
  --shadow-lifted: 0 18px 44px rgba(15, 23, 42, 0.1);
  --shadow-panel: 0 10px 28px rgba(15, 23, 42, 0.065);
}

html {
  scroll-padding-top: 96px;
}

body {
  background-color: #edf3f8;
  background-image:
    linear-gradient(180deg, rgba(250, 252, 255, 0.92), rgba(236, 243, 249, 0.92)),
    repeating-linear-gradient(90deg, rgba(32, 42, 98, 0.04) 0 1px, transparent 1px 56px),
    repeating-linear-gradient(0deg, rgba(8, 118, 111, 0.032) 0 1px, transparent 1px 56px);
  background-size: auto, 56px 56px, 56px 56px;
  font-feature-settings: "kern" 1, "liga" 1;
}

.app-shell {
  grid-template-columns: var(--nav-width) minmax(0, 1fr);
}

.sidebar {
  overflow: hidden;
  padding: 16px 14px;
  border-right: 1px solid rgba(197, 207, 221, 0.84);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(246, 249, 252, 0.96));
  box-shadow: 12px 0 36px rgba(15, 23, 42, 0.07);
}

.brand {
  min-height: 78px;
  border-color: rgba(197, 207, 221, 0.84);
  background:
    linear-gradient(180deg, #ffffff, #f8fbff);
}

.brand img,
.login-brand img,
.startup-panel img,
.timeout-brand img {
  image-rendering: auto;
  transform: translateZ(0);
}

.nav-list {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  overflow: auto;
  padding: 2px 4px 10px 0;
  overscroll-behavior: contain;
  scrollbar-color: #bdc9d8 transparent;
  scrollbar-width: thin;
}

.nav-section {
  margin: 14px 8px 4px;
  color: #68778e;
  font-size: 0.68rem;
  letter-spacing: 0;
}

.nav-item {
  grid-template-columns: var(--nav-icon-size) minmax(0, 1fr);
  min-height: 50px;
  gap: 10px;
  padding: 0 10px 0 8px;
  border: 1px solid transparent;
  color: #26354b;
  transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease, color 140ms ease, transform 140ms ease;
}

.nav-item i {
  width: var(--nav-icon-size);
  height: var(--nav-icon-size);
  border: 1px solid rgba(197, 207, 221, 0.64);
  background: #f1f6fb;
}

.nav-item strong {
  font-size: 0.92rem;
  line-height: 1.12;
}

.nav-item small {
  color: #64748b;
  font-size: 0.67rem;
}

.nav-item:hover,
.nav-item:focus-visible {
  border-color: rgba(197, 207, 221, 0.96);
  background: #ffffff;
  box-shadow: var(--shadow-panel);
  color: #111827;
  transform: translateX(2px);
}

.nav-item.is-active {
  border-color: rgba(35, 88, 166, 0.24);
  background: #ffffff;
  box-shadow: 0 14px 32px rgba(35, 88, 166, 0.14);
}

.nav-item.is-active::before {
  left: -5px;
  top: 9px;
  bottom: 9px;
  width: 4px;
}

.nav-item.is-active i {
  border-color: rgba(35, 88, 166, 0.2);
  background: var(--blue-soft);
  color: var(--blue);
}

.sidebar-actions {
  gap: 9px;
  padding-top: 12px;
}

.sidebar-actions .icon-button {
  min-width: var(--touch-target);
  min-height: var(--touch-target);
}

.workspace {
  width: 100%;
  max-width: none;
  padding: var(--content-gutter) calc(var(--content-gutter) + 4px) calc(var(--content-gutter) + 8px);
}

.topbar {
  z-index: 30;
  min-height: 88px;
  margin: -10px -8px 22px;
  padding: 14px 8px 16px;
  background:
    linear-gradient(180deg, rgba(248, 251, 255, 0.92), rgba(238, 244, 250, 0.82));
  backdrop-filter: blur(18px);
}

.topbar > div:first-child {
  min-width: min(520px, 100%);
}

.topbar h1 {
  line-height: 1.02;
}

.topbar-controls {
  gap: 9px;
}

.search-box {
  min-height: 44px;
  grid-template-columns: 18px minmax(220px, 340px);
  border-color: rgba(197, 207, 221, 0.68);
  background: #ffffff;
  box-shadow: var(--shadow-panel);
}

.primary-button,
.secondary-button,
.ghost-button,
.icon-button,
.mini-button,
.widget-control,
.quick-tile {
  min-height: var(--touch-target);
}

.icon-button,
.widget-control {
  width: var(--touch-target);
  height: var(--touch-target);
}

.status-pill,
.user-pill {
  min-height: var(--touch-target);
}

.view-region {
  gap: 22px;
}

.metric-card,
.panel,
.widget,
.module-card,
.table-wrap,
.clock-card,
.empty-state {
  border-color: rgba(197, 207, 221, 0.82);
  box-shadow: var(--shadow-panel);
}

.metric-card:hover,
.panel:hover,
.widget:hover,
.module-card:hover,
.part-card:hover {
  box-shadow: var(--shadow-lifted);
}

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

.module-grid {
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

.dashboard-grid {
  gap: 16px;
}

.table-wrap {
  scrollbar-gutter: stable;
}

table {
  min-width: 860px;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
}

th,
td {
  line-height: 1.36;
}

@media (min-width: 1200px) {
  :root {
    --content-gutter: 28px;
    --nav-width: 300px;
  }

  .workspace {
    padding-right: 32px;
  }

  .module-grid {
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  }
}

@media (min-width: 1800px) {
  :root {
    --content-gutter: 36px;
    --nav-width: 318px;
    --nav-icon-size: 38px;
  }

  .brand {
    min-height: 88px;
  }

  .brand img {
    max-width: 232px;
  }

  .nav-item {
    min-height: 56px;
  }

  .nav-item strong {
    font-size: 0.98rem;
  }

  .nav-item small {
    font-size: 0.7rem;
  }

  .topbar {
    min-height: 98px;
    margin-bottom: 28px;
  }

  .search-box {
    grid-template-columns: 18px minmax(280px, 440px);
  }

  .metric-grid,
  .report-summary {
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 18px;
  }

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

  .widget {
    grid-column: span 4;
  }

  .widget.large {
    grid-column: span 8;
  }

  .module-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
  }

  .panel,
  .widget,
  .module-card,
  .metric-card,
  .clock-card {
    padding: 22px;
  }
}

@media (min-width: 2560px) {
  :root {
    --content-gutter: 44px;
    --nav-width: 340px;
    --nav-icon-size: 40px;
    --touch-target: 46px;
  }

  .workspace {
    padding-right: 52px;
  }

  .view-region {
    gap: 28px;
  }

  .dashboard-grid {
    grid-template-columns: repeat(20, minmax(0, 1fr));
    gap: 22px;
  }

  .widget {
    grid-column: span 5;
  }

  .widget.large {
    grid-column: span 10;
  }

  .metric-grid,
  .report-summary {
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 22px;
  }

  .module-grid {
    grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
    gap: 22px;
  }

  .report-chart {
    min-height: 540px;
  }

  table {
    min-width: 1120px;
  }

  .report-table {
    min-width: 1400px;
  }

  .audit-table,
  .hr-master-table {
    min-width: 1520px;
  }
}

@media (min-width: 3840px) {
  :root {
    --content-gutter: 56px;
    --nav-width: 372px;
    --nav-icon-size: 44px;
    --touch-target: 50px;
  }

  .sidebar {
    padding: 22px 18px;
  }

  .brand {
    min-height: 102px;
  }

  .brand img {
    max-width: 264px;
  }

  .nav-list {
    gap: 8px;
  }

  .nav-item {
    min-height: 62px;
    padding-inline: 10px 12px;
  }

  .workspace {
    padding-right: 64px;
    padding-bottom: 72px;
  }

  .topbar {
    min-height: 112px;
    margin-bottom: 34px;
  }

  .dashboard-grid {
    grid-template-columns: repeat(24, minmax(0, 1fr));
    gap: 26px;
  }

  .widget {
    grid-column: span 6;
  }

  .widget.large {
    grid-column: span 12;
  }

  .metric-grid,
  .report-summary {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 26px;
  }

  .module-grid {
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 26px;
  }

  .panel,
  .widget,
  .module-card,
  .metric-card,
  .clock-card {
    padding: 26px;
  }

  .report-chart {
    min-height: 660px;
  }
}

@media (min-width: 6000px) {
  :root {
    --content-gutter: 72px;
    --nav-width: 420px;
    --nav-icon-size: 48px;
    --touch-target: 54px;
  }

  .workspace {
    padding-right: 86px;
  }

  .dashboard-grid {
    grid-template-columns: repeat(32, minmax(0, 1fr));
    gap: 30px;
  }

  .widget {
    grid-column: span 8;
  }

  .widget.large {
    grid-column: span 16;
  }

  .metric-grid,
  .report-summary {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
  }

  .module-grid {
    grid-template-columns: repeat(auto-fill, minmax(410px, 1fr));
    gap: 30px;
  }

  .report-chart {
    min-height: 820px;
  }
}

@media (max-width: 1100px) {
  :root {
    --content-gutter: 18px;
    --touch-target: 44px;
  }

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 60;
    height: auto;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-right: 0;
    border-bottom: 1px solid rgba(197, 207, 221, 0.88);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
  }

  .brand {
    width: 124px;
    min-height: 52px;
    padding: 8px;
  }

  .brand img {
    max-width: 100%;
  }

  .nav-list {
    flex-direction: row;
    align-items: stretch;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 2px 4px 6px;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }

  .nav-list::-webkit-scrollbar {
    display: none;
  }

  .nav-section {
    display: none;
  }

  .nav-item {
    flex: 0 0 156px;
    min-height: 48px;
    scroll-snap-align: start;
    transform: none;
  }

  .nav-item:hover,
  .nav-item:focus-visible {
    transform: translateY(-1px);
  }

  .nav-item.is-active::before {
    left: 10px;
    right: 10px;
    top: auto;
    bottom: -4px;
    width: auto;
    height: 4px;
  }

  .sidebar-actions {
    align-self: center;
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
  }

  .workspace {
    padding: var(--content-gutter);
  }

  .topbar {
    position: sticky;
    top: 73px;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    margin: -6px -4px 18px;
    padding: 10px 4px 14px;
  }

  .topbar-controls {
    justify-content: flex-start;
  }
}

@media (max-width: 820px) and (min-width: 761px) {
  .topbar {
    position: static;
    gap: 12px;
    margin: 0 0 18px;
    padding: 0 0 14px;
    background: transparent;
    border-bottom: 0;
    backdrop-filter: none;
  }

  .topbar-controls {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: stretch;
    gap: 9px;
  }

  .topbar-controls .search-box {
    grid-column: 1 / -1;
    order: -1;
    width: 100%;
  }

  .topbar-controls .user-pill {
    grid-column: 1 / -2;
    min-width: 0;
  }

  .topbar-controls > [data-action="signout"] {
    grid-column: -2 / -1;
    margin-left: 0;
  }

  .topbar-controls .legal-topbar-button {
    display: none;
  }
}

@media (max-width: 760px) {
  :root {
    --content-gutter: 14px;
    --touch-target: 46px;
  }

  body {
    background-size: auto, 40px 40px, 40px 40px;
  }

  .sidebar {
    grid-template-columns: minmax(0, 1fr);
    gap: 9px;
    padding: 10px;
  }

  .brand,
  .nav-list,
  .sidebar-actions {
    grid-column: 1 / -1;
    justify-self: stretch;
    max-width: 100%;
  }

  .brand {
    width: 100%;
    min-height: 50px;
    place-items: center;
  }

  .brand img {
    max-width: 178px;
  }

  .nav-list {
    width: 100%;
    padding-inline: 1px;
  }

  .nav-item {
    flex-basis: 148px;
    grid-template-columns: 32px minmax(0, 1fr);
    min-height: 50px;
    padding-inline: 8px;
  }

  .nav-item i {
    width: 32px;
    height: 32px;
  }

  .nav-item strong {
    font-size: 0.8rem;
  }

  .nav-item small {
    font-size: 0.58rem;
  }

  .sidebar-actions {
    display: none;
  }

  .topbar {
    position: static;
    gap: 12px;
    margin: 0 0 16px;
    padding: 0 0 12px;
    background: transparent;
    border-bottom: 0;
    backdrop-filter: none;
  }

  .topbar > div:first-child {
    min-width: 0;
  }

  .topbar h1 {
    font-size: 1.76rem;
  }

  .topbar-controls {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: stretch;
    gap: 8px;
  }

  .topbar-controls .search-box {
    grid-column: 1 / -1;
    order: -1;
    width: 100%;
  }

  .topbar-controls #live-clock,
  .topbar-controls #quick-add-button,
  .topbar-controls #system-status,
  .topbar-controls #save-status {
    min-width: 0;
  }

  .topbar-controls .user-pill {
    grid-column: 1 / -2;
    min-width: 0;
  }

  .topbar-controls > [data-action="signout"] {
    grid-column: -2 / -1;
    margin-left: 0;
  }

  .topbar-controls .legal-topbar-button {
    display: none;
  }

  .metric-grid,
  .report-summary,
  .module-grid,
  .dashboard-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .metric-card {
    grid-template-columns: 40px minmax(0, 1fr);
    align-items: start;
    gap: 10px;
    min-height: auto;
    padding: 16px;
  }

  .metric-card > div {
    min-width: 0;
  }

  .metric-card:not(:has(.metric-icon)) {
    grid-template-columns: minmax(0, 1fr);
  }

  .metric-card:not(:has(.metric-icon)) strong {
    justify-self: start;
  }

  .metric-value {
    font-size: 1.34rem;
    overflow-wrap: anywhere;
  }

  .widget,
  .widget.large,
  .widget.full {
    grid-column: 1 / -1;
  }

  .panel-header,
  .table-head,
  .widget-header,
  .clock-card-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .table-wrap {
    margin-inline: -4px;
  }

  table {
    min-width: 760px;
  }
}

@media (max-width: 420px) {
  :root {
    --content-gutter: 10px;
  }

  .nav-item {
    flex-basis: 132px;
  }

  .topbar h1 {
    font-size: 1.58rem;
  }

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

  .topbar-controls .search-box,
  .topbar-controls .user-pill {
    grid-column: 1 / -1;
  }

  .topbar-controls > [data-action="signout"] {
    grid-column: 1 / 2;
    justify-self: start;
  }

  .primary-button,
  .secondary-button,
  .ghost-button,
  .icon-button,
  .mini-button,
  .widget-control {
    min-height: 46px;
  }

  .icon-button,
  .widget-control {
    width: 46px;
    height: 46px;
  }
}

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