:root {
  color-scheme: dark;
  --page: #060e1a;
  --shell: #0d1726;
  --panel: #0a1424;
  --panel-soft: #0e1a2c;
  --line: #293b56;
  --line-strong: #3b5272;
  --text: #f6f8fc;
  --muted: #9eb2ce;
  --muted-strong: #bfd0e6;
  --teal: #20c8c9;
  --teal-soft: rgba(32, 200, 201, 0.12);
  --blue: #238bed;
  --blue-bright: #15b7d3;
  --danger: #ff7f83;
  --danger-bg: rgba(214, 71, 80, 0.12);
  --radius: 15px;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--page);
}

body {
  min-height: 100vh;
  margin: 0;
  padding: 20px;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 0%, rgba(23, 156, 190, 0.09), transparent 28rem),
    var(--page);
  -webkit-font-smoothing: antialiased;
}

.splash {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 42%, rgba(34, 211, 197, 0.13), transparent 21rem),
    linear-gradient(180deg, #07101c, #091322);
  animation: splashOut 0.65s cubic-bezier(0.4, 0, 0.2, 1) 2.85s forwards;
}

.splash-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 17px;
  transform: translateY(-2vh);
}

.splash-logo {
  position: relative;
  width: 148px;
  height: 148px;
  overflow: hidden;
  opacity: 0;
  border-radius: 33px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  transform: scale(0.78) translateY(9px);
  animation: logoIn 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) 0.08s forwards;
}

.splash-logo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  animation: meshPull 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) 0.58s both;
}

.shine {
  position: absolute;
  inset: -25% -75%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.18), transparent);
  transform: translateX(-55%) rotate(18deg);
  animation: shine 1.65s ease 0.42s both;
}

.splash-name {
  opacity: 0;
  text-align: center;
  transform: translateY(8px);
  animation: splashTextIn 0.6s ease 0.72s forwards;
}

.splash-name strong {
  display: block;
  font-size: 2.15rem;
  letter-spacing: -0.04em;
}

.splash-name span {
  display: block;
  margin-top: 5px;
  color: #7f94ad;
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.14em;
}

.loader {
  width: 150px;
  height: 4px;
  overflow: hidden;
  opacity: 0;
  border-radius: 999px;
  background: #172439;
  animation: splashTextIn 0.35s ease 1s forwards;
}

.loader div {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--teal));
  animation: splashLoad 1.75s cubic-bezier(0.2, 0.7, 0.2, 1) 1s forwards;
}

@keyframes logoIn {
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes meshPull {
  from {
    transform: scaleX(1.09);
  }

  to {
    transform: scaleX(1);
  }
}

@keyframes shine {
  from {
    transform: translateX(-55%) rotate(18deg);
  }

  to {
    transform: translateX(55%) rotate(18deg);
  }
}

@keyframes splashTextIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes splashLoad {
  to {
    width: 100%;
  }
}

@keyframes splashOut {
  to {
    visibility: hidden;
    opacity: 0;
    transform: scale(1.02);
  }
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button,
summary,
label {
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

.app-shell {
  width: min(100%, 1000px);
  margin: 0 auto;
  padding: 30px 28px 20px;
  overflow: hidden;
  background: var(--shell);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.app-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 26px;
}

.brand-mark {
  width: 72px;
  height: 72px;
  flex: 0 0 72px;
  overflow: hidden;
  border: 0;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 9px 24px rgba(0, 0, 0, 0.28);
}

.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

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

.header-actions {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  margin-left: auto;
}

.language-switch {
  display: inline-flex;
  min-height: 35px;
  align-items: center;
  gap: 4px;
  padding: 3px 5px;
  color: #66809d;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(7, 17, 31, 0.5);
}

.language-button {
  min-height: 27px;
  padding: 0 8px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 730;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  background: transparent;
  transition:
    color 140ms ease,
    background 140ms ease;
}

.language-button:hover {
  color: var(--text);
}

.language-button.is-active {
  color: #d9ffff;
  background: rgba(32, 200, 201, 0.14);
  box-shadow: inset 0 0 0 1px rgba(32, 200, 201, 0.32);
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--teal);
  font-size: 0.74rem;
  font-weight: 750;
  letter-spacing: 0.18em;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 5px;
  font-size: clamp(1.9rem, 4vw, 2.35rem);
  line-height: 1.04;
  letter-spacing: -0.035em;
}

.subtitle {
  margin-bottom: 0;
  color: var(--muted-strong);
  font-size: 1rem;
}

.install-button {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-left: 0;
  white-space: nowrap;
}

.install-button svg {
  width: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.calculation-rule {
  margin-bottom: 18px;
  padding: 15px 17px;
  color: var(--muted-strong);
  border: 1px solid var(--line);
  border-left: 5px solid var(--teal);
  border-radius: 14px;
  background: rgba(7, 17, 31, 0.42);
}

.calculation-rule p {
  margin: 0;
  font-size: 0.96rem;
  line-height: 1.55;
}

.calculation-rule strong,
.calculation-rule b {
  color: #c6defa;
}

#reduction-form {
  margin-bottom: 18px;
}

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

.input-card {
  display: grid;
  gap: 8px;
  min-width: 0;
  color: var(--muted-strong);
  font-size: 0.9rem;
}

.input-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.input-card input {
  width: 100%;
  min-height: 51px;
  padding: 10px 14px;
  color: var(--text);
  font-size: 1.08rem;
  font-weight: 650;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  outline: none;
  background: #081221;
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease,
    background 150ms ease;
}

.input-card input:hover {
  border-color: #516987;
}

.input-card input:focus {
  border-color: var(--teal);
  background: #0a1727;
  box-shadow: 0 0 0 3px rgba(32, 200, 201, 0.14);
}

.input-card.has-error {
  color: #ffadb0;
}

.input-card.has-error input {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(255, 127, 131, 0.12);
}

.error-message {
  margin-top: 12px;
  padding: 11px 13px;
  color: #ffc5c7;
  font-size: 0.9rem;
  line-height: 1.45;
  border: 1px solid rgba(255, 127, 131, 0.34);
  border-radius: 11px;
  background: var(--danger-bg);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 17px;
}

.primary-button,
.secondary-button {
  min-height: 43px;
  padding: 0 18px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 760;
  border: 1px solid transparent;
  transition:
    transform 120ms ease,
    border-color 120ms ease,
    background 120ms ease,
    opacity 120ms ease;
}

.primary-button {
  background: linear-gradient(115deg, var(--blue), var(--blue-bright));
  box-shadow: 0 8px 22px rgba(25, 141, 224, 0.2);
}

.secondary-button {
  border-color: var(--line-strong);
  background: #111e32;
}

.primary-button:hover:not(:disabled),
.secondary-button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.secondary-button:hover:not(:disabled) {
  border-color: #597191;
  background: #16253b;
}

.primary-button:active:not(:disabled),
.secondary-button:active:not(:disabled) {
  transform: translateY(0);
}

.work-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.work-button svg {
  width: 15px;
  fill: currentColor;
}

.primary-button:disabled,
.secondary-button:disabled {
  color: #77869a;
  border-color: #24334a;
  cursor: not-allowed;
  opacity: 0.68;
  background: #121c2b;
  box-shadow: none;
}

button:focus-visible,
summary:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(61, 210, 211, 0.38);
  outline-offset: 2px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(240px, 0.92fr);
  gap: 16px;
  margin-bottom: 18px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.result-panel,
.stats-panel,
.lookup-panel {
  padding: 18px;
}

.result-panel,
.stats-panel {
  min-height: 196px;
}

.panel h2 {
  margin-bottom: 12px;
  font-size: 1.08rem;
  letter-spacing: -0.015em;
}

.plan-mode-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin: 0 0 18px;
  padding: 0;
  border: 0;
}

.plan-mode-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 43px;
  padding: 0 15px;
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  cursor: pointer;
  background: #091424;
  transition:
    border-color 140ms ease,
    background 140ms ease;
}

