:root {
  --ink: #1f2933;
  --muted: #637381;
  --line: #e3e8ee;
  --panel: #ffffff;
  --soft: #f7f9fb;
  --nav: #ffffff;
  --teal: #25666a;
  --teal-soft: #edf7f6;
  --amber: #9a6a16;
  --amber-soft: #fff7e8;
  --red: #b42318;
  --red-soft: #fff0ed;
  --blue-soft: #f1f5f9;
  --shadow: 0 1px 2px rgba(31, 41, 51, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #f7f9fb;
  color: var(--ink);
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 14px;
}

[hidden] {
  display: none !important;
}

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

button {
  cursor: pointer;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(360px, 520px) minmax(280px, 420px);
  gap: 18px;
  align-items: start;
  justify-content: center;
  padding: 56px 24px;
}

.login-card,
.login-aside {
  background: var(--panel);
  border: 1px solid var(--line);
}

.login-card {
  padding: 28px;
}

.login-brand {
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.login-copy {
  margin: 24px 0 20px;
}

.login-copy h2 {
  margin: 0 0 8px;
  font-size: 24px;
}

.login-copy p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.login-form {
  display: grid;
  gap: 10px;
}

.login-form .primary-button,
.login-form .ghost-button {
  width: 100%;
  margin-top: 4px;
}

.login-aside {
  padding: 16px;
  display: grid;
  gap: 12px;
}

.form-status,
.save-status {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.4;
}

.form-status.error,
.save-status.error {
  color: var(--red);
}

.form-status.ok,
.save-status.ok {
  color: var(--teal);
}

.app-container {
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--nav);
  color: var(--ink);
  padding: 12px 18px;
  display: grid;
  grid-template-columns: auto minmax(220px, 1fr) auto minmax(240px, 320px);
  gap: 14px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  box-shadow: none;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid var(--line);
  background: var(--soft);
  color: var(--teal);
  font-weight: 800;
  letter-spacing: 0.02em;
}

.brand h1,
.brand p,
.identity-panel h2,
.identity-panel p {
  margin: 0;
}

.brand h1 {
  font-size: 16px;
}

.brand p,
.identity-panel,
.coverage-card {
  color: var(--muted);
}

.identity-panel,
.coverage-card {
  padding: 10px 12px;
  background: var(--soft);
  border: 1px solid var(--line);
  margin-bottom: 0;
}

.identity-panel h2 {
  font-size: 15px;
  color: var(--ink);
  margin-bottom: 6px;
}

dl {
  margin: 0;
}

dt {
  font-size: 12px;
  text-transform: uppercase;
  color: var(--muted);
}

dd {
  margin: 2px 0 6px;
}

.steps {
  display: flex;
  gap: 4px;
  margin-bottom: 0;
  overflow-x: auto;
}

.progressive-steps {
  overflow: visible;
}

.step-button {
  width: auto;
  display: flex;
  align-items: center;
  padding: 10px 14px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  text-align: left;
  white-space: nowrap;
}

.step-button.active {
  background: var(--teal-soft);
  color: var(--teal);
}

.step-button.locked {
  color: #7a8793;
  background: #f3f6f8;
  cursor: not-allowed;
}

.meter-label {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin: 8px 0;
}

.meter {
  height: 10px;
  background: #e6edf3;
  overflow: hidden;
}

.meter span {
  display: block;
  width: 0%;
  height: 100%;
  background: var(--teal);
  transition: width 180ms ease;
}

.release-card {
  border: 1px solid var(--line);
  background: #fff;
  padding: 14px;
}

.release-card .eyebrow {
  margin-bottom: 10px;
}

.release-item {
  display: grid;
  gap: 4px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.release-item:first-child {
  border-top: 0;
  padding-top: 0;
}

.release-item strong {
  color: var(--ink);
}

.release-item span {
  width: fit-content;
  padding: 3px 7px;
  font-size: 12px;
  font-weight: 700;
  background: #eef6f4;
  color: var(--teal);
}

.release-item.pending span {
  background: #fff4db;
  color: #8a5b00;
}

.release-item.locked span {
  background: #eef1f4;
  color: #64717d;
}

.release-item.quiet strong {
  color: var(--muted);
}

.release-item small {
  color: var(--muted);
  line-height: 1.35;
}

.app-shell {
  margin-left: 0;
  min-height: 100vh;
  padding: 18px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: var(--panel);
  padding: 14px 0 16px;
  box-shadow: none;
  border: 1px solid var(--line);
  border-width: 0 0 1px;
  margin-bottom: 16px;
}

.topbar h2,
.section-heading h3,
.assistant-header h3 {
  margin: 0;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.top-actions {
  display: flex;
  gap: 10px;
}

.primary-button,
.ghost-button {
  min-height: 38px;
  border: 1px solid var(--teal);
  padding: 0 14px;
  font-weight: 700;
}

.primary-button {
  background: var(--teal);
  color: #fff;
}

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

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

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

.notice {
  background: #fff;
  border: 1px solid var(--line);
  border-left: 3px solid var(--amber);
  color: var(--ink);
  padding: 11px 14px;
  margin-bottom: 16px;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 14px;
  align-items: start;
}

.main-panel,
.assistant-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: none;
}

.main-panel {
  min-height: 720px;
}

.view {
  display: none;
  padding: 20px;
}

.view.active {
  display: block;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 24px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
}

.section-heading p {
  max-width: 520px;
  margin: 0;
  color: var(--muted);
}

.search-row,
.split-row {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.split-row {
  grid-template-columns: 320px minmax(0, 1fr);
  align-items: end;
}

label {
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 9px 10px;
  color: var(--ink);
}

input:focus,
select:focus,
textarea:focus,
button:focus {
  outline: 2px solid rgba(37, 102, 106, 0.18);
  outline-offset: 2px;
}

.family-list {
  display: grid;
  gap: 12px;
}

.family-step-help {
  border: 1px solid var(--line);
  border-left: 3px solid var(--teal);
  background: #fff;
  padding: 12px;
  margin-bottom: 14px;
}

.family-step-help span {
  display: block;
  color: var(--muted);
  margin-top: 3px;
}

.family-card {
  border: 1px solid var(--line);
  background: #fff;
}

.family-step-card {
  padding: 14px;
}

.family-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 14px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.family-head h4 {
  margin: 0 0 4px;
  font-size: 16px;
}

.family-head p {
  margin: 0;
  color: var(--muted);
}

.family-actions {
  display: flex;
  gap: 8px;
  align-items: start;
}

.choice-button {
  min-height: 34px;
  border: 1px solid var(--line);
  background: var(--soft);
  padding: 0 10px;
  color: var(--ink);
}

.choice-button.active-use {
  border-color: var(--teal);
  background: var(--teal-soft);
  color: #155356;
}

.choice-button.active-no {
  border-color: var(--amber);
  background: var(--amber-soft);
  color: #5f3d08;
}

.family-body {
  padding: 14px;
}

.family-step-card .family-body {
  padding: 14px 0 0;
}

.family-nav {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.examples {
  margin: 0 0 12px;
  color: var(--muted);
}

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

.check-option {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 10px;
  border: 1px solid var(--line);
  background: #fff;
}

.check-option:hover {
  border-color: #bfd0dc;
  background: var(--soft);
}

.check-option input {
  width: auto;
  min-height: 0;
  margin-top: 3px;
}

.status-line {
  margin-top: 12px;
  color: var(--muted);
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  background: var(--soft);
  color: var(--ink);
  font-weight: 700;
}

.tag.warning {
  background: var(--amber-soft);
  color: #7c4c0a;
}

.tag.danger {
  background: var(--red-soft);
  color: var(--red);
}

.function-flag {
  margin-top: 8px;
}

.hint-box {
  border: 1px solid var(--line);
  background: #fff;
  border-left: 3px solid var(--teal);
  padding: 12px;
}

.hint-box span {
  display: block;
  color: var(--muted);
  margin-top: 2px;
}

.function-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--line);
  background: #fff;
}

.function-matrix {
  overflow-x: auto;
}

.function-filter-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--amber);
  background: #fff;
  color: var(--ink);
  padding: 12px;
  margin-bottom: 12px;
}

