:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #f8fbff;
  --ink: #0f172a;
  --muted: #475569;
  --line: #dbe4ef;
  --brand: #0f766e;
  --brand-weak: #d1fae5;
  --danger: #b42318;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: "IBM Plex Sans", "Avenir Next", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 90% -20%, #cffafe 0%, rgba(207, 250, 254, 0) 52%),
    radial-gradient(1000px 540px at -15% -15%, #dcfce7 0%, rgba(220, 252, 231, 0) 48%),
    var(--bg);
}

.app-shell {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
  transition: grid-template-columns 0.18s ease;
}

body.nav-menu-collapsed .app-shell {
  grid-template-columns: 76px 1fr;
}

.nav-rail {
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, #f8fbff 0%, #f3f8ff 100%);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  transition: padding 0.18s ease;
}

.mobile-nav-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mobile-nav-toggle {
  border: 1px solid #99f6e4;
  border-radius: 999px;
  background: linear-gradient(180deg, #ecfeff, #e6fff8);
  color: #0f766e;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  flex: 0 0 auto;
}

.mobile-nav-toggle i {
  font-size: 14px;
}

.mobile-nav-current {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.2;
  flex: 1 1 auto;
}

.mobile-nav-current-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748b;
}

#mobile-nav-current-view {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: min(100%, 180px);
  text-align: right;
}

.nav-rail-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 100%;
  flex: 1;
}

body.nav-menu-collapsed .nav-rail {
  padding: 16px 10px;
  gap: 10px;
}

body.nav-menu-collapsed .mobile-nav-current,
body.nav-menu-collapsed .nav-rail-content {
  display: none;
}

body.nav-menu-collapsed .mobile-nav-toggle {
  width: 48px;
  justify-content: center;
  padding-inline: 0;
}

body.nav-menu-collapsed .mobile-nav-toggle-text {
  display: none;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
}

.language-switcher {
  padding: 8px;
  margin-bottom: 4px;
}

.language-switcher label {
  margin: 0 0 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
}

.language-switcher select {
  width: 100%;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #14b8a6, #0f766e);
  color: #fff;
  font-size: 18px;
}

.brand-kicker {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #0f766e;
  font-weight: 600;
}

.brand-title {
  font-size: 18px;
  line-height: 1.1;
  font-weight: 700;
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-btn {
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: #0f172a;
  text-align: left;
  padding: 10px 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 500;
}

.nav-btn i {
  color: #334155;
}

.nav-btn:hover {
  border-color: #bfdbfe;
  background: #eef6ff;
}

.nav-btn.active {
  border-color: #99f6e4;
  background: linear-gradient(180deg, #ecfeff, #e6fff8);
  color: #0f766e;
  font-weight: 600;
}

.nav-btn.active i {
  color: #0f766e;
}

.nav-submenu {
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
}

.nav-submenu[open] {
  border-color: #dbeafe;
  background: #f8fbff;
}

.nav-submenu.has-active {
  border-color: #99f6e4;
  background: linear-gradient(180deg, #ecfeff, #e6fff8);
}

.nav-submenu-summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  cursor: pointer;
  color: #334155;
  font-size: 13px;
  font-weight: 700;
}

.nav-submenu-summary::-webkit-details-marker {
  display: none;
}

.nav-submenu-title {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.nav-submenu-title i {
  color: #475569;
}

.nav-submenu-chevron {
  color: #64748b;
  transition: transform 0.15s ease;
}

.nav-submenu[open] .nav-submenu-chevron {
  transform: rotate(180deg);
}

.nav-submenu-items {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 6px 6px;
}

.nav-submenu-items .nav-btn {
  border-color: #dbeafe;
  background: #fff;
  padding: 8px 10px;
  font-size: 13px;
}

.nav-submenu-items .nav-btn:hover {
  border-color: #93c5fd;
  background: #eff6ff;
}

.status-panel {
  margin-top: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 10px;
}

.status-label {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 5px;
}

#status {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}

#status.status-error {
  color: #991b1b;
}

#status.status-success {
  color: #065f46;
}

#last-page {
  font-size: 12px;
  color: #0f172a;
  font-weight: 600;
  margin-top: 3px;
}

.status-errors {
  margin-top: 6px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
  padding: 6px;
}

.status-errors-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.status-errors-head .pill {
  min-width: 28px;
  text-align: center;
  padding: 1px 8px;
}

#status-error-count.has-errors {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.status-errors-actions {
  display: flex;
  gap: 4px;
}

.status-errors-actions .btn.btn-sm {
  padding: 1px 6px;
  font-size: 11px;
}

.error-log-details {
  margin-top: 6px;
}

.error-log-details summary {
  cursor: pointer;
  list-style: none;
  font-size: 12px;
  color: #334155;
  font-weight: 600;
}

.error-log-details summary::-webkit-details-marker {
  display: none;
}

