/* HydroScape Pro — compact engineering UI
   Layout: fixed sidebar navigation + content column. Density-first: 13.5px base, tight spacing. */

:root {
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, 'Cascadia Mono', 'JetBrains Mono', Consolas, monospace;

  --bg-primary: #0b0f17;
  --bg-secondary: #101623;
  --bg-card: #121a28;
  --bg-card-hover: #162030;
  --bg-input: #1a2334;
  --bg-input-focus: #1e293b;
  --bg-elevated: #1c2637;

  --border-color: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.14);
  --border-color-hover: rgba(16, 185, 129, 0.35);
  --border-focus: #10b981;

  --text-primary: #eef2f7;
  --text-secondary: #a3adbd;
  --text-muted: #6b7686;

  --accent-emerald: #10b981;
  --accent-emerald-glow: rgba(16, 185, 129, 0.22);
  --accent-cyan: #22d3ee;
  --accent-cyan-glow: rgba(34, 211, 238, 0.18);
  --accent-blue: #60a5fa;
  --accent-amber: #f59e0b;
  --accent-amber-glow: rgba(245, 158, 11, 0.2);
  --accent-rose: #f43f5e;
  --accent-rose-glow: rgba(244, 63, 94, 0.22);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --radius-full: 9999px;

  --sidebar-w: 236px;
  --topbar-h: 50px;
  --transition: all 0.15s ease;
}

[data-theme="light"] {
  --bg-primary: #f3f5f8;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #ffffff;
  --bg-input: #f1f4f8;
  --bg-input-focus: #ffffff;
  --bg-elevated: #e9edf3;

  --border-color: #e3e8ef;
  --border-strong: #cbd3de;
  --border-color-hover: rgba(16, 185, 129, 0.5);

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #8a94a6;

  --accent-cyan: #0891b2;
  --accent-blue: #2563eb;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 2px 8px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.14);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

html { font-size: 13.5px; }

body {
  font-family: var(--font-family);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.45;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ------------------------------------------------------------------ shell */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 60;
}

.sb-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--border-color);
  min-height: var(--topbar-h);
}

.logo-icon {
  width: 30px; height: 30px; flex: 0 0 30px;
  background: linear-gradient(135deg, var(--accent-emerald), #0e9f8f);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
}

.logo-text h1 { font-size: 0.95rem; font-weight: 700; letter-spacing: -0.01em; display: flex; align-items: center; gap: 0.4rem; line-height: 1.1; }
.logo-badge {
  font-size: 0.6rem; padding: 0.05rem 0.4rem;
  background: rgba(16, 185, 129, 0.15); color: var(--accent-emerald);
  border: 1px solid rgba(16, 185, 129, 0.3); border-radius: var(--radius-full); font-weight: 700;
}
.logo-subtitle { font-size: 0.68rem; color: var(--text-muted); margin-top: 1px; }
.sb-close { display: none; margin-left: auto; }

.sb-search { position: relative; padding: 0.6rem 0.75rem 0.3rem; }
.sb-search .search-icon { position: absolute; left: 1.35rem; top: 50%; transform: translateY(-10%); color: var(--text-muted); pointer-events: none; }
.sb-search input { padding-left: 2rem; font-size: 0.8rem; padding-top: 0.42rem; padding-bottom: 0.42rem; }

.sb-nav { flex: 1; overflow-y: auto; padding: 0.35rem 0.5rem 0.75rem; scrollbar-width: thin; }
.sb-group { margin-top: 0.55rem; }
.sb-group-title {
  font-size: 0.64rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-muted); padding: 0.25rem 0.6rem 0.3rem;
}

