/* Twinworks — factory digital twin workspace. Scoped under .uwapp-twinworks. Industrial green / steel / signal yellow. */
.uwapp-twinworks {
  --tw-accent: #15803d;
  --tw-accent-2: #166534;
  --tw-accent-soft: #dcfce7;
  --tw-steel: #334155;
  --tw-yellow: #facc15;
  --tw-bg: #f1f5f9;
  --tw-panel: #ffffff;
  --tw-panel-2: #f8fafc;
  --tw-ink: #0f172a;
  --tw-muted: #64748b;
  --tw-line: #e2e8f0;
  --tw-line-2: #cbd5e1;
  --tw-focus: #2563eb;
  --tw-danger: #b91c1c;
  --tw-warn-bg: #fef3c7;
  --tw-warn-ink: #78350f;
  --tw-good-bg: #dcfce7;
  --tw-good-ink: #14532d;
  --tw-shadow: 0 8px 30px rgba(15, 23, 42, 0.16);
  --tw-left-w: 260px;
  --tw-right-w: 320px;
  --tw-dash-h: 300px;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 13px;
  color: var(--tw-ink);
}
.uwapp-twinworks .tw-app[data-theme='dark'],
.tw-app[data-theme='dark'] {
  --tw-accent: #22c55e;
  --tw-accent-2: #16a34a;
  --tw-accent-soft: #14532d;
  --tw-bg: #0b1220;
  --tw-panel: #111a2b;
  --tw-panel-2: #0f172a;
  --tw-ink: #e2e8f0;
  --tw-muted: #94a3b8;
  --tw-line: #1e293b;
  --tw-line-2: #334155;
  --tw-focus: #60a5fa;
  --tw-warn-bg: #422006;
  --tw-warn-ink: #fde68a;
  --tw-good-bg: #052e16;
  --tw-good-ink: #bbf7d0;
  --tw-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}
.tw-app {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--tw-bg);
  color: var(--tw-ink);
  overflow: hidden;
}
.tw-app *,
.tw-app *::before,
.tw-app *::after {
  box-sizing: border-box;
}
.tw-app :focus-visible {
  outline: 2px solid var(--tw-focus);
  outline-offset: 2px;
}
.tw-app [hidden] {
  display: none !important;
}
.tw-grow {
  flex: 1;
}
.tw-muted {
  color: var(--tw-muted);
}
.tw-ico {
  flex: none;
}

