:root {
  --bg: #07090f;
  --surface: #111722;
  --surface-2: #151d2a;
  --ink: #f4fbff;
  --muted: #9aa8b8;
  --line: rgba(255,255,255,0.08);
  --blue: #48c8b0;
  --blue-2: rgba(72, 200, 176, 0.12);
  --green: #48c8b0;
  --green-2: rgba(72, 200, 176, 0.12);
  --amber: #ff9a3c;
  --amber-2: rgba(255, 154, 60, 0.12);
  --red: #d54b1a;
  --red-2: rgba(213, 75, 26, 0.16);
  --purple: #6aa7ff;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
  --radius: 22px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 0, rgba(72, 200, 176, 0.16), transparent 30rem),
    radial-gradient(circle at 88% 4%, rgba(255, 154, 60, 0.13), transparent 28rem),
    linear-gradient(180deg, #07090f 0%, #0b1018 52%, #07090f 100%);
  font: 15px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input, textarea, select { font: inherit; }
input, textarea, select { font-weight: 400; }
input::placeholder, textarea::placeholder { font-weight: 400; color: #8a9ab0; }
button {
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 850;
  cursor: pointer;
  transition: transform .16s ease, filter .16s ease, box-shadow .16s ease;
}
button:hover { filter: brightness(.98); transform: translateY(-1px); }
.primary {
  border: 1px solid rgba(255,154,60,0.45);
  background: linear-gradient(135deg, #170606 0%, #6f0f0f 35%, #d54b1a 68%, #ff9a3c 100%);
  color: #fff3ea;
  box-shadow: 0 14px 30px rgba(213,75,26,.22);
}
.secondary, .file-label { background: rgba(255,255,255,0.05); color: #f4fbff; border: 1px solid rgba(255,255,255,0.10); }
.danger { background: linear-gradient(135deg, #2a0a0a, #8f1d12 62%, #d54b1a); color: #fff3ea; border: 1px solid rgba(255,154,60,0.38); }
.sample-action { background: linear-gradient(135deg, #064e3b 0%, #0f9f6e 58%, #48c8b0 100%); color: #ecfffb; border: 1px solid rgba(72,200,176,0.46); box-shadow: 0 14px 30px rgba(72,200,176,.18); }
.reset-action { background: linear-gradient(135deg, #2a0a0a 0%, #8f1d12 58%, #d54b1a 100%); color: #fff3ea; border: 1px solid rgba(255,92,75,0.44); box-shadow: 0 14px 30px rgba(213,75,26,.20); }
.print-action { background: linear-gradient(135deg, #082f49 0%, #0b6fae 58%, #38bdf8 100%); color: #effaff; border: 1px solid rgba(56,189,248,0.46); box-shadow: 0 14px 30px rgba(56,189,248,.18); }
.icon { width: 36px; height: 36px; padding: 0; border: 1px solid var(--line); background: rgba(255,255,255,0.06); color: var(--ink); font-size: 20px; }

.shell { width: min(1440px, calc(100% - 32px)); margin: 0 auto; padding: 28px 0 56px; }
.hero {
  display: flex;
  gap: 20px;
  justify-content: space-between;
  align-items: flex-start;
  padding: 28px;
  border: 1px solid rgba(255,154,60,0.22);
  border-radius: 28px;
  background:
    linear-gradient(135deg, rgba(72,200,176,0.12), rgba(72,200,176,0.03)),
    linear-gradient(120deg, rgba(23,6,6,.96) 0%, rgba(111,15,15,.92) 42%, rgba(213,75,26,.82) 72%, rgba(255,154,60,.88) 100%);
  box-shadow: var(--shadow);
}
.hero h1 { max-width: 920px; margin: 0 0 10px; font-size: clamp(32px, 4.5vw, 56px); line-height: 1.02; letter-spacing: -.045em; }
.lede { max-width: 850px; margin: 0; color: #fff3ea; font-size: 18px; }
.eyebrow { margin: 0 0 6px; text-transform: uppercase; letter-spacing: .08em; color: #48c8b0; font-size: 12px; font-weight: 950; }
.hero-actions, .button-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.notice { margin: 18px 0; padding: 14px 16px; border: 1px solid rgba(255, 72, 72, 0.55); border-radius: 18px; background: linear-gradient(180deg, rgba(255, 72, 72, 0.18), rgba(255, 72, 72, 0.07)); color: #ff6b6b; }
.notice strong { color: #ff4d4d; }

.app-layout { display: grid; grid-template-columns: 276px minmax(0, 1fr); gap: 18px; align-items: start; }
.sidebar { position: sticky; top: 16px; display: grid; gap: 12px; }
.sidebar-card, .side-nav { border: 1px solid var(--line); border-radius: 20px; background: linear-gradient(180deg, rgba(19,24,35,0.96), rgba(14,17,24,0.98)); box-shadow: 0 18px 44px rgba(0,0,0,.28); }
.status-card { padding: 18px; display: flex; align-items: center; justify-content: space-between; }
.status-label { color: var(--muted); font-weight: 800; }
.status-card strong { font-size: 34px; letter-spacing: -.05em; color: #48c8b0; }
.side-nav { padding: 10px; display: grid; gap: 6px; }
.side-nav a { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 14px; color: #e8f6ff; text-decoration: none; font-weight: 900; }
.side-nav a:hover, .side-nav a:focus { background: var(--blue-2); outline: none; }
.side-nav span { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 10px; background: linear-gradient(135deg, #10372f, #48c8b0); color: #eafffb; font-size: 13px; }
.help-card { padding: 16px; }
.help-card p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.workspace { min-width: 0; }

.panel { margin: 0 0 18px; padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(180deg, rgba(19,24,35,0.96), rgba(14,17,24,0.98)); box-shadow: var(--shadow); scroll-margin-top: 18px; }
.section-head { display: flex; gap: 16px; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; }
.section-head.compact { margin-bottom: 10px; }
.section-head h2 { margin: 0 0 6px; font-size: 28px; line-height: 1.12; letter-spacing: -.025em; }
.muted { color: var(--muted); margin: 0; }

.grid { display: grid; gap: 12px; margin-bottom: 12px; }
.grid.two { grid-template-columns: repeat(2, 1fr); }
.grid.three { grid-template-columns: repeat(3, 1fr); }
label { display: block; font-weight: 850; color: #e8f6ff; }
input, textarea, select { width: 100%; margin-top: 6px; padding: 10px 11px; border: 1px solid rgba(255,255,255,0.10); border-radius: 12px; background: rgba(7,9,15,0.72); color: var(--ink); outline: none; }
input:focus, textarea:focus, select:focus { border-color: rgba(72,200,176,0.62); box-shadow: 0 0 0 4px rgba(72,200,176,.12); }
textarea { min-height: 96px; resize: vertical; }
small { display: block; margin-top: 4px; color: var(--muted); font-weight: 650; }
.multi-select { min-height: 96px; }

.example-box, .asset-hint-grid > div, .empty { border: 1px solid var(--line); border-radius: 16px; background: var(--surface-2); padding: 14px; color: #c8d4df; }
.cards { display: grid; gap: 14px; }
.card { border: 1px solid var(--line); border-radius: 20px; background: rgba(17,23,34,0.92); padding: 16px; }
.card-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 12px; }
.card-head strong { font-size: 20px; letter-spacing: -.02em; }
.asset-hint-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.asset-hint-grid strong { display: block; }
.asset-hint-grid span { display: block; color: var(--muted); font-size: 13px; }
.fallback-box { margin: 12px 0; padding: 14px; border: 1px dashed rgba(72,200,176,0.38); border-radius: 16px; background: rgba(7,9,15,0.58); color: var(--ink); }
.fallback-box label { color: #e8f6ff; }
.fallback-box input[type="checkbox"] { width: auto; margin: 0 8px 0 0; accent-color: #48c8b0; }

.importance-4 { border-left: 7px solid var(--red); }
.importance-3 { border-left: 7px solid #f59e0b; }
.importance-2 { border-left: 7px solid var(--blue); }
.importance-1 { border-left: 7px solid #94a3b8; }

.visual-panel { overflow: hidden; background: radial-gradient(circle at top left, rgba(72,200,176,0.12), transparent 36%), linear-gradient(180deg, rgba(19,24,35,0.98) 0%, rgba(11,15,22,0.98) 100%); }
.flow-diagram { position: relative; display: grid; gap: 18px; padding: 0 0 18px; }
.model-stage-label { position: static; justify-self: start; width: fit-content; padding: 6px 11px; border: 1px solid rgba(72,200,176,0.34); border-radius: 999px; background: rgba(72,200,176,0.10); color: #cffff7; font-weight: 950; font-size: 13px; box-shadow: 0 8px 18px rgba(0,0,0,.16); }
.model-stage-label.side { margin-top: 2px; }
.model-completion-banner { display: flex; justify-content: space-between; gap: 12px; margin-left: 0; padding: 14px 16px; border: 1px solid rgba(255,154,60,0.28); border-radius: 18px; background: linear-gradient(180deg, rgba(255,154,60,0.13), rgba(255,154,60,0.04)); color: #ffe1c4; font-weight: 900; }
.model-completion-banner span { color: #aebdcc; }
.model-topology { display: grid; justify-items: center; gap: 10px; padding-top: 2px; }
.model-function { position: relative; width: min(520px, 100%); padding: 16px 18px; text-align: center; border-radius: 12px; border: 1px solid rgba(72,200,176,0.48); background: linear-gradient(180deg, rgba(72,200,176,0.14), rgba(72,200,176,0.05)); box-shadow: 0 14px 28px rgba(0,0,0,.22); }
.model-function strong { display: block; font-size: 15px; }
.model-function p { margin: 7px auto 10px; max-width: 90%; color: #b9c8d8; font-size: 12px; font-weight: 800; }
.model-function i, .model-asset i { position: absolute; top: 9px; right: 9px; width: 12px; height: 12px; border-radius: 50%; background: #1ba95c; }
.model-connector.vertical { width: 2px; height: 22px; background: rgba(72,200,176,0.46); }
.model-connector.split { width: min(900px, 86%); height: 22px; border-top: 2px solid rgba(72,200,176,0.35); border-left: 2px solid rgba(72,200,176,0.35); border-right: 2px solid rgba(72,200,176,0.35); }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.chip-row small { display: inline-flex; margin: 0; padding: 3px 8px; border: 1px solid rgba(255,255,255,0.10); border-radius: 999px; background: rgba(255,255,255,0.05); color: #e8f6ff; font-size: 11px; font-weight: 950; }
.model-columns { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.model-column { min-height: 260px; padding: 14px; border: 1px solid rgba(255,255,255,0.08); border-radius: 18px; background: linear-gradient(180deg, rgba(255,255,255,0.055), rgba(255,255,255,0.025)); box-shadow: 0 12px 28px rgba(0,0,0,.24); }
.model-column-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; margin-bottom: 12px; }
.model-column h3 { margin: 0 0 5px; font-size: 16px; line-height: 1.15; }
.model-column p { margin: 0; color: #aebdcc; font-size: 12px; }
.model-column b { display: grid; place-items: center; flex: 0 0 auto; width: 22px; height: 22px; border-radius: 50%; background: rgba(72,200,176,0.16); color: #cffff7; font-size: 12px; }
.model-assets { display: grid; gap: 10px; }
.model-asset { position: relative; padding: 13px; text-align: center; border-radius: 10px; border: 1px solid rgba(72,200,176,0.42); background: rgba(72,200,176,0.10); }
.model-asset.red { border-color: rgba(255,92,75,0.58); background: rgba(127,29,29,0.28); }
.model-asset.red i { background: #ff5c4b; }
.model-asset strong, .model-asset span { display: block; }
.model-asset strong { font-size: 15px; }
.model-asset span { color: #657992; font-size: 12px; font-weight: 850; margin: 3px 0 8px; }
.dashed { border-style: dashed; background: rgba(255,255,255,0.03); text-align: center; }
.flow-empty { grid-column: 1 / -1; }

.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.metrics div { padding: 18px; text-align: center; border: 1px solid rgba(255,255,255,0.08); border-radius: 18px; background: rgba(7,9,15,0.62); }
.metrics span { display: block; font-size: 34px; font-weight: 950; letter-spacing: -.04em; color: #e8f6ff; }
.metrics small { font-weight: 800; color: #aebdcc; }
.damage-matrix { display: grid; gap: 10px; margin: 0 0 18px; }
.matrix-header { display: flex; justify-content: space-between; gap: 12px; align-items: end; }
.matrix-header h3 { margin: 0; }
.matrix-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.matrix-cell { min-height: 150px; padding: 12px; border: 1px solid rgba(255,255,255,0.08); border-radius: 18px; background: rgba(7,9,15,0.62); color: #e8f6ff; }
.matrix-cell h4 { margin: 0 0 8px; font-size: 14px; color: #f4fbff; }
.matrix-cell h4 small { color: #aebdcc; }
.matrix-cell.importance-4 { background: rgba(127,29,29,0.22); border-color: rgba(255,92,75,0.24); }
.matrix-cell.importance-3 { background: rgba(122,67,0,0.20); border-color: rgba(255,154,60,0.24); }
.matrix-cell.importance-2 { background: rgba(15,39,65,0.42); border-color: rgba(72,200,176,0.20); }
.matrix-cell.importance-1 { background: rgba(17,24,39,0.62); }
.matrix-pill { display: grid; gap: 2px; margin: 7px 0; padding: 9px; border-radius: 12px; background: rgba(7,9,15,0.78); border: 1px solid rgba(255,255,255,0.08); }
.matrix-pill strong { font-size: 13px; color: #f4fbff; }
.matrix-pill span { color: #aebdcc; font-size: 12px; }
.matrix-pill em { font-style: normal; font-size: 11px; font-weight: 900; color: #48c8b0; }
.matrix-pill.no-fallback em { color: #ff9a3c; }
.value-map { display: grid; gap: 14px; }
.map-block { border: 1px solid rgba(255,255,255,0.08); border-radius: 18px; background: rgba(7,9,15,0.62); padding: 16px; }
.map-block h3 { margin: 0 0 5px; color: #f4fbff; }
.map-block p { margin: 0 0 6px; color: #aebdcc; }
.map-assets { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-top: 12px; }
.map-asset { padding: 12px; border: 1px solid rgba(255,255,255,0.08); border-radius: 14px; background: rgba(17,24,39,0.72); }
.map-asset strong, .map-asset span, .map-asset em { display: block; }
.map-asset span { color: var(--muted); font-size: 13px; }
.map-asset em { margin-top: 6px; font-style: normal; font-size: 12px; font-weight: 850; }
.empty.mini { padding: 12px; font-size: 13px; }

#reportOutput, #notificationOutput { min-height: 560px; max-height: 760px; overflow: auto; margin: 0; padding: 18px; border-radius: 18px; background: #0d172a; color: #eaf2ff; white-space: pre-wrap; font: 13px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace; }
#notificationOutput { min-height: 420px; }
.file-label { display: inline-flex; align-items: center; justify-content: center; border-radius: 12px; padding: 9px 14px; font-weight: 850; cursor: pointer; }
.file-label input { display: none; }

@media (max-width: 1080px) {
  .app-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .side-nav { grid-template-columns: repeat(3, 1fr); }
  .model-columns { grid-template-columns: repeat(2, 1fr); }
  .matrix-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  .shell { width: min(100% - 20px, 1240px); padding-top: 14px; }
  .hero, .section-head { display: block; }
  .hero-actions, .button-row { margin-top: 14px; }
  .side-nav, .grid.two, .grid.three, .asset-hint-grid, .metrics, .matrix-grid, .model-columns { grid-template-columns: 1fr; }
  .model-stage-label { position: static; }
  .model-completion-banner { display: grid; }
}

@media print {
  body { background: #fff; }
  .hero-actions, .sidebar, .notice, .button-row, #subfunctions, #assets { display: none !important; }
  .app-layout { display: block; }
  .shell { width: 100%; padding: 0; }
  .hero, .panel { box-shadow: none; border: 0; padding: 0; }
  #reportOutput, #notificationOutput { max-height: none; min-height: 0; color: #000; background: #fff; padding: 0; }

  body.print-notification-only .hero,
  body.print-notification-only .sidebar,
  body.print-notification-only #visual,
  body.print-notification-only #core,
  body.print-notification-only #subfunctions,
  body.print-notification-only #assets,
  body.print-notification-only #overview,
  body.print-notification-only #report,
  body.print-notification-only .notice {
    display: none !important;
  }

  body.print-notification-only .app-layout,
  body.print-notification-only .workspace,
  body.print-notification-only #notification {
    display: block !important;
  }
}
