:root {
  --bg: #eef2f1;
  --panel: #ffffff;
  --ink: #17211d;
  --muted: #5c6a63;
  --line: #d9dfd8;
  --accent: #176b5b;
  --accent-2: #b23b46;
  --accent-3: #2f63a2;
  --gold: #d8b735;
  --warn: #8a5a10;
  --soft: #eaf2ef;
  --shadow: 0 10px 22px rgba(23, 33, 29, 0.07);
}

* { box-sizing: border-box; }

.app-sidebar,
.brand-mark,
.sidebar-link,
.sidebar-note {
  display: none !important;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
}

.topbar {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  padding: 12px clamp(16px, 3vw, 30px);
  border-bottom: 1px solid rgba(255,255,255,.08);
  background: #151b19;
  color: #f6faf8;
  position: sticky;
  top: 0;
  z-index: 4;
}

.topbar p {
  color: #aebdb7;
  margin-bottom: 0;
}

.corpece-brand {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  border-radius: 8px;
}

.corpece-brand img {
  display: block;
  height: 50px;
  width: auto;
  max-width: 210px;
  object-fit: contain;
}

.topbar-copy {
  min-width: 0;
  flex: 1 1 auto;
}

.topbar-copy a {
  color: #eef7f3;
  font-weight: 800;
}

h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(1.45rem, 3vw, 2.2rem); margin-bottom: 4px; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1rem; }
p, small, .muted { color: var(--muted); }

.status-pill {
  padding: 7px 10px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 999px;
  white-space: nowrap;
  background: rgba(255,255,255,.08);
  color: #dce8e3;
  font-size: .84rem;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  padding: 18px clamp(14px, 2.5vw, 28px) 36px;
  width: 100%;
  max-width: 1480px;
  margin-inline: auto;
}

.workspace-tabs {
  position: sticky;
  top: 69px;
  z-index: 3;
  display: flex;
  gap: 4px;
  padding: 8px 0 0;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  overflow-x: auto;
}

.workspace-tab {
  border: 1px solid transparent;
  border-bottom: 2px solid transparent;
  border-radius: 6px 6px 0 0;
  background: transparent;
  color: var(--muted);
  padding: 9px 12px;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: none;
}

.workspace-tab:hover,
.workspace-tab.active {
  background: var(--panel);
  color: var(--ink);
  border-color: var(--line);
  border-bottom-color: var(--gold);
}

.workspace-panel:not(.active) {
  display: none !important;
}

.workspace-panel.active {
  display: block;
}

.controls.workspace-panel.active {
  display: grid;
}

.file-hero {
  max-width: 720px;
  margin: 22px auto;
  text-align: center;
  padding: 34px 36px;
}

.file-hero-icon {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  margin-bottom: 14px;
  background: var(--soft);
  color: var(--accent);
  font-weight: 900;
  letter-spacing: 0;
}

.file-hero p {
  max-width: 540px;
  margin-inline: auto;
  line-height: 1.5;
}

.file-dropzone {
  display: grid;
  justify-items: center;
  gap: 12px;
  margin: 26px 0 14px;
  padding: 32px;
  border: 1px dashed color-mix(in srgb, var(--line) 70%, var(--muted));
  border-radius: 8px;
  background: #fbfcfb;
}

.file-dropzone.is-dragging {
  border-color: var(--accent);
  background: var(--soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.file-dropzone input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.file-detail-panel {
  margin-top: 14px;
}

.file-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

#file-detail-output > .muted {
  margin: 8px 0 6px;
  font-size: .82rem;
}

#file-detail-output > .button-row {
  gap: 6px;
}

.file-stat {
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent-3);
  border-radius: 6px;
  padding: 9px 10px;
  background: #fbfcfb;
  min-height: 62px;
}

.file-stat strong {
  display: block;
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.file-stat span {
  display: block;
  color: var(--muted);
  margin-top: 4px;
  font-size: .8rem;
  line-height: 1.2;
}

@media (max-width: 980px) {
  .file-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .file-stat-grid {
    grid-template-columns: 1fr;
  }
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  box-shadow: var(--shadow);
}

.controls,
.workspace-panel {
  align-self: start;
}

.controls {
  display: grid;
  grid-template-columns: minmax(280px, .72fr) minmax(440px, 1.28fr);
  gap: 12px 16px;
}

.controls > h2,
.controls > .steps,
.controls > .field,
.controls > .grid,
.controls > .notice,
.controls > .button-row,
.controls > .advanced-config {
  grid-column: 1;
}

.controls > fieldset {
  grid-column: 2;
  grid-row: 2 / span 6;
  margin: 0;
}

.dashboard {
  grid-column: 1;
}
.dashboard #dashboard-placeholder {
  display: none;
}

.dashboard.is-pending #dashboard-placeholder {
  display: grid;
}