.tab-btn {
  display: flex; align-items: center; gap: 0.55rem;
  width: 100%;
  background: none; border: none;
  padding: 0.42rem 0.6rem;
  border-radius: var(--radius-md);
  font-family: inherit; font-size: 0.8rem; font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer; text-align: left;
  transition: var(--transition);
  white-space: nowrap;
}
.tab-btn svg { width: 15px; height: 15px; flex: 0 0 15px; opacity: 0.8; }
.tab-btn span { overflow: hidden; text-overflow: ellipsis; }
.tab-btn:hover { background: var(--bg-elevated); color: var(--text-primary); }
.tab-btn.active { background: rgba(16, 185, 129, 0.13); color: var(--accent-emerald); font-weight: 600; }
.tab-btn.active svg { opacity: 1; }
.tab-btn[hidden] { display: none; }
.sb-new {
  margin-left: auto; font-style: normal; font-size: 0.58rem; font-weight: 700; text-transform: uppercase;
  color: var(--accent-cyan); background: var(--accent-cyan-glow); padding: 0.05rem 0.35rem; border-radius: var(--radius-full);
}
.sb-badge {
  margin-left: auto; font-size: 0.66rem; font-weight: 700; min-width: 1.35rem; text-align: center;
  background: var(--bg-elevated); color: var(--text-secondary); padding: 0.05rem 0.35rem; border-radius: var(--radius-full);
}
.tab-btn.active .sb-badge { background: var(--accent-emerald); color: #fff; }
.sb-empty { font-size: 0.75rem; color: var(--text-muted); padding: 0.75rem 0.6rem; }

.sb-footer { border-top: 1px solid var(--border-color); padding: 0.6rem 0.75rem; }
.stats-chips { display: grid; grid-template-columns: 1fr 1fr; gap: 0.3rem; }
.stat-chip {
  background: var(--bg-input); border: 1px solid var(--border-color);
  padding: 0.25rem 0.45rem; border-radius: var(--radius-sm);
  font-size: 0.66rem; display: flex; justify-content: space-between; gap: 0.3rem; color: var(--text-muted);
}
.stat-chip strong { color: var(--accent-emerald); font-variant-numeric: tabular-nums; }
.sb-copy { font-size: 0.62rem; color: var(--text-muted); margin-top: 0.45rem; }
.sb-backdrop { display: none; }

/* content column */
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg-secondary) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  height: var(--topbar-h);
}
.header-container { display: flex; align-items: center; gap: 0.75rem; height: 100%; padding: 0 1rem; }
.sb-toggle { display: none; }
.build-stamp { font-size: 0.58rem; font-weight: 400; color: var(--text-muted); margin-left: 0.4rem; letter-spacing: 0.02em; font-variant-numeric: tabular-nums; }
.topbar-title { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.topbar-group { font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); font-weight: 700; }
.topbar-title h2 { font-size: 0.98rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 0.35rem; }
.topbar-sep { width: 1px; height: 20px; background: var(--border-strong); margin: 0 0.25rem; }

.icon-btn {
  background: transparent; border: 1px solid transparent; color: var(--text-secondary);
  width: 30px; height: 30px; border-radius: var(--radius-md);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; transition: var(--transition);
}
.icon-btn:hover { color: var(--text-primary); background: var(--bg-elevated); border-color: var(--border-color); }

.unit-toggle-btn, .lang-toggle-btn {
  display: inline-flex; align-items: center; gap: 0.15rem;
  background: var(--bg-input); border: 1px solid var(--border-color); color: var(--text-primary);
  padding: 0.18rem; border-radius: var(--radius-full); font-size: 0.7rem; font-weight: 600; cursor: pointer; transition: var(--transition);
}
.unit-toggle-btn:hover, .lang-toggle-btn:hover { border-color: var(--border-strong); }
.unit-pill, .lang-pill { padding: 0.12rem 0.5rem; border-radius: 999px; color: var(--text-muted); }
.unit-pill.active { background: var(--accent-emerald); color: #fff; }
.lang-pill.active { background: var(--accent-cyan); color: #04141a; }

.main-container { flex: 1; width: 100%; max-width: 1480px; margin: 0 auto; padding: 1rem 1rem 1.5rem; }

.app-footer {
  border-top: 1px solid var(--border-color);
  padding: 0.6rem 1rem; font-size: 0.68rem; color: var(--text-muted);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.4rem;
}

/* ------------------------------------------------------------------ tabs */
.tab-content { display: none; animation: fadeIn 0.18s ease-out; }
.tab-content.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

/* intro banner (legacy, hidden) */
.intro-banner { display: none; }

/* ------------------------------------------------------------------ grid & cards */
.calculator-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 0.85rem; align-items: start; }
.calculator-grid.grid-zones { grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.25fr); }
@media (max-width: 1000px) { .calculator-grid, .calculator-grid.grid-zones { grid-template-columns: 1fr; } }

