/* ═══════════════════════════════════════════
   SOLAR PAL — DEC Group Inc.
   © 2025 DEC Group Inc. All rights reserved.
   Free for personal use · decgroup.pro
════════════════════════════════════════════ */

:root {
  /* DEC Group brand palette */
  --dec-red:      #D42B2B;
  --dec-red-dark: #A81E1E;
  --dec-red-bg:   #fdf0f0;
  --dec-dark:     #1a1a1a;
  --dec-mid:      #2c2c2c;

  /* Surfaces */
  --surface:    #ffffff;
  --surface-2:  #f5f6f8;
  --border:     #e4e7ec;
  --border-2:   #cdd2da;

  /* Text */
  --text:       #111318;
  --text-sec:   #4a5260;
  --text-hint:  #8c96a4;

  /* Semantic */
  --blue:       #1a6fc4;
  --blue-bg:    #e8f1fb;
  --red-loss:   #c0392b;
  --green:      #1e7e34;
  --green-bg:   #e8f5eb;

  /* Grays */
  --gray-100: #f1f3f6;
  --gray-200: #e4e7ec;
  --gray-300: #cdd2da;
  --gray-500: #8c96a4;
  --gray-700: #4a5260;
  --gray-900: #111318;

  /* Geometry */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 14px rgba(0,0,0,0.10);

  /* Layout */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
  --font:      -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'SF Mono', 'Roboto Mono', Menlo, Consolas, monospace;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { height: 100%; overscroll-behavior: none; }
body {
  margin: 0; font-family: var(--font);
  background: var(--dec-dark);
  color: var(--text); height: 100%; overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
input, select, button { font-family: var(--font); }
button { cursor: pointer; border: none; background: none; padding: 0; }
input, select { outline: none; }
.hidden { display: none !important; }

/* ═══════════════ SPLASH ════════════════ */
.splash {
  position: fixed; inset: 0;
  background: var(--dec-dark);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
}
.splash-inner { text-align: center; padding: 24px; }
.splash-dec-icon {
  width: 80px; height: 80px;
  border-radius: 20px;
  margin-bottom: 18px;
  display: block; margin-left: auto; margin-right: auto;
}
.splash-wordmark {
  font-size: 36px; font-weight: 800;
  color: #fff; letter-spacing: -1px;
  margin-bottom: 4px;
}
.splash-wordmark span { color: var(--dec-red); }
.splash-tagline {
  font-size: 13px; color: rgba(255,255,255,0.4);
  text-transform: uppercase; letter-spacing: 0.12em;
  margin-bottom: 32px;
}
.splash-loader {
  width: 100px; height: 3px;
  background: rgba(255,255,255,0.1);
  border-radius: 99px; overflow: hidden;
  margin: 0 auto 24px;
}
.splash-loader-bar {
  height: 100%; background: var(--dec-red);
  border-radius: 99px;
  animation: loadbar 1.4s ease forwards;
}
@keyframes loadbar { from { width:0 } to { width:100% } }
.splash-copy { font-size: 11px; color: rgba(255,255,255,0.25); }

/* ═══════════════ APP SHELL ═══════════════ */
.app {
  position: fixed; inset: 0;
  background: var(--surface-2);
  display: flex; flex-direction: column; overflow: hidden;
}
.status-area { height: var(--safe-top); background: var(--dec-dark); flex-shrink: 0; }

/* ── Header ── */
.app-header {
  height: 56px; background: var(--dec-dark);
  display: flex; align-items: center;
  padding: 0 12px; flex-shrink: 0; gap: 10px;
}
.header-back {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; color: rgba(255,255,255,0.7); flex-shrink: 0;
}
.header-back:active { background: rgba(255,255,255,0.1); }
.header-brand {
  flex: 1; display: flex; align-items: center; gap: 9px; min-width: 0;
}
.header-dec-icon {
  width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
}
.header-title-wrap { display: flex; flex-direction: column; min-width: 0; }
.header-app-name {
  font-size: 16px; font-weight: 800; color: #fff;
  letter-spacing: -0.3px; line-height: 1.1;
}
.header-screen-name {
  font-size: 11px; color: rgba(255,255,255,0.4);
  text-transform: uppercase; letter-spacing: 0.07em;
}
.header-action {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--dec-red); color: #fff; flex-shrink: 0;
}
.header-action:active { background: var(--dec-red-dark); transform: scale(0.94); }
.header-action.hidden-icon { background: transparent; pointer-events: none; }

/* ── Wizard Strip ── */
.wizard-strip {
  background: var(--dec-dark);
  padding: 0 20px 14px; flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.wizard-steps { display: flex; align-items: center; }
.wstep { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.wstep-circle {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.18);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; color: rgba(255,255,255,0.35);
  transition: all 0.22s;
}
.wstep-circle.active { border-color: var(--dec-red); color: var(--dec-red); }
.wstep-circle.done { background: var(--dec-red); border-color: var(--dec-red); color: #fff; }
.wstep-circle.done span { display: none; }
.wstep-circle.done::after {
  content: '';
  width: 10px; height: 6px;
  border-left: 2px solid #fff; border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translateY(-1px); display: block;
}
.wstep-label { font-size: 10px; color: rgba(255,255,255,0.35); font-weight: 500; }
.wstep-label.active { color: var(--dec-red); }
.wstep-label.done { color: rgba(255,255,255,0.55); }
.wstep-line {
  flex: 1; height: 2px; background: rgba(255,255,255,0.1);
  margin: 0 4px; margin-bottom: 14px; border-radius: 1px; transition: background 0.22s;
}
.wstep-line.active { background: var(--dec-red); }

/* ── Screens ── */
.screen-host { flex: 1; overflow: hidden; position: relative; }
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; }
.scroll-area {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 16px 16px 0;
}
.form-bottom-space { height: 24px; }

/* ── Bottom Nav ── */
.bottom-nav {
  flex-shrink: 0; padding: 12px 16px;
  padding-bottom: calc(12px + var(--safe-bot));
  background: var(--surface); border-top: 1px solid var(--border);
  display: flex; gap: 10px;
}
.bottom-nav .btn-primary.full,
.bottom-nav .btn-primary { flex: 1; }
.bottom-nav .btn-secondary { flex-shrink: 0; }

/* ── Tab Bar ── */
.tab-bar {
  flex-shrink: 0; background: var(--dec-dark);
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex; padding-bottom: var(--safe-bot);
}
.tab-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px; padding: 8px 4px;
  color: rgba(255,255,255,0.35); font-size: 10px; font-weight: 500;
  min-height: 56px; transition: color 0.15s;
}
.tab-item svg { stroke: rgba(255,255,255,0.35); transition: stroke 0.15s; }
.tab-item.active { color: var(--dec-red); }
.tab-item.active svg { stroke: var(--dec-red); }
.tab-item:active { opacity: 0.7; }
.safe-area-bottom { height: 0; flex-shrink: 0; }

/* ═════════ BUTTONS ═════════ */
.btn-primary {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 13px 20px;
  background: var(--dec-red); color: #fff;
  border-radius: var(--radius-lg);
  font-size: 15px; font-weight: 600; letter-spacing: -0.1px;
  transition: all 0.15s; white-space: nowrap;
}
.btn-primary:active { background: var(--dec-red-dark); transform: scale(0.97); }
.btn-primary.full { width: 100%; }
.btn-secondary {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 13px 16px;
  background: var(--surface); color: var(--text);
  border: 1.5px solid var(--border-2); border-radius: var(--radius-lg);
  font-size: 15px; font-weight: 500; transition: all 0.15s;
}
.btn-secondary:active { background: var(--gray-100); transform: scale(0.97); }
.btn-location {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 11px 14px;
  background: var(--blue-bg); color: var(--blue);
  border-radius: var(--radius-md); font-size: 14px; font-weight: 500;
  margin-top: 8px; border: 1px solid rgba(26,111,196,0.2);
  transition: all 0.15s;
}
.btn-location:active { background: #d0e5f7; }

/* ═════════ FORMS ═════════ */
.form-section { margin-bottom: 20px; }
.form-section-label {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--text-hint);
  margin-bottom: 8px; padding-left: 4px;
}
.form-card {
  background: var(--surface); border-radius: var(--radius-lg);
  border: 1px solid var(--border); overflow: hidden; box-shadow: var(--shadow-sm);
}
.form-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 16px; border-bottom: 1px solid var(--border);
  gap: 12px; min-height: 52px;
}
.form-row.last { border-bottom: none; }
.form-label { font-size: 15px; color: var(--text); flex-shrink: 0; }
.form-unit { font-size: 12px; color: var(--text-hint); margin-left: 3px; }
.form-input {
  flex: 1; text-align: right; font-size: 15px; color: var(--text);
  border: none; background: transparent; padding: 0; min-width: 0;
}
.form-input.num { font-family: var(--font-mono); font-size: 14px; }
.form-input::placeholder { color: var(--gray-300); }
.form-card .form-select {
  border: none; background: transparent; font-size: 14px; color: var(--text);
  text-align: right; padding: 0; -webkit-appearance: none; appearance: none;
}

