/* Hackathon WOW UI components: crisp navy/teal surfaces, light & dark themes,
   tabular numerals, zero decorative gradients, mobile responsive. */

/* Collapsible dashboard builder bar so KPIs start above the fold */
details.dashboard-settings { padding: 14px 20px; margin: 0 0 18px; }
details.dashboard-settings > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  cursor: pointer; list-style: none; font-size: 14px; font-weight: 600; color: #0b5367; padding: 2px 0;
}
details.dashboard-settings > summary::-webkit-details-marker { display: none; }
details.dashboard-settings > summary::after {
  content: ""; width: 8px; height: 8px; border-right: 1.8px solid currentColor; border-bottom: 1.8px solid currentColor;
  transform: rotate(45deg); transition: transform .16s ease; flex: 0 0 auto;
}
details.dashboard-settings[open] > summary::after { transform: rotate(-135deg); }
.dashboard-settings-body { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.dashboard-widget-accent { background: #eaf7f5; border-color: #9bccc6; }
[data-theme="dark"] details.dashboard-settings > summary { color: #8fd8de; }

/* 1. AI Decision Trace & PII Shield */
.ai-trace-card {
  margin: 18px 0;
  border: 1px solid #b7d7da;
  border-left: 3px solid #0b5367;
  border-radius: 10px;
  background: #f5fbfb;
  overflow: hidden;
}
.ai-trace-summary {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px;
  padding: 13px 16px; cursor: pointer; list-style: none;
  font-size: 13px; font-weight: 600; color: #102a43;
}
.ai-trace-summary::-webkit-details-marker { display: none; }
.ai-trace-summary:hover { background: #eaf5f6; }
.ai-trace-title { display: inline-flex; align-items: center; gap: 8px; color: #0b5367; }
.ai-trace-title svg { flex: 0 0 auto; color: #147d92; }
.ai-trace-summary-chips { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.ai-summary-chip {
  font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 999px;
  background: #e4eff3; color: #244c60; font-variant-numeric: tabular-nums;
}
.ai-summary-shield { background: #e3f6ee; color: #156647; }
.ai-summary-grounded { background: #dcefed; color: #0b5367; }

.ai-trace-body {
  display: grid; gap: 16px; padding: 16px; border-top: 1px solid #cde2e6; background: #fff;
}
.ai-trace-block h4 {
  margin: 0 0 10px; font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--muted);
}
.ai-trace-block-head {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 10px;
}
.ai-trace-block-head h4 { margin: 0; }
.ai-shield-banner {
  padding: 10px 12px; border-radius: 8px; border: 1px solid #a7dfc8;
  background: #effbf5; color: #145c40; font-size: 12px; font-weight: 600; line-height: 1.5;
}
.ai-trace-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.ai-pii-chip {
  display: inline-block; padding: 3px 8px; border-radius: 5px;
  background: #e3f2f4; color: #0b5367; font-size: 11px; font-weight: 700; letter-spacing: .03em;
}
.ai-masked-preview {
  margin-top: 12px; padding: 11px 13px; border-radius: 8px;
  background: #f4f7fa; border: 1px solid var(--line);
}
.ai-masked-preview small { display: block; color: var(--muted); font-size: 11px; margin-bottom: 6px; }
.ai-masked-preview p {
  margin: 0; font-size: 13px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink);
}
.pii-token {
  display: inline-block; padding: 1px 6px; border-radius: 4px;
  background: #0b5367; color: #fff; font: 600 11px ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .02em;
}
.ai-grounded-badge {
  font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 999px;
  background: #dcefed; color: #0b5367;
}
.ai-trace-source { margin: 0 0 10px; font-size: 12px; color: var(--muted); }
.ai-trace-source strong { color: var(--ink); }
.ai-steps-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ai-step {
  padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); font-size: 13px; line-height: 1.55;
}
.ai-step p { margin: 6px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.ai-step-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px; }
.ai-step-id {
  font: 600 11px ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--muted);
}
.ai-step-selected {
  background: #eaf7f5; border-color: #84c5be; border-left: 3px solid #0b5367;
}
.ai-step-skipped {
  background: #f4f7fa; border-color: #d9e2ec; color: var(--muted);
}
.ai-step-skipped p { text-decoration: line-through; opacity: .78; }
.ai-step-muted { background: #fbfcfd; color: var(--muted); font-size: 12px; }
.ai-step-pill {
  font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px;
}
.ai-step-pill-selected { background: #0b5367; color: #fff; }
.ai-step-pill-skipped { background: #e2e8f0; color: #475d6d; }
.ai-steps-other { margin-top: 10px; }
.ai-steps-other > summary {
  cursor: pointer; font-size: 12px; color: var(--muted); padding: 4px 0;
}
.ai-steps-other .ai-steps-list { margin-top: 8px; }
.ai-audit-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px 16px; margin: 0; padding: 12px; border-radius: 8px; background: #f4f7fa;
}
.ai-audit-grid dt { font-size: 11px; color: var(--muted); margin-bottom: 3px; }
.ai-audit-grid dd { margin: 0; font-size: 12px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

[data-theme="dark"] .ai-trace-card { background: #172b39; border-color: #3a6472; border-left-color: #75c9c5; }
[data-theme="dark"] .ai-trace-summary { color: #e0edf7; }
[data-theme="dark"] .ai-trace-summary:hover { background: #1e3748; }
[data-theme="dark"] .ai-trace-title { color: #9ee0e2; }
[data-theme="dark"] .ai-trace-title svg { color: #75c9c5; }
[data-theme="dark"] .ai-summary-chip { background: #233c4d; color: #cde2ee; }
[data-theme="dark"] .ai-summary-shield { background: #17362e; color: #8ce3c3; }
[data-theme="dark"] .ai-summary-grounded { background: #20454e; color: #9ee0e2; }
[data-theme="dark"] .ai-trace-body { background: #132432; border-color: #345466; }
[data-theme="dark"] .ai-shield-banner { background: #17362e; border-color: #2f6c5a; color: #8ce3c3; }
[data-theme="dark"] .ai-pii-chip { background: #20454e; color: #9ee0e2; }
[data-theme="dark"] .ai-masked-preview,
[data-theme="dark"] .ai-audit-grid { background: #1a2c3b; border-color: #3c5264; }
[data-theme="dark"] .pii-token { background: #75c9c5; color: #102a35; }
[data-theme="dark"] .ai-grounded-badge { background: #20454e; color: #9ee0e2; }
[data-theme="dark"] .ai-step-selected { background: #1c3d46; border-color: #4b8f94; border-left-color: #75c9c5; color: #e0edf7; }
[data-theme="dark"] .ai-step-pill-selected { background: #75c9c5; color: #102a35; }
[data-theme="dark"] .ai-step-skipped,
[data-theme="dark"] .ai-step-muted { background: #182b39; border-color: #324a5b; color: #9eb5c6; }
[data-theme="dark"] .ai-step-pill-skipped { background: #283f50; color: #b8cddc; }

/* 2. 1-Click Demo Role Switcher */
.demo-auth-panel {
  margin-top: 20px; padding: 16px; border: 1px solid #b7d7da; border-radius: 10px; background: #edf6f6;
}
.demo-auth-head { margin-bottom: 12px; }
.demo-auth-head strong { display: block; font-size: 13px; color: #0b5367; }
.demo-auth-head small { display: block; font-size: 11px; color: var(--muted); margin-top: 3px; }
.demo-auth-buttons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.demo-auth-btn {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  padding: 10px 12px; border: 1px solid #bfd8de; border-radius: 8px;
  background: #fff; color: var(--ink); text-align: left; min-height: 44px;
}
.demo-auth-btn:hover:not(:disabled) { border-color: #0b5367; background: #f5fbfb; }
.demo-auth-btn b { font-size: 13px; font-weight: 600; color: #0b5367; }
.demo-auth-btn span { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }

.demo-role-switcher {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px;
  border: 1px solid rgba(159, 179, 200, .35); border-radius: 8px; background: rgba(255, 255, 255, .07);
}
.demo-switcher-tag {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: #8fd8de; padding: 0 6px;
}
.demo-role-pill {
  min-height: 30px; padding: 4px 10px; border: 0; border-radius: 6px;
  background: transparent; color: #d5e4ef; font-size: 12px; font-weight: 500; white-space: nowrap;
}
.demo-role-pill:hover:not(:disabled) { background: rgba(255, 255, 255, .14); color: #fff; }
.demo-role-pill.active { background: #32a7a0; color: #0c222e; font-weight: 700; }

[data-theme="dark"] .demo-auth-panel { background: #1a3340; border-color: #3f6a77; }
[data-theme="dark"] .demo-auth-head strong { color: #9ee0e2; }
[data-theme="dark"] .demo-auth-btn { background: #132432; border-color: #3c5d6d; color: #e0edf7; }
[data-theme="dark"] .demo-auth-btn:hover:not(:disabled) { background: #1d3646; border-color: #75c9c5; }
[data-theme="dark"] .demo-auth-btn b { color: #9ee0e2; }

/* 3. Visual SVG Workflow DAG & Process Mining Route Map */
.dag-preview { margin: 18px 0 6px; }
.dag-wrap {
  border: 1px solid var(--line); border-radius: 10px; background: #f8fbfc; padding: 12px; margin: 12px 0;
}
.dag-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.dag-svg { display: block; min-width: 100%; height: auto; font-family: 'Golos Text', Arial, sans-serif; }
.dag-edge { stroke: #7fa0b2; stroke-width: 2; }
.dag-edge-done { stroke: #21866b; }
.dag-edge-active { stroke: #c58b16; }
.dag-edge-failed { stroke: #c93756; }
.dag-arrow-head { fill: #7fa0b2; }
.dag-node-box { stroke-width: 1.4; }
.dag-node-title { font-size: 12.5px; font-weight: 600; fill: #102a43; }
.dag-node-sub { font-size: 10.5px; fill: #526d82; }

.dag-node-design .dag-node-box { fill: #ffffff; stroke: #a8c7d2; }
.dag-node-design .dag-node-accent { fill: #147d92; }
.dag-node-terminal .dag-node-box { fill: #edf5f6; stroke: #8cb7c4; }
.dag-node-terminal .dag-node-accent { fill: #102a43; }
.dag-node-done .dag-node-box { fill: #effbf5; stroke: #7bc9a8; }
.dag-node-done .dag-node-accent { fill: #21866b; }
.dag-node-active .dag-node-box { fill: #fff8e6; stroke: #e3ba59; }
.dag-node-active .dag-node-accent { fill: #c58b16; }
.dag-node-pending .dag-node-box { fill: #f4f7fa; stroke: #bcccdc; }
.dag-node-pending .dag-node-accent { fill: #627d98; }
.dag-node-failed .dag-node-box { fill: #fff1f3; stroke: #e593a3; }
.dag-node-failed .dag-node-accent { fill: #c93756; }

.dag-legend {
  display: flex; flex-wrap: wrap; gap: 10px 18px; margin-top: 10px; padding-top: 8px;
  border-top: 1px solid var(--line); font-size: 11px; color: var(--muted);
}
.dag-legend span { display: inline-flex; align-items: center; gap: 6px; }
.dag-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; }
.dag-dot-done { background: #21866b; }
.dag-dot-active { background: #c58b16; }
.dag-dot-pending { background: #627d98; }
.dag-dot-failed { background: #c93756; }
.dag-dot-design { background: #147d92; }

.process-map-card { margin: 20px 0; }
.process-map-head {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 12px;
}
.process-map-head h2 { margin: 0; font-size: 18px; }
.process-loop-alert {
  font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px;
  background: #fde5e7; color: #a3233d;
}
.process-ok-badge {
  font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px;
  background: #e6f5ef; color: #176b4a;
}
.pm-edge-forward path { stroke: #147d92; }
.pm-edge-loop path { stroke: #c93756; }
.pm-arrow-fwd { fill: #147d92; }
.pm-arrow-loop { fill: #c93756; }
.pm-badge-bg { fill: #e6f4f6; stroke: #9bc5cf; stroke-width: 1; }
.pm-badge-loop { fill: #fde5e7; stroke: #e593a3; }
.pm-edge-label { font-size: 10.5px; font-weight: 700; fill: #0b5367; font-variant-numeric: tabular-nums; }
.pm-edge-label-loop { fill: #a3233d; }
.process-route-loop { border-left: 3px solid #c93756; padding-left: 14px; }

[data-theme="dark"] .dag-wrap { background: #132432; border-color: #3c5264; }
[data-theme="dark"] .dag-node-title { fill: #e0edf7; }
[data-theme="dark"] .dag-node-sub { fill: #a4bacb; }
[data-theme="dark"] .dag-node-design .dag-node-box { fill: #1a2c3b; stroke: #4b7888; }
[data-theme="dark"] .dag-node-terminal .dag-node-box { fill: #203b48; stroke: #5f95a3; }
[data-theme="dark"] .dag-node-terminal .dag-node-accent { fill: #75c9c5; }
[data-theme="dark"] .dag-node-done .dag-node-box { fill: #16332c; stroke: #3a8d73; }
[data-theme="dark"] .dag-node-active .dag-node-box { fill: #362c14; stroke: #b78d2d; }
[data-theme="dark"] .dag-node-pending .dag-node-box { fill: #1d2e3d; stroke: #4c6477; }
[data-theme="dark"] .dag-node-failed .dag-node-box { fill: #3d1f28; stroke: #b84a62; }
[data-theme="dark"] .pm-edge-forward path { stroke: #60c0ca; }
[data-theme="dark"] .pm-arrow-fwd { fill: #60c0ca; }
[data-theme="dark"] .pm-edge-loop path { stroke: #f2748b; }
[data-theme="dark"] .pm-arrow-loop { fill: #f2748b; }
[data-theme="dark"] .pm-badge-bg { fill: #1e3b48; stroke: #4d8392; }
[data-theme="dark"] .pm-badge-loop { fill: #44202a; stroke: #a8495d; }
[data-theme="dark"] .pm-edge-label { fill: #b8e8ec; }
[data-theme="dark"] .pm-edge-label-loop { fill: #ffb3be; }
[data-theme="dark"] .process-loop-alert { background: #421f28; color: #ffa6b3; }
[data-theme="dark"] .process-ok-badge { background: #17362e; color: #8ce3c3; }

/* 4. Interactive Pilot Scaling Calculator */
.pilot-calculator { margin: 20px 0 24px; }
.pilot-calc-header {
  display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 10px 18px; margin-bottom: 18px;
}
.pilot-calc-header h2 { margin: 0 0 4px; font-size: 18px; }
.pilot-calc-header p { margin: 0; font-size: 12px; }
.pilot-calc-source {
  font-size: 11px; font-weight: 600; padding: 5px 10px; border-radius: 6px;
  background: #edf5f6; color: #0b5367; font-variant-numeric: tabular-nums;
}
.pilot-calc-control { margin-bottom: 18px; }
.pilot-calc-control label {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  font-size: 13px; font-weight: 600; margin-bottom: 10px;
}
.pilot-calc-control strong { font-size: 18px; color: #0b5367; font-variant-numeric: tabular-nums; }
.pilot-calc-control input[type="range"] {
  width: 100%; min-height: 28px; padding: 0; border: 0; background: transparent;
  accent-color: #0b5367; cursor: pointer;
}
.pilot-calc-ticks {
  display: flex; justify-content: space-between; gap: 8px;
  font-size: 11px; color: var(--muted); margin-top: 4px; font-variant-numeric: tabular-nums;
}
.pilot-calc-kpis {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px;
}
.pilot-kpi {
  padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: #fbfcfd;
}
.pilot-kpi-accent { background: #eaf7f5; border-color: #9bccc6; }
.pilot-kpi span { display: block; font-size: 12px; color: var(--muted); }
.pilot-kpi strong {
  display: block; font-size: 26px; line-height: 1.25; margin: 8px 0 4px;
  color: var(--ink); font-variant-numeric: tabular-nums;
}
.pilot-kpi small { display: block; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }

[data-theme="dark"] .pilot-calc-source { background: #203c46; color: #9ee0e2; }
[data-theme="dark"] .pilot-calc-control strong { color: #9ee0e2; }
[data-theme="dark"] .pilot-calc-control input[type="range"] { accent-color: #75c9c5; }
[data-theme="dark"] .pilot-kpi { background: #132432; border-color: #3c5264; }
[data-theme="dark"] .pilot-kpi-accent { background: #1a3740; border-color: #3f7680; }

/* 5. Read-only 1C Ticket Context card & Compact Ticket Metadata drawer */
.onec-context-card {
  margin: 16px 0; padding: 14px 16px; border: 1px solid #c6dce2; border-left: 3px solid #147d92;
  border-radius: 10px; background: #f4f9fa;
}
.onec-context-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px;
}
.onec-context-head h3 { margin: 0; font-size: 14px; font-weight: 600; color: #0b5367; }
.onec-readonly-badge {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  padding: 2px 7px; border-radius: 4px; background: #dcefed; color: #0b5367;
}
.onec-context-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px 16px; margin: 0;
}
.onec-context-grid dt { font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.onec-context-grid dd { margin: 0; font-size: 13px; font-weight: 500; color: var(--ink); overflow-wrap: anywhere; }

.ticket-metadata-drawer {
  margin: 14px 0 18px; border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; background: #f8fbfc;
}
.ticket-metadata-drawer > summary {
  cursor: pointer; font-size: 13px; font-weight: 600; color: #0b5367; padding: 4px 0;
}
.ticket-metadata-drawer .ticket-metadata-form {
  margin: 14px 0 4px; padding-bottom: 0; border-bottom: 0;
}
.ticket-asset-box {
  margin: 0 0 14px; padding: 12px 14px; border-radius: 8px;
  background: var(--workflow-soft); border: 1px solid var(--line);
}
.ticket-asset-box p { margin: 6px 0 0; font-size: 13px; }

[data-theme="dark"] .onec-context-card { background: #18303d; border-color: #3a6472; border-left-color: #75c9c5; }
[data-theme="dark"] .onec-context-head h3 { color: #9ee0e2; }
[data-theme="dark"] .onec-readonly-badge { background: #20454e; color: #9ee0e2; }
[data-theme="dark"] .ticket-metadata-drawer { background: #132432; border-color: #3c5264; }
[data-theme="dark"] .ticket-metadata-drawer > summary { color: #9ee0e2; }

@media (max-width: 850px) {
  .demo-role-switcher { flex-wrap: wrap; max-width: 100%; }
  .pilot-calc-kpis { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .demo-auth-buttons { grid-template-columns: 1fr; }
  .demo-switcher-tag { display: none; }
  .demo-role-pill { padding: 4px 8px; font-size: 11px; }
  .pilot-calc-ticks { font-size: 10px; }
}
