/* ---------------------------------------------------------------------------
   Design tokens — aligned with NeverDry brand
--------------------------------------------------------------------------- */
:root {
  --accent:       #1f6aa5;
  --accent-2:     #2980b9;
  --accent-light: #d6e8f5;
  --bg:           #f8fafb;
  --card-bg:      #ffffff;
  --text:         #2c3e50;
  --muted:        #6b7280;
  --border:       #e2e8f0;
  --green:        #27ae60;
  --orange:       #f39c12;
  --red:          #e74c3c;
  --green-bg:     #f0fdf4;
  --orange-bg:    #fffbeb;
  --red-bg:       #fef2f2;
  --radius-sm:    6px;
  --radius:       12px;
  --shadow:       0 2px 8px rgba(0,0,0,.06);
  --shadow-md:    0 4px 16px rgba(0,0,0,.10);
  --font:         -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ---------------------------------------------------------------------------
   Reset & base
--------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  font-size:   15px;
  line-height: 1.6;
  background:  var(--bg);
  color:       var(--text);
  padding-bottom: 60px;
}

/* ---------------------------------------------------------------------------
   Hero
--------------------------------------------------------------------------- */
.hero {
  background:  linear-gradient(135deg, var(--accent), var(--accent-2));
  color:       white;
  padding:     12px 20px 40px;
  text-align:  center;
}

.lang-bar {
  text-align:    right;
  margin-bottom: 28px;
}

.lang-bar a {
  color:           rgba(255,255,255,.75);
  text-decoration: none;
  font-size:       .78em;
  font-weight:     500;
  letter-spacing:  .04em;
  margin-left:     6px;
  padding:         2px 7px;
  border-radius:   4px;
  transition:      background .15s;
}

.lang-bar a:hover  { background: rgba(255,255,255,.15); color: white; }
.lang-bar a.active { background: rgba(255,255,255,.22); color: white; font-weight: 700; }

.hero-brand {
  display:     flex;
  align-items: center;
  justify-content: center;
  gap:         .6em;
  margin-bottom: .2em;
}

.hero-logo {
  width:       48px;
  height:      48px;
  flex-shrink: 0;
  object-fit:  contain;
}

.hero h1 {
  font-size:     2.2em;
  font-weight:   700;
  margin-bottom: 0;
  letter-spacing: -.01em;
}

.hero .tagline {
  font-size:   1.05em;
  opacity:     .85;
  margin-bottom: 1.5em;
}

.hero-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; align-items: center; }

.unit-toggle {
  display:       flex;
  border-radius: var(--radius-sm);
  overflow:      hidden;
  border:        1.5px solid rgba(255,255,255,.4);
  align-self:    center;
}

.unit-btn {
  background:  transparent;
  border:      none;
  color:       rgba(255,255,255,.75);
  padding:     6px 14px;
  font-size:   .88em;
  font-weight: 600;
  cursor:      pointer;
  font-family: var(--font);
  transition:  background .15s, color .15s;
  line-height: 1;
}

.unit-toggle .unit-btn + .unit-btn { border-left: 1px solid rgba(255,255,255,.3); }
.unit-btn:hover  { background: rgba(255,255,255,.12); color: white; }
.unit-btn.active { background: rgba(255,255,255,.22); color: white; }

.unit-suffix { font-weight: 400; opacity: .7; font-size: .85em; }

.cta {
  display:       inline-block;
  background:    white;
  color:         var(--accent);
  padding:       10px 26px;
  border-radius: var(--radius-sm);
  border:        none;
  font-family:   var(--font);
  font-size:     .95em;
  font-weight:   600;
  cursor:        pointer;
  text-decoration: none;
  transition:    transform .2s, box-shadow .2s;
}
.cta:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,.15); }

.cta.secondary {
  background: rgba(255,255,255,.15);
  color:      white;
  border:     2px solid rgba(255,255,255,.5);
}
.cta.secondary:hover { background: rgba(255,255,255,.25); }

