:root {
  --bg: #f5f3ef;
  --surface: #ffffff;
  --surface-strong: #fbfaf7;
  --text: #22211f;
  --muted: #6c675f;
  --line: #ded8cf;
  --line-strong: #cfc6b8;
  --primary: #205f72;
  --primary-dark: #174655;
  --primary-soft: #e6f2f4;
  --accent: #7b4e1d;
  --good: #19764b;
  --good-bg: #e8f5ed;
  --warn: #a86d00;
  --warn-bg: #fff4d7;
  --bad: #b2392f;
  --bad-bg: #fde9e7;
  --shadow: 0 16px 50px rgba(41, 35, 28, 0.08);
  --radius: 8px;
  --font: "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  background:
    linear-gradient(90deg, rgba(32, 95, 114, 0.06) 0 1px, transparent 1px 100%),
    linear-gradient(180deg, rgba(123, 78, 29, 0.05) 0 1px, transparent 1px 100%),
    var(--bg);
  background-size: 36px 36px;
}

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

button {
  cursor: pointer;
}

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

.app-shell {
  width: min(1480px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 42px;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 260px;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid #9dbbc3;
  border-radius: 8px;
  color: var(--primary);
  background: var(--primary-soft);
  font-size: 24px;
  font-weight: 800;
}

.brand h1,
.page-heading h2 {
  margin: 0;
  letter-spacing: 0;
}

.brand h1 {
  font-size: clamp(20px, 2vw, 28px);
}

.brand p,
.page-heading p,
.muted {
  margin: 4px 0 0;
  color: var(--muted);
}

.header-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.header-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.install-button[hidden] {
  display: none !important;
}

.app-preferences {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin: -10px 0 12px;
}

.preference-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 10px 26px rgba(41, 35, 28, 0.04);
}

.preference-group > span {
  padding: 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

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

.choice-row.compact {
  gap: 4px;
}

.choice-button {
  min-height: 32px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 6px 9px;
  color: var(--text);
  background: #fff;
  font-size: 13px;
  font-weight: 800;
}

.choice-button:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.choice-button.is-active {
  border-color: var(--primary);
  color: #fff;
  background: var(--primary);
}

.pwa-status {
  display: flex;
  align-items: center;
  gap: 8px;
  width: max-content;
  min-height: 30px;
  margin: -10px 0 18px auto;
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 10px 26px rgba(41, 35, 28, 0.06);
  font-size: 13px;
}

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

.exchange-panel {
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.exchange-panel h4 {
  margin: 0;
  font-size: 16px;
}

.exchange-panel p {
  max-width: 760px;
  margin: 4px 0 12px;
  color: var(--muted);
}

.exchange-rate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}

.exchange-rate-field label {
  white-space: nowrap;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--good);
  box-shadow: 0 0 0 3px rgba(25, 118, 75, 0.13);
}

.pwa-status.is-offline {
  border-color: #e2c891;
  color: #704f07;
  background: #fff8e7;
}

.pwa-status.is-offline .status-dot {
  background: var(--warn);
  box-shadow: 0 0 0 3px rgba(168, 109, 0, 0.14);
}

.app-demo-guide {
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr);
  gap: 18px;
  align-items: stretch;
  margin-bottom: 18px;
  border: 1px solid rgba(32, 95, 114, 0.18);
  border-radius: 8px;
  padding: 18px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(230, 242, 244, 0.74)),
    var(--surface);
  box-shadow: 0 16px 46px rgba(41, 35, 28, 0.07);
}

.app-demo-guide__copy {
  display: grid;
  align-content: center;
  gap: 8px;
}

.app-demo-guide .eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.app-demo-guide h2,
.app-demo-guide p {
  margin: 0;
}

.app-demo-guide h2 {
  font-size: 22px;
  line-height: 1.18;
}

.app-demo-guide__copy p:not(.eyebrow),
.app-demo-guide__steps p {
  color: var(--muted);
  line-height: 1.55;
}

.app-demo-guide__steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.app-demo-guide__steps article {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 142px;
  border: 1px solid rgba(32, 95, 114, 0.13);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.84);
}