/* ---------- top bar & menus ---------- */
.tw-top {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 8px;
  background: var(--tw-panel);
  border-bottom: 1px solid var(--tw-line);
  flex: none;
}
.tw-top-logo {
  border-radius: 6px;
}
.tw-menubar {
  display: flex;
  align-items: center;
}
.tw-menubar-item {
  position: relative;
}
.tw-menubar-btn {
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  padding: 6px 9px;
  border-radius: 6px;
  cursor: pointer;
}
.tw-menubar-btn:hover,
.tw-menubar-btn[aria-expanded='true'] {
  background: var(--tw-line);
}
.tw-menu {
  min-width: 230px;
  background: var(--tw-panel);
  border: 1px solid var(--tw-line-2);
  border-radius: 10px;
  box-shadow: var(--tw-shadow);
  padding: 5px;
  z-index: 60;
}
.tw-menubar-drop {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 3px;
}
.tw-ctx {
  position: fixed;
  z-index: 80;
}
.tw-menu-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
}
.tw-menu-item:hover:not([disabled]),
.tw-menu-item:focus-visible {
  background: var(--tw-accent-soft);
  outline: none;
}
.tw-menu-item[disabled] {
  opacity: 0.45;
  cursor: default;
}
.tw-menu-ico {
  width: 16px;
  display: inline-flex;
  color: var(--tw-muted);
}
.tw-menu-label {
  flex: 1;
}
.tw-menu-key {
  color: var(--tw-muted);
  font-size: 11px;
}
.tw-menu-sub {
  color: var(--tw-muted);
}
.tw-menu-sep {
  height: 1px;
  background: var(--tw-line);
  margin: 4px 2px;
}
.tw-menu-heading {
  padding: 4px 8px 6px;
  font-weight: 700;
  color: var(--tw-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.tw-menu-flyout {
  position: absolute;
  left: 100%;
  top: -6px;
  margin-left: 2px;
}
.tw-top-mid {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 10px;
}
.tw-projname {
  border: 1px dashed transparent;
  background: none;
  color: inherit;
  font: inherit;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: text;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tw-projname:hover {
  border-color: var(--tw-line-2);
}
.tw-scen-select {
  width: auto;
  max-width: 200px;
  padding: 3px 6px;
}
.tw-savestate {
  color: var(--tw-muted);
  font-size: 12px;
  white-space: nowrap;
}

/* ---------- toolbar ---------- */
.tw-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  background: var(--tw-panel-2);
  border-bottom: 1px solid var(--tw-line);
  flex: none;
  overflow-x: auto;
  scrollbar-width: thin;
}
.tw-palette,
.tw-viewgrp,
.tw-run {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border-radius: 9px;
  background: var(--tw-panel);
  border: 1px solid var(--tw-line);
}
.tw-sep {
  width: 1px;
  align-self: stretch;
  background: var(--tw-line);
  margin: 2px 4px;
}
.tw-ibtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 30px;
  height: 30px;
  padding: 0 6px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: none;
  color: inherit;
  cursor: pointer;
}
.tw-ibtn:hover {
  background: var(--tw-line);
}
.tw-ibtn.on,
.tw-ibtn[aria-pressed='true'] {
  background: var(--tw-accent-soft);
  border-color: var(--tw-accent);
  color: var(--tw-accent-2);
}
.tw-app[data-theme='dark'] .tw-ibtn.on {
  color: #bbf7d0;
}
.tw-pal-source { color: #0e7490; }
.tw-pal-buffer { color: #a16207; }
.tw-pal-machine { color: #15803d; }
.tw-pal-assembly { color: #7c3aed; }
.tw-pal-split { color: #475569; }
.tw-pal-conveyor { color: #334155; }
.tw-pal-quality { color: #be185d; }
.tw-pal-sink { color: #1d4ed8; }
.tw-app[data-theme='dark'] .tw-palette .tw-ibtn { color: #cbd5e1; }
.tw-play {
  background: var(--tw-accent);
  color: #fff;
}
.tw-play:hover {
  background: var(--tw-accent-2);
}
.tw-speed-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 4px;
  color: var(--tw-muted);
}
.tw-speed {
  width: 90px;
  accent-color: var(--tw-accent);
}
.tw-speed-lbl {
  min-width: 58px;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
}
.tw-clock {
  font: 600 13px ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  padding: 3px 8px;
  background: #0f172a;
  color: var(--tw-yellow);
  border-radius: 6px;
  min-width: 82px;
  text-align: center;
}
.tw-progress {
  width: 70px;
  height: 6px;
  border-radius: 3px;
  background: var(--tw-line);
  overflow: hidden;
}
.tw-progress i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--tw-accent);
}
.tw-busy .tw-progress i {
  background: var(--tw-yellow);
}
.tw-only-narrow {
  display: none;
}

/* ---------- buttons & inputs ---------- */
.tw-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px solid var(--tw-line-2);
  background: var(--tw-panel);
  color: inherit;
  font: inherit;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.tw-btn:hover:not([disabled]) {
  border-color: var(--tw-accent);
}
.tw-btn[disabled] {
  opacity: 0.5;
  cursor: default;
}
.tw-btn span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.tw-btn-primary {
  background: var(--tw-accent);
  border-color: var(--tw-accent);
  color: #fff;
}
.tw-btn-primary:hover:not([disabled]) {
  background: var(--tw-accent-2);
}
.tw-btn-danger {
  color: var(--tw-danger);
}
.tw-btn-danger:hover:not([disabled]) {
  border-color: var(--tw-danger);
}
.tw-btn-ghost {
  border-color: transparent;
  background: none;
}
.tw-btn-small {
  padding: 4px 9px;
  font-size: 12px;
}
.tw-btn-tiny {
  padding: 2px 7px;
  font-size: 11px;
  border-radius: 6px;
}
.tw-btn.small { padding: 4px 9px; font-size: 12px; }
.tw-input {
  width: 100%;
  font: inherit;
  color: inherit;
  background: var(--tw-panel);
  border: 1px solid var(--tw-line-2);
  border-radius: 7px;
  padding: 5px 7px;
  min-height: 30px;
}
textarea.tw-input {
  resize: vertical;
}
.tw-input:focus {
  border-color: var(--tw-accent);
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--tw-accent) 20%, transparent);
}
.tw-invalid {
  border-color: var(--tw-danger) !important;
}
.tw-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin: 6px 0;
  min-width: 0;
}
.tw-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--tw-muted);
}
.tw-help {
  font-size: 11px;
  color: var(--tw-muted);
}
.tw-check {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 6px 0;
  cursor: pointer;
}
.tw-check input {
  accent-color: var(--tw-accent);
  width: 16px;
  height: 16px;
}
.tw-grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 8px;
}
.tw-grid3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0 8px;
}
.tw-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 6px 0;
}
.tw-btn-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.tw-color {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--tw-line-2);
  border-radius: 6px;
  background: none;
}
.tw-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.tw-chip {
  border: 1px solid var(--tw-line-2);
  background: var(--tw-panel);
  color: inherit;
  font: inherit;
  font-size: 12px;
  padding: 2px 9px;
  border-radius: 999px;
  cursor: pointer;
}
.tw-chip.on {
  background: var(--tw-accent);
  border-color: var(--tw-accent);
  color: #fff;
}
.tw-badge {
  background: var(--tw-yellow);
  color: #422006;
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
}