.error-log-details summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 6px;
  color: #0f766e;
  transform-origin: 50% 55%;
  transition: transform 0.15s ease;
}

.error-log-details[open] summary::before {
  transform: rotate(90deg);
}

.status-error-list {
  margin-top: 6px;
  max-height: 220px;
  overflow: auto;
}

.error-log-item {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  padding: 6px;
  margin-bottom: 6px;
}

.error-log-item:last-child {
  margin-bottom: 0;
}

.error-log-item .error-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: #64748b;
}

.error-log-item .error-source {
  color: #334155;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 145px;
}

.error-log-item .error-message {
  margin-top: 4px;
  color: #991b1b;
  font-size: 12px;
  line-height: 1.35;
}

.error-log-item pre {
  margin: 6px 0 0;
  font-family: "IBM Plex Mono", Menlo, monospace;
  font-size: 10px;
  color: #334155;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 5px;
  max-height: 130px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.app-main {
  padding: 20px 26px 30px;
  overflow-x: hidden;
}

.top-indicators-shell {
  margin: 0 0 10px;
}

.top-indicators-summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #0f172a;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
}

.top-indicators-summary::-webkit-details-marker {
  display: none;
}

.top-indicators-summary::before {
  content: "▸";
  color: #475569;
  font-size: 11px;
  line-height: 1;
}

.top-indicators-shell[open] .top-indicators-summary::before {
  content: "▾";
}

.session-banner {
  position: static;
  top: auto;
  z-index: 30;
  margin: 8px 0 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.session-banner-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.session-banner-kicker {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #475569;
  font-weight: 700;
}

.session-banner-value {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  text-align: left;
}

.session-banner-switch-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.session-banner-switch-wrap label {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  color: #334155;
  display: inline-flex;
}

.session-banner-switch-wrap select {
  min-width: 220px;
  padding: 6px 8px;
}

.session-banner.signed-in {
  border-color: #86efac;
  background: linear-gradient(180deg, rgba(240, 253, 244, 0.96), rgba(255, 255, 255, 0.96));
}

.session-banner.signed-out {
  border-color: #fdba74;
  background: linear-gradient(180deg, rgba(255, 247, 237, 0.96), rgba(255, 255, 255, 0.96));
}

.smart-undo-panel {
  margin: 8px 0 0;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 8px 12px;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.smart-undo-meta {
  min-width: 0;
}

.smart-undo-kicker {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #334155;
  font-weight: 700;
  margin-bottom: 2px;
}

.smart-undo-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.smart-undo-controls select {
  min-width: min(56vw, 520px);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.view-head h2 {
  margin: 0;
  font-size: 29px;
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.view-head h2.quality-recorder-heading {
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: 0;
}

.view-head p {
  margin: 8px 0 16px;
  color: var(--muted);
  font-size: 14px;
}

#view-operators .view-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

#view-operators .view-head h2 {
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: 0;
}

#view-operators .view-head p {
  margin: 0;
  font-size: 12px;
}

h3 {
  margin: 0 0 10px;
  font-size: 17px;
}

h4 {
  margin: 8px 0;
  font-size: 14px;
  color: #334155;
}

.grid {
  display: grid;
  gap: 12px;
}

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

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 11px;
  font-size: 13px;
  font-weight: 500;
  color: #334155;
}

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

.btn,
.nav-btn,
.chip-btn {
  transition:
    transform 0.09s ease,
    box-shadow 0.2s ease,
    background-color 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    opacity 0.2s ease;
}

.btn:hover:not(:disabled),
.nav-btn:hover:not(:disabled),
.chip-btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn:active:not(:disabled),
.btn.is-pressed:not(:disabled),
.nav-btn:active:not(:disabled),
.nav-btn.is-pressed:not(:disabled),
.chip-btn:active:not(:disabled),
.chip-btn.is-pressed:not(:disabled) {
  transform: translateY(1px) scale(0.985);
}

.btn:focus-visible,
.nav-btn:focus-visible,
.chip-btn:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 3px rgba(14, 165, 164, 0.25);
}

.btn:disabled,
.btn.disabled {
  opacity: 0.72;
  cursor: not-allowed;
}

.btn.is-loading {
  position: relative;
  pointer-events: none;
}

.btn.is-loading::after {
  content: "";
  width: 12px;
  height: 12px;
  margin-left: 8px;
  display: inline-block;
  border-radius: 999px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: btn-spin 0.7s linear infinite;
  vertical-align: -1px;
}

.btn.is-success {
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.22);
}

.btn.is-error {
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.22);
}

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

input,
select,
textarea {
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
  padding: 9px 11px;
  color: #0f172a;
}

input:focus,
select:focus,
textarea:focus {
  outline: 0;
  border-color: #0ea5a4;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.16);
}