.plan-mode-option:has(input:checked) {
  border-color: #3c79ac;
  background: #0c1a2d;
}

.plan-mode-option input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: #1f9df2;
}

.plan-mode-option span {
  font-size: 0.92rem;
}

.empty-state strong {
  display: block;
  margin-bottom: 11px;
  font-size: 1.55rem;
  line-height: 1;
}

.empty-state p,
.stats-empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.stats-empty {
  font-size: 1rem;
}

.result-content h3 {
  margin-bottom: 10px;
  color: var(--muted-strong);
  font-size: 0.82rem;
  font-weight: 720;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.distribution-plan {
  display: grid;
  gap: 8px;
}

.plan-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid #263b57;
  border-radius: 11px;
  background: #0d1b2e;
}

.plan-count {
  min-width: 58px;
  color: #6bdde0;
  font-size: 1.03rem;
  font-weight: 780;
}

.plan-instruction {
  margin: 0;
  color: var(--text);
  font-size: 0.94rem;
  font-weight: 650;
  line-height: 1.3;
}

.plan-instruction small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.35;
}

.pattern-sequence {
  word-break: break-word;
}

.plan-note {
  margin: 10px 1px 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.result-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-top: 16px;
}

.result-action-button {
  display: inline-flex;
  min-height: 49px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 9px 12px;
  line-height: 1.25;
  text-align: left;
}

.result-action-button svg {
  width: 19px;
  flex: 0 0 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.result-action-note {
  margin: 9px 1px 0;
  color: #8096b2;
  font-size: 0.75rem;
  line-height: 1.4;
}

.summary-grid {
  display: grid;
  gap: 11px;
  margin: 0;
}

.summary-grid div {
  padding: 10px 11px;
  border: 1px solid #243650;
  border-radius: 11px;
  background: #0d1a2b;
}

.summary-grid dt {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.75rem;
}

.summary-grid dd {
  margin: 0;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 720;
  line-height: 1.35;
}

.mesh-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0 0;
  padding-top: 14px;
  border-top: 1px solid #243650;
}

.mesh-summary div {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid #243650;
  border-radius: 10px;
  background: #0d1a2b;
}

.mesh-summary dt {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.3;
}

.mesh-summary dd {
  margin: 0;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 760;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
}

.mesh-summary .mesh-summary-primary,
.mesh-summary .mesh-summary-length {
  border-color: rgba(32, 200, 201, 0.34);
  background: var(--teal-soft);
}

.mesh-summary-primary dd,
.mesh-summary-length dd {
  color: #d9ffff;
  font-size: 1.08rem;
}

.lookup-panel {
  margin-bottom: 15px;
}

.lookup-heading {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 10px;
}

.lookup-heading h2 {
  margin: 0;
}

.lookup-heading > span {
  padding: 4px 8px;
  color: #a8f4f1;
  font-size: 0.7rem;
  font-weight: 780;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid rgba(32, 200, 201, 0.3);
  border-radius: 999px;
  background: var(--teal-soft);
}

.table-wrap {
  overflow-x: auto;
  scrollbar-color: #3d5575 #0b1626;
}

.lookup-toolbar {
  margin: 0 15px 12px 0;
}

.lookup-toolbar button {
  min-height: 44px;
  padding: 8px 12px;
  line-height: 1.4;
}

.table-wrap.is-expanded {
  max-height: 440px;
  overflow-y: auto;
}

.lookup-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--panel);
}

.lookup-table {
  width: 100%;
  min-width: 590px;
  border-collapse: collapse;
  table-layout: fixed;
}

.lookup-table th,
.lookup-table td {
  padding: 10px 11px;
  text-align: left;
  border-bottom: 1px solid #293b54;
}

.lookup-table th {
  color: #dbe8f7;
  font-size: 0.82rem;
  font-weight: 750;
}

.lookup-table th span {
  color: var(--muted);
  font-weight: 560;
}

.lookup-table td {
  color: var(--text);
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
}

.lookup-table tbody tr {
  cursor: pointer;
  transition:
    background 140ms ease,
    box-shadow 140ms ease;
}

.lookup-table tbody tr:hover,
.lookup-table tbody tr:has(.mesh-choice:focus-visible) {
  background: rgba(30, 63, 95, 0.14);
}

.lookup-table tbody tr.is-selected {
  background: rgba(32, 200, 201, 0.11);
  box-shadow: inset 0 0 0 1px rgba(32, 200, 201, 0.42);
}

.lookup-table tbody tr.is-selected td:first-child {
  color: #d9ffff;
  font-weight: 780;
}

.mesh-choice {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0;
  color: inherit;
  text-align: left;
  border: 0;
  cursor: pointer;
  background: transparent;
}

.selected-indicator {
  padding: 3px 6px;
  color: #b9f7f4;
  font-size: 0.65rem;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
  border: 1px solid rgba(32, 200, 201, 0.28);
  border-radius: 999px;
  opacity: 0;
  background: rgba(32, 200, 201, 0.1);
}

.is-selected .selected-indicator {
  opacity: 1;
}

.table-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.45;
}

.table-note strong {
  color: var(--muted-strong);
}

.help-card {
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(8, 18, 32, 0.58);
}

.help-card summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 13px 15px;
  cursor: pointer;
  color: var(--muted-strong);
  font-size: 0.9rem;
  font-weight: 690;
  list-style: none;
}

.help-card summary::-webkit-details-marker {
  display: none;
}

.help-card summary svg {
  width: 19px;
  flex: 0 0 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  transition: transform 160ms ease;
}

.help-card[open] summary svg {
  transform: rotate(180deg);
}

.help-content {
  padding: 0 15px 4px;
  color: var(--muted);
  font-size: 0.87rem;
  line-height: 1.5;
}

.help-content p {
  margin-bottom: 11px;
}

.help-content strong {
  color: var(--muted-strong);
}

.length-calculator {
  margin-bottom: 12px;
  padding: 18px;
}

.length-mesh-note,
.length-note {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.5;
}

.length-mesh-note strong {
  color: #a8f4f1;
}

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

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

.length-results > div {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
}

.length-results dt {
  color: var(--muted-strong);
  font-size: 0.875rem;
  line-height: 1.4;
}