.app-demo-guide__steps span {
  width: fit-content;
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--primary);
  background: var(--primary-soft);
  font-size: 12px;
  font-weight: 900;
}

.app-demo-guide__steps strong {
  color: var(--text);
  line-height: 1.25;
}

.app-demo-guide__actions {
  display: flex;
  grid-column: 1 / -1;
  flex-wrap: wrap;
  gap: 10px;
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button,
.nav-button,
.icon-button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 9px 14px;
  color: var(--text);
  background: #fff;
  transition: border-color 0.16s ease, background-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.primary-button {
  border-color: var(--primary);
  color: #fff;
  background: var(--primary);
  font-weight: 700;
}

.primary-button:hover {
  background: var(--primary-dark);
}

.secondary-button {
  border-color: var(--line-strong);
  background: var(--surface);
  font-weight: 650;
}

.secondary-button:hover,
.ghost-button:hover,
.nav-button:hover,
.icon-button:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.ghost-button {
  border-color: transparent;
  background: transparent;
}

.danger-button {
  border-color: #dfa7a1;
  color: var(--bad);
  background: var(--bad-bg);
}

.danger-button:hover {
  border-color: var(--bad);
}

.nav-button {
  border-color: var(--line);
  background: var(--surface-strong);
}

.nav-button.is-active {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
  font-weight: 700;
}

.icon-button {
  width: 40px;
  padding: 0;
  font-size: 20px;
  line-height: 1;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.page-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.page-heading h2 {
  font-size: clamp(22px, 2.4vw, 34px);
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 280px) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metric {
  min-height: 92px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(20px, 2.2vw, 28px);
  line-height: 1.05;
}

.category-stats {
  margin-bottom: 16px;
}

.panel-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.panel-heading h3 {
  margin: 0;
  font-size: 18px;
}

.panel-heading p {
  max-width: 620px;
  margin: 4px 0 0;
  color: var(--muted);
}

.category-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.category-stat-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(41, 35, 28, 0.04);
}

.category-stat-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.category-stat-head strong {
  overflow-wrap: anywhere;
  font-size: 16px;
}

.category-stat-head span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.category-stat-card dl {
  display: grid;
  gap: 8px;
  margin: 0;
}

.category-stat-card dl div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.category-stat-card dt {
  color: var(--muted);
  font-size: 13px;
}

.category-stat-card dd {
  margin: 0;
  font-weight: 750;
  text-align: right;
  white-space: nowrap;
}

.niche-panel {
  margin-bottom: 16px;
}

.niche-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(41, 35, 28, 0.04);
  cursor: pointer;
}

.niche-panel summary span {
  font-size: 18px;
  font-weight: 800;
}

.niche-panel summary small {
  max-width: 680px;
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.niche-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.niche-card {
  display: flex;
  min-height: 230px;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.niche-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.niche-card-head strong {
  font-size: 16px;
}

.niche-card-head span {
  flex: 0 0 auto;
  color: var(--primary);
  font-size: 13px;
  font-weight: 800;
}

.niche-card p {
  margin: 0;
  color: var(--muted);
}

.niche-card dl {
  display: grid;
  gap: 8px;
  margin: auto 0 0;
}

.niche-card dl div {
  display: grid;
  gap: 3px;
}

.niche-card dt,
.niche-card dd {
  margin: 0;
}

.niche-card dt {
  font-weight: 750;
}

.niche-card dd {
  color: var(--muted);
  font-size: 13px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 8px 26px rgba(41, 35, 28, 0.05);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.panel-header h3 {
  margin: 0;
  font-size: 18px;
}

.panel-body {
  padding: 16px;
}

.list-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
}

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

th {
  color: var(--muted);
  background: var(--surface-strong);
  font-size: 13px;
  font-weight: 750;
}

tr:last-child td {
  border-bottom: 0;
}

.number-cell {
  text-align: right;
  white-space: nowrap;
}

.row-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  white-space: nowrap;
}

.service-name {
  display: block;
  font-weight: 750;
}

.category-tag,
.status-pill {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 13px;
  font-weight: 700;
}

.category-tag {
  color: #5f431f;
  background: #f3e4cc;
}

.status-pill.good {
  color: var(--good);
  background: var(--good-bg);
}

.status-pill.low_margin {
  color: var(--warn);
  background: var(--warn-bg);
}

.status-pill.loss {
  color: var(--bad);
  background: var(--bad-bg);
}

.empty-state {
  display: grid;
  min-height: 260px;
  place-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  text-align: center;
}

.empty-state-inner {
  width: min(440px, 90%);
}

.empty-state h3 {
  margin: 0 0 8px;
  font-size: 22px;
}

.empty-state p {
  margin: 0 0 18px;
  color: var(--muted);
}

.editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(340px, 0.75fr);
  gap: 16px;
  align-items: start;
}