/* ═════════ PROJECTS ═════════ */
.projects-list { display: flex; flex-direction: column; gap: 12px; }
.project-card {
  background: var(--surface); border-radius: var(--radius-lg);
  border: 1px solid var(--border); box-shadow: var(--shadow-sm); overflow: hidden;
}
.project-card:active { transform: scale(0.98); }
.project-card-body { padding: 16px; cursor: pointer; }
.project-name { font-size: 17px; font-weight: 700; color: var(--text); margin-bottom: 3px; }
.project-desc { font-size: 13px; color: var(--text-sec); margin-bottom: 10px; }
.project-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.project-badge {
  font-size: 11px; font-weight: 500; padding: 3px 9px;
  border-radius: 99px; background: var(--gray-100); color: var(--gray-700);
}
.project-badge.type-offgrid { background: var(--green-bg); color: var(--green); }
.project-badge.type-grid { background: var(--blue-bg); color: var(--blue); }
.project-badge.type-hybrid { background: #fff3e0; color: #b45309; }
.project-stats { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.project-stat {
  text-align: center; background: var(--surface-2);
  border-radius: var(--radius-sm); padding: 8px 4px;
}
.ps-num { font-size: 18px; font-weight: 700; color: var(--dec-dark); font-family: var(--font-mono); line-height: 1.1; }
.ps-label { font-size: 10px; color: var(--text-hint); margin-top: 2px; }
.project-card-footer { display: flex; border-top: 1px solid var(--border); }
.project-footer-btn {
  flex: 1; padding: 12px; font-size: 13px; font-weight: 500; color: var(--text-sec);
  display: flex; align-items: center; justify-content: center; gap: 5px;
  border-right: 1px solid var(--border); transition: background 0.1s;
}
.project-footer-btn:last-child { border-right: none; }
.project-footer-btn:active { background: var(--gray-100); }
.project-footer-btn.danger { color: var(--dec-red); }
.project-footer-btn.primary { color: var(--blue); }
.projects-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 60px 32px; text-align: center;
}
.empty-icon { color: var(--gray-300); margin-bottom: 16px; }
.empty-title { font-size: 20px; font-weight: 600; color: var(--text); margin: 0 0 6px; }
.empty-sub { font-size: 14px; color: var(--text-sec); margin: 0; line-height: 1.5; }

/* ═════════ LOADS TABLE ═════════ */
.loads-section {
  background: var(--surface); border-radius: var(--radius-lg);
  border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  overflow: hidden; margin-bottom: 12px;
}
.loads-header-row {
  display: grid; grid-template-columns: 1fr 60px 52px 56px 36px;
  padding: 9px 14px; background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.lh { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-hint); }
.lh-num { text-align: right; }
.loads-list { min-height: 4px; }
.load-item {
  display: grid; grid-template-columns: 1fr 60px 52px 56px 36px;
  padding: 11px 14px; border-bottom: 1px solid var(--border); align-items: center;
}
.load-item:last-child { border-bottom: none; }
.li-name-wrap { min-width: 0; }
.li-name { font-size: 13px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-desc { font-size: 11px; color: var(--text-hint); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-num { font-size: 12px; font-family: var(--font-mono); color: var(--text); text-align: right; }
.li-wh { font-size: 12px; font-family: var(--font-mono); color: var(--dec-red); font-weight: 600; text-align: right; }
.li-del {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%; color: var(--gray-500); margin-left: auto;
}
.li-del:active { background: var(--dec-red-bg); color: var(--dec-red); }
.loads-empty-msg { padding: 24px; text-align: center; font-size: 14px; color: var(--text-hint); }
.loads-summary {
  background: var(--surface); border-radius: var(--radius-lg);
  border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  padding: 4px 0; margin-bottom: 16px;
}
.summary-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.summary-row:last-child { border-bottom: none; }
.summary-key { font-size: 14px; color: var(--text-sec); }
.summary-val { font-size: 17px; font-weight: 700; color: var(--dec-dark); font-family: var(--font-mono); }

/* Add load form */
.add-load-card {
  background: var(--surface); border-radius: var(--radius-lg);
  border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  padding: 16px; margin-bottom: 12px;
}
.add-load-title {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--text-hint); margin-bottom: 12px;
}
.add-row { margin-bottom: 10px; }
.add-row-inline { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.add-label { display: block; font-size: 12px; color: var(--text-sec); margin-bottom: 4px; }
.add-input {
  width: 100%; padding: 10px 12px;
  border: 1.5px solid var(--border-2); border-radius: var(--radius-sm);
  font-size: 15px; color: var(--text); background: var(--surface);
  transition: border-color 0.15s;
}
.add-input:focus { border-color: var(--dec-red); }
.add-input.num { font-family: var(--font-mono); }

/* Power input + unit group */
.power-input-group {
  display: flex; border: 1.5px solid var(--border-2);
  border-radius: var(--radius-sm); overflow: hidden;
  background: var(--surface); transition: border-color 0.15s;
}
.power-input-group:focus-within { border-color: var(--dec-red); }
.power-input-group .add-input.power-val {
  border: none; border-radius: 0; flex: 1; min-width: 0;
  padding: 10px 6px 10px 12px;
}
.power-input-group .add-input.power-val:focus { outline: none; }
.power-unit-select {
  border: none; border-left: 1.5px solid var(--border-2); border-radius: 0;
  background: var(--surface-2); color: var(--text-sec);
  font-size: 13px; font-weight: 700; font-family: var(--font-mono);
  padding: 0 6px 0 8px; cursor: pointer;
  -webkit-appearance: auto; appearance: auto;
  min-width: 62px; height: 100%;
}
.power-unit-select:focus { outline: none; }

.add-wh-preview {
  text-align: center; font-size: 16px; font-weight: 700;
  color: var(--dec-red); font-family: var(--font-mono);
  margin: 6px 0 14px; min-height: 24px;
}

/* ═════════ RESULTS ═════════ */
.results-hero {
  background: var(--dec-dark); border-radius: var(--radius-lg);
  padding: 16px; margin-bottom: 12px; text-align: center;
}
.rh-site { font-size: 20px; font-weight: 800; color: #fff; letter-spacing: -0.3px; }
.rh-sub { font-size: 12px; color: rgba(255,255,255,0.4); margin-top: 4px; }
.metrics-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.metric-card {
  background: var(--surface); border-radius: var(--radius-lg);
  border: 1px solid var(--border); padding: 14px 12px;
  text-align: center; box-shadow: var(--shadow-sm);
}
.mc-num { font-size: 32px; font-weight: 800; font-family: var(--font-mono); line-height: 1; margin-bottom: 2px; }
.metric-card.accent-red .mc-num { color: var(--dec-red); }
.metric-card.accent-dark .mc-num { color: var(--dec-dark); }
.mc-unit { font-size: 12px; color: var(--text-hint); margin-bottom: 4px; }
.mc-label { font-size: 11px; color: var(--text-sec); }
.result-card {
  background: var(--surface); border-radius: var(--radius-lg);
  border: 1px solid var(--border); padding: 14px 16px;
  margin-bottom: 10px; box-shadow: var(--shadow-sm);
}
.rc-label {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--text-hint); margin-bottom: 12px;
}
.sun-chart-wrap { width: 100%; height: 120px; position: relative; }
.sun-chart-wrap canvas { width: 100% !important; height: 100% !important; }
.sun-chart-legend {
  display: flex; align-items: center; gap: 4px;
  margin-top: 8px; font-size: 11px; color: var(--text-sec);
}
.scl-dot { width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0; }
.scl-dot.bad  { background: var(--dec-red); }
.scl-dot.good { background: var(--dec-dark); }
.rc-row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 9px 0; border-bottom: 1px solid var(--border); gap: 12px;
}
.rc-row.last { border-bottom: none; padding-bottom: 0; }
.rck { font-size: 13px; color: var(--text-sec); flex: 1; }
.rcv { font-size: 13px; font-weight: 600; font-family: var(--font-mono); color: var(--text); text-align: right; flex-shrink: 0; }
.rcv.loss { color: var(--red-loss); }
.total-row { margin-top: 4px; border-top: 1px solid var(--border); padding-top: 9px; }
.total-row .rck { font-weight: 600; color: var(--text); }
.total-loss { font-size: 15px; }
.r-load-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 0; border-bottom: 1px solid var(--border); gap: 8px;
}
.r-load-row:last-child { border-bottom: none; padding-bottom: 0; }
.r-load-info { flex: 1; min-width: 0; }
.r-load-name { font-size: 13px; font-weight: 500; color: var(--text); }
.r-load-sub { font-size: 11px; color: var(--text-hint); }
.r-load-wh { font-size: 13px; font-weight: 600; font-family: var(--font-mono); color: var(--dec-red); flex-shrink: 0; }
.result-actions { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.btn-result-action {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 12px 8px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  font-size: 12px; color: var(--text-sec); font-weight: 500;
  box-shadow: var(--shadow-sm); transition: all 0.15s;
}
.btn-result-action:active { background: var(--gray-100); transform: scale(0.97); }
.btn-result-action svg { color: var(--dec-dark); }

/* ═════════ ABOUT / LICENSE ═════════ */
.about-hero {
  background: var(--dec-dark); border-radius: var(--radius-lg);
  padding: 28px 24px 20px; text-align: center; margin-bottom: 16px;
}
.about-dec-logo {
  max-width: 220px; height: auto; display: block;
  margin: 0 auto;
  /* The logo PNG has a black background — display it full width */
  border-radius: var(--radius-md);
}
.about-app-name {
  font-size: 26px; font-weight: 800; color: var(--text);
  letter-spacing: -0.5px; text-align: center; margin-bottom: 4px;
}
.about-version {
  font-size: 13px; color: var(--text-hint); text-align: center; margin-bottom: 20px;
}
.about-card {
  background: var(--surface); border-radius: var(--radius-lg);
  border: 1px solid var(--border); padding: 16px;
  margin-bottom: 12px; box-shadow: var(--shadow-sm);
}
.about-section-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--dec-red);
  margin-bottom: 10px; padding-bottom: 8px;
  border-bottom: 1.5px solid var(--dec-red-bg);
}
.about-text { font-size: 13px; color: var(--text-sec); line-height: 1.6; margin: 0; }
.about-link { color: var(--dec-red); text-decoration: none; font-weight: 500; }
.about-link:hover { text-decoration: underline; }