textarea {
  min-height: 160px;
  resize: vertical;
}

#google-auth-json,
#test-failure-logs {
  min-height: 200px;
  font-family: "IBM Plex Mono", Menlo, monospace;
  font-size: 12px;
}

.checkbox-label {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  margin-top: 2px;
}

.checkbox-label input {
  width: auto;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 14px;
}

.card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  padding: 12px;
  margin-bottom: 12px;
}

.card-subtle {
  background: var(--surface-2);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.dashboard-summary-cards {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.metric-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: linear-gradient(180deg, #ffffff, #f9fcff);
}

.metric-card-btn {
  appearance: none;
  width: 100%;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}

.metric-card-btn:hover {
  transform: translateY(-1px);
  border-color: #7dd3fc;
  box-shadow: 0 10px 24px rgba(14, 165, 233, 0.12);
}

.metric-card-btn:focus-visible {
  outline: 2px solid rgba(14, 165, 233, 0.55);
  outline-offset: 2px;
}

.metric-label {
  font-size: 12px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.metric-value {
  font-size: 24px;
  line-height: 1.1;
  font-weight: 700;
  margin-top: 4px;
}

.dashboard-visual-grid {
  margin-bottom: 12px;
}

.simple-viz-chart {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 38px;
}

.viz-row {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) minmax(140px, 2.6fr) auto;
  align-items: center;
  gap: 9px;
}

.viz-row-btn {
  appearance: none;
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.viz-row-btn:hover .viz-label {
  color: #0369a1;
}

.viz-row-btn:focus-visible {
  outline: 2px solid rgba(14, 165, 233, 0.55);
  outline-offset: 2px;
  border-radius: 8px;
}

.viz-label {
  font-size: 12px;
  color: #334155;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.viz-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #06b6d4, #0f766e);
}

.viz-fill.secondary {
  background: linear-gradient(90deg, #38bdf8, #1d4ed8);
}

.viz-stack {
  display: flex;
  width: 100%;
  height: 100%;
}

.viz-stack-minor {
  background: #86efac;
}

.viz-stack-major {
  background: #fca5a5;
}

.viz-value {
  font-size: 12px;
  font-weight: 600;
  color: #0f172a;
  white-space: nowrap;
}

.viz-empty {
  font-size: 12px;
  color: #64748b;
  padding: 4px 0;
}

.viz-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 2px;
}

.viz-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: #475569;
}

.viz-legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
}

.viz-legend-dot.minor {
  background: #86efac;
}

.viz-legend-dot.major {
  background: #fca5a5;
}

.split-grid {
  display: grid;
  gap: 12px;
}

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

.split-grid.three-panels {
  grid-template-columns: 1.2fr 1fr 1.2fr;
}

.pill {
  display: inline-block;
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 2px 8px;
  font-size: 12px;
}

.pill.ok {
  border-color: #86efac;
  background: #f0fdf4;
  color: #166534;
}

.pill.warn {
  border-color: #fdba74;
  background: #fff7ed;
  color: #9a3412;
}

.pill.bad {
  border-color: #fca5a5;
  background: #fef2f2;
  color: #991b1b;
}

.quick-access-card {
  background: linear-gradient(180deg, #ffffff, #f8feff);
}

.quick-access-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.quick-access-group {
  margin-bottom: 8px;
}

.quick-access-label {
  font-size: 12px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.operator-form-launcher-groups {
  display: grid;
  gap: 12px;
}

.operator-form-launcher-group {
  border: 1px solid #dbeafe;
  border-radius: 10px;
  padding: 10px;
  background: #f8fbff;
}

.operator-form-launcher-title {
  margin: 0 0 8px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #1e40af;
}

.operator-form-launcher-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.operator-form-btn {
  border: 1px solid #bfdbfe;
  background: #ffffff;
  color: #0f172a;
  border-radius: 9px;
  padding: 12px 14px;
  min-height: 60px;
  font-weight: 700;
  font-size: 14px;
  line-height: 1.2;
}

.operator-form-btn:hover:not(:disabled) {
  border-color: #60a5fa;
  background: #eff6ff;
}

.operator-form-btn .operator-form-btn-hint {
  display: block;
  margin-top: 4px;
  font-weight: 500;
  font-size: 12px;
  color: #475569;
}

.quick-print-bar {
  position: sticky;
  top: 8px;
  z-index: 25;
  border-color: #99f6e4;
  background: linear-gradient(180deg, rgba(240, 253, 250, 0.98), rgba(255, 255, 255, 0.98));
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.1);
}

.quick-print-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

#quick-print-last-btn {
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

#quick-print-meta {
  margin: 0;
  flex: 1 1 260px;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 36px;
}

.chip-btn {
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  background: #f8fbff;
  color: #0f172a;
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
}

.chip-btn:hover {
  border-color: #38bdf8;
  background: #ecfeff;
}

.chip-btn.favorite {
  border-color: #99f6e4;
  background: #f0fdfa;
  color: #0f766e;
}

.chip-btn.active {
  border-color: #0f766e;
  background: #ccfbf1;
  font-weight: 600;
}

.form-feedback {
  margin-top: 12px;
  border: 1px solid #fecaca;
  border-radius: 12px;
  background: #fef2f2;
  color: #7f1d1d;
  padding: 12px 14px;
  box-shadow: 0 10px 24px rgba(127, 29, 29, 0.08);
}

.form-feedback.is-warning {
  border-color: #fcd34d;
  background: #fffbeb;
  color: #92400e;
  box-shadow: 0 10px 24px rgba(146, 64, 14, 0.08);
}

.form-feedback.is-success {
  border-color: #86efac;
  background: #f0fdf4;
  color: #166534;
  box-shadow: 0 10px 24px rgba(22, 101, 52, 0.08);
}

.form-feedback.is-info {
  border-color: #93c5fd;
  background: #eff6ff;
  color: #1d4ed8;
  box-shadow: 0 10px 24px rgba(29, 78, 216, 0.08);
}

.form-feedback-title {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 4px;
}

.form-feedback-message {
  font-size: 13px;
  line-height: 1.45;
}

.form-feedback-detail {
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.admin-overview-card {
  background:
    radial-gradient(120% 120% at 0% 0%, rgba(20, 184, 166, 0.09), rgba(20, 184, 166, 0)),
    linear-gradient(180deg, #ffffff, #f7fcff);
  border-color: #bae6fd;
}

.admin-overview-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.admin-overview-head h3 {
  margin: 0 0 4px;
}

.admin-overview-range-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.admin-range-btn {
  border-color: #bfdbfe;
  background: #f8fbff;
  color: #0f172a;
  font-weight: 600;
}

.admin-range-btn.active {
  border-color: #0891b2;
  background: #ecfeff;
  color: #0e7490;
}

.admin-overview-summary-cards {
  margin-bottom: 12px;
}

.dashboard-section-heading {
  margin: 4px 0 10px;
}

.dashboard-section-heading h3 {
  margin: 0 0 4px;
}

.dashboard-section-heading p {
  margin: 0;
  color: #64748b;
}

.production-dashboard-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.production-dashboard-toolbar .mini-muted {
  margin: 0;
}

.dashboard-section-kicker {
  margin: 12px 0 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #0f766e;
}

.injection-mold-board-card {
  background:
    radial-gradient(130% 130% at 100% 0%, rgba(14, 165, 233, 0.08), rgba(14, 165, 233, 0)),
    linear-gradient(180deg, #ffffff, #f7fcff);
  border-color: #bae6fd;
}

.injection-mold-summary-cards {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 10px;
}

.injection-mold-status-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.injection-mold-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
  max-height: 620px;
  overflow: auto;
  padding-right: 4px;
}

.injection-mold-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  background: #ffffff;
  padding: 10px 11px;
  cursor: pointer;
  transition:
    border-color 120ms ease,
    box-shadow 120ms ease,
    transform 120ms ease;
}

.injection-mold-card:hover {
  border-color: #38bdf8;
  box-shadow: 0 10px 28px rgba(14, 165, 233, 0.08);
  transform: translateY(-1px);
}

.injection-mold-card.active {
  border-color: #0f766e;
  background: #f0fdfa;
  box-shadow: 0 12px 28px rgba(15, 118, 110, 0.1);
}

.injection-mold-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.injection-mold-card-metrics {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: #0f172a;
}

.injection-mold-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.injection-mold-detail-head h5 {
  margin: 0 0 4px;
}

.timeline-viz-shell {
  margin: 10px 0 14px;
}

.timeline-viz {
  border: 1px solid #dbeafe;
  border-radius: 16px;
  background: linear-gradient(180deg, #f8fbff, #eef8ff);
  padding: 14px 12px 10px;
}

.timeline-viz-bars {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  align-items: end;
  gap: 4px;
  min-height: 120px;
}

.timeline-viz-bar-wrap {
  display: flex;
  align-items: flex-end;
  min-height: 120px;
}

.timeline-viz-bar-btn {
  appearance: none;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.timeline-viz-bar-btn:focus-visible {
  outline: 2px solid rgba(14, 165, 233, 0.55);
  outline-offset: 2px;
  border-radius: 6px;
}

.timeline-viz-bar-btn:hover .timeline-viz-bar {
  filter: brightness(1.05);
}

.timeline-viz-bar {
  width: 100%;
  min-height: 2px;
  border-radius: 999px 999px 4px 4px;
  background: linear-gradient(180deg, #0ea5e9, #0284c7);
}

.timeline-viz-axis {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
  font-size: 11px;
  color: #64748b;
}

.timeline-viz-axis span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip-empty {
  color: #64748b;
  font-size: 12px;
  padding: 8px 2px;
}

.station-tabs {
  display: inline-flex;
  gap: 6px;
  margin-bottom: 12px;
}

.production-dashboard-tabs {
  display: flex;
  flex-wrap: wrap;
}

.station-tab-btn {
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #f8fafc;
  color: #334155;
  padding: 6px 13px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.station-tab-btn.active {
  border-color: #14b8a6;
  background: #ecfeff;
  color: #0f766e;
}

.station-tab-panel {
  display: none;
}

.station-tab-panel.active {
  display: block;
}

.quality-wizard-card {
  padding: 16px;
}

.quality-wizard-head {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

.quality-step-indicator {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
}

.quality-selection-summary {
  min-height: 20px;
  font-size: 14px;
  color: #334155;
  font-weight: 600;
}

.quality-step-panel {
  display: none;
}

.quality-step-panel.active {
  display: block;
}

.quality-step-title {
  margin: 0 0 10px;
  font-size: 24px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.2;
}

.quality-choice-grid {
  display: grid;
  gap: 10px;
}

.quality-choice-grid-molds {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

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

.quality-choice-grid-areas {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.quality-choice-btn {
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  background: #fff;
  text-align: center;
  padding: 12px 10px;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
  color: #0f172a;
  cursor: pointer;
}

.quality-choice-btn:hover {
  border-color: #14b8a6;
}

.quality-choice-btn.active {
  border-width: 2px;
  border-color: #0f766e;
  background: #ecfeff;
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.14);
}

.quality-choice-unknown {
  font-size: 15px;
  font-weight: 600;
}

.quality-mold-step-actions {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
}

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

.quality-defect-group {
  grid-column: 1 / -1;
}

.quality-defect-group-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  color: #475569;
  margin: 2px 0 8px;
}

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

.quality-defect-family-btn {
  text-align: left;
  min-height: 88px;
}

.quality-defect-family-btn .defect-code {
  font-family: "IBM Plex Mono", Menlo, monospace;
  font-size: 12px;
  font-weight: 700;
  color: #0f172a;
}

.quality-defect-family-btn .defect-label {
  margin-top: 6px;
  font-size: 14px;
  color: #334155;
  line-height: 1.35;
}

.quality-defect-card {
  border: 1px solid #dbeafe;
  border-radius: 10px;
  background: #f8fbff;
  padding: 10px;
}

.quality-defect-card-title {
  font-size: 15px;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.3;
  margin-bottom: 8px;
}

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

.quality-defect-card-actions.major-only {
  grid-template-columns: 1fr;
}

.quality-defect-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 8px 0 8px;
  flex-wrap: wrap;
}

.quality-defect-minor-toggle {
  margin: 0;
  font-size: 14px;
}

.quality-wizard-actions {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.pillow-defect-head {
  margin-top: 12px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.pillow-defect-head h5 {
  margin: 0;
}

.pillow-defect-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.pillow-defect-btn {
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
  text-align: left;
  padding: 8px 10px;
  cursor: pointer;
}

.pillow-defect-btn .defect-code {
  font-family: "IBM Plex Mono", Menlo, monospace;
  font-size: 12px;
  font-weight: 700;
  color: #0f172a;
}

.pillow-defect-btn .defect-label {
  margin-top: 2px;
  font-size: 12px;
  color: #334155;
  line-height: 1.35;
}

.pillow-defect-btn:hover {
  border-color: #14b8a6;
}

.pillow-defect-btn.active {
  border-width: 2px;
  border-color: #0f766e;
  background: #ecfeff;
}

.pillow-defect-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.quality-defect-btn {
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
  text-align: left;
  padding: 9px 10px;
  cursor: pointer;
}

.quality-defect-btn .defect-severity {
  font-size: 13px;
  font-weight: 700;
  color: #1e293b;
}

.quality-defect-btn .defect-code {
  margin-top: 4px;
  font-size: 12px;
  font-weight: 500;
  color: #64748b;
}

.quality-defect-btn .defect-label {
  margin-top: 2px;
  font-size: 14px;
  color: #334155;
  line-height: 1.3;
}

.quality-defect-btn.minor {
  border-color: #86efac;
  background: #f0fdf4;
}

.quality-defect-btn.major {
  border-color: #fca5a5;
  background: #fef2f2;
}

.quality-defect-btn.active {
  border-width: 2px;
  border-color: #0f766e;
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.14);
}

.quality-mold-unknown-hint {
  margin-bottom: 10px;
  border: 1px dashed #93c5fd;
  border-radius: 10px;
  background: #eff6ff;
  color: #1e3a8a;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  padding: 10px;
}

.quality-location-preview-field {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #334155;
}

.quality-location-preview-field input {
  margin-top: 6px;
  font-size: 15px;
  font-weight: 700;
}

.quality-notes-field {
  display: block;
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #334155;
}

.quality-recorder-evidence-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 8px;
}

.quality-photo-field {
  display: block;
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #334155;
}

.quality-photo-field input[type="file"] {
  margin-top: 6px;
}

.quality-photo-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.quality-photo-preview {
  width: 100%;
  max-height: 280px;
  object-fit: contain;
  border: 1px solid #dbeafe;
  border-radius: 12px;
  background: #f8fbff;
  margin-bottom: 12px;
}

#quality-notes {
  min-height: 88px;
  font-size: 15px;
}

#quality-severity-context.quality-submit-feedback-success {
  color: #166534;
  font-weight: 700;
}

#quality-severity-context.quality-submit-feedback-error {
  color: #b91c1c;
  font-weight: 700;
}

.quality-dashboard-tabs {
  margin-top: 12px;
  margin-bottom: 12px;
}

.quality-photo-gallery-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.quality-photo-gallery-head h3 {
  margin: 0;
}

.quality-photo-gallery {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.quality-photo-card {
  border: 1px solid #dbeafe;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  display: flex;
  flex-direction: column;
}

.quality-photo-card-media {
  display: block;
  aspect-ratio: 4 / 3;
  background: #e2e8f0;
  overflow: hidden;
}

.quality-photo-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.quality-photo-card-placeholder {
  display: grid;
  place-items: center;
  min-height: 220px;
  padding: 16px;
  text-align: center;
  color: #64748b;
  background: #f8fafc;
}

.quality-photo-card-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
}

.quality-photo-card-title {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.35;
}

.quality-photo-card-meta {
  font-size: 12px;
  color: #64748b;
}

.quality-photo-card-notes {
  font-size: 13px;
  line-height: 1.4;
  color: #334155;
}

.quality-photo-empty {
  grid-column: 1 / -1;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  background: #f8fafc;
  color: #64748b;
  padding: 18px;
}

.quality-recent-defect-title {
  font-size: 12px;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.35;
}

.quality-recent-defect-code {
  margin-top: 2px;
  font-size: 11px;
  color: #64748b;
  font-family: "IBM Plex Mono", Menlo, monospace;
}

.quality-recent-grid-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.quality-recent-auto-save {
  margin: 0;
  font-size: 14px;
}

#quality-recent-grid {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 8px;
}

#quality-recent-grid .tabulator {
  border: 0;
}

#quality-recent-grid .tabulator .tabulator-header .tabulator-col {
  background: color-mix(in srgb, var(--surface-2) 70%, #fff);
}

#quality-recent-grid .tabulator-row.tabulator-row-even {
  background: color-mix(in srgb, var(--surface-2) 30%, transparent);
}

