:root {
  color-scheme: light;
  --bg: #f0fbfc;
  --surface: #ffffff;
  --panel: #ffffff;
  --panel-2: #eefbfc;
  --ink: #181d38;
  --text: #1f2942;
  --muted: #63727a;
  --line: #d8edf0;
  --accent: #06bbcc;
  --accent-2: #078493;
  --warm: #f39c42;
  --danger: #9a4f1f;
  --shadow: 0 18px 45px rgba(18, 31, 34, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, Arial, Helvetica, sans-serif;
  letter-spacing: 0;
  height: 100%;
  overflow: hidden;
}

.app-shell {
  display: grid;
  grid-template-rows: 56px minmax(0, 1fr);
  height: 100vh;
}

.topbar {
  align-items: center;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 6px 28px rgba(24, 29, 56, 0.08);
  color: var(--ink);
  display: flex;
  height: 56px;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 100;
}

.wordmark {
  align-items: center;
  display: flex;
  gap: 12px;
}

.mark {
  align-items: center;
  background: var(--accent);
  border-radius: 0;
  color: #fff;
  display: inline-flex;
  font-size: 13px;
  font-weight: 900;
  height: 34px;
  justify-content: center;
  width: 34px;
}

.wordmark strong,
.wordmark span {
  display: block;
}

.wordmark span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(340px, 420px) minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
}

.input-pane {
  background: #ffffff;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
  overflow: auto;
  padding: 24px;
  scrollbar-width: thin;
}