.length-results dd {
  margin: 5px 0 0;
  font-size: 1.2rem;
  font-weight: 760;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.length-results .length-whole-result {
  border-color: rgba(32, 200, 201, 0.34);
  background: var(--teal-soft);
}

.length-whole-result dd {
  color: #d9ffff;
}

.length-note {
  margin: 12px 0 0;
}

@media (max-width: 680px) {
  .length-calculator {
    padding: 15px;
  }

  .length-calculator-grid {
    grid-template-columns: 1fr;
  }

  .length-results {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
  }
}

.safety-card {
  padding: 12px 14px;
  color: #9eb3cc;
  font-size: 0.82rem;
  line-height: 1.5;
  border: 1px solid #273a52;
  border-radius: 12px;
  background: rgba(7, 17, 31, 0.38);
}

.safety-card strong {
  color: #cbd9e9;
}

footer {
  padding-top: 18px;
  color: #83b1dc;
  font-size: 0.8rem;
}

footer p {
  margin: 0;
}

footer span {
  padding: 0 4px;
  color: #4a6582;
}

footer .copyright {
  margin-top: 6px;
  color: #738ba7;
}

.print-sheet {
  display: none;
}

dialog {
  width: min(calc(100% - 28px), 500px);
  max-height: calc(100dvh - 28px);
  padding: 0;
  overflow: auto;
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  background: #0b1525;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.58);
}

dialog::backdrop {
  background: rgba(2, 7, 13, 0.78);
  backdrop-filter: blur(5px);
}

.install-dialog {
  width: min(calc(100% - 28px), 440px);
}

.install-dialog-card {
  padding: 30px;
  text-align: center;
}

.install-dialog-icon {
  width: 82px;
  height: 82px;
  margin: 0 auto 20px;
  overflow: hidden;
  border-radius: 22px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.34);
}

.install-dialog-icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.install-dialog-card h2 {
  margin-bottom: 11px;
}

.install-dialog-card > p:not(.eyebrow) {
  margin-bottom: 22px;
  color: var(--muted);
  line-height: 1.55;
}

.install-dialog-card form,
.install-dialog-card button {
  width: 100%;
}

.dialog-shell {
  min-height: 420px;
  padding: 18px;
}

.dialog-topbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin-bottom: 25px;
}

.dialog-topbar-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.dialog-topbar p {
  margin: 0;
  font-size: 0.96rem;
  font-weight: 750;
  text-align: center;
}

.icon-button,
.small-text-button,
.text-button {
  border: 0;
  cursor: pointer;
  background: transparent;
}

.icon-button {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.icon-button svg {
  width: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 2;
}

#toggle-fullscreen[aria-pressed="true"] {
  color: #7de8e9;
  border-color: rgba(32, 200, 201, 0.52);
  background: var(--teal-soft);
}

.small-text-button {
  justify-self: end;
  padding: 8px 0;
  color: var(--muted);
  font-size: 0.76rem;
}

.counter-step {
  margin-bottom: 8px;
  color: var(--muted-strong);
  font-size: 0.89rem;
  text-align: center;
}

.progress-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #1d2a3d;
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--teal));
  transition: width 220ms ease;
}

.count-display {
  display: grid;
  justify-items: center;
  padding: 37px 10px 28px;
}

.count-number {
  color: var(--text);
  font-size: clamp(4.5rem, 18vw, 7rem);
  font-weight: 790;
  line-height: 0.95;
  letter-spacing: -0.06em;
  font-variant-numeric: tabular-nums;
}

.count-label {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.93rem;
}

.action-callout {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 13px 14px;
  border: 1px solid rgba(32, 200, 201, 0.28);
  border-radius: 12px;
  background: var(--teal-soft);
}