#injection-downtime-free-reason {
  min-height: 84px;
}

#injection-summary-cards {
  margin-top: 10px;
}

body.operator-simple-mode #operator-workspace-tables,
body.operator-simple-mode #operators-summary-cards,
body.operator-simple-mode #operators-visual-cards,
body.operator-simple-mode #operator-admin-panel {
  display: none !important;
}

#production-record-hint {
  margin-top: 6px;
}

.compact-details {
  margin-bottom: 12px;
}

.compact-details summary {
  cursor: pointer;
  list-style: none;
  color: #334155;
  font-weight: 600;
}

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

.compact-details summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 8px;
  color: #0f766e;
  transform-origin: 50% 55%;
  transition: transform 0.15s ease;
}

.compact-details[open] summary::before {
  transform: rotate(90deg);
}

.compact-details .details-grid,
.compact-details .details-actions {
  margin-top: 10px;
}

.preview-wrap {
  margin-top: 8px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 10px;
  border-radius: 12px;
  overflow: auto;
}

#preview-image {
  max-width: 100%;
  border: 1px solid #0f172a;
  background: #fff;
}

#preview-pdf {
  width: 100%;
  min-height: 560px;
  border: 1px solid #0f172a;
  background: #fff;
}

.table {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}

.table thead th {
  background: #f8fafc;
  font-size: 12px;
  color: #334155;
  border-bottom-color: var(--line);
}