.editor-stack,
.result-stack {
  display: grid;
  gap: 16px;
}

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

.form-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field {
  display: grid;
  gap: 6px;
}

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

label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 9px 10px;
  color: var(--text);
  background: #fff;
  outline: none;
}

textarea {
  min-height: 88px;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(32, 95, 114, 0.13);
}

input.invalid {
  border-color: var(--bad);
  background: var(--bad-bg);
}

.hint {
  color: var(--muted);
  font-size: 13px;
}

.consumables-wrap {
  overflow-x: auto;
}

.consumables-table input {
  min-width: 130px;
}

.consumables-table input.material-name {
  min-width: 180px;
}

.calc-cell {
  min-width: 130px;
  color: var(--primary);
  font-weight: 750;
}

.result-panel {
  position: sticky;
  top: 16px;
  overflow: hidden;
}

.result-hero {
  padding: 18px;
  color: #fff;
  background: var(--primary);
}

.result-hero.good {
  background: var(--good);
}

.result-hero.low_margin {
  color: #2d2110;
  background: #f6c454;
}

.result-hero.loss {
  background: var(--bad);
}

.result-hero span {
  display: block;
  opacity: 0.85;
  font-size: 13px;
  font-weight: 700;
}

.result-hero strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.05;
}

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

.result-item {
  min-height: 86px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--surface-strong);
}

.result-item span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.result-item strong {
  display: block;
  margin-top: 6px;
  overflow-wrap: anywhere;
  font-size: 20px;
}

.monthly-profit,
.monthly-impact {
  margin: 0 14px 14px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--primary);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--surface);
}

.monthly-profit.good,
.monthly-impact.good {
  border-left-color: var(--good);
  background: var(--good-bg);
}

.monthly-profit.low_margin,
.monthly-impact.low_margin {
  border-left-color: var(--warn);
  background: var(--warn-bg);
}

.monthly-profit.loss,
.monthly-impact.loss {
  border-left-color: var(--bad);
  background: var(--bad-bg);
}

.monthly-profit span,
.monthly-impact span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.monthly-profit strong,
.monthly-impact strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
  font-size: 28px;
  line-height: 1.1;
}

.monthly-profit p,
.monthly-impact p {
  margin: 8px 0 0;
  color: var(--text);
}

.converted-panel {
  margin: 0 14px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--surface);
}

.converted-panel > span {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.converted-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}

.converted-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  background: var(--surface-strong);
}

.converted-card strong {
  display: block;
  margin-bottom: 6px;
  color: var(--primary);
}

.converted-card p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.calculation-details {
  margin: 0 14px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: #fff;
}

.calculation-details h4 {
  margin: 0 0 4px;
  font-size: 16px;
}

.calculation-details p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
}

.calc-lines {
  display: grid;
  gap: 8px;
}