/* ---------- main area ---------- */
.tw-main {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: var(--tw-left-w) 5px minmax(0, 1fr) 5px var(--tw-right-w);
}
.tw-left,
.tw-right {
  background: var(--tw-panel);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.tw-left {
  border-right: 1px solid var(--tw-line);
}
.tw-right {
  border-left: 1px solid var(--tw-line);
  overflow-y: auto;
  padding: 10px 12px 30px;
}
.tw-split {
  background: transparent;
  position: relative;
  z-index: 3;
}
.tw-split-v {
  cursor: col-resize;
}
.tw-split-h {
  cursor: row-resize;
  height: 5px;
  flex: none;
  background: var(--tw-line);
}
.tw-split:hover,
.tw-split:focus-visible {
  background: var(--tw-accent);
}
.tw-center {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.tw-canvas-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.tw-plan,
.tw-gl,
.tw-gl-overlay {
  position: absolute;
  inset: 0;
  display: block;
  touch-action: none;
}
.tw-gl-overlay {
  pointer-events: none;
}
.tw-plan:focus-visible {
  outline: 2px solid var(--tw-focus);
  outline-offset: -2px;
}
.tw-pointer {
  cursor: pointer;
}
.tw-crosshair,
.tw-placing {
  cursor: crosshair;
}
.tw-grabbing {
  cursor: grabbing;
}
.tw-3dbar {
  position: absolute;
  left: 10px;
  bottom: 10px;
  display: flex;
  gap: 4px;
}
.tw-legend {
  position: absolute;
  right: 10px;
  bottom: 10px;
  max-width: calc(100% - 20px);
  display: none;
  flex-wrap: wrap;
  gap: 4px 12px;
  padding: 8px 10px;
  background: color-mix(in srgb, var(--tw-panel) 92%, transparent);
  border: 1px solid var(--tw-line);
  border-radius: 9px;
  font-size: 11.5px;
  pointer-events: none;
  box-shadow: var(--tw-shadow);
}
.tw-legend.on {
  display: flex;
}
.tw-legend span {
  display: flex;
  align-items: center;
  gap: 6px;
}
.tw-legend i,
.tw-state-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
}
.tw-s-busy { background: #16a34a; }
.tw-s-setup { background: #7c3aed; }
.tw-s-waitop { background: #d97706; }
.tw-s-blocked { background: #dc2626; }
.tw-s-idle { background: #94a3b8; }
.tw-s-down { background: #111827; border: 1px solid #64748b; }
.tw-s-maint { background: #0891b2; }
.tw-s-off { background: #cbd5e1; }
.tw-tip {
  position: absolute;
  z-index: 20;
  max-width: 240px;
  background: var(--tw-panel);
  border: 1px solid var(--tw-line-2);
  border-radius: 8px;
  padding: 7px 9px;
  box-shadow: var(--tw-shadow);
  pointer-events: none;
  font-size: 12px;
}
.tw-readonly {
  display: none;
  padding: 6px 10px;
  background: var(--tw-warn-bg);
  color: var(--tw-warn-ink);
  font-size: 12px;
}

/* ---------- panels ---------- */
.tw-panel-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--tw-muted);
}
.tw-tabs {
  display: flex;
  border-bottom: 1px solid var(--tw-line);
  flex: none;
  overflow-x: auto;
}
.tw-tab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--tw-muted);
  font: inherit;
  font-size: 12px;
  padding: 8px 9px;
  cursor: pointer;
  white-space: nowrap;
}
.tw-tab[aria-selected='true'] {
  color: var(--tw-ink);
  border-bottom-color: var(--tw-accent);
  font-weight: 700;
}
.tw-left .tw-tab .tw-tab-label {
  display: none;
}
.tw-left .tw-tab[aria-selected='true'] .tw-tab-label {
  display: inline;
}
.tw-tabpanel {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
}
.tw-tree,
.tw-tree ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.tw-tree {
  margin-top: 8px;
}
.tw-tree-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--tw-muted);
  margin: 10px 0 3px;
}
.tw-tree-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 7px;
  border-radius: 6px;
  cursor: pointer;
}
.tw-tree-item:hover {
  background: var(--tw-panel-2);
}
.tw-tree-item.sel {
  background: var(--tw-accent-soft);
}
.tw-tree-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tw-tree-id {
  color: var(--tw-muted);
  font-size: 11px;
  font-family: ui-monospace, monospace;
}
.tw-type-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: none;
}
.tw-t-source { background: #0e7490; }
.tw-t-buffer { background: #a16207; }
.tw-t-machine { background: #15803d; }
.tw-t-assembly { background: #7c3aed; }
.tw-t-split { background: #475569; }
.tw-t-conveyor { background: #334155; }
.tw-t-quality { background: #be185d; }
.tw-t-sink { background: #1d4ed8; }
.tw-subtitle {
  font-size: 12px;
  margin: 14px 0 6px;
  color: var(--tw-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.tw-hint {
  font-size: 11.5px;
  line-height: 1.45;
  margin: 6px 0;
}
.tw-card {
  border: 1px solid var(--tw-line);
  border-radius: 10px;
  padding: 8px 10px;
  margin: 8px 0;
  background: var(--tw-panel);
}
.tw-card-active {
  border-color: var(--tw-accent);
  box-shadow: 0 0 0 1px var(--tw-accent);
}
.tw-card-head {
  display: flex;
  align-items: center;
  gap: 7px;
}
.tw-live {
  font-size: 12px;
  color: var(--tw-accent-2);
  font-weight: 600;
  margin: 6px 0;
}
.tw-app[data-theme='dark'] .tw-live {
  color: #86efac;
}
.tw-route-steps {
  margin: 4px 0;
  padding-left: 20px;
}
.tw-route-steps li {
  margin: 2px 0;
}
.tw-route-steps li span {
  margin-right: 4px;
}
.tw-tiny {
  min-width: 20px;
  height: 20px;
  padding: 0 2px;
}
.tw-days {
  display: flex;
  gap: 3px;
  margin: 8px 0;
  flex-wrap: wrap;
}
.tw-shift {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin: 4px 0;
}
.tw-shift > strong,
.tw-shift > span:first-child {
  flex: 0 0 100%;
  font-size: 11.5px;
}
.tw-shift input[type='time'] {
  width: auto;
  flex: 1 1 96px;
  min-width: 0;
  padding: 3px 4px;
}
.tw-break {
  padding-left: 14px;
  color: var(--tw-muted);
}
.tw-week {
  margin: 6px 0;
}
.tw-week-row {
  display: grid;
  grid-template-columns: 30px 1fr;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  color: var(--tw-muted);
}
.tw-week-bar {
  position: relative;
  height: 7px;
  background: var(--tw-line);
  border-radius: 3px;
  margin: 1.5px 0;
}
.tw-week-on {
  position: absolute;
  top: 0;
  bottom: 0;
  background: var(--tw-accent);
  border-radius: 2px;
}

/* ---------- inspector ---------- */
.tw-insp-head {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px;
  margin-bottom: 6px;
  background: var(--tw-panel-2);
  border-radius: 9px;
}
.tw-insp-head .tw-type-dot {
  width: 14px;
  height: 14px;
}
.tw-sec {
  border-top: 1px solid var(--tw-line);
  padding: 4px 0 6px;
}
.tw-sec > summary {
  cursor: pointer;
  font-weight: 700;
  padding: 7px 0;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
}
.tw-sec > summary::-webkit-details-marker {
  display: none;
}
.tw-sec > summary::before {
  content: '▸';
  color: var(--tw-muted);
  transition: transform 0.15s;
}
.tw-sec[open] > summary::before {
  transform: rotate(90deg);
}
.tw-sec-results {
  background: var(--tw-good-bg);
  border-radius: 9px;
  padding: 2px 9px 8px;
  margin-top: 8px;
}
.tw-dist {
  border-left: 3px solid var(--tw-accent-soft);
  padding-left: 8px;
  margin: 6px 0;
}
.tw-dist-info {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 11.5px;
}
.tw-dist-spark {
  width: 140px;
  height: 36px;
  flex: none;
  background: var(--tw-panel-2);
  border-radius: 4px;
}
.tw-mix-row {
  display: grid;
  grid-template-columns: 14px 1fr 90px;
  align-items: center;
  gap: 7px;
  margin: 4px 0;
}
.tw-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
}
.tw-route-row {
  display: grid;
  grid-template-columns: 1fr 80px auto;
  align-items: center;
  gap: 6px;
  margin: 4px 0;
}
.tw-route-row .tw-chips {
  grid-column: 1 / -1;
}
.tw-route-to {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tw-mini-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.tw-mini-table th {
  text-align: left;
  color: var(--tw-muted);
  font-weight: 600;
  padding: 3px;
}
.tw-mini-table td {
  padding: 2px 3px;
}
.tw-kv {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3px 10px;
  margin: 4px 0 0;
  font-size: 12px;
}
.tw-kv dt {
  color: var(--tw-muted);
}
.tw-kv dd {
  margin: 0;
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.tw-insp-actions {
  display: flex;
  gap: 6px;
  margin-top: 14px;
}
.tw-issue {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  padding: 5px 7px;
  margin: 4px 0;
  border-radius: 6px;
  background: var(--tw-warn-bg);
  color: var(--tw-warn-ink);
  font-size: 12px;
}
.tw-issue-error {
  background: #fee2e2;
  color: #7f1d1d;
}

/* ---------- dashboard ---------- */
.tw-dash {
  height: var(--tw-dash-h);
  flex: none;
  display: flex;
  flex-direction: column;
  background: var(--tw-panel);
  min-height: 0;
}
.tw-dash-big .tw-dash {
  height: 62vh;
}
.tw-dash-head {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--tw-line);
  flex: none;
}
.tw-dash-tabs {
  display: flex;
  overflow-x: auto;
  flex: 1;
  scrollbar-width: thin;
}
.tw-dash-tools {
  display: flex;
  padding: 0 4px;
}
.tw-dash-body {
  flex: 1;
  overflow: auto;
  padding: 10px 14px 20px;
}
.tw-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}
.tw-kpi {
  border: 1px solid var(--tw-line);
  border-radius: 10px;
  padding: 8px 11px;
  background: var(--tw-panel-2);
  min-width: 0;
}
.tw-kpi-main {
  border-color: var(--tw-accent);
  background: var(--tw-accent-soft);
}
.tw-kpi-warn {
  border-color: #f59e0b;
}
.tw-kpi-alert {
  border-color: #dc2626;
}
.tw-kpi-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--tw-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.tw-kpi-value {
  font-size: 19px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  margin: 2px 0;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.tw-kpi-sub {
  font-size: 11.5px;
  color: var(--tw-muted);
}
.tw-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 10px;
  margin: 8px 0;
}
.tw-chart-card {
  border: 1px solid var(--tw-line);
  border-radius: 10px;
  padding: 8px 10px;
  background: var(--tw-panel);
  min-width: 0;
  margin: 8px 0;
}
.tw-cards .tw-chart-card {
  margin: 0;
}
.tw-wide {
  grid-column: 1 / -1;
}
.tw-chart-card h3 {
  font-size: 13px;
  margin: 2px 0 6px;
}
.tw-card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.tw-card-actions {
  display: flex;
  gap: 2px;
}
.tw-chart {
  max-width: 100%;
  height: auto;
  display: block;
  color: var(--tw-ink);
}
.tw-wide .tw-chart {
  width: 100%;
  max-height: 520px;
}
.tw-callout {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 11px;
  border-radius: 9px;
  background: var(--tw-panel-2);
  border: 1px solid var(--tw-line);
  margin: 8px 0;
  line-height: 1.45;
}
.tw-callout.tw-good {
  background: var(--tw-good-bg);
  color: var(--tw-good-ink);
  border-color: transparent;
}
.tw-callout.tw-warn {
  background: var(--tw-warn-bg);
  color: var(--tw-warn-ink);
  border-color: transparent;
}
.tw-stale {
  align-items: center;
}
.tw-table-wrap {
  overflow-x: auto;
  margin: 8px 0;
}
.tw-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.tw-table caption {
  text-align: left;
  font-weight: 700;
  padding: 4px 0;
}
.tw-table th,
.tw-table td {
  border-bottom: 1px solid var(--tw-line);
  padding: 5px 8px;
  text-align: right;
  white-space: nowrap;
}
.tw-table th:first-child,
.tw-table td:first-child {
  text-align: left;
}
.tw-table thead th {
  color: var(--tw-muted);
  font-weight: 600;
  background: var(--tw-panel-2);
  position: sticky;
  top: 0;
}
.tw-table tbody th {
  font-weight: 600;
}
.tw-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--tw-muted);
  padding: 24px;
  text-align: center;
}
.tw-recs li {
  margin: 4px 0;
  line-height: 1.45;
}
.tw-formula {
  font: 700 20px Georgia, serif;
  text-align: center;
  padding: 8px;
}
.tw-sweep-form {
  display: grid;
  grid-template-columns: 2fr 2fr 1fr 1fr 1fr 1fr auto;
  gap: 0 8px;
  align-items: end;
}
.tw-field-btn {
  justify-content: flex-end;
}
.tw-gantt-ctl .tw-field {
  width: 110px;
}

/* ---------- status bar ---------- */
.tw-status {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 26px;
  padding: 0 10px;
  font-size: 11.5px;
  color: var(--tw-muted);
  background: var(--tw-panel);
  border-top: 1px solid var(--tw-line);
  flex: none;
  white-space: nowrap;
  overflow: hidden;
}
.tw-st-msg {
  overflow: hidden;
  text-overflow: ellipsis;
}
.tw-st-issues {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 0;
  background: var(--tw-warn-bg);
  color: var(--tw-warn-ink);
  border-radius: 6px;
  font: inherit;
  padding: 1px 7px;
  cursor: pointer;
}
.tw-st-issues.tw-err {
  background: #fee2e2;
  color: #7f1d1d;
}

/* ---------- modals, toasts, tour ---------- */
.tw-modal-back {
  position: absolute;
  inset: 0;
  z-index: 70;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.tw-modal {
  background: var(--tw-panel);
  color: var(--tw-ink);
  border-radius: 14px;
  box-shadow: var(--tw-shadow);
  width: min(520px, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
}
.tw-modal-wide {
  width: min(980px, 100%);
}
.tw-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 6px 18px;
}
.tw-modal-head h2 {
  font-size: 16px;
  margin: 0;
}
.tw-modal-body {
  padding: 4px 18px 10px;
  overflow: auto;
  line-height: 1.5;
}
.tw-modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 18px 14px;
  border-top: 1px solid var(--tw-line);
}
.tw-toasts {
  position: absolute;
  right: 14px;
  bottom: 38px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
}
.tw-toast {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 420px;
  padding: 9px 13px;
  border-radius: 10px;
  background: #0f172a;
  color: #f8fafc;
  box-shadow: var(--tw-shadow);
  animation: tw-in 0.18s ease-out;
}
.tw-toast-good {
  background: #14532d;
}
.tw-toast-error {
  background: #7f1d1d;
}
.tw-toast-out {
  opacity: 0;
  transition: opacity 0.3s;
}
@keyframes tw-in {
  from {
    transform: translateY(8px);
    opacity: 0;
  }
}
.tw-tour-ring {
  position: absolute;
  z-index: 85;
  border: 3px solid var(--tw-yellow);
  border-radius: 10px;
  box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.45);
  pointer-events: none;
  transition: all 0.25s;
}
.tw-tour {
  position: absolute;
  z-index: 86;
  width: 320px;
  background: var(--tw-panel);
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: var(--tw-shadow);
  border-top: 4px solid var(--tw-yellow);
}
.tw-tour h3 {
  margin: 4px 0;
  font-size: 15px;
}
.tw-tour p {
  margin: 4px 0 8px;
  line-height: 1.45;
}
.tw-tour-step {
  font-size: 11px;
  color: var(--tw-muted);
  font-weight: 700;
  text-transform: uppercase;
}
.tw-keys {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 6px 22px;
}
.tw-keys h3 {
  font-size: 13px;
  margin: 8px 0 4px;
}
.tw-keys dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 10px;
  margin: 0;
}
.tw-keys dd {
  margin: 0;
}
kbd {
  font: 600 11px ui-monospace, monospace;
  background: var(--tw-panel-2);
  border: 1px solid var(--tw-line-2);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 1px 6px;
  white-space: nowrap;
}
.tw-code {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 8px;
  padding: 10px;
  overflow: auto;
  max-height: 220px;
  font: 12px ui-monospace, monospace;
}

/* ---------- start screen ---------- */
.tw-start-hero {
  text-align: center;
  padding: 8px 0 4px;
}
.tw-start-hero .tw-row {
  justify-content: center;
}
.tw-start-wordmark {
  height: 52px;
  width: auto;
}
.tw-start-wordmark,
.tw-about-wordmark {
  background: linear-gradient(135deg, #166534, #14532d 60%, #334155);
  border-radius: 12px;
  padding: 6px 14px;
}
.tw-tpl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
}
.tw-tpl {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
  border: 1px solid var(--tw-line);
  border-radius: 12px;
  padding: 8px;
  background: var(--tw-panel-2);
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.tw-tpl:hover,
.tw-tpl:focus-visible {
  border-color: var(--tw-accent);
  box-shadow: 0 0 0 2px var(--tw-accent-soft);
}
.tw-tpl img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  background: #fff;
}
.tw-tpl .tw-muted {
  font-size: 11.5px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tw-recent {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 6px;
}
.tw-recent li {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--tw-line);
  border-radius: 10px;
  padding: 6px;
}
.tw-recent img {
  border-radius: 6px;
  background: #fff;
}
.tw-recent-ph {
  width: 96px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--tw-panel-2);
  border-radius: 6px;
}
.tw-linkbtn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  min-width: 0;
}
.tw-linkbtn strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.tw-lb-out {
  margin-top: 10px;
}

/* ---------- report / print ---------- */
.tw-print {
  display: none;
}
.tw-report {
  font-family: system-ui, sans-serif;
  color: #0f172a;
  max-width: 820px;
  margin: 0 auto;
}
.tw-report-head {
  display: flex;
  gap: 12px;
  align-items: center;
  border-bottom: 3px solid #15803d;
  padding-bottom: 8px;
}
.tw-report h1 {
  margin: 0;
  font-size: 22px;
}
.tw-report h2 {
  font-size: 16px;
  margin: 18px 0 6px;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 3px;
  break-after: avoid;
}
.tw-report .tw-chart,
.tw-report svg {
  max-width: 100%;
  height: auto;
  break-inside: avoid;
}
.tw-report-layout {
  width: 100%;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
}
.tw-report-foot {
  margin-top: 24px;
  font-size: 11px;
  color: #64748b;
}
@media print {
  body.tw-printing > *:not(.tw-print) {
    display: none !important;
  }
  body.tw-printing .tw-print {
    display: block;
  }
  body.tw-printing {
    background: #fff;
  }
  .tw-report .tw-table th,
  .tw-report .tw-table td {
    padding: 3px 6px;
  }
}

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .tw-main {
    grid-template-columns: 0 0 minmax(0, 1fr) 0 0;
  }
  .tw-left,
  .tw-right {
    position: absolute;
    top: 76px;
    bottom: 26px;
    z-index: 30;
    width: min(340px, 86vw);
    box-shadow: var(--tw-shadow);
    display: none;
  }
  .tw-left {
    left: 0;
  }
  .tw-right {
    right: 0;
  }
  .tw-show-left .tw-left,
  .tw-show-right .tw-right {
    display: flex;
  }
  .tw-show-right .tw-right {
    display: block;
  }
  .tw-split-v {
    display: none;
  }
  .tw-only-narrow {
    display: inline-flex;
  }
  .tw-savestate {
    display: none;
  }
  .tw-sweep-form {
    grid-template-columns: 1fr 1fr 1fr;
  }
}
@media (max-width: 700px) {
  .tw-ro .tw-palette,
  .tw-ro .tw-viewgrp .tw-ibtn:last-child,
  .tw-ro .tw-only-narrow:last-child,
  .tw-ro .tw-menubar-item:nth-child(2),
  .tw-ro .tw-menubar-item:nth-child(4) {
    display: none;
  }
  .tw-ro .tw-readonly {
    display: block;
  }
  .tw-top-mid,
  .tw-speed-wrap,
  .tw-progress {
    display: none;
  }
  .tw-dash {
    --tw-dash-h: 42vh;
  }
  .tw-cards {
    grid-template-columns: 1fr;
  }
  .tw-status > span:nth-last-child(-n + 3) {
    display: none;
  }
  .tw-grid3 {
    grid-template-columns: 1fr 1fr;
  }
}
@media (prefers-reduced-motion: reduce) {
  .tw-toast,
  .tw-tour-ring {
    animation: none;
    transition: none;
  }
}