.table td {
  font-size: 13px;
  color: #0f172a;
  vertical-align: top;
  border-color: #e2e8f0;
}

#operators-recent-table td.cell-time {
  min-width: 136px;
  white-space: nowrap;
}

#operators-recent-table td.cell-role {
  min-width: 120px;
  white-space: nowrap;
}

#operators-recent-table td.cell-code {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#operators-recent-table td .pill {
  white-space: nowrap;
}

.ai-chat-thread {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fbff;
  padding: 10px;
  max-height: 360px;
  overflow: auto;
  margin-bottom: 10px;
}

.ai-msg {
  border: 1px solid #dbeafe;
  background: #fff;
  border-radius: 10px;
  padding: 8px 10px;
  margin-bottom: 8px;
}

.ai-msg:last-child {
  margin-bottom: 0;
}

.ai-msg-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: #64748b;
  margin-bottom: 4px;
}

.ai-msg-user .ai-msg-body {
  color: #0f172a;
  font-weight: 600;
}

.ai-msg-assistant {
  border-color: #99f6e4;
  background: #f0fdfa;
}

.ai-msg-assistant .ai-msg-body {
  color: #0f172a;
}

.ai-msg-status {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.ai-msg-status.ok {
  color: #166534;
}

.ai-msg-status.error {
  color: #991b1b;
}

.json-block {
  margin: 8px 0 0;
  border: 1px solid var(--line);
  background: #f8fafc;
  border-radius: 10px;
  padding: 8px;
  max-height: 250px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.designer-layout {
  display: grid;
  grid-template-columns: 1fr 1.4fr 1fr;
  gap: 12px;
  align-items: start;
}

.tracked-layout {
  display: grid;
  grid-template-columns: 1.05fr 1.35fr 1.5fr;
  gap: 12px;
  align-items: start;
}

.field-row {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
  margin-bottom: 10px;
  background: #fbfdff;
}

.tracked-field-row {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfdff;
  padding: 8px;
  margin-bottom: 8px;
}

#tracked-model-validation {
  min-height: 18px;
  margin: 6px 0 10px;
}

#tracked-model-validation.error {
  color: #991b1b;
}