.brand-row,
.summary-band,
.report-hero,
.result-toolbar {
  align-items: flex-start;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.result-toolbar .kicker,
.summary-band .kicker,
.report-hero .kicker {
  display: inline-block;
  position: relative;
}

.result-toolbar .kicker::after,
.summary-band .kicker::after,
.report-hero .kicker::after {
  background: var(--accent);
  content: "";
  height: 2px;
  left: calc(100% + 12px);
  position: absolute;
  top: 50%;
  width: 70px;
}

.brand-row {
  background: linear-gradient(rgba(24, 29, 56, 0.90), rgba(24, 29, 56, 0.90));
  border-radius: 0;
  margin: 0 0 2px;
  padding: 24px;
}

.kicker {
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  margin: 0 0 8px;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  color: var(--ink);
  line-height: 1.08;
  margin: 0;
}

h1 {
  font-size: 38px;
}

.brand-row h1 {
  color: #ffffff;
}

.brand-row p:not(.kicker) {
  color: #dce8ec;
}

h2 {
  font-size: 30px;
}

h3 {
  font-size: 18px;
  margin-bottom: 10px;
}

p {
  color: var(--muted);
  line-height: 1.42;
  margin: 8px 0 0;
}

.subcopy {
  max-width: 330px;
}

.status-pill {
  background: rgba(6, 187, 204, 0.14);
  border: 1px solid rgba(6, 187, 204, 0.40);
  border-radius: 999px;
  color: #ffffff;
  flex: 0 0 auto;
  font-size: 12px;
  max-width: 150px;
  overflow: hidden;
  padding: 7px 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.input-tools {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0;
  box-shadow: 0 10px 24px rgba(18, 31, 34, 0.04);
  display: grid;
  gap: 9px;
  padding: 12px;
}

.file-drop {
  background: var(--panel-2);
  border: 1px dashed var(--accent);
  border-radius: 0;
  color: var(--ink);
  cursor: pointer;
  font-weight: 900;
  padding: 15px;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.file-drop:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.file-drop.has-file {
  background: #e0f8fb;
  border-style: solid;
  color: var(--accent);
}

.file-drop.has-error {
  background: #fff0e7;
  border-style: solid;
  color: var(--danger);
}

.file-drop input {
  display: none;
}

.limit-note {
  color: var(--muted);
  font-size: 12px;
  padding-left: 3px;
}

textarea {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 0;
  box-shadow: inset 0 1px 0 rgba(18, 31, 34, 0.04);
  color: var(--text);
  flex: 1 1 260px;
  font: 15px/1.5 Arial, Helvetica, sans-serif;
  min-height: 240px;
  padding: 14px;
  resize: none;
  width: 100%;
}

textarea:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(14, 119, 114, 0.14);
}

.actions,
.report-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

button,
.report-actions a,
.print-button {
  background: var(--accent);
  border: 0;
  border-radius: 0;
  color: #fff;
  cursor: pointer;
  font-weight: 900;
  padding: 11px 14px;
  text-decoration: none;
  transition: background 160ms ease, transform 160ms ease;
}

button:hover,
.report-actions a:hover,
.print-button:hover {
  background: var(--ink);
  transform: translateY(-1px);
}

button:disabled {
  cursor: wait;
  opacity: 0.6;
}

button.secondary {
  background: var(--panel-2);
  color: var(--text);
}

.privacy-note {
  border-top: 1px solid var(--line);
  font-size: 13px;
  padding-top: 14px;
}

.result-pane {
  background:
    linear-gradient(rgba(24, 29, 56, 0.04), rgba(24, 29, 56, 0.04)),
    linear-gradient(90deg, rgba(6, 187, 204, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(6, 187, 204, 0.06) 1px, transparent 1px),
    #f0fbfc;
  background-size: auto, 36px 36px, 36px 36px, auto;
  min-height: 0;
  overflow: auto;
  padding: 22px;
  scrollbar-width: thin;
}

.result-toolbar {
  background: rgba(251, 250, 246, 0.92);
  border: 1px solid var(--line);
  border-radius: 0;
  box-shadow: var(--shadow);
  margin: 0 auto 18px;
  max-width: 1280px;
  padding: 18px;
}

.result-toolbar span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  margin-top: 14px;
}

.empty-state {
  display: grid;
  gap: 16px;
  margin: 0 auto;
  max-width: 1224px;
}

.empty-hero,
.preview-grid > div,
.preview-table,
.metric-grid div,
.table-wrap {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 0;
  box-shadow: var(--shadow);
}

.empty-hero {
  align-items: center;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 142px;
  gap: 20px;
  padding: 26px;
}

.empty-hero h2 {
  max-width: 620px;
}

.score-orb {
  align-items: center;
  background: conic-gradient(from 230deg, #d5f5f8, var(--accent), var(--ink), #d5f5f8);
  border-radius: 999px;
  display: flex;
  flex-direction: column;
  height: 126px;
  justify-content: center;
  position: relative;
  width: 126px;
}

.score-orb::after {
  background: #fff;
  border-radius: inherit;
  content: "";
  inset: 10px;
  position: absolute;
}

.score-orb span,
.score-orb small {
  position: relative;
  z-index: 1;
}

.score-orb span {
  color: var(--ink);
  font-size: 28px;
  font-weight: 900;
}

.score-orb small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.score-orb.pulse {
  animation: pulse 900ms ease-in-out infinite alternate;
}

@keyframes pulse {
  from { transform: scale(0.98); }
  to { transform: scale(1.02); }
}

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

.preview-grid > div {
  padding: 18px;
}

.preview-grid span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 900;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.preview-grid strong {
  color: var(--accent-2);
  font-size: 26px;
}

.preview-table {
  overflow: hidden;
}

.preview-table > div {
  align-items: center;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 90px;
  gap: 14px;
  padding: 12px 16px;
}

.preview-table > div + div {
  border-top: 1px solid var(--line);
}

.table-head {
  background: var(--panel-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.bar {
  background: #dce7e4;
  border-radius: 999px;
  height: 10px;
}

.w80 { width: 80%; }
.w55 { width: 55%; }
.w35 { width: 35%; }

.summary-band,
.report-hero {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--line);
  border-radius: 0;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  padding: 20px;
}

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

.metric-grid div {
  padding: 16px;
}

.metric-grid span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 6px;
}

.metric-grid strong {
  color: var(--accent-2);
  font-size: 24px;
}

section {
  margin-bottom: 22px;
}

.table-wrap {
  overflow: auto;
}

table {
  border-collapse: collapse;
  font-size: 14px;
  width: 100%;
}

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

th {
  background: var(--panel-2);
  color: #384642;
  font-size: 12px;
  text-transform: uppercase;
}

td:first-child,
td:nth-child(2),
td:nth-child(3) {
  white-space: nowrap;
}

.empty-state.error h2 {
  color: var(--danger);
}

.report-page {
  background: #f8f6ef;
  overflow: auto;
}

.report-shell {
  margin: 0 auto;
  max-width: 1120px;
  padding: 28px;
}

.model-note {
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

@media (max-width: 980px) {
  body {
    overflow: auto;
  }

  .topbar nav {
    display: none;
  }

  .workspace {
    grid-template-columns: 1fr;
    height: auto;
  }

  .input-pane {
    border-right: 0;
    max-height: none;
  }

  textarea {
    min-height: 260px;
  }

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

  .empty-hero {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .topbar {
    padding: 0 16px;
  }

  .input-pane,
  .result-pane {
    padding: 16px;
  }

  h1 {
    font-size: 34px;
  }

  .preview-grid,
  .metric-grid {
    grid-template-columns: 1fr;
  }
}

@media print {
  html,
  body {
    background: #fff;
    height: auto;
    overflow: visible;
  }

  .print-button,
  .report-actions {
    display: none;
  }

  .report-page {
    background: #fff;
    height: auto;
    overflow: visible;
  }

  .report-shell {
    max-width: none;
    padding: 0;
  }

  .report-hero,
  .metric-grid div,
  .table-wrap,
  .model-note {
    box-shadow: none;
  }

  .table-wrap {
    overflow: visible;
  }

  table {
    page-break-inside: auto;
  }

  tr {
    page-break-inside: avoid;
    page-break-after: auto;
  }

  thead {
    display: table-header-group;
  }
}