.calc-card, .results-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 0.9rem 1rem 1rem;
  box-shadow: var(--shadow-sm);
}
.calc-card + .calc-card, .calc-card + .results-card { margin-top: 0.85rem; }

.card-header {
  display: flex; justify-content: space-between; align-items: center; gap: 0.5rem;
  margin-bottom: 0.7rem; padding-bottom: 0.55rem; border-bottom: 1px solid var(--border-color);
}
.card-header h3 { font-size: 0.9rem; font-weight: 700; display: flex; align-items: center; gap: 0.4rem; }
.card-header h3 svg { width: 16px; height: 16px; color: var(--accent-emerald); }
.card-header h4 { font-size: 0.82rem; }
.card-tag {
  font-size: 0.64rem; color: var(--text-muted); background: var(--bg-input);
  padding: 0.15rem 0.45rem; border-radius: var(--radius-sm); white-space: nowrap; max-width: 55%; overflow: hidden; text-overflow: ellipsis;
}
.toolbar { display: flex; gap: 0.35rem; flex-wrap: wrap; }

.sub-block { margin-top: 0.75rem; padding-top: 0.65rem; border-top: 1px dashed var(--border-color); }
.sub-title { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent-cyan); margin-bottom: 0.45rem; }
.card-sub-section { margin-top: 0.75rem !important; padding-top: 0.65rem !important; }
.card-sub-section h4 { font-size: 0.8rem !important; }

/* ------------------------------------------------------------------ forms */
.form-group { margin-bottom: 0.6rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.55rem; }
.form-row-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 560px) { .form-row, .form-row-3 { grid-template-columns: 1fr; } }

label { display: block; font-size: 0.7rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 0.22rem; }

input[type="number"], input[type="text"], input[type="search"], select, textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-family: inherit; font-size: 0.82rem;
  padding: 0.4rem 0.55rem;
  border-radius: var(--radius-md);
  outline: none; transition: var(--transition);
  font-variant-numeric: tabular-nums;
}
select { cursor: pointer; }
select.list-select { padding: 0.25rem; font-size: 0.78rem; }
select.list-select option { padding: 0.22rem 0.4rem; border-radius: 4px; }
input:focus, select:focus, textarea:focus { border-color: var(--border-focus); background: var(--bg-input-focus); box-shadow: 0 0 0 2px var(--accent-emerald-glow); }
input::placeholder { color: var(--text-muted); }

.input-with-addon { position: relative; display: flex; align-items: center; }
.input-with-addon input, .input-with-addon select { padding-right: 3rem; }
.input-addon { position: absolute; right: 0.55rem; font-size: 0.66rem; font-weight: 600; color: var(--text-muted); pointer-events: none; }
.input-help { font-size: 0.66rem; color: var(--text-muted); margin-top: 0.25rem; line-height: 1.35; }

.search-box { position: relative; margin-bottom: 0.6rem; }
.search-box input { padding-left: 2rem; }
.search-box .search-icon { position: absolute; left: 0.6rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); width: 14px; height: 14px; }