#tracked-model-validation.ok {
  color: #166534;
}

#tracked-id-range {
  margin: 2px 0 10px;
  font-weight: 600;
}

#tracked-item-fields label {
  margin-bottom: 8px;
}

.attr-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 360px;
}

.attr-list code {
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#designer-canvas-wrap {
  border: 1px dashed #94a3b8;
  border-radius: 10px;
  background: linear-gradient(180deg, #ffffff, #f8fafc);
  padding: 10px;
  overflow: auto;
}

#designer-canvas {
  position: relative;
  width: 612px;
  height: 396px;
  border: 1px solid #111;
  background: #fff;
}

#designer-safe-area {
  position: absolute;
  border: 1px dashed #16a34a;
  pointer-events: none;
}

#designer-date-lock {
  position: absolute;
  right: 12px;
  top: 8px;
  font-size: 11px;
  border: 1px solid #0f766e;
  color: #0f766e;
  background: #ecfdf3;
  border-radius: 6px;
  padding: 2px 6px;
}

.design-element {
  position: absolute;
  border: 1px dashed #94a3b8;
  color: #111827;
  font-size: 11px;
  overflow: hidden;
  background: rgba(236, 253, 243, 0.55);
  cursor: grab;
  user-select: none;
  padding: 2px 4px;
}