.action-callout svg {
  width: 25px;
  flex: 0 0 25px;
  fill: none;
  stroke: var(--teal);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.action-callout p {
  margin: 0;
  color: var(--muted-strong);
  font-size: 0.88rem;
  line-height: 1.4;
}

.next-button {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  gap: 9px;
}

.next-button svg {
  width: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.text-button {
  display: block;
  margin: 10px auto 0;
  padding: 7px 10px;
  color: var(--muted);
  font-size: 0.84rem;
}

.counter-complete {
  padding: 42px 15px 30px;
  text-align: center;
}

.complete-icon {
  display: grid;
  width: 68px;
  height: 68px;
  margin: 0 auto 19px;
  place-items: center;
  color: var(--teal);
  border: 1px solid rgba(32, 200, 201, 0.36);
  border-radius: 50%;
  background: var(--teal-soft);
}

.complete-icon svg {
  width: 35px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.counter-complete h2 {
  margin-bottom: 9px;
}

.counter-complete > p:not(.eyebrow) {
  margin-bottom: 22px;
  color: var(--muted);
}

dialog.fullscreen-mode,
dialog:fullscreen {
  inset: 0;
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  border: 0;
  border-radius: 0;
}

dialog.fullscreen-mode .dialog-shell,
dialog:fullscreen .dialog-shell {
  display: flex;
  min-height: 100dvh;
  flex-direction: column;
  padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
}

dialog.fullscreen-mode .counter-active,
dialog.fullscreen-mode .counter-complete,
dialog:fullscreen .counter-active,
dialog:fullscreen .counter-complete {
  width: min(100%, 620px);
  margin: auto;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@media (max-width: 760px) {
  body {
    padding: 12px;
  }

  .app-shell {
    padding: 24px 20px 17px;
    border-radius: 19px;
  }

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

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

  .result-panel,
  .stats-panel {
    min-height: auto;
  }

  .stats-panel {
    min-height: 135px;
  }

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

  .summary-grid div {
    padding: 9px;
  }
}

@media (max-width: 520px) {
  body {
    padding: 0;
    background: var(--shell);
  }

  .app-shell {
    padding: max(20px, env(safe-area-inset-top)) 15px max(15px, env(safe-area-inset-bottom));
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .app-header {
    display: grid;
    grid-template-columns: 60px minmax(0, 1fr);
    align-items: start;
    gap: 13px;
    margin-bottom: 20px;
  }

  .header-actions {
    grid-column: 1 / -1;
    width: 100%;
    margin-left: 0;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .install-button {
    width: auto;
    min-width: 145px;
  }

  .brand-mark {
    width: 60px;
    height: 60px;
    flex-basis: 60px;
    border-radius: 17px;
  }

  h1 {
    font-size: 1.72rem;
  }

  .subtitle {
    font-size: 0.88rem;
  }

  .calculation-rule {
    padding: 13px 14px;
  }

  .calculation-rule p {
    font-size: 0.87rem;
  }

  .button-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .work-button {
    grid-column: 1 / -1;
    justify-content: center;
  }

  .result-panel,
  .stats-panel,
  .lookup-panel {
    padding: 15px;
  }

  .plan-mode-picker {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .plan-mode-option {
    justify-content: center;
    padding: 0 9px;
  }

  .plan-mode-option span {
    font-size: 0.81rem;
  }

  .result-actions {
    grid-template-columns: 1fr;
  }

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

  .mesh-summary {
    grid-template-columns: 1fr 1fr;
  }

  .lookup-panel {
    padding-right: 0;
  }

  .lookup-panel h2,
  .table-note {
    padding-right: 15px;
  }

  .lookup-table {
    min-width: 545px;
  }

  .dialog-shell {
    min-height: 390px;
    padding: 15px;
  }

  .install-dialog-card {
    padding: 25px 20px;
  }
}

@page {
  size: A4;
  margin: 14mm;
}

@media print {

  .splash {
    display: none !important;
  }

  :root {
    color-scheme: light;
  }

  html,
  body {
    min-width: 0;
    min-height: 0;
    padding: 0;
    color: #102033;
    background: #fff;
  }

  body > :not(#print-sheet) {
    display: none !important;
  }

  #print-sheet {
    display: block !important;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  }

  .print-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-bottom: 14px;
    border-bottom: 2px solid #183d5c;
  }

  .print-header img {
    width: 64px;
    height: 64px;
    border-radius: 16px;
  }

  .print-header p {
    margin: 0 0 3px;
    color: #087f84;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.16em;
  }

  .print-header h1 {
    margin: 0 0 3px;
    color: #102033;
    font-size: 22px;
    line-height: 1.15;
  }

  .print-header span {
    color: #53677d;
    font-size: 10px;
  }

  .print-values {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin: 18px 0 10px;
  }

  .print-values div {
    padding: 10px;
    border: 1px solid #b9c6d3;
    border-radius: 7px;
  }

  .print-values span,
  .print-summary span {
    display: block;
    margin-bottom: 3px;
    color: #52677d;
    font-size: 9px;
  }

  .print-values strong {
    color: #102033;
    font-size: 15px;
  }

  .print-summary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0 18px;
    margin-bottom: 18px;
    padding: 10px 12px;
    border-radius: 7px;
    background: #eef4f8;
  }

  .print-summary p {
    margin: 3px 0;
    font-size: 11px;
  }

  .print-summary span {
    display: inline;
    margin: 0;
  }

  .print-sheet h2 {
    margin: 0 0 9px;
    color: #102033;
    font-size: 16px;
  }

  .print-plan {
    display: grid;
    gap: 7px;
  }

  .print-plan .plan-row {
    break-inside: avoid;
    padding: 9px 11px;
    color: #102033;
    border: 1px solid #b8c7d5;
    background: #fff;
  }

  .print-plan .plan-count {
    color: #087f84;
  }

  .print-plan .plan-instruction {
    color: #102033;
  }

  .print-plan .plan-instruction small,
  .print-plan-note {
    color: #52677d;
  }

  .print-plan-note {
    margin: 9px 0 18px;
    font-size: 10px;
    line-height: 1.4;
  }

  .print-safety {
    break-inside: avoid;
    padding: 9px 11px;
    color: #354b61;
    font-size: 9px;
    line-height: 1.45;
    border: 1px solid #c8d2dc;
    border-radius: 7px;
  }

  .print-sheet > footer {
    padding-top: 12px;
    color: #60758a;
    font-size: 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }

  .splash,
  .splash-logo,
  .splash-logo img,
  .shine,
  .splash-name,
  .loader,
  .loader div {
    animation-delay: 0ms !important;
  }
}

.panel-figure{margin:12px 0 24px;padding:16px;border:1px solid var(--line);border-radius:12px;background:linear-gradient(145deg,#0d2030,#0a1424)}.shape-heading{display:flex;align-items:center;justify-content:space-between;gap:12px}.shape-heading h3{margin:0;font-size:1rem}.shape-heading span{font-size:.8rem;color:var(--teal)}.shape-widths{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin:16px 0 8px}.shape-widths span{display:block;color:var(--muted);font-size:.875rem}.shape-widths strong{display:block;font-size:1.15rem;margin-top:4px}.panel-figure svg{width:100%;max-width:460px;height:auto;display:block;margin:8px auto}.shape-dimensions{font-size:.9375rem;line-height:1.6;color:var(--muted-strong)}.panel-figure figcaption{color:var(--muted);font-size:.875rem;line-height:1.5;margin-top:12px}#shape-empty{font-size:.9375rem;line-height:1.5;padding:14px 0;color:var(--muted-strong)}

/* Nettpanel dashboard */
:root{--page:#091316;--shell:#101e22;--panel:#122429;--panel-soft:#172c30;--line:#2a4146;--muted:#9eb7ba;--teal:#73dfc0;--blue:#73dfc0;--blue-bright:#73dfc0;--radius:18px}
body{padding:0 28px 28px;background:radial-gradient(ellipse at 80% 0, #16353577,transparent 55%),#091316}
.app-shell{max-width:1220px;margin:0 auto;padding:0;border:0;border-radius:0;background:none;box-shadow:none}
.concept-banner{padding:12px 0;border-bottom:1px solid #293d40;display:flex;justify-content:space-between;gap:12px;color:#a6bebf;font-size:12px;letter-spacing:.03em}
.concept-banner b{color:#83dfc7;font-weight:500}.app-header{padding:28px 0;margin:0;border-bottom:1px solid var(--line)}
.brand-mark{width:60px;height:60px;border-radius:15px;box-shadow:none}.brand-copy h1{font-size:30px;letter-spacing:-1px}.subtitle{font-size:13px}
.design-intro{display:flex;align-items:end;justify-content:space-between;margin:30px 0 22px;gap:18px}.design-intro h2{font-size:28px;letter-spacing:-.9px;margin:0 0 7px}.design-intro p{margin:0;color:var(--muted);font-size:14px}.design-intro a{color:#a6dfd0;text-decoration:none;font-size:13px;border-bottom:1px solid #476e65;padding-bottom:4px}
.studio-grid{display:grid;grid-template-columns:1fr 1.12fr;gap:20px;margin-bottom:20px}.setup-card{padding:26px;background:var(--panel);border:1px solid var(--line);border-radius:18px}.setup-heading{margin:0 0 24px;font-size:16px;display:flex;align-items:center;gap:12px}.step-number{font-size:11px;color:var(--teal);border:1px solid #426259;border-radius:50%;width:25px;height:25px;display:inline-grid;place-items:center}
.input-grid{display:grid;grid-template-columns:1fr 1fr;gap:18px}.input-card:last-child{grid-column:1/-1}.input-card input{background:#0d1d21;border:1px solid #3c5357;height:66px;font-size:28px;font-weight:600;padding:14px 18px;border-radius:10px}.input-label{font-size:12px;letter-spacing:.02em}.button-row{margin-top:22px;gap:10px}.primary-button{background:#88e4c8;color:#09251e;border:0;box-shadow:none;font-weight:750}.secondary-button{background:#1c3035;border-color:#395055}.work-button{width:100%;justify-content:center;background:transparent}.calculation-rule{margin:22px 0 0;padding:14px;border:0;border-left:2px solid #58756d;background:#0e1d21;font-size:12px;line-height:1.65;border-radius:0 10px 10px 0}
.panel-figure{margin:0;padding:23px 26px;border:1px solid #344d51;background:radial-gradient(ellipse at center,#203c3d55,transparent 65%),#101f24;border-radius:18px;position:relative}.shape-heading h3{font-size:16px}.shape-heading>span{background:#203a37;color:#a5d7c8;border:0}.shape-widths{margin:18px 0 6px}.shape-widths strong{font-size:22px}.panel-figure svg{max-height:310px;max-width:420px}.shape-widths>div{background:transparent;border:0;padding:0}.shape-widths>div:last-child{text-align:right}
.dashboard-grid{grid-template-columns:1.12fr 1fr;gap:20px;margin:0 0 20px}.panel{padding:24px;border-radius:18px;background:var(--panel);border:1px solid var(--line)}.panel h2{font-size:16px;margin-bottom:20px}.summary-grid{grid-template-columns:repeat(3,1fr);gap:8px}.summary-grid>div{padding:12px 0;background:none;border:0}.summary-grid dd{font-size:19px}.summary-grid dt{font-size:11px}.mesh-summary{display:grid;grid-template-columns:1fr 1fr;gap:12px;border-top:1px solid var(--line);padding-top:18px}.mesh-summary>div{display:block;padding:0;border:0}.mesh-summary dt{font-size:11px}.mesh-summary dd{font-size:21px;margin:6px 0}.mesh-summary-length dd{color:#8ae4c9}.distribution-plan{gap:10px}.plan-mode-picker{margin-bottom:20px}.plan-mode-option{border-radius:8px;font-size:12px}.result-actions{flex-wrap:wrap}.result-actions button{font-size:12px}.result-action-note,.plan-note{font-size:12px}.lookup-panel{margin-top:0}.lookup-table th{font-size:11px;text-transform:uppercase;letter-spacing:.05em;color:#9bb9b8}.lookup-table td{padding:13px 10px;font-size:14px}.lookup-table tr.is-selected{background:#71dfbc13}.table-note{font-size:12px}.help-card{margin:20px 0}.safety-card{font-size:12px;background:none;border-color:#364849}footer{font-size:11px;padding:20px 0}.length-calculator{margin-top:20px}
@media(min-width:950px){.length-calculator-grid .input-card{grid-column:auto}}
@media(max-width:750px){body{padding:0 14px 20px}.studio-grid,.dashboard-grid{grid-template-columns:1fr}.setup-card,.panel,.panel-figure{padding:20px}.design-intro h2{font-size:24px}.design-intro a{display:none}.app-header{padding:22px 0}.brand-copy h1{font-size:25px}.concept-banner{font-size:10px}.header-actions{flex-wrap:wrap}.summary-grid{grid-template-columns:repeat(3,1fr)}}
@media print{.concept-banner,.design-intro,.studio-grid{display:none!important}}
.saved-panels{margin:0 0 20px}.saved-panel-controls{display:flex;align-items:end;gap:12px;flex-wrap:wrap}.saved-panel-controls label{flex:1;min-width:180px;display:grid;gap:8px;font-size:12px;color:var(--muted)}.saved-panel-controls input{width:100%;padding:13px;background:#0d1d21;color:var(--text);border:1px solid var(--line-strong);border-radius:9px;font:inherit;font-size:16px}.saved-panel-row{display:flex;align-items:center;gap:10px;padding:16px 0;border-top:1px solid var(--line)}.saved-panel-row>div{flex:1;min-width:0}.saved-panel-row strong{overflow-wrap:anywhere}.saved-panel-row p{color:var(--muted);font-size:12px;margin:7px 0 0}.saved-panel-row button{font-size:12px}#saved-panel-status{font-size:13px;color:var(--teal)}@media(max-width:550px){.saved-panel-row{flex-wrap:wrap}.saved-panel-row>div{flex-basis:100%}}
.project-fields{display:grid;grid-template-columns:1fr 2fr;gap:16px;margin-top:18px}.project-fields label{display:grid;align-content:start;gap:8px;font-size:12px;color:var(--muted)}.project-fields input,.project-fields textarea,.project-filter select{width:100%;border:1px solid var(--line-strong);background:#0d1d21;color:var(--text);border-radius:9px;padding:12px;font:inherit;font-size:14px}.project-fields textarea{resize:vertical;min-height:86px}.project-filter{display:flex;gap:12px;align-items:center;margin:18px 0;font-size:12px}.project-filter select{max-width:320px}.project-heading{font-size:15px;margin:22px 0 10px;overflow-wrap:anywhere}.panel-status-badge{display:inline-block;margin-left:12px;font-size:11px;color:#b4e4d4;border:1px solid #49655d;border-radius:20px;padding:3px 8px}.wake-controls{padding:12px 20px;border-bottom:1px solid var(--line);font-size:13px;text-align:center}.wake-controls label{display:flex;justify-content:center;align-items:center;gap:10px}.wake-controls input{width:20px;height:20px;accent-color:var(--teal)}.wake-controls p{font-size:11px;color:var(--muted);margin:6px 0 0}#undo-complete-step{margin-top:14px}.print-panel-extras p{white-space:pre-wrap;overflow-wrap:anywhere}.print-panel-extras>div{margin:16px 0}@media(max-width:600px){.project-fields{grid-template-columns:1fr}}@media print{.print-panel-extras{color:#111}.print-panel-extras strong{color:#111}}
.material-fields{display:grid;grid-template-columns:repeat(3,1fr);gap:14px;border:1px solid var(--line);border-radius:12px;margin:18px 0;padding:16px}.material-fields legend{font-size:14px;padding:0 6px}.material-fields label{display:grid;gap:8px;font-size:12px;color:var(--muted)}.material-fields input,.direction-control select{min-width:0;width:100%;padding:11px;border:1px solid var(--line-strong);border-radius:8px;background:#0d1d21;color:var(--text);font:inherit}.direction-control{margin:16px 0}.direction-control>label{font-size:12px;color:var(--muted);display:block;margin-bottom:8px}.direction-control select{font-size:14px}.large-text-control{margin-top:12px}.large-work-text .count-number{font-size:clamp(100px,24vw,240px);line-height:1.05}.large-work-text .count-label{font-size:clamp(22px,4vw,36px)}.large-work-text .action-callout{font-size:clamp(20px,3vw,30px)}.large-work-text .next-button{font-size:24px;min-height:70px}.large-work-text .dialog-shell{overflow:auto;max-height:100dvh}.preflight-dialog{color:var(--text);background:var(--panel);border:1px solid var(--line-strong);border-radius:18px;max-width:540px;width:calc(100% - 28px);padding:0}.preflight-inner{padding:26px}.preflight-inner h2{font-size:22px;margin-top:0}.preflight-inner p{font-size:14px;line-height:1.6;color:var(--muted)}#preflight-checks{display:grid;gap:12px;margin:22px 0}#preflight-checks label{display:flex;align-items:center;gap:12px;padding:12px;background:var(--panel-soft);border-radius:8px}#preflight-checks input{width:24px;height:24px;accent-color:var(--teal)}#panel-label-sheet{display:none}@media(max-width:600px){.material-fields{grid-template-columns:1fr}}@media print{body.printing-panel-label>*{display:none!important}body.printing-panel-label>#panel-label-sheet{display:block!important;color:#111;background:#fff;border:1px solid #111;width:100%;max-width:100mm;padding:6mm;font-family:system-ui,sans-serif;break-inside:avoid}#panel-label-sheet h1{color:#111;font-size:20pt;margin:2mm 0 5mm;overflow-wrap:anywhere}#panel-label-sheet .label-brand{font-size:9pt;letter-spacing:2px}#panel-label-sheet dl{display:grid;grid-template-columns:1fr 1fr;gap:2mm 4mm;font-size:10pt}#panel-label-sheet dt{color:#333}#panel-label-sheet dd{margin:0;font-weight:600;overflow-wrap:anywhere}.preflight-dialog{display:none!important}}
@media print{body.printing-panel-label>#print-sheet{display:none!important}}
.project-tools{border-top:1px solid var(--line);padding-top:14px;margin-top:18px}.project-tools .button-row{margin:0;flex-wrap:wrap}.project-tools button{font-size:12px}#import-review{border:1px solid var(--line-strong);border-radius:10px;padding:14px;margin:14px 0}#import-review p{font-size:13px;line-height:1.5}#import-review button{margin-right:10px}#project-print-sheet{display:none}@media print{body.printing-project>*{display:none!important}body.printing-project>#print-sheet,body.printing-project>#panel-label-sheet{display:none!important}body.printing-project>#project-print-sheet{display:block!important;background:#fff;color:#111;font:11pt/1.5 system-ui,sans-serif}.project-print-panel{break-before:page}.project-print-panel:first-child{break-before:auto}.project-print-panel h1{font-size:22pt;color:#111}.project-print-panel h2{font-size:17pt;color:#111}.project-print-panel h3{font-size:12pt;color:#111}.project-print-panel dl{display:grid;grid-template-columns:1fr 2fr;gap:2mm 5mm}.project-print-panel dd{margin:0}.project-print-panel p,.project-print-panel dd,.project-print-panel h1,.project-print-panel h2{overflow-wrap:anywhere}.project-print-notes{white-space:pre-wrap}.project-print-panel footer{margin-top:8mm;color:#444;font-size:9pt}}

/* Professional maritime/industrial visual theme. */
:root {
  --page: #07111d;
  --shell: #0b1726;
  --panel: #0e1e30;
  --panel-soft: #13273a;
  --line: #233a50;
  --line-strong: #35566f;
  --text: #f1f7fb;
  --muted: #91a9bb;
  --muted-strong: #c8d6e1;
  --teal: #35d0bf;
  --teal-soft: rgba(53, 208, 191, 0.12);
  --blue: #3f8cff;
  --blue-bright: #69a8ff;
  --danger: #ff6b72;
  --danger-bg: rgba(255, 107, 114, 0.12);
  --shadow: 0 24px 70px rgba(0, 7, 15, 0.38);
  --radius: 16px;
}

html { color-scheme: dark; }
body {
  color: var(--text);
  background:
    radial-gradient(circle at 82% -8%, rgba(48, 130, 190, 0.18), transparent 31rem),
    radial-gradient(circle at 5% 18%, rgba(25, 178, 165, 0.08), transparent 27rem),
    linear-gradient(180deg, #07111d 0%, #081521 48%, #07111d 100%);
}

.splash {
  background:
    radial-gradient(circle at 50% 42%, rgba(43, 200, 190, 0.16), transparent 21rem),
    linear-gradient(180deg, #06101b, #0a1928);
}
.splash-ring,
.primary-button { background: linear-gradient(120deg, #2d77e5, #35cdbc); }
.primary-button {
  color: #fff;
  border: 1px solid rgba(121, 226, 215, 0.28);
  box-shadow: 0 9px 25px rgba(28, 127, 185, 0.24);
  font-weight: 750;
}
.primary-button:hover { filter: brightness(1.08); transform: translateY(-1px); }
.secondary-button {
  color: #e8f3f8;
  background: #14283a;
  border-color: #315169;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}
.secondary-button:hover { background: #193247; border-color: #4a7896; transform: translateY(-1px); }
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible { outline: 3px solid rgba(53, 208, 191, 0.32); outline-offset: 2px; }

.concept-banner {
  border-color: #20384b;
  color: #8ea8ba;
  text-transform: uppercase;
  letter-spacing: .09em;
}
.concept-banner b { color: #6fe0d3; font-weight: 700; }
.app-header { border-color: #20384b; }
.brand-mark {
  border: 1px solid rgba(117, 181, 216, 0.26);
  box-shadow: 0 10px 30px rgba(0, 7, 14, 0.32);
}
.brand-copy h1 { color: #f7fbfe; }
.subtitle { color: #91a9bb; }
.language-switch {
  padding: 4px;
  border: 1px solid #2b475e;
  border-radius: 10px;
  background: rgba(10, 25, 39, 0.72);
}
.language-button { border-radius: 7px; }
.language-button.is-active { color: #062620; background: #65dccc; }
.design-intro h2 { color: #f5f9fc; }
.design-intro a { color: #6fe0d3; border-color: #387b75; }

.setup-card,
.panel,
.panel-figure,
.help-card,
.safety-card {
  border-color: #233d53;
  background: linear-gradient(155deg, rgba(18, 39, 58, 0.98), rgba(12, 29, 46, 0.98));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035), 0 16px 44px rgba(0, 8, 17, 0.16);
}
.setup-heading,
.panel h2,
.shape-heading h3 { color: #f4f9fc; }
.step-number {
  color: #62dfd1;
  border-color: #36756f;
  background: rgba(44, 202, 187, 0.08);
}
.input-label,
.saved-panel-controls label,
.project-fields label,
.material-fields label,
.direction-control>label { color: #a8bdcb; font-weight: 650; }
.input-card input,
.saved-panel-controls input,
.project-fields input,
.project-fields textarea,
.project-filter select,
.material-fields input,
.direction-control select {
  color: #f5f9fc;
  background: #091826;
  border-color: #315169;
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.18);
}
.input-card input:hover,
.saved-panel-controls input:hover,
.project-fields input:hover,
.project-fields textarea:hover,
.project-filter select:hover,
.material-fields input:hover,
.direction-control select:hover { border-color: #46718d; }
.input-card input:focus,
.saved-panel-controls input:focus,
.project-fields input:focus,
.project-fields textarea:focus,
.project-filter select:focus,
.material-fields input:focus,
.direction-control select:focus {
  border-color: #45d3c3;
  box-shadow: 0 0 0 3px rgba(53, 208, 191, 0.13), inset 0 1px 4px rgba(0, 0, 0, 0.16);
}

.calculation-rule {
  color: #b8cbd7;
  border-left-color: #39cbbb;
  background: rgba(8, 23, 36, 0.86);
}
.panel-figure {
  border-color: #294b61;
  background:
    radial-gradient(ellipse at center, rgba(31, 124, 143, 0.18), transparent 67%),
    linear-gradient(160deg, #10283a, #0b1d2e);
}
.shape-heading>span {
  color: #76dfd4;
  background: rgba(53, 208, 191, 0.09);
  border: 1px solid rgba(88, 211, 199, 0.18);
  border-radius: 999px;
  padding: 4px 9px;
}
.shape-widths span { color: #8fa8ba; }
.shape-widths strong { color: #f7fbfd; }

.plan-mode-option { border-color: #29475d; background: rgba(9, 25, 39, 0.62); }
.plan-mode-option:has(input:checked),
#preflight-checks label:has(input:checked) {
  border-color: #3e8e8a;
  background: rgba(53, 208, 191, 0.10);
}
input[type="radio"],
input[type="checkbox"] { accent-color: #35d0bf; }
.distribution-plan>div {
  border-color: #27475d;
  background: rgba(8, 24, 38, 0.64);
}
.plan-count { color: #66ddd0; }
.mesh-summary-length dd,
#saved-panel-status,
.plan-status,
.sync-status { color: #67dfd2; }
.summary-grid>div,
.mesh-summary>div { border-color: #243e53; }
.summary-grid dt,
.mesh-summary dt { color: #8fa7b8; }

.lookup-table th {
  color: #9eb6c6;
  background: rgba(8, 22, 35, 0.72);
}
.lookup-table td { border-color: #223c51; }
.lookup-table tbody tr { transition: background .18s ease; }
.lookup-table tbody tr:hover { background: rgba(69, 147, 179, 0.08); }
.lookup-table tr.is-selected { background: rgba(53, 208, 191, 0.11); }
.lookup-table tr.is-selected td:first-child { box-shadow: inset 3px 0 #35d0bf; }
.mesh-choice { color: #edf7fb; }
.table-note,
.length-note { color: #91a9bb; }

.saved-panel-row { border-color: #253f53; }
.saved-panel-row:hover { background: rgba(54, 122, 151, 0.045); }
.panel-status-badge { color: #9ae5dc; border-color: #3d716f; background: rgba(53, 208, 191, 0.07); }
.material-fields,
.project-tools,
#import-review { border-color: #29485e; }
.help-card summary { color: #e9f4f8; }
.safety-card { color: #a9bfcc; background: rgba(12, 29, 43, 0.72); }
footer { color: #7f9aab; border-color: #1f3749; }

.dialog-shell,
.preflight-dialog,
.install-dialog-card {
  background: linear-gradient(165deg, #10263a, #0b1b2c);
  border-color: #31536a;
  box-shadow: 0 28px 100px rgba(0, 5, 12, 0.65);
}
.dialog-topbar,
.wake-controls { border-color: #29475d; }
.progress-track { background: #142c3e; }
.progress-fill { background: linear-gradient(90deg, #3d86f5, #35d0bf); }
.count-number { color: #f5fbfd; text-shadow: 0 0 34px rgba(54, 202, 190, 0.12); }
.action-callout { border-color: #31546b; background: rgba(10, 29, 44, 0.72); }

/* Phone layout */
@media (max-width: 640px) {
  html, body { min-width: 0; width: 100%; overflow-x: hidden; }
  body { padding: 0 10px 18px; }
  .app-shell { width: 100%; min-width: 0; }
  .app-header { grid-template-columns: 50px minmax(0, 1fr); gap: 12px; }
  .brand-mark { width: 50px; height: 50px; }
  .brand-copy h1 { font-size: 23px; }
  .brand-copy .subtitle { font-size: 12px; }
  .header-actions { grid-column: 1 / -1; width: 100%; justify-content: space-between; gap: 10px; }
  .language-switch { flex-shrink: 0; }
  .install-button { min-width: 0; max-width: 100%; }
  .design-intro { margin: 22px 2px 16px; }
  .design-intro h2 { font-size: 22px; }
  .studio-grid, .dashboard-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .setup-card, .panel, .panel-figure { min-width: 0; padding: 16px; border-radius: 14px; }
  .input-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .input-card, .input-card:last-child { grid-column: auto; min-width: 0; }
  .input-card input { height: 58px; font-size: 24px; }
  .button-row, .saved-panel-controls, .project-tools .button-row { display: grid; grid-template-columns: minmax(0, 1fr); width: 100%; }
  .button-row > *, .saved-panel-controls > *, .project-tools .button-row > * { width: 100%; min-width: 0; }
  .saved-panel-controls label { min-width: 0; }
  .project-fields, .material-fields { grid-template-columns: minmax(0, 1fr); }
  .project-filter { display: grid; grid-template-columns: minmax(0, 1fr); align-items: stretch; }
  .project-filter select { max-width: none; }
  .saved-panel-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: stretch; }
  .saved-panel-row > div { grid-column: 1 / -1; min-width: 0; }
  .saved-panel-row button { width: 100%; min-width: 0; padding-inline: 8px; }
  .panel-status-badge { display: table; margin: 7px 0 0; }
  .summary-grid { grid-template-columns: minmax(0, 1fr); }
  .mesh-summary { grid-template-columns: minmax(0, 1fr); }
  .shape-widths { gap: 8px; }
  .shape-widths strong { font-size: 17px; overflow-wrap: anywhere; }
  .result-actions { display: grid; grid-template-columns: minmax(0, 1fr); }
  .result-actions button { width: 100%; }
  .table-wrap { margin-inline: -16px; padding-inline: 16px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .lookup-table { min-width: 520px; }
  .length-calculator-grid, .length-results { grid-template-columns: minmax(0, 1fr); }
  dialog { max-width: 100%; }
  .dialog-shell { width: 100%; max-width: none; min-height: 100dvh; border-radius: 0; overflow-x: hidden; }
  .dialog-topbar { grid-template-columns: auto minmax(0, 1fr); gap: 8px; padding: 12px; }
  .dialog-topbar > .small-text-button { grid-column: 1 / -1; width: 100%; }
  .dialog-topbar p { text-align: right; overflow-wrap: anywhere; }
  .wake-controls { padding: 10px 12px; }
  .wake-controls label { align-items: flex-start; text-align: left; }
  .count-display { padding-inline: 8px; }
  .count-number { font-size: clamp(72px, 28vw, 130px); }
  .large-work-text .count-number { font-size: clamp(88px, 34vw, 150px); }
  .large-work-text .action-callout { font-size: 19px; }
  .counter-active { padding: 18px 14px max(20px, env(safe-area-inset-bottom)); }
  .preflight-inner { padding: 20px 16px; }
  #preflight-checks label { align-items: flex-start; }
  #import-review .primary-button, #import-review .secondary-button { width: 100%; margin: 6px 0 0; }
}

@media (max-width: 380px) {
  .saved-panel-row { grid-template-columns: minmax(0, 1fr); }
  .saved-panel-row > div { grid-column: auto; }
  .shape-widths { grid-template-columns: minmax(0, 1fr); }
  .shape-widths > div:last-child { text-align: left; }
}

/* Main navigation and integrated nylon netting reference */
.app-tabs {
  display: flex;
  gap: 6px;
  margin: -4px 0 22px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(5, 15, 26, 0.58);
}

.app-tab {
  flex: 1;
  min-height: 43px;
  padding: 9px 14px;
  color: var(--muted-strong);
  font-weight: 760;
  border: 0;
  border-radius: 9px;
  cursor: pointer;
  background: transparent;
}

.app-tab:hover { color: var(--text); background: rgba(46, 117, 151, 0.10); }
.app-tab.is-active { color: #052b28; background: linear-gradient(135deg, #6ae0d2, #35c7bc); box-shadow: 0 8px 22px rgba(23, 184, 173, 0.16); }

.app-shell.notlin-active > :not(.app-header, .app-tabs, #notlin-view, footer) { display: none !important; }
.notlin-view { display: grid; gap: 18px; }
.notlin-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 22px; padding: 6px 2px 2px; }
.notlin-hero h2 { margin-bottom: 7px; font-size: clamp(1.65rem, 4vw, 2.15rem); letter-spacing: -0.035em; }
.notlin-muted { margin: 0; color: var(--muted); line-height: 1.5; }
.notlin-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.notlin-source-link { text-decoration: none; }

.notlin-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.notlin-stats > div { padding: 17px 18px; border: 1px solid #263f55; border-radius: 13px; background: linear-gradient(155deg, rgba(17, 39, 58, 0.98), rgba(10, 26, 42, 0.98)); }
.notlin-stats span { display: block; margin-bottom: 8px; color: var(--muted); font-size: 0.78rem; }
.notlin-stats strong { font-size: 1.55rem; letter-spacing: -0.03em; }
.notlin-stats strong small { font-size: 0.78rem; }
.notlin-stats > div > small { margin-left: 7px; color: var(--muted); }

.notlin-layout { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 16px; align-items: start; }
.notlin-table-panel { padding: 0; overflow: hidden; }
.notlin-panel-head { display: flex; justify-content: space-between; gap: 12px; padding: 20px 20px 14px; }
.notlin-panel-head h3 { margin-bottom: 4px; }
.notlin-panel-head p { margin: 0; color: var(--muted); font-size: 0.8rem; }
.notlin-filters { display: grid; grid-template-columns: minmax(180px, 1fr) 190px; gap: 12px; padding: 0 20px 15px; }
.notlin-filters label { display: grid; gap: 7px; color: var(--muted-strong); font-size: 0.76rem; font-weight: 700; }
.notlin-filters input,
.notlin-filters select { width: 100%; min-height: 44px; padding: 10px 11px; color: var(--text); border: 1px solid #315169; border-radius: 9px; outline: 0; background: #091826; }
.notlin-filters input:focus,
.notlin-filters select:focus { border-color: #45d3c3; box-shadow: 0 0 0 3px rgba(53, 208, 191, 0.13); }
.notlin-result-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 20px 12px; color: var(--muted); font-size: 0.76rem; }
.notlin-result-line .secondary-button { min-height: 32px; padding: 5px 9px; font-size: 0.75rem; }
.notlin-table-wrap,
.notlin-requirements-wrap { overflow: auto; -webkit-overflow-scrolling: touch; }
.notlin-table-wrap { max-height: 650px; }
.notlin-table,
.notlin-requirements,
.notlin-detail table { width: 100%; border-collapse: collapse; white-space: nowrap; font-size: 0.78rem; }
.notlin-table th,
.notlin-table td,
.notlin-requirements th,
.notlin-requirements td,
.notlin-detail th,
.notlin-detail td { padding: 11px 10px; text-align: left; border-bottom: 1px solid #223c51; font-variant-numeric: tabular-nums; }
.notlin-table th,
.notlin-requirements th,
.notlin-detail th { color: #9eb6c6; font-size: 0.69rem; text-transform: uppercase; letter-spacing: 0.04em; background: #0d2133; }
.notlin-table th { position: sticky; top: 0; z-index: 1; }
.notlin-table th:first-child,
.notlin-table td:first-child { padding-left: 20px; }
.notlin-table tbody tr { cursor: pointer; }
.notlin-table tbody tr:hover { background: rgba(69, 147, 179, 0.09); }
.notlin-table tbody tr.is-selected,
.notlin-requirements tr.is-selected { background: rgba(53, 208, 191, 0.12); }
.notlin-table tbody tr.is-selected td:first-child { box-shadow: inset 3px 0 #35d0bf; }
.notlin-table tbody tr:focus-visible { outline: 2px solid #45d3c3; outline-offset: -2px; }
.notlin-empty { padding: 22px; color: var(--muted); text-align: center; }

.notlin-side { display: grid; gap: 16px; }
.notlin-detail-panel { padding: 20px; }
.notlin-detail-panel > h3 { margin-bottom: 15px; }
.notlin-detail-empty { padding: 18px 2px; color: var(--muted); line-height: 1.55; text-align: center; }
.notlin-detail h4 { margin: 17px 0 7px; font-size: 0.95rem; }
.notlin-detail h4:first-child { margin-top: 0; font-size: 1.2rem; }
.notlin-detail > p { color: var(--muted); font-size: 0.78rem; }
.notlin-detail dl { display: grid; grid-template-columns: 1fr 1fr; gap: 13px 10px; margin: 16px 0 20px; }
.notlin-detail dt { margin-bottom: 3px; color: var(--muted); font-size: 0.69rem; }
.notlin-detail dd { margin: 0; font-weight: 750; }
.notlin-warning { padding: 17px 18px; color: #aec3d0; border: 1px solid #29485e; border-radius: 13px; background: rgba(9, 25, 39, 0.68); font-size: 0.78rem; line-height: 1.55; }
.notlin-warning strong { color: var(--text); }
.notlin-warning p { margin: 7px 0 0; }
.notlin-requirements-panel { padding: 0; overflow: hidden; }
.notlin-requirements th:first-child,
.notlin-requirements td:first-child { padding-left: 20px; }
.notlin-source-note { margin: 0; color: #829bae; font-size: 0.73rem; line-height: 1.6; }

@media (max-width: 840px) {
  .notlin-layout { grid-template-columns: minmax(0, 1fr); }
  .notlin-side { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

@media (max-width: 640px) {
  .app-tabs { margin-bottom: 18px; }
  .app-tab { min-height: 46px; padding-inline: 8px; }
  .notlin-hero { align-items: stretch; flex-direction: column; }
  .notlin-actions { display: grid; grid-template-columns: minmax(0, 1fr); }
  .notlin-actions > * { width: 100%; }
  .notlin-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .notlin-stats > div { padding: 14px; }
  .notlin-stats > div:last-child { grid-column: 1 / -1; }
  .notlin-filters { grid-template-columns: minmax(0, 1fr); padding-inline: 15px; }
  .notlin-panel-head,
  .notlin-result-line { padding-inline: 15px; }
  .notlin-table { min-width: 750px; }
  .notlin-table th:first-child,
  .notlin-table td:first-child { padding-left: 15px; }
  .notlin-side { grid-template-columns: minmax(0, 1fr); }
  .notlin-detail dl { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
.notlin-table tr.thread-start td { border-top: 12px solid #091827; }
.notlin-table td:first-child { color: #78e2d7; font-weight: 800; }

/* Integrated material database and breaking-strength control */
.material-module { min-width: 0; }
.material-subtabs {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 7px;
  padding: 6px;
  border: 1px solid #29465b;
  border-radius: 14px;
  background: rgba(7, 20, 33, 0.78);
}
.material-subtabs button {
  min-width: 0;
  min-height: 42px;
  padding: 9px 10px;
  color: #9fb6c6;
  font: inherit;
  font-size: 0.79rem;
  font-weight: 780;
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
  background: transparent;
  transition: color .18s ease, border-color .18s ease, background .18s ease;
}
.material-subtabs button:hover { color: #effbfc; background: rgba(66, 141, 170, .1); }
.material-subtabs button.is-active {
  color: #052c29;
  border-color: rgba(105, 234, 219, .34);
  background: linear-gradient(135deg, #70e2d5, #37c9bd);
  box-shadow: 0 8px 20px rgba(32, 194, 181, .13);
}
.material-panel { display: grid; gap: 16px; min-width: 0; }
.material-panel[hidden] { display: none !important; }
.material-stat-source { font-size: 1.03rem !important; overflow-wrap: anywhere; }
.material-use-button { width: 100%; margin-top: 15px; }
.material-use-button[disabled] { opacity: .48; cursor: not-allowed; }
.material-table-message { padding: 36px 20px !important; color: var(--muted); text-align: center !important; white-space: normal; }

.strength-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2.5fr);
  gap: 16px;
  align-items: start;
}
.strength-grid .notlin-requirements thead th { white-space: normal; }
.strength-boundary-note {
  margin: 14px 20px 18px;
  padding-left: 12px;
  color: #a8bbc7;
  border-left: 3px solid #bf8e3a;
  font-size: .78rem;
  line-height: 1.5;
}

@media (max-width: 1000px) {
  .strength-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 900px) {
  .material-subtabs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .material-subtabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .material-subtabs button { min-height: 46px; padding-inline: 7px; }
  .strength-grid .notlin-requirements :is(th, td) { padding-inline: 8px; }
  .strength-boundary-note { margin-inline: 15px; }
}