/* ---------------------------------------------------------------------------
   How-to steps strip
--------------------------------------------------------------------------- */
.how-to-steps {
  display:         flex;
  gap:             0;
  list-style:      none;
  margin:          24px 0 0;
  border-radius:   var(--radius);
  overflow:        hidden;
  box-shadow:      var(--shadow);
}

.how-to-steps li {
  flex:            1;
  display:         flex;
  align-items:     center;
  gap:             10px;
  background:      var(--card-bg);
  padding:         12px 14px;
  font-size:       .85em;
  line-height:     1.3;
  border-right:    1px solid var(--border);
  color:           var(--text);
}

.how-to-steps li:last-child { border-right: none; }

.step-n {
  flex-shrink:     0;
  width:           24px;
  height:          24px;
  border-radius:   50%;
  background:      var(--accent);
  color:           white;
  font-size:       .75em;
  font-weight:     700;
  display:         flex;
  align-items:     center;
  justify-content: center;
}

@media (max-width: 600px) {
  .how-to-steps {
    flex-direction: column;
    margin-bottom:  0;
  }
  .how-to-steps li { border-right: none; border-bottom: 1px solid var(--border); }
  .how-to-steps li:last-child { border-bottom: none; }
}

/* ---------------------------------------------------------------------------
   Layout
--------------------------------------------------------------------------- */
.container {
  max-width: 960px;
  margin:    0 auto;
  padding:   0 20px;
}

section {
  background:    var(--card-bg);
  border-radius: var(--radius);
  box-shadow:    var(--shadow);
  margin-top:    20px;
  padding:       24px 28px;
}

h2 {
  font-size:   1em;
  font-weight: 600;
  color:       var(--accent);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 16px;
}