.design-element.box {
  background: transparent;
  border: 2px solid #64748b;
}

.design-element.line {
  background: #334155;
  border: none;
  min-height: 2px;
}

.design-element.selected {
  border: 2px solid #0f766e;
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.2);
}

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

.inline-link-btn {
  border: 0;
  background: transparent;
  color: #0b63c6;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
  margin: 0;
  font: inherit;
  line-height: inherit;
}

.inline-link-btn:hover {
  color: #084e98;
}

.inline-link-btn:focus-visible {
  outline: 2px solid rgba(14, 165, 233, 0.55);
  outline-offset: 2px;
  border-radius: 4px;
}

.quick-detail-modal {
  position: fixed;
  inset: 0;
  z-index: 2500;
  background: rgba(15, 23, 42, 0.4);
  padding: 16px;
  display: grid;
  place-items: center;
}

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

.quick-detail-dialog {
  width: min(1120px, calc(100vw - 24px));
  max-height: calc(100vh - 28px);
  overflow: auto;
}

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

.quick-detail-head h3 {
  margin: 0 0 4px;
}

.quick-detail-summary-cards {
  margin-top: 10px;
}

.quick-detail-grid {
  margin-top: 12px;
}

#procedure-alerts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 10px;
}

#procedure-steps {
  max-height: 260px;
  overflow: auto;
}

#procedure-steps .checkbox-label {
  margin-bottom: 7px;
}

#procedure-response-text,
#procedure-notes,
#procedure-miss-reason,
#admin-procedure-steps {
  min-height: 96px;
}

#operator-session-name,
#operator-session-role,
#operator-session-expires,
#procedure-run-status {
  background: #f8fafc;
}

.test-status {
  display: inline-block;
  min-width: 70px;
  text-align: center;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  border: 1px solid var(--line);
  background: #f8fafc;
}

.test-status.running {
  border-color: #fdba74;
  background: #fff7ed;
  color: #9a3412;
}

.test-status.pass {
  border-color: #86efac;
  background: #f0fdf4;
  color: #166534;
}