.license-badge {
  display: inline-block; background: var(--green-bg); color: var(--green);
  font-size: 12px; font-weight: 700; padding: 5px 14px;
  border-radius: 99px; margin-bottom: 12px; border: 1px solid rgba(30,126,52,0.2);
}
.license-terms { margin: 10px 0; display: flex; flex-direction: column; gap: 7px; }
.lt-row { display: flex; gap: 8px; font-size: 13px; color: var(--text-sec); align-items: flex-start; line-height: 1.5; }
.lt-bullet { flex-shrink: 0; font-weight: 700; color: var(--green); margin-top: 1px; }
.lt-row.red .lt-bullet { color: var(--dec-red); }
.lt-row.red { color: var(--text-sec); }

/* ═════════ TOAST ═════════ */
.toast {
  position: fixed; bottom: calc(68px + var(--safe-bot));
  left: 50%; transform: translateX(-50%);
  background: var(--dec-dark); color: #fff;
  font-size: 14px; font-weight: 500; padding: 10px 20px;
  border-radius: 99px; z-index: 500; white-space: nowrap;
  box-shadow: var(--shadow-md); animation: toastIn 0.22s ease;
  border: 1px solid rgba(255,255,255,0.08);
}
@keyframes toastIn {
  from { opacity:0; transform: translateX(-50%) translateY(8px); }
  to   { opacity:1; transform: translateX(-50%) translateY(0); }
}