/* ------------------------------------------------------------------ buttons */
.btn-primary, .btn-success, .btn-secondary, .btn-outline, .btn-danger, .btn-add-bom {
  font-family: inherit; cursor: pointer; transition: var(--transition);
  display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem;
  border-radius: var(--radius-md); font-size: 0.78rem; font-weight: 600; line-height: 1.2;
}
.btn-primary { background: var(--accent-emerald); color: #fff; border: 1px solid transparent; padding: 0.5rem 0.9rem; width: 100%; }
.btn-primary:hover { background: #0ea371; }
.btn-success { background: var(--accent-emerald); color: #fff; border: 1px solid transparent; padding: 0.42rem 0.8rem; }
.btn-success:hover { background: #0ea371; }
.btn-secondary, .btn-outline { background: transparent; border: 1px solid var(--border-strong); color: var(--text-primary); padding: 0.42rem 0.8rem; }
.btn-secondary:hover, .btn-outline:hover { border-color: var(--accent-emerald); color: var(--accent-emerald); }
.btn-danger { background: rgba(244, 63, 94, 0.12); border: 1px solid rgba(244, 63, 94, 0.3); color: var(--accent-rose); padding: 0.3rem 0.55rem; }
.btn-danger:hover { background: var(--accent-rose); color: #fff; }
.btn-sm { padding: 0.28rem 0.55rem !important; font-size: 0.7rem !important; }
.btn-add-bom {
  margin-top: 0.65rem; width: 100%;
  background: rgba(16, 185, 129, 0.08); border: 1px dashed rgba(16, 185, 129, 0.4); color: var(--accent-emerald);
  padding: 0.42rem;
}
.btn-add-bom:hover { background: rgba(16, 185, 129, 0.16); border-style: solid; }

/* ------------------------------------------------------------------ results */
.result-hero {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.12), rgba(34, 211, 238, 0.05));
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: var(--radius-md);
  padding: 0.7rem 0.9rem; margin-bottom: 0.7rem;
  display: grid; grid-template-columns: 1fr auto; grid-template-areas: "label value" "sub value"; align-items: center; column-gap: 0.75rem;
}
.result-hero-label { grid-area: label; font-size: 0.66rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700; }
.result-hero-value { grid-area: value; font-size: 1.7rem; font-weight: 800; color: var(--accent-emerald); line-height: 1; font-variant-numeric: tabular-nums; text-align: right; }
.result-hero-value small, .result-hero-value span[style] { font-size: 0.85rem !important; font-weight: 600; color: var(--text-secondary); }
.result-hero-sub { grid-area: sub; font-size: 0.68rem; color: var(--text-muted); margin-top: 0.15rem; }

.metrics-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.5rem; margin-bottom: 0.7rem; }
.metrics-grid.metrics-3 { grid-template-columns: repeat(3, 1fr); }
.metric-box { background: var(--bg-input); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 0.5rem 0.6rem; }
.metric-label { font-size: 0.62rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.metric-value { font-size: 1.05rem; font-weight: 700; margin-top: 0.1rem; font-variant-numeric: tabular-nums; }
.metric-unit { font-size: 0.66rem; color: var(--text-secondary); font-weight: 500; margin-left: 0.2rem; }

.status-badge {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.5rem 0.7rem; border-radius: var(--radius-md);
  font-size: 0.74rem; font-weight: 500; margin-bottom: 0.7rem; line-height: 1.35;
}
.status-badge svg { flex: 0 0 16px; width: 16px; height: 16px; }
.status-badge.safe { background: rgba(16, 185, 129, 0.1); border: 1px solid rgba(16, 185, 129, 0.3); color: #34d399; }
.status-badge.warning { background: rgba(245, 158, 11, 0.1); border: 1px solid rgba(245, 158, 11, 0.3); color: #fbbf24; }
.status-badge.danger { background: rgba(244, 63, 94, 0.1); border: 1px solid rgba(244, 63, 94, 0.3); color: #fb7185; }
[data-theme="light"] .status-badge.safe { color: #047857; }
[data-theme="light"] .status-badge.warning { color: #b45309; }
[data-theme="light"] .status-badge.danger { color: #be123c; }

.bar-container { margin-top: 0.5rem; background: var(--bg-input); border-radius: var(--radius-full); height: 6px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: var(--radius-full); transition: width 0.3s ease-out, background-color 0.3s; }

.stack-bar { display: flex; height: 14px; border-radius: var(--radius-full); overflow: hidden; background: var(--bg-input); margin-bottom: 0.6rem; }
.stack-bar > i { display: block; height: 100%; min-width: 1px; }

.lateral-results-box { padding: 0.6rem !important; }
.cost-breakdown-card { background: rgba(34, 211, 238, 0.06); border: 1px solid rgba(34, 211, 238, 0.2); border-radius: var(--radius-md); padding: 0.7rem 0.85rem; margin-top: 0.7rem; }

/* ------------------------------------------------------------------ tables */
.table-responsive { overflow: auto; border: 1px solid var(--border-color); border-radius: var(--radius-md); margin-top: 0.6rem; }
.table-responsive.tall { max-height: 480px; }
table { width: 100%; border-collapse: collapse; font-size: 0.76rem; text-align: left; }
th { background: var(--bg-input); color: var(--text-secondary); padding: 0.42rem 0.6rem; font-weight: 600; border-bottom: 1px solid var(--border-color); white-space: nowrap; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.03em; position: sticky; top: 0; z-index: 1; }
td { padding: 0.4rem 0.6rem; border-bottom: 1px solid var(--border-color); font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: rgba(255, 255, 255, 0.025); }
[data-theme="light"] tbody tr:hover td { background: rgba(15, 23, 42, 0.03); }
th.num, td.num { text-align: right; }
td.empty { text-align: center; color: var(--text-muted); padding: 1.2rem; }
.mini-table td { padding: 0.32rem 0.55rem; }
#zn-table td, #zn-table th, #pl-table td, #pl-table th { white-space: nowrap; }
#pl-table td:first-child { white-space: normal; min-width: 180px; }
.row-active td { background: rgba(16, 185, 129, 0.08); }
.bom-table th, .bom-table td { padding: 0.45rem 0.6rem; }
.row-warn td { color: var(--accent-amber); }
.row-bad td { color: var(--accent-rose); }

.chips { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.chip { font-size: 0.68rem; background: var(--bg-input); border: 1px solid var(--border-color); padding: 0.18rem 0.5rem; border-radius: var(--radius-full); }
.chip b { color: var(--accent-emerald); margin-left: 0.2rem; }
.pill-water { display: inline-block; font-size: 0.62rem; font-weight: 700; padding: 0.08rem 0.4rem; border-radius: var(--radius-full); }
.pill-water.w0 { background: rgba(34, 211, 238, 0.15); color: var(--accent-cyan); }
.pill-water.w1 { background: rgba(16, 185, 129, 0.15); color: var(--accent-emerald); }
.pill-water.w2 { background: rgba(96, 165, 250, 0.18); color: var(--accent-blue); }

.zn-preview { font-size: 0.72rem; color: var(--text-secondary); background: var(--bg-input); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 0.45rem 0.6rem; margin-bottom: 0.6rem; line-height: 1.5; }
.zn-preview b { color: var(--text-primary); }

/* ------------------------------------------------------------------ sprinkler cards */
.sprinkler-cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 0.5rem; margin-top: 0.6rem; max-height: 480px; overflow-y: auto; padding-right: 0.2rem; }
.sprinkler-item-card { background: var(--bg-input); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 0.6rem 0.7rem; cursor: pointer; transition: var(--transition); }
.sprinkler-item-card:hover { border-color: var(--accent-emerald); }
.sprinkler-brand { font-size: 0.6rem; text-transform: uppercase; font-weight: 700; color: var(--accent-cyan); }
.sprinkler-title { font-size: 0.8rem; font-weight: 700; margin: 0.15rem 0 0.35rem; line-height: 1.2; }
.sprinkler-stats { display: flex; justify-content: space-between; border-top: 1px solid var(--border-color); padding-top: 0.35rem; font-size: 0.66rem; color: var(--text-secondary); gap: 0.3rem; flex-wrap: wrap; }

/* ------------------------------------------------------------------ canvas */
.canvas-wrapper { position: relative; background: #0a111a; border: 1px solid var(--border-color); border-radius: var(--radius-md); overflow: hidden; display: flex; justify-content: center; align-items: center; padding: 0.5rem; min-height: 300px; }
.canvas-wrapper.canvas-sm { min-height: 0; }
#coverage-canvas, #un-canvas { background: #0a111a; border-radius: var(--radius-sm); max-width: 100%; height: auto; }
.canvas-legend { display: flex; gap: 0.8rem; align-items: center; justify-content: center; margin-top: 0.5rem; font-size: 0.68rem; color: var(--text-secondary); flex-wrap: wrap; }
.legend-item { display: flex; align-items: center; gap: 0.3rem; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* ------------------------------------------------------------------ ETo month editor */
.et-months { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0.3rem; margin: 0.3rem 0 0.4rem; }
.et-months label { font-size: 0.6rem; margin-bottom: 0.1rem; text-align: center; }
.et-months input { padding: 0.25rem 0.3rem; font-size: 0.72rem; text-align: center; }
@media (max-width: 560px) { .et-months { grid-template-columns: repeat(4, 1fr); } }

.seasonal-chart { display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px; align-items: end; height: 120px; padding: 0.6rem 0.4rem 0.3rem; background: var(--bg-input); border-radius: var(--radius-md); margin-top: 0.6rem; }
.seasonal-col { display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; }
.seasonal-bar { width: 100%; background: linear-gradient(to top, var(--accent-cyan), var(--accent-emerald)); border-radius: 3px 3px 0 0; transition: height 0.3s; min-height: 4px; }
.seasonal-col:nth-child(6) .seasonal-bar, .seasonal-col:nth-child(7) .seasonal-bar, .seasonal-col:nth-child(8) .seasonal-bar { background: linear-gradient(to top, var(--accent-emerald), var(--accent-amber)); }
.seasonal-pct { font-size: 0.58rem; font-weight: 700; margin-bottom: 2px; }
.seasonal-month { font-size: 0.58rem; color: var(--text-muted); margin-top: 3px; font-weight: 600; }

/* ------------------------------------------------------------------ modals */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(4px); display: none; align-items: center; justify-content: center; z-index: 1000; padding: 1rem; }
.modal-backdrop.active { display: flex; }
.modal-content { background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: var(--radius-lg); max-width: 640px; width: 100%; max-height: 92vh; overflow-y: auto; box-shadow: var(--shadow-lg); padding: 1rem 1.1rem; }
.modal-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border-color); padding-bottom: 0.55rem; margin-bottom: 0.8rem; }
.modal-header h3 { font-size: 0.95rem; font-weight: 700; display: flex; align-items: center; gap: 0.4rem; }
.modal-header h3 svg { width: 16px; height: 16px; }
.modal-close-btn { background: none; border: none; color: var(--text-muted); font-size: 1.35rem; cursor: pointer; line-height: 1; }
.modal-close-btn:hover { color: var(--text-primary); }
.converter-group { background: var(--bg-input); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 0.6rem 0.7rem; margin-bottom: 0.6rem; }
.converter-group-title { font-size: 0.66rem; font-weight: 700; color: var(--accent-cyan); text-transform: uppercase; margin-bottom: 0.4rem; }
.converter-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.45rem; }
@media (max-width: 560px) { .converter-grid { grid-template-columns: 1fr 1fr; } }
.modal-report-content { max-width: 900px; }
.report-config-bar { background: var(--bg-input); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 0.7rem; margin-bottom: 0.8rem; }

/* A4 report (print) */
.a4-paper { background: #fff; color: #1e293b; border-radius: var(--radius-sm); padding: 2rem 1.9rem; box-shadow: var(--shadow-md); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; line-height: 1.45; font-size: 0.82rem; }
.a4-header { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid #0f766e; padding-bottom: 0.7rem; margin-bottom: 1rem; }
.a4-brand h2 { font-size: 1.3rem; font-weight: 800; color: #0f766e; }
.a4-brand p { font-size: 0.76rem; color: #64748b; margin-top: 0.15rem; }
.a4-meta { text-align: right; font-size: 0.74rem; color: #475569; }
.a4-section { margin-bottom: 1rem; }
.a4-section-title { font-size: 0.86rem; font-weight: 700; color: #0f172a; border-left: 4px solid #0f766e; padding-left: 0.5rem; margin-bottom: 0.5rem; text-transform: uppercase; letter-spacing: 0.4px; }
.a4-table { width: 100%; border-collapse: collapse; margin-bottom: 0.5rem; font-size: 0.76rem; }
.a4-table th, .a4-table td { border: 1px solid #cbd5e1; padding: 0.32rem 0.5rem; text-align: left; color: #1e293b; background: #fff; position: static; text-transform: none; letter-spacing: 0; }
.a4-table th { background: #f1f5f9; color: #334155; font-weight: 700; }
.a4-table tr:nth-child(even) td { background: #f8fafc; }
.a4-signature-box { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-top: 1.5rem; padding-top: 1rem; border-top: 1px dashed #cbd5e1; }
.a4-sig-col { border: 1px solid #cbd5e1; border-radius: 4px; padding: 0.8rem; height: 90px; display: flex; flex-direction: column; justify-content: space-between; }
.a4-sig-title { font-size: 0.72rem; font-weight: 700; color: #475569; }
.a4-sig-line { border-bottom: 1px solid #94a3b8; padding-top: 2rem; font-size: 0.66rem; color: #94a3b8; text-align: center; }

/* ------------------------------------------------------------------ toasts */
.toast-host { position: fixed; right: 1rem; bottom: 1rem; display: flex; flex-direction: column; gap: 0.4rem; z-index: 2000; pointer-events: none; }
.toast { background: var(--bg-elevated); border: 1px solid var(--border-strong); color: var(--text-primary); padding: 0.5rem 0.8rem; border-radius: var(--radius-md); font-size: 0.76rem; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 0.5rem; animation: toastIn 0.2s ease-out; max-width: 340px; }
.toast.ok { border-left: 3px solid var(--accent-emerald); }
.toast.warn { border-left: 3px solid var(--accent-amber); }
.toast.err { border-left: 3px solid var(--accent-rose); }
.toast.hide { opacity: 0; transform: translateY(6px); transition: all 0.25s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform 0.2s ease; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .sb-close { display: inline-flex; }
  .sb-backdrop { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5); z-index: 55; opacity: 0; pointer-events: none; transition: opacity 0.2s; }
  .sb-backdrop.open { opacity: 1; pointer-events: auto; }
  .sb-toggle { display: inline-flex; }
  .main-container { padding: 0.75rem 0.75rem 1.25rem; }
  .header-actions .lang-toggle-btn { display: none; }
}

/* ------------------------------------------------------------------ print */
@media print {
  body { background: #fff !important; color: #000 !important; }
  .sidebar, .topbar, .app-footer, .report-config-bar, .modal-header, .toast-host, .btn-primary, .btn-add-bom { display: none !important; }
  .app-shell, .content, .main-container { display: block !important; padding: 0 !important; margin: 0 !important; max-width: none !important; }
  .modal-backdrop { position: static !important; display: block !important; background: none !important; padding: 0 !important; }
  .modal-content { border: none !important; box-shadow: none !important; padding: 0 !important; max-width: 100% !important; width: 100% !important; max-height: none !important; overflow: visible !important; }
  .a4-paper { box-shadow: none !important; padding: 0 !important; }
}

/* ------------------------------------------------------------------ DXF designer */
.dz-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 0.85rem; align-items: start; }
@media (max-width: 1000px) { .dz-layout { grid-template-columns: 1fr; } }
.dz-panel { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-lg); padding: 0.4rem 0.85rem 0.6rem; max-height: calc(100vh - var(--topbar-h) - 2.5rem); overflow-y: auto; position: sticky; top: calc(var(--topbar-h) + 1rem); scrollbar-width: thin; }
.dz-sec { padding: 0.55rem 0 0.6rem; border-bottom: 1px dashed var(--border-color); }
.dz-sec:last-child { border-bottom: none; }
.dz-sec h4 { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent-cyan); margin-bottom: 0.45rem; }
.dz-sec .form-group { margin-bottom: 0.45rem; }
.dz-layers { display: flex; flex-wrap: wrap; gap: 0.2rem; max-height: 72px; overflow-y: auto; }
.dz-layers label { display: inline-flex; align-items: center; gap: 0.2rem; font-size: 0.62rem; font-weight: 500; background: var(--bg-input); border: 1px solid var(--border-color); border-radius: var(--radius-full); padding: 0.05rem 0.4rem; margin: 0; cursor: pointer; }
.dz-layers input { margin: 0; }
.dz-tools { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.25rem; }
.dz-tools button, .dz-typebar button { font-family: inherit; font-size: 0.7rem; font-weight: 600; padding: 0.35rem 0.3rem; border-radius: var(--radius-sm); border: 1px solid var(--border-color); background: var(--bg-input); color: var(--text-secondary); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 0.3rem; }
.dz-tools button:hover, .dz-typebar button:hover { border-color: var(--border-strong); color: var(--text-primary); }
.dz-tools button.active { background: rgba(16, 185, 129, 0.15); border-color: var(--accent-emerald); color: var(--accent-emerald); }
.dz-typebar { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.25rem; margin-top: 0.4rem; }
.dz-typebar button i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.dz-typebar button.active { border-color: var(--accent-emerald); color: var(--text-primary); }
.dz-typebar button.danger { color: var(--accent-rose); grid-column: span 3; }
.dz-selection { font-size: 0.7rem; color: var(--text-secondary); background: var(--bg-input); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 0.4rem 0.55rem; margin-top: 0.45rem; line-height: 1.4; }
.dz-selection b { color: var(--text-primary); }
.dz-check { display: flex; align-items: center; gap: 0.35rem; font-size: 0.7rem; font-weight: 500; color: var(--text-secondary); margin: 0.25rem 0 0; cursor: pointer; }
.dz-kv { font-size: 0.7rem; color: var(--text-secondary); margin-top: 0.45rem; line-height: 1.45; }
.dz-kv b { color: var(--text-primary); }
.dz-main { min-width: 0; }
.dz-canvas-wrap { position: relative; background: #0a111a; border: 1px solid var(--border-color); border-radius: var(--radius-lg); overflow: hidden; height: min(68vh, 720px); min-height: 380px; }
[data-theme="light"] .dz-canvas-wrap { background: #f8fafc; }
#dz-canvas { display: block; width: 100%; height: 100%; cursor: crosshair; touch-action: none; }
#dz-canvas.pan { cursor: grab; }
#dz-canvas.panning { cursor: grabbing; }
.dz-hud { position: absolute; left: 0.6rem; bottom: 0.5rem; font-size: 0.66rem; font-family: var(--font-mono); color: var(--text-secondary); background: color-mix(in srgb, var(--bg-secondary) 80%, transparent); padding: 0.2rem 0.5rem; border-radius: var(--radius-sm); pointer-events: none; }
.dz-zoom { position: absolute; right: 0.6rem; top: 0.6rem; display: flex; flex-direction: column; gap: 0.2rem; }
.dz-zoom button { width: 28px; height: 28px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--bg-secondary); color: var(--text-primary); cursor: pointer; font-size: 0.9rem; }
.dz-results { margin-top: 0.7rem; }

.dz-sec-pump { background: rgba(16, 185, 129, 0.06); margin: 0 -0.85rem; padding-left: 0.85rem; padding-right: 0.85rem; border-bottom: 1px solid rgba(16, 185, 129, 0.25); }
.dz-area-list { max-height: 150px; overflow-y: auto; border: 1px solid var(--border-color); border-radius: var(--radius-md); margin-top: 0.45rem; scrollbar-width: thin; }
.dz-area-list table { font-size: 0.68rem; }
.dz-area-list td, .dz-area-list th { padding: 0.2rem 0.4rem; }
.dz-area-list select { padding: 0.1rem 0.3rem; font-size: 0.66rem; }
.dz-area-list tr.sel td { background: rgba(16, 185, 129, 0.12); }
#dz-auto-log { white-space: pre-line; font-family: var(--font-mono); font-size: 0.64rem; }