.calc-line {
  display: grid;
  grid-template-columns: minmax(92px, 0.85fr) minmax(0, 1.45fr);
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.calc-line > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.calc-line strong {
  display: block;
  font-size: 15px;
}

.calc-line small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.advice {
  margin: 0 14px 14px;
  border-left: 4px solid var(--primary);
  border-radius: 6px;
  padding: 12px;
  background: var(--primary-soft);
}

.advice.good {
  border-color: var(--good);
  background: var(--good-bg);
}

.advice.low_margin {
  border-color: var(--warn);
  background: var(--warn-bg);
}

.advice.loss {
  border-color: var(--bad);
  background: var(--bad-bg);
}

.warning-list {
  margin: 0 14px 14px;
  padding: 12px 12px 12px 28px;
  border-radius: 6px;
  color: #5b3510;
  background: #fff4d7;
}

.settings-actions,
.editor-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.settings-panel {
  max-width: 980px;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 20;
  max-width: min(420px, calc(100% - 40px));
  transform: translateY(20px);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--text);
  background: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

.result-nudge {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 25;
  display: grid;
  gap: 10px;
  width: min(420px, calc(100% - 40px));
  border: 1px solid rgba(32, 95, 114, 0.22);
  border-radius: 8px;
  padding: 16px;
  color: var(--text);
  background: #ffffff;
  box-shadow: 0 22px 70px rgba(41, 35, 28, 0.18);
  transform: translateY(18px);
  opacity: 0;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.result-nudge[hidden] {
  display: none;
}

.result-nudge.is-visible {
  transform: translateY(0);
  opacity: 1;
}

.result-nudge .eyebrow,
.result-nudge p {
  margin: 0;
}

.result-nudge .eyebrow {
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.result-nudge p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.55;
}

.result-nudge__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.result-nudge__close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  font-size: 20px;
  line-height: 1;
}

.result-nudge__close:hover {
  color: var(--text);
  background: var(--primary-soft);
}

[data-access-state].is-active {
  color: var(--success);
  font-weight: 800;
}

.access-meter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 18px 0;
  border: 1px solid rgba(47, 111, 115, 0.22);
  border-radius: 8px;
  padding: 16px 18px;
  background: linear-gradient(135deg, rgba(232, 245, 244, 0.98), rgba(255, 255, 255, 0.96));
  box-shadow: 0 14px 36px rgba(20, 60, 64, 0.08);
}

.access-meter.is-full {
  border-color: rgba(208, 82, 65, 0.28);
  background: linear-gradient(135deg, rgba(255, 244, 241, 0.98), rgba(255, 255, 255, 0.96));
}

.access-meter strong {
  display: block;
  margin-bottom: 4px;
  font-size: 16px;
}

.access-meter p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.license-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background:
    linear-gradient(135deg, rgba(6, 18, 24, 0.94), rgba(22, 58, 62, 0.9)),
    rgba(8, 18, 32, 0.92);
  backdrop-filter: blur(10px);
}

.license-modal.is-visible {
  display: flex;
}

.license-dialog {
  width: min(860px, calc(100vw - 28px));
  max-height: calc(100vh - 44px);
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  padding: 0;
  background: #f8fbfa;
  box-shadow: 0 34px 90px rgba(2, 10, 18, 0.52);
}

.license-hero {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  position: relative;
  padding: 26px 30px;
  color: #ffffff;
  background:
    linear-gradient(135deg, rgba(29, 76, 80, 0.96), rgba(18, 45, 57, 0.98)),
    var(--primary);
}

.license-hero-mark {
  display: grid;
  flex: 0 0 54px;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 8px;
  color: #113c40;
  background: #e7fbf7;
  font-size: 28px;
  font-weight: 900;
}

.license-hero h2 {
  margin: 8px 44px 8px 0;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.08;
}

.license-hero p {
  max-width: 650px;
  margin: 0;
  color: rgba(255, 255, 255, 0.84);
  line-height: 1.55;
}

.license-badge,
.license-plan-label {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.14);
  color: inherit;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.license-badge.is-active {
  color: #063f33;
  background: #bff5df;
}