/* ═════════ MODAL ═════════ */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 200; }
.modal {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: var(--surface); border-radius: var(--radius-xl);
  padding: 24px; width: calc(100% - 48px); max-width: 320px; z-index: 201;
  box-shadow: var(--shadow-md);
}
.modal-title { font-size: 17px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.modal-body { font-size: 14px; color: var(--text-sec); line-height: 1.5; margin-bottom: 20px; }
.modal-actions { display: flex; gap: 10px; }
.modal-btn { flex: 1; padding: 12px; border-radius: var(--radius-lg); font-size: 15px; font-weight: 600; text-align: center; }
.modal-btn.cancel { background: var(--gray-100); color: var(--text); border: 1px solid var(--border); }
.modal-btn.cancel:active { background: var(--gray-200); }
.modal-btn.danger { background: var(--dec-red); color: #fff; }
.modal-btn.danger:active { background: var(--dec-red-dark); }

/* ═════════ ANIMATIONS ═════════ */
.screen-enter { animation: screenIn 0.2s ease forwards; }
@keyframes screenIn { from { opacity:0; transform: translateX(20px); } to { opacity:1; transform: translateX(0); } }

/* ═════════ RESPONSIVE ═════════ */
@media (min-width: 430px) {
  .scroll-area { padding: 20px 20px 0; }
  .app { max-width: 430px; margin: 0 auto; }
}

/* ═════════ HELP SCREEN ═════════ */
.help-hero {
  background: var(--dec-dark); border-radius: var(--radius-lg);
  padding: 24px 16px 20px; text-align: center; margin-bottom: 14px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.help-hero-icon {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--dec-red); display: flex; align-items: center; justify-content: center;
}
.help-hero-title { font-size: 20px; font-weight: 800; color: #fff; letter-spacing: -0.3px; }
.help-hero-sub { font-size: 12px; color: rgba(255,255,255,0.4); text-transform: uppercase; letter-spacing: 0.08em; }

.help-card {
  background: var(--surface); border-radius: var(--radius-lg);
  border: 1px solid var(--border); padding: 16px;
  margin-bottom: 12px; box-shadow: var(--shadow-sm);
}
.help-section-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 15px; font-weight: 700; color: var(--text);
  margin-bottom: 14px; padding-bottom: 10px;
  border-bottom: 1.5px solid var(--border);
}
.help-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--dec-red); color: #fff;
  font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.help-text { font-size: 13px; line-height: 1.65; color: var(--text-sec); margin: 0; }

/* Quick-start steps */
.qs-steps { display: flex; flex-direction: column; gap: 0; margin-top: 14px; }
.qs-step {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.qs-step:last-child { border-bottom: none; padding-bottom: 0; }
.qs-circle {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--dec-red); color: #fff;
  font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.qs-body { flex: 1; }
.qs-title { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.qs-desc { font-size: 13px; color: var(--text-sec); line-height: 1.5; }

/* Field groups */
.help-field-group { margin-top: 14px; }
.help-field-group:first-child { margin-top: 0; }
.hfg-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--dec-red);
  margin-bottom: 8px; padding-bottom: 6px;
  border-bottom: 1px solid var(--dec-red-bg);
}
.help-field {
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.help-field.last { border-bottom: none; padding-bottom: 0; }
.hf-name { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.hf-desc { font-size: 13px; color: var(--text-sec); line-height: 1.6; }

/* Tips */
.help-tip {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--surface-2); border-radius: var(--radius-md);
  border: 1px solid var(--border); padding: 10px 12px;
  margin-top: 10px; font-size: 13px; color: var(--text-sec); line-height: 1.55;
}
.tip-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.tip-body { flex: 1; }
.tip-body strong { color: var(--text); font-weight: 600; }

/* FAQ */
.faq-item { border-bottom: 1px solid var(--border); }
.faq-item:last-child { border-bottom: none; }
.faq-q {
  display: flex; justify-content: space-between; align-items: center;
  padding: 13px 0; cursor: pointer; gap: 10px;
  font-size: 14px; font-weight: 500; color: var(--text); line-height: 1.4;
  user-select: none; -webkit-user-select: none;
}
.faq-q:active { opacity: 0.7; }
.faq-chevron { flex-shrink: 0; color: var(--text-hint); transition: transform 0.2s; }
.faq-q.open .faq-chevron { transform: rotate(180deg); }
.faq-a {
  display: none; padding: 0 0 12px;
  font-size: 13px; color: var(--text-sec); line-height: 1.65;
}
.faq-a.open { display: block; }

/* Contact */
.contact-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.contact-row:last-of-type { border-bottom: none; }
.contact-icon {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--dec-red-bg); color: var(--dec-red);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.contact-icon svg { stroke: var(--dec-red); }
.contact-body { flex: 1; }
.contact-label { font-size: 11px; color: var(--text-hint); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 2px; }
.contact-link { font-size: 15px; font-weight: 600; color: var(--dec-red); text-decoration: none; }
.contact-link:hover { text-decoration: underline; }

/* ═════════ DARK MODE ═════════ */
@media (prefers-color-scheme: dark) {
  :root {
    --surface:    #1c1c1e;
    --surface-2:  #111113;
    --border:     #2c2c2e;
    --border-2:   #3a3a3c;
    --text:       #f2f2f7;
    --text-sec:   #aeaeb2;
    --text-hint:  #636366;
    --gray-100:   #2c2c2e;
    --gray-200:   #3a3a3c;
    --gray-300:   #48484a;
    --dec-red-bg: #2d0808;
    --blue-bg:    #0a1f38;
    --green-bg:   #0a1f0f;
  }
  body { background: #000; }
  .project-stat, .result-card, .metric-card, .form-card,
  .add-load-card, .loads-section, .loads-summary,
  .about-card, .project-card { background: #1c1c1e; }
  .ps-num { color: #f2f2f7; }
  .metric-card.accent-dark .mc-num { color: #f2f2f7; }
}