/* ---------------------------------------------------------------------------
   Inputs & selects
--------------------------------------------------------------------------- */
input[type="text"],
input[type="number"],
select {
  font-family:   var(--font);
  font-size:     .9rem;
  padding:       7px 11px;
  border:        1px solid var(--border);
  border-radius: var(--radius-sm);
  background:    var(--card-bg);
  color:         var(--text);
  width:         100%;
  transition:    border-color .15s, box-shadow .15s;
}
input:focus, select:focus {
  outline:    none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

/* ---------------------------------------------------------------------------
   Line metadata
--------------------------------------------------------------------------- */
.line-meta {
  display:   flex;
  flex-wrap: wrap;
  gap:       18px;
  align-items: flex-end;
}

.field-group {
  display:        flex;
  flex-direction: column;
  gap:            5px;
  flex:           1 1 200px;
}

.field-group label {
  font-size:   .78rem;
  font-weight: 600;
  color:       var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* ---------------------------------------------------------------------------
   Nodes table
--------------------------------------------------------------------------- */
.nodes-section table {
  width:           100%;
  border-collapse: collapse;
  border-radius:   var(--radius-sm);
  overflow:        hidden;
  box-shadow:      var(--shadow);
}

.nodes-section th {
  background:    var(--accent);
  color:         white;
  padding:       10px 12px;
  text-align:    left;
  font-size:     .78rem;
  font-weight:   600;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.nodes-section td {
  padding:        8px 10px;
  border-bottom:  1px solid #eee;
  vertical-align: middle;
  background:     var(--card-bg);
}

.nodes-section tbody tr:nth-child(even) td { background: #f9f9f9; }
.nodes-section tbody tr:last-child td { border-bottom: none; }

.nodes-section input,
.nodes-section select { font-size: .875rem; padding: 5px 8px; }

.col-num  { width: 38px;  text-align: center; color: var(--muted); }
.col-plant { min-width: 200px; }
.col-count { width: 90px; }
.col-diam  { width: 130px; }
.col-del   { width: 44px; text-align: center; }

/* Combobox */
.combobox { position: relative; }
.combo-input { width: 100%; }

.combo-list {
  position:      absolute;
  z-index:       9999;
  background:    var(--card-bg);
  border:        1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow:    var(--shadow-md);
  list-style:    none;
  max-height:    260px;
  overflow-y:    auto;
  padding:       4px 0;
  margin:        0;
}

.combo-list li {
  padding:    6px 12px;
  cursor:     pointer;
  display:    flex;
  flex-direction: column;
  gap:        1px;
}
.combo-list li:hover,
.combo-list li.active { background: var(--accent-light); }
.combo-list li:hover .combo-sci,
.combo-list li.active .combo-sci { color: var(--accent); }

.combo-sci {
  font-size:   .875rem;
  font-style:  italic;
  white-space: nowrap;
  overflow:    hidden;
  text-overflow: ellipsis;
}
.combo-common {
  font-size:  .75rem;
  color:      var(--muted);
  white-space: nowrap;
  overflow:   hidden;
  text-overflow: ellipsis;
}

.nodes-footer {
  display:     flex;
  align-items: center;
  gap:         18px;
  margin-top:  14px;
  flex-wrap:   wrap;
}

/* ---------------------------------------------------------------------------
   Buttons (non-hero)
--------------------------------------------------------------------------- */
button {
  font-family: var(--font);
  cursor:      pointer;
}

.btn-add {
  display:       inline-flex;
  align-items:   center;
  gap:           6px;
  padding:       7px 16px;
  font-size:     .875rem;
  font-weight:   600;
  border-radius: var(--radius-sm);
  border:        2px solid var(--accent);
  background:    transparent;
  color:         var(--accent);
  transition:    background .15s, color .15s;
}
.btn-add:hover { background: var(--accent); color: white; }

.btn-del {
  padding:    3px 9px;
  font-size:  1.1rem;
  color:      var(--red);
  border:     1px solid transparent;
  background: transparent;
  border-radius: var(--radius-sm);
}
.btn-del:hover { background: var(--red-bg); border-color: #fca5a5; }

.missing-plant-hint {
  font-size: .82rem;
  color:     var(--muted);
}
.missing-plant-hint a {
  color:           var(--accent);
  text-decoration: none;
  font-weight:     500;
}
.missing-plant-hint a:hover { text-decoration: underline; }

/* ---------------------------------------------------------------------------
   Summary cards
--------------------------------------------------------------------------- */
.summary-cards {
  display:        flex;
  flex-wrap:      wrap;
  gap:            12px;
  margin-bottom:  20px;
}

.card {
  flex:           1 1 140px;
  background:     var(--bg);
  border-radius:  var(--radius-sm);
  border:         1px solid var(--border);
  padding:        12px 16px;
  display:        flex;
  flex-direction: column;
  gap:            4px;
}
.card.wide { flex-basis: 100%; }

.card .label {
  font-size:      .7rem;
  font-weight:    600;
  color:          var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.card .value { font-size: .95rem; }

.status.ok   { color: var(--green);  font-weight: 700; }
.status.warn { color: var(--orange); font-weight: 700; }
.status.crit { color: var(--red);    font-weight: 700; }

/* ---------------------------------------------------------------------------
   Result table
--------------------------------------------------------------------------- */
.result-table {
  width:           100%;
  border-collapse: collapse;
  border-radius:   var(--radius-sm);
  overflow:        hidden;
  box-shadow:      var(--shadow);
  font-size:       .875rem;
  margin-top:      6px;
}

.result-table th {
  background:     var(--accent);
  color:          white;
  padding:        10px 12px;
  text-align:     left;
  font-size:      .72rem;
  font-weight:    600;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.result-table td {
  padding:        8px 12px;
  border-bottom:  1px solid #eee;
  background:     var(--card-bg);
}

.result-table tbody tr:nth-child(even) td { background: #f9f9f9; }
.result-table tbody tr:last-child td { border-bottom: none; }

.num    { text-align: right; font-variant-numeric: tabular-nums; }
.compat { text-align: center; font-weight: 700; }

.ok   { color: var(--green); }
.warn { color: var(--orange); }
.crit { color: var(--red); }

.tfoot-total td {
  border-top: 2px solid var(--border);
  padding: 9px 12px;
}
.tfoot-label {
  font-size: .78rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.tfoot-val {
  font-weight: 700;
  font-size: .95rem;
}
.tfoot-total .ok   { background: var(--green-bg);  color: var(--green); }
.tfoot-total .crit { background: var(--red-bg);    color: var(--red); }

/* ---------------------------------------------------------------------------
   Notes
--------------------------------------------------------------------------- */
.notes {
  list-style:     none;
  margin-top:     16px;
  display:        flex;
  flex-direction: column;
  gap:            6px;
}
.notes li {
  font-size:     .85rem;
  color:         var(--muted);
  padding:       8px 12px;
  border-radius: var(--radius-sm);
  background:    var(--accent-light);
  border-left:   3px solid var(--accent);
}

/* ---------------------------------------------------------------------------
   Advanced settings
--------------------------------------------------------------------------- */
.cfg-section { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }

#cfg-toggle {
  background:     transparent;
  border:         none;
  color:          var(--muted);
  font-size:      .78rem;
  font-weight:    600;
  padding:        0;
  text-transform: uppercase;
  letter-spacing: .05em;
  cursor:         pointer;
}
#cfg-toggle:hover { color: var(--accent); }

.cfg-grid {
  display:               grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap:                   14px;
  margin-top:            14px;
}

.cfg-field { display: flex; flex-direction: column; gap: 5px; }
.cfg-field label {
  font-size:      .78rem;
  font-weight:    500;
  color:          var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* ---------------------------------------------------------------------------
   Utility
--------------------------------------------------------------------------- */
.hint     { color: var(--muted); font-size: .9rem; padding: 8px 0; }
.muted    { color: var(--muted); }
.error-msg { color: var(--red); font-size: .9rem; }

.fatal-error {
  max-width:     480px;
  margin:        80px auto;
  padding:       32px;
  background:    var(--card-bg);
  border-radius: var(--radius);
  box-shadow:    var(--shadow-md);
  text-align:    center;
}
.fatal-error h2 { color: var(--red); margin-bottom: 10px; }

/* ---------------------------------------------------------------------------
   HA CTA banner
--------------------------------------------------------------------------- */
.ha-cta {
  background:  linear-gradient(135deg, #0d6eaa 0%, #1a8a5c 100%);
  color:       white;
  padding:     36px 20px;
  margin-top:  40px;
}
.ha-cta-inner {
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  gap:             24px;
  flex-wrap:       wrap;
  max-width:       760px;
  margin:          0 auto;
}
.ha-cta-eyebrow {
  font-size:     .75rem;
  font-weight:   700;
  text-transform: uppercase;
  letter-spacing: .1em;
  opacity:       .75;
  margin-bottom: .35em;
}
.ha-cta-body {
  font-size:   1.02rem;
  line-height: 1.5;
  opacity:     .93;
}
.ha-cta-actions {
  display:     flex;
  align-items: center;
  gap:         14px;
  flex-shrink: 0;
  flex-wrap:   wrap;
}
.ha-cta .cta {
  white-space: nowrap;
  background:  white;
  color:       #0d6eaa;
  padding:     10px 22px;
  font-size:   .9rem;
}
.ha-cta .cta:hover { box-shadow: 0 4px 16px rgba(0,0,0,.25); }
.ha-cta-actions img { display: block; }

@media (max-width: 600px) {
  .ha-cta-inner   { flex-direction: column; text-align: center; }
  .ha-cta-actions { justify-content: center; }
  .ha-cta .cta    { width: 100%; text-align: center; }
}

/* ---------------------------------------------------------------------------
   Footer / credits
--------------------------------------------------------------------------- */
.credits {
  margin-top:  40px;
  padding:     20px 0;
  border-top:  1px solid var(--border);
  text-align:  center;
}
.credits p {
  font-size: .78rem;
  color:     var(--muted);
  line-height: 1.6;
}
.credits a { color: var(--accent); text-decoration: none; }
.credits a:hover { text-decoration: underline; }

/* ---------------------------------------------------------------------------
   Responsive
--------------------------------------------------------------------------- */
@media (max-width: 600px) {
  .hero { padding: 36px 16px 28px; }
  .hero h1 { font-size: 1.7em; }
  section { padding: 16px; }
  .col-diam { display: none; }
}