.license-close {
  position: absolute;
  top: 18px;
  right: 18px;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.license-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.license-body {
  display: grid;
  gap: 18px;
  padding: 24px 30px 28px;
  background:
    linear-gradient(180deg, rgba(242, 249, 247, 0.96), #ffffff 42%),
    #ffffff;
}

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

.license-plan-card {
  display: grid;
  gap: 12px;
  border: 1px solid rgba(47, 111, 115, 0.18);
  border-radius: 8px;
  padding: 18px;
  background: #ffffff;
}

.license-plan-card.is-pro {
  border-color: rgba(47, 111, 115, 0.36);
  background: linear-gradient(180deg, #f5fffc, #ffffff);
  box-shadow: inset 0 0 0 1px rgba(47, 111, 115, 0.06);
}

.license-plan-card .license-plan-label {
  color: var(--primary);
  background: var(--primary-soft);
}

.license-plan-card strong {
  display: block;
  font-size: 20px;
  line-height: 1.2;
}

.license-plan-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.license-feature-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.license-feature-list li {
  display: flex;
  gap: 8px;
  color: var(--text);
  line-height: 1.4;
}

.license-feature-list li::before {
  content: "✓";
  flex: 0 0 auto;
  color: var(--success);
  font-weight: 900;
}

.license-meter {
  display: grid;
  gap: 8px;
}

.license-meter__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
}

.license-meter__row b {
  color: var(--text);
}

.license-meter__bar {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7eeee;
}

.license-meter__bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), #5cb6a8);
}

.license-code-panel {
  display: grid;
  gap: 14px;
  border: 1px solid rgba(47, 111, 115, 0.18);
  border-radius: 8px;
  padding: 18px;
  background: #ffffff;
  box-shadow: 0 12px 34px rgba(20, 60, 64, 0.08);
}

.license-status {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.license-field {
  display: grid;
  gap: 8px;
  color: var(--text);
  font-weight: 700;
}

.license-field input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  font: inherit;
}

.license-code-hint {
  color: var(--muted);
  font-weight: 600;
  line-height: 1.4;
}

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

.activation-steps {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(47, 111, 115, 0.18);
  border-radius: 8px;
  padding: 16px 18px;
  background: #f7fbfa;
  box-shadow: inset 0 0 0 1px rgba(47, 111, 115, 0.04);
}

.activation-steps h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.25;
}

.activation-steps ol {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.45;
}

.license-status {
  margin-top: 12px;
}

.license-status.error {
  color: var(--danger);
}

.license-status.warning {
  color: #9a6700;
}

@media (max-width: 1060px) {
  .editor-layout {
    grid-template-columns: 1fr;
  }

  .result-panel {
    position: static;
  }
}

@media (max-width: 820px) {
  .app-shell {
    width: min(100% - 20px, 1480px);
    padding-top: 10px;
  }

  .app-header,
  .page-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .header-actions {
    justify-content: stretch;
  }

  .app-preferences {
    justify-content: stretch;
    margin: -6px 0 12px;
  }

  .preference-group {
    flex: 1 1 280px;
    justify-content: space-between;
  }

  .header-actions button,
  .header-actions a,
  .page-heading button {
    flex: 1 1 auto;
  }

  .pwa-status {
    width: 100%;
    justify-content: center;
    margin: -6px 0 14px;
  }

  .toolbar,
  .app-demo-guide,
  .app-demo-guide__steps,
  .summary-strip,
  .category-stat-grid,
  .license-plan-grid,
  .niche-grid,
  .form-grid,
  .form-grid.three,
  .settings-choice-grid,
  .result-grid {
    grid-template-columns: 1fr;
  }

  .access-meter,
  .license-hero,
  .license-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .license-dialog {
    width: min(100%, calc(100vw - 18px));
    max-height: calc(100vh - 18px);
  }

  .license-hero,
  .license-body {
    padding-left: 18px;
    padding-right: 18px;
  }

  .license-hero h2 {
    margin-right: 38px;
  }

  .panel-heading,
  .category-stat-head,
  .niche-panel summary,
  .niche-card-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .niche-panel summary small {
    text-align: left;
  }

  .category-stat-card dd {
    white-space: normal;
  }
}

@media print {
  body {
    background: #fff;
  }

  .app-header,
  .app-preferences,
  .pwa-status,
  .app-demo-guide,
  .result-nudge,
  .toolbar,
  .header-actions,
  .editor-actions,
  .settings-actions,
  .toast {
    display: none !important;
  }

  .app-shell {
    width: 100%;
    padding: 0;
  }

  .panel {
    box-shadow: none;
  }
}