.function-filter-note span {
  display: block;
  margin-top: 2px;
}

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

.function-table th {
  background: var(--soft);
  color: var(--ink);
  font-size: 13px;
}

.function-table tr.selected-row td {
  background: var(--teal-soft);
}

.function-table tr.generic-row td {
  background: #fffaf0;
}

.function-table td small {
  display: block;
  color: var(--muted);
  margin-top: 4px;
}

.ops {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.op-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--line);
  padding: 5px 7px;
  background: #fff;
}

.op-chip input {
  width: auto;
  min-height: 0;
}

.row-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
  font-weight: 700;
}

.row-check input {
  width: auto;
  min-height: 0;
  margin-top: 3px;
}

.row-picker {
  grid-column: 1 / -1;
  border: 1px solid var(--line);
  background: #fff;
  padding: 14px;
}

.row-picker p {
  margin: 8px 0 0;
  color: var(--muted);
}

.row-context {
  grid-column: 1 / -1;
  border: 1px solid var(--line);
  border-left: 3px solid var(--teal);
  background: #fff;
  padding: 14px;
}

.row-context h4,
.row-context p {
  margin: 0;
}

.row-context p + p {
  margin-top: 8px;
}

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

.field-card {
  border: 1px solid var(--line);
  padding: 14px;
  background: #fff;
}

