/* ── RESET & BASE ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
  font-family: 'Segoe UI', Arial, sans-serif;
  background: #f0f4f8;
  color: #1a2332;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── MOBILE TOPBAR ───────────────────────────────────── */
.mobile-topbar {
  display: none;
  align-items: center;
  gap: 12px;
  background: #fff;
  border-bottom: 1px solid #dde3ea;
  padding: 12px 16px;
  position: sticky;
  top: 0;
  z-index: 200;
}
.mobile-logo { font-size: 16px; font-weight: 700; color: #1a56db; }
.hamburger {
  background: none; border: none; font-size: 20px;
  cursor: pointer; color: #374151; padding: 2px 6px;
  border-radius: 6px;
}
.hamburger:hover { background: #f3f4f6; }

/* ── SIDEBAR OVERLAY ─────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 299;
}
.sidebar-overlay.active { display: block; }

/* ── SIDEBAR ─────────────────────────────────────────── */
.sidebar {
  width: 240px;
  min-height: 100vh;
  background: #fff;
  border-right: 1px solid #dde3ea;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 300;
  overflow-y: auto;
  transition: transform 0.25s ease;
}
.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 16px 14px;
  border-bottom: 1px solid #dde3ea;
}
.logo-icon { font-size: 26px; }
.logo-name { font-size: 15px; font-weight: 700; color: #1a56db; }
.logo-sub { font-size: 10px; color: #9ca3af; margin-top: 1px; }
.nav-section {
  padding: 14px 16px 4px;
  font-size: 10px; font-weight: 700;
  color: #9ca3af; letter-spacing: 0.8px;
  text-transform: uppercase;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px; margin: 1px 8px;
  border-radius: 7px; font-size: 13px;
  color: #374151; text-decoration: none;
  transition: all 0.15s; cursor: pointer;
  position: relative;
}
.nav-item:hover { background: #eff6ff; color: #1a56db; }
.nav-item.active { background: #eff6ff; color: #1a56db; font-weight: 600; }
.nav-item.nav-soon { opacity: 0.5; pointer-events: none; }
.nav-icon { font-size: 16px; width: 20px; text-align: center; }
.nav-badge {
  margin-left: auto; background: #eff6ff; color: #1a56db;
  font-size: 9px; font-weight: 700; padding: 2px 6px;
  border-radius: 10px; letter-spacing: 0.3px;
}
.nav-soon-tag {
  margin-left: auto; background: #f3f4f6; color: #9ca3af;
  font-size: 9px; font-weight: 600; padding: 2px 6px;
  border-radius: 10px;
}
.sidebar-footer {
  margin-top: auto; padding: 14px 16px;
  font-size: 10px; color: #d1d5db;
  border-top: 1px solid #f3f4f6;
}

/* ── MAIN CONTENT ────────────────────────────────────── */
body { flex-direction: row; }
.main-content {
  margin-left: 240px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow: hidden;
}

/* ── PAGE HEADER (calculator pages) ─────────────────── */
.page-header {
  background: #fff;
  border-bottom: 1px solid #dde3ea;
  padding: 14px 24px;
  display: flex; align-items: center;
  justify-content: space-between; gap: 12px;
  flex-wrap: wrap;
}
.page-header h1 { font-size: 17px; font-weight: 700; color: #111827; }
.std-badge {
  background: #eff6ff; color: #1a56db;
  font-size: 11px; font-weight: 600;
  padding: 3px 10px; border-radius: 20px;
}

/* ── TABS (calculator pages) ─────────────────────────── */
.calc-tabs {
  display: flex; background: #fff;
  border-bottom: 2px solid #dde3ea;
  padding: 0 20px; gap: 0;
}
.calc-tab {
  padding: 10px 20px; font-size: 13px; font-weight: 600;
  color: #6b7280; cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px; transition: all 0.15s;
  user-select: none;
}
.calc-tab.active { color: #1a56db; border-bottom-color: #1a56db; }
.calc-tab:hover { color: #1a56db; }
.calc-tab-section { display: none; }
.calc-tab-section.active { display: block; }

/* ── CALC CONTENT AREA ───────────────────────────────── */
.calc-content { flex: 1; padding: 16px 20px; overflow: auto; }

/* ── HERO (homepage) ─────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, #1a56db 0%, #1e3a8a 100%);
  color: #fff; padding: 48px 32px;
  display: flex; align-items: center;
  justify-content: space-between; gap: 24px;
}
.hero-text h1 { font-size: 32px; font-weight: 800; line-height: 1.2; margin-bottom: 12px; }
.hero-text p { font-size: 14px; color: #bfdbfe; max-width: 480px; line-height: 1.6; margin-bottom: 22px; }
.hero-visual { font-size: 80px; opacity: 0.15; }

/* ── STATS BAR ───────────────────────────────────────── */
.stats-bar {
  display: flex; background: #1e3a8a;
  border-top: 1px solid rgba(255,255,255,0.1);
}
.stat { flex: 1; padding: 14px 20px; text-align: center; border-right: 1px solid rgba(255,255,255,0.1); }
.stat:last-child { border-right: none; }
.stat-val { font-size: 20px; font-weight: 700; color: #fff; }
.stat-lbl { font-size: 10px; color: #93c5fd; margin-top: 2px; text-transform: uppercase; letter-spacing: 0.5px; }

/* ── SECTIONS ────────────────────────────────────────── */
.section { padding: 28px 28px 0; }
.section-title { font-size: 16px; font-weight: 700; color: #111827; margin-bottom: 16px; }

/* ── CALCULATOR CARDS ────────────────────────────────── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  padding-bottom: 28px;
}
.calc-card {
  background: #fff; border: 1px solid #dde3ea;
  border-radius: 12px; padding: 18px;
  display: flex; gap: 14px; align-items: flex-start;
  text-decoration: none; color: inherit;
  transition: all 0.2s;
  position: relative;
}
.calc-card.available:hover {
  border-color: #1a56db;
  box-shadow: 0 4px 16px rgba(26,86,219,0.1);
  transform: translateY(-2px);
}
.calc-card.soon { opacity: 0.65; }
.card-icon { font-size: 28px; flex-shrink: 0; margin-top: 2px; }
.card-title { font-size: 14px; font-weight: 700; color: #111827; margin-bottom: 5px; }
.card-desc { font-size: 12px; color: #6b7280; line-height: 1.5; margin-bottom: 10px; }
.card-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.card-tags span {
  background: #f1f5f9; color: #475569;
  font-size: 10px; font-weight: 600;
  padding: 2px 7px; border-radius: 10px;
}
.card-arrow { margin-left: auto; font-size: 18px; color: #1a56db; align-self: center; }
.soon-badge {
  background: #fef3c7; color: #d97706;
  font-size: 10px; font-weight: 600;
  padding: 2px 8px; border-radius: 10px;
  margin-left: 6px; vertical-align: middle;
}

/* ── BUTTONS ─────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 8px 16px; border-radius: 7px;
  font-size: 13px; font-weight: 600;
  cursor: pointer; border: none;
  transition: all 0.15s; white-space: nowrap;
  text-decoration: none;
}
.btn-primary { background: #1a56db; color: #fff; }
.btn-primary:hover { background: #1648c0; }
.btn-lg { padding: 12px 24px; font-size: 14px; }
.btn-success { background: #059669; color: #fff; }
.btn-success:hover { background: #047857; }
.btn-outline { background: #fff; color: #374151; border: 1px solid #d1d5db; }
.btn-outline:hover { background: #f9fafb; }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-danger { background: #fee2e2; color: #dc2626; border: 1px solid #fca5a5; }

/* ── DATA GRID (cable sizing) ────────────────────────── */
.grid-wrap { overflow-x: auto; border: 1px solid #dde3ea; border-radius: 10px; background: #fff; }
table { width: 100%; border-collapse: collapse; font-size: 12px; min-width: 1400px; }
thead tr { background: #f1f5f9; }
th {
  padding: 8px; text-align: center;
  font-weight: 600; font-size: 10px;
  color: #6b7280; text-transform: uppercase;
  letter-spacing: 0.4px;
  border-bottom: 2px solid #dde3ea;
  border-right: 1px solid #e5e7eb;
  white-space: nowrap;
}
th:last-child { border-right: none; }
td {
  padding: 4px; border-bottom: 1px solid #f3f4f6;
  border-right: 1px solid #f3f4f6;
  text-align: center; vertical-align: middle;
}
td:last-child { border-right: none; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafbff; }
td input, td select {
  width: 100%; border: 1px solid transparent;
  border-radius: 4px; padding: 4px 5px;
  font-size: 12px; color: #111827;
  background: transparent; outline: none; text-align: center;
}
td input:focus, td select:focus {
  border-color: #1a56db; background: #fff;
  box-shadow: 0 0 0 2px rgba(26,86,219,0.08);
}
th.grp-input  { background: #e0e7ff; color: #3730a3; }
th.grp-result { background: #d1fae5; color: #065f46; }
th.grp-status { background: #fef3c7; color: #92400e; }
.r-cable  { font-weight: 700; color: #1a56db; font-size: 13px; }
.r-ok     { color: #059669; font-weight: 600; }
.r-warn   { color: #d97706; font-weight: 600; }
.r-err    { color: #dc2626; font-weight: 600; }
.r-neutral{ color: #9ca3af; }
.del-btn  { background: none; border: none; cursor: pointer; color: #dc2626; font-size: 14px; padding: 2px 6px; border-radius: 4px; }
.del-btn:hover { background: #fee2e2; }

/* ── SUMMARY CARDS ───────────────────────────────────── */
.summary-bar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.s-card { flex: 1; min-width: 110px; background: #fff; border: 1px solid #dde3ea; border-radius: 8px; padding: 10px 13px; }
.s-card .lbl { font-size: 10px; color: #6b7280; font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; }
.s-card .val { font-size: 20px; font-weight: 700; color: #1a56db; margin-top: 2px; }

/* ── TOOLBAR ─────────────────────────────────────────── */
.toolbar { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; align-items: center; }
.toolbar-right { margin-left: auto; display: flex; gap: 8px; }

/* ── LIBRARY TABLE ───────────────────────────────────── */
.lib-table { border: 1px solid #dde3ea; border-radius: 10px; overflow: hidden; background: #fff; }
.lib-table table { min-width: 600px; }
.lib-table th { background: #f1f5f9; font-size: 11px; padding: 9px 12px; text-align: left; border-bottom: 1px solid #dde3ea; font-weight: 600; color: #374151; }
.lib-table td { padding: 8px 12px; font-size: 12px; border-bottom: 1px solid #f3f4f6; text-align: left; }
.lib-table tr:last-child td { border-bottom: none; }

/* ── SPINNER ─────────────────────────────────────────── */
.spinner { display: none; width: 14px; height: 14px; border: 2px solid #fff; border-top-color: transparent; border-radius: 50%; animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── TOAST ───────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 20px; right: 20px;
  background: #1a2332; color: #fff;
  padding: 10px 18px; border-radius: 8px;
  font-size: 13px; font-weight: 500;
  opacity: 0; transition: opacity 0.3s;
  z-index: 999; pointer-events: none;
}
.toast.show { opacity: 1; }

/* ── FOOTER ──────────────────────────────────────────── */
.footer {
  margin-top: auto; padding: 16px 28px;
  font-size: 11px; color: #9ca3af;
  border-top: 1px solid #e5e7eb;
  background: #fff;
}

/* ── RESPONSIVE ──────────────────────────────────────── */
@media (max-width: 768px) {
  .mobile-topbar { display: flex; }
  .sidebar {
    transform: translateX(-100%);
    top: 0;
  }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  body { flex-direction: column; }
  .hero { padding: 28px 20px; }
  .hero-text h1 { font-size: 24px; }
  .hero-visual { display: none; }
  .stats-bar { flex-wrap: wrap; }
  .section { padding: 20px 16px 0; }
  .calc-content { padding: 12px 14px; }
  .page-header { padding: 12px 16px; }
  .toolbar { gap: 6px; }
  .toolbar-right { margin-left: 0; width: 100%; }
}