.test-status.fail {
  border-color: #fca5a5;
  background: #fef2f2;
  color: #991b1b;
}

.test-status.skip {
  border-color: #cbd5e1;
  background: #f8fafc;
  color: #475569;
}

.toast-stack {
  position: fixed;
  right: 18px;
  bottom: 16px;
  width: min(420px, calc(100vw - 24px));
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 2000;
  pointer-events: none;
}

.toast-card {
  pointer-events: auto;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 18px 34px rgba(15, 23, 42, 0.16);
  padding: 10px 11px;
  animation: toast-in 0.16s ease;
}

.toast-card.closing {
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.12s ease;
}

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

.toast-title {
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
}

.toast-close {
  border: 0;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 6px;
}

.toast-close:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.toast-message {
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.45;
  color: #334155;
}

.toast-card.tone-info {
  border-color: #93c5fd;
}

.toast-card.tone-success {
  border-color: #86efac;
}

.toast-card.tone-warning {
  border-color: #fdba74;
}

.toast-card.tone-error {
  border-color: #fda4af;
}

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

@media (max-width: 1200px) {
  .designer-layout {
    grid-template-columns: 1fr;
  }

  .tracked-layout {
    grid-template-columns: 1fr;
  }

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

  .split-grid.two-panels,
  .split-grid.three-panels {
    grid-template-columns: 1fr;
  }

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

  .quality-choice-grid-molds {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

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

  .pillow-defect-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .viz-row {
    grid-template-columns: minmax(110px, 1fr) minmax(110px, 2fr) auto;
  }
}

@media (max-width: 760px) {
  .quality-defect-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .quality-recorder-evidence-grid,
  .quality-photo-gallery {
    grid-template-columns: 1fr;
  }

  .quality-step-title {
    font-size: 20px;
  }

  .quality-choice-grid-molds {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

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

  .quality-choice-btn {
    font-size: 16px;
    padding: 11px 8px;
  }

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

@media (max-width: 1100px) {
  .quality-photo-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

  .nav-rail {
    position: sticky;
    top: 0;
    z-index: 1400;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 10px 12px;
    background:
      linear-gradient(180deg, rgba(248, 251, 255, 0.95) 0%, rgba(243, 248, 255, 0.95) 100%),
      #f8fbff;
    backdrop-filter: blur(7px);
    gap: 0;
  }

  .mobile-nav-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }

  .mobile-nav-toggle {
    border: 1px solid #99f6e4;
    border-radius: 999px;
    background: linear-gradient(180deg, #ecfeff, #e6fff8);
    color: #0f766e;
    padding: 7px 12px;
    font-size: 13px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
  }

  .mobile-nav-toggle i {
    font-size: 14px;
  }

  .mobile-nav-current {
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.2;
  }

  .mobile-nav-current-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
  }

  #mobile-nav-current-view {
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 180px;
  }

  .nav-rail-content {
    display: none;
    min-height: 0;
    margin-top: 10px;
    padding: 10px;
    gap: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
  }

  .nav-rail.is-open .nav-rail-content {
    display: flex;
  }

  .brand-block {
    margin-bottom: 0;
    padding: 4px;
  }

  .nav-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    max-height: min(46vh, 360px);
    overflow: auto;
  }

  .status-panel {
    margin-top: 4px;
  }

  .app-main {
    padding: 14px 12px 20px;
  }

  .top-indicators-shell {
    margin-bottom: 8px;
  }

  .top-indicators-summary {
    width: 100%;
    justify-content: center;
    padding: 7px 10px;
    font-size: 12px;
  }

  .session-banner {
    position: static;
    top: auto;
    padding: 7px 10px;
    flex-direction: column;
    align-items: stretch;
  }

  .session-banner-value {
    font-size: 13px;
  }

  .session-banner-switch-wrap {
    width: 100%;
    margin-left: 0;
  }

  .session-banner-switch-wrap select {
    flex: 1;
    min-width: 0;
  }

  .smart-undo-panel {
    padding: 7px 10px;
    flex-direction: column;
    align-items: stretch;
  }

  .smart-undo-controls {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .smart-undo-controls select {
    min-width: 0;
    width: 100%;
  }

  .grid.two {
    grid-template-columns: 1fr;
  }

  .quick-print-bar {
    top: 6px;
  }

  .quick-print-head {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  #quick-print-last-btn {
    width: 100%;
    min-height: 46px;
    font-size: 16px;
  }

  .operator-form-launcher-buttons {
    flex-direction: column;
  }

  .operator-form-btn {
    width: 100%;
    text-align: left;
    min-height: 72px;
    padding: 14px;
    font-size: 15px;
  }

  #view-operators .view-head p {
    display: none;
  }

  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .viz-row {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .viz-track {
    width: 100%;
  }

  #designer-canvas {
    width: 100%;
    height: 300px;
  }
}