.question-card {
  grid-column: 1 / -1;
}

.field-card h4 {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  margin: 0 0 8px;
}

.field-card p {
  margin: 0 0 10px;
  color: var(--muted);
}

.question-field + .question-field {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.readonly-value {
  border: 1px solid var(--line);
  border-left: 3px solid var(--teal);
  background: #fff;
  padding: 12px;
}

.readonly-value strong,
.readonly-value span {
  display: block;
}

.readonly-value span {
  margin-top: 6px;
  color: var(--muted);
}

.question-progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

.question-meter {
  background: var(--soft);
  margin-bottom: 14px;
}

.question-meter span {
  background: var(--teal);
}

.multi-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 360px;
  overflow: auto;
  padding-right: 4px;
}

.question-warning {
  margin: 10px 0 0;
  color: var(--red);
  font-weight: 700;
}

.question-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

.tooltip {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
}

.tooltip:hover::after,
.tooltip:focus::after {
  content: attr(data-tip);
  position: absolute;
  z-index: 5;
  right: 0;
  top: 28px;
  width: 260px;
  padding: 10px;
  background: var(--ink);
  color: #fff;
  font-weight: 400;
  line-height: 1.35;
  box-shadow: var(--shadow);
}

.assistant-panel {
  position: sticky;
  top: 22px;
  padding: 12px;
  background: transparent;
  border-color: transparent;
}

.tip-card {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.tip-card h4,
.tip-card p {
  margin: 0;
}

.tip-card p {
  color: var(--muted);
  margin-top: 4px;
}

.tooltip-dot {
  width: 26px;
  height: 26px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--teal);
  font-weight: 800;
}

.selected-summary {
  border-top: 1px solid var(--line);
  padding-top: 14px;
  margin-top: 4px;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip-list.empty {
  display: block;
  color: var(--muted);
}

.chip {
  padding: 6px 8px;
  background: var(--soft);
  color: #155356;
  font-weight: 700;
}

.chip.needs-work {
  background: var(--amber-soft);
  color: #7c4c0a;
}

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

.review-card {
  border: 1px solid var(--line);
  padding: 16px;
  background: #fff;
}

.review-card span {
  font-size: 30px;
  font-weight: 800;
  color: var(--ink);
}

.review-card p {
  margin: 4px 0 0;
  color: var(--muted);
}

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

.validation-item {
  padding: 12px;
  border: 1px solid var(--line);
  background: #fff;
}

.validation-item p {
  margin: 6px 0 0;
  color: var(--muted);
}

.validation-item.blocked {
  border-color: #f0b5ad;
  background: #fff;
  border-left: 3px solid var(--red);
}

.validation-item.ok {
  border-color: var(--line);
  background: #fff;
  border-left: 3px solid var(--teal);
}

.small {
  font-size: 12px;
}

@media (max-width: 1100px) {
  .sidebar {
    position: static;
    width: auto;
    grid-template-columns: 1fr;
  }

  .steps {
    flex-wrap: wrap;
  }

  .app-shell {
    margin-left: 0;
  }

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

  .assistant-panel {
    position: static;
  }
}

@media (max-width: 760px) {
  .topbar,
  .section-heading,
  .top-actions {
    display: grid;
  }

  .split-row,
  .field-grid,
  .review-grid,
  .data-options,
  .multi-options {
    grid-template-columns: 1fr;
  }

  .app-shell {
    padding: 12px;
  }
}