.dashboard.is-pending .filters,
.dashboard.is-pending .analysis-tabs,
.dashboard.is-pending .report-options,
.dashboard.is-pending .metric-grid,
.dashboard.is-pending .dashboard-grid,
.dashboard.is-pending article {
  display: none;
}

.steps {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 0;
  margin: 0 0 8px;
}

.steps li {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px;
  background: #fbfcfb;
  min-height: 64px;
}

.steps span {
  display: inline-grid;
  place-items: center;
  width: 21px;
  height: 21px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--accent);
  font-weight: 800;
  margin-bottom: 5px;
  font-size: .78rem;
}

.steps b,
.steps small {
  display: block;
  font-size: .72rem;
}

.steps .active {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.steps .done span {
  background: var(--accent);
  color: #fff;
}

.notice {
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: var(--soft);
  color: var(--ink);
  font-size: .84rem;
}

.help-box {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 9px;
  background: #fbfcfb;
  color: var(--muted);
  font-size: .8rem;
  line-height: 1.35;
}

.report-options {
  margin-bottom: 14px;
}

.advanced-config {
  margin: 16px 0;
  background: #fbfcfb;
}

.category-config {
  margin-top: 14px;
}

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

.category-toggle {
  display: flex;
  grid-template-columns: auto 1fr;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: #fff;
}

.category-toggle input {
  width: auto;
  margin-top: 3px;
}

.category-toggle span {
  display: grid;
  gap: 3px;
}

.section-toggles {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 6px;
}

.section-toggles label {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
  background: #fff;
  font-size: .82rem;
  min-height: 36px;
  cursor: pointer;
}

.section-toggles input {
  width: auto;
}

.report-export-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.report-options {
  padding: 10px 12px;
}

.report-options summary {
  cursor: pointer;
  font-weight: 750;
}

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

.section-title-row h3 {
  margin: 0;
}

.section-inline-toggle {
  display: inline-flex;
  align-items: center;
  grid-template-columns: none;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 9px;
  background: #fff;
  color: var(--muted);
  font-size: .82rem;
  white-space: nowrap;
  cursor: pointer;
}

.section-inline-toggle input {
  width: auto;
}

.report-section.section-disabled {
  padding: 10px 12px;
  min-height: 0;
  opacity: .72;
}

.report-section.section-disabled > :not(.section-title-row) {
  display: none !important;
}

.report-section.section-disabled .section-inline-toggle {
  border-color: var(--accent-2);
  color: var(--accent-2);
}

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

.insight {
  border-left: 4px solid var(--accent);
  background: var(--soft);
  padding: 10px 12px;
}

.analyst-insight {
  border-left-color: var(--gold);
  background: #fff9df;
}

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

.dashboard-grid { display: contents; }

.field, label {
  display: grid;
  gap: 6px;
  font-weight: 650;
  font-size: .92rem;
}

.field-label {
  font-weight: 650;
  font-size: .92rem;
}

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

.purpose-options,
.objective-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.purpose-options label,
.objective-options label {
  display: flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 8px;
  background: #fbfcfb;
  font-size: .84rem;
  cursor: pointer;
}

.purpose-options input,
.objective-options input {
  width: auto;
}

.integral-option {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: 8px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 7px 12px;
  background: var(--soft);
  color: var(--ink);
  cursor: pointer;
}

.integral-option input {
  width: auto;
}

.analyst-comment-editor {
  margin-bottom: 12px;
}

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

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: #fff;
  color: var(--ink);
}

.readonly-value {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: var(--soft);
  color: var(--muted);
  font-weight: 800;
  min-height: 38px;
  display: flex;
  align-items: center;
}

select {
  padding-left: 32px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--accent) 50%),
    linear-gradient(135deg, var(--accent) 50%, transparent 50%);
  background-position:
    13px 50%,
    19px 50%;
  background-size:
    7px 7px,
    7px 7px;
  background-repeat: no-repeat;
}

select {
  appearance: none;
  padding-right: 32px;
}

.conditional-field {
  margin-top: 8px;
}

.file-picker {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px;
  background: #fff;
}

.file-picker input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.file-picker-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 150px;
  border-radius: 6px;
  padding: 9px 13px;
  background: var(--gold);
  color: #1f2926;
  border: 1px solid #c8a92d;
  box-shadow: 0 6px 14px rgba(216, 183, 53, .2);
  font-weight: 850;
  cursor: pointer;
}

.file-picker:focus-within .file-picker-button,
.file-picker-button:hover {
  filter: brightness(1.03);
  box-shadow: 0 0 0 3px rgba(216, 183, 53, .24);
}

.file-picker-name {
  min-width: 0;
  color: var(--muted);
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.section-help {
  margin: -2px 0 12px;
  color: var(--muted);
  font-size: .88rem;
  line-height: 1.45;
}

textarea {
  resize: vertical;
  min-height: 86px;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: .86rem;
}

fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 16px 0;
  padding: 14px;
}

legend {
  padding: 0 6px;
  font-weight: 750;
}

.required-note {
  border-left: 4px solid var(--accent-3);
  background: #f5f8fb;
  color: var(--ink);
  padding: 8px 10px;
  margin-bottom: 12px;
  font-size: .9rem;
}

input:required:placeholder-shown {
  border-color: color-mix(in srgb, var(--warn) 55%, var(--line));
}

details {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

summary {
  cursor: pointer;
  font-weight: 750;
  margin-bottom: 10px;
}

summary::marker {
  color: var(--accent);
}

summary::-webkit-details-marker {
  color: var(--accent);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
}

button, .button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  border-radius: 6px;
  padding: 7px 10px;
  min-height: 34px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .86rem;
}

.primary-action {
  background: var(--gold);
  border-color: #c8a92d;
  color: #1f2926;
  font-weight: 800;
  padding-inline: 14px;
  box-shadow: 0 8px 18px rgba(216, 183, 53, .22);
}

button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.ghost {
  background: #fff;
  color: var(--accent);
}

.analysis-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin: -2px 0 12px;
  overflow-x: auto;
}

.analysis-tabs a {
  color: var(--muted);
  text-decoration: none;
  padding: 9px 12px;
  border-bottom: 2px solid transparent;
  font-weight: 750;
  font-size: .88rem;
  white-space: nowrap;
}

.analysis-tabs a:hover,
.analysis-tabs a:focus,
.analysis-tabs a.active {
  color: var(--ink);
  border-bottom-color: var(--gold);
  background: #fbfcfb;
}

.analysis-focus {
  display: grid;
  gap: 4px;
  border-left: 4px solid var(--gold);
  border-radius: 6px;
  background: #fff9df;
  padding: 9px 12px;
  margin-bottom: 12px;
  color: var(--ink);
}

.analysis-focus span {
  color: var(--muted);
  line-height: 1.35;
}

.analyze-action-row {
  display: flex;
  justify-content: center;
  margin: 12px 0 14px;
}

.analyze-action-row .primary-action {
  min-width: 180px;
}

.analysis-next-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.dashboard.is-pending .analysis-next-actions {
  display: none;
}

.analysis-panel {
  display: none;
}

.analysis-panel.active {
  display: block;
}

body[data-workspace-view="report"] .analysis-tabs,
body[data-workspace-view="report"] .analysis-focus,
body[data-workspace-view="report"] .filters {
  display: none;
}

body[data-workspace-view="report"] .section-head {
  margin-bottom: 0;
}

.empty {
  min-height: 160px;
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 20px;
  text-align: center;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 14px;
}

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

.metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 0;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfb;
}

.metric strong {
  display: block;
  font-size: 1.55rem;
  margin-bottom: 4px;
  overflow-wrap: anywhere;
}

.lopdp-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 240px));
  gap: 8px;
  margin-bottom: 12px;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 720 / 260;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(23, 33, 29, 0.02);
}

#network-chart {
  display: none;
}

.table-wrap {
  overflow: auto;
  max-height: 390px;
  margin-top: 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}

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

th {
  background: var(--soft);
  position: sticky;
  top: 0;
}

.tag {
  display: inline-block;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--accent);
  font-size: .78rem;
  margin: 2px;
}

.warning { color: var(--warn); font-weight: 700; }
.danger { color: var(--accent-2); font-weight: 700; }
.ok { color: var(--accent); font-weight: 700; }

.recommendation {
  border-left: 4px solid var(--accent-3);
  padding: 10px 12px;
  background: #f5f8fb;
  margin-bottom: 10px;
  border-radius: 0 6px 6px 0;
}

.recommendation p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.4;
}

.recommendation-intro {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 10px;
  background: #fff;
  color: var(--muted);
  font-size: .86rem;
}

@media (max-width: 980px) {
  .layout, .controls, .two, .filters, .metric-grid, .steps, .section-toggles {
    grid-template-columns: 1fr;
  }
  .workspace-tabs {
    position: sticky;
    top: 0;
    padding-top: 6px;
  }
  .controls > h2,
  .controls > .steps,
  .controls > .field,
  .controls > .grid,
  .controls > .notice,
  .controls > .button-row,
  .controls > .advanced-config,
  .controls > fieldset {
    grid-column: 1;
    grid-row: auto;
  }
  .topbar, .section-head {
    align-items: flex-start;
    flex-direction: column;
  }
  .status-pill { white-space: normal; }
}

@media print {
  .topbar, .controls, .filters, .button-row, .report-options, .analysis-tabs, .workspace-tabs, .exclude-print { display: none !important; }
  .layout { display: block; padding: 0; }
  .panel { box-shadow: none; break-inside: avoid; }
}
