/* ==========================================================================
   Keifa Steel Tools - Rebar Weight Calculator
   Design System: Dual-Theme (Crisp Engineering Light as Default + Dark Mode)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Theme Variables (Default: Clean High-End Engineering Light Theme)
   -------------------------------------------------------------------------- */
:root {
  /* Color Palette - Light Theme (Default) */
  --bg-primary: #f8fafc;
  --bg-secondary: #f1f5f9;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --bg-surface: #f1f5f9;
  --bg-input: #ffffff;
  
  --border-subtle: #e2e8f0;
  --border-focus: #d97706;
  --border-glow: rgba(217, 119, 6, 0.2);
  
  /* Text Colors */
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #64748b;
  
  /* Accent Colors */
  --amber-primary: #d97706;
  --amber-hover: #b45309;
  --amber-glow: rgba(217, 119, 6, 0.15);
  --amber-surface: #fef3c7;
  --amber-text: #92400e;
  
  --cyan-primary: #0284c7;
  --cyan-surface: #e0f2fe;
  --cyan-glow: rgba(2, 132, 199, 0.2);
  
  --green-primary: #10b981;
  --green-surface: #d1fae5;
  
  --red-primary: #ef4444;
  --red-surface: #fee2e2;

  /* Elevation Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  --shadow-glow: 0 0 20px rgba(217, 119, 6, 0.12);

  /* Geometry & Transition */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-full: 9999px;
  --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);

  /* Specific Component Colors */
  --topbar-bg: rgba(255, 255, 255, 0.88);
  --results-card-bg: #ffffff;
  --results-card-border: #e2e8f0;
  --svg-viewport-bg: #f8fafc;
  --svg-viewport-border: #cbd5e1;
  --stat-box-bg: #f8fafc;
  --table-th-bg: #f1f5f9;
  --table-hover-bg: #f8fafc;
  --summary-strip-bg: #f8fafc;
}

/* --------------------------------------------------------------------------
   2. Dark Theme Overrides (Active when data-theme="dark")
   -------------------------------------------------------------------------- */
[data-theme="dark"] {
  --bg-primary: #090d16;
  --bg-secondary: #0f172a;
  --bg-card: rgba(17, 24, 39, 0.88);
  --bg-card-hover: rgba(30, 41, 59, 0.95);
  --bg-surface: #1e293b;
  --bg-input: #0b1120;
  
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: #f59e0b;
  --border-glow: rgba(245, 158, 11, 0.25);
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --amber-primary: #f59e0b;
  --amber-hover: #d97706;
  --amber-glow: rgba(245, 158, 11, 0.2);
  --amber-surface: rgba(245, 158, 11, 0.12);
  --amber-text: #fbbf24;
  
  --cyan-primary: #38bdf8;
  --cyan-surface: rgba(56, 189, 248, 0.12);
  --cyan-glow: rgba(56, 189, 248, 0.25);
  
  --green-primary: #10b981;
  --green-surface: rgba(16, 185, 129, 0.12);
  
  --red-primary: #ef4444;
  --red-surface: rgba(239, 68, 68, 0.12);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 25px rgba(245, 158, 11, 0.2);

  --topbar-bg: rgba(9, 13, 22, 0.85);
  --results-card-bg: linear-gradient(145deg, rgba(24, 33, 49, 0.95), rgba(15, 23, 42, 0.9));
  --results-card-border: rgba(245, 158, 11, 0.35);
  --svg-viewport-bg: radial-gradient(circle at 50% 50%, #152033, #090e18 80%);
  --svg-viewport-border: rgba(255, 255, 255, 0.08);
  --stat-box-bg: rgba(11, 17, 32, 0.6);
  --table-th-bg: #111827;
  --table-hover-bg: rgba(30, 41, 59, 0.5);
  --summary-strip-bg: #0f172a;
}

/* --------------------------------------------------------------------------
   3. Global Layout & Resets
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(ellipse at 50% 0%, rgba(217, 119, 6, 0.06), transparent 45%),
    radial-gradient(circle at 90% 80%, rgba(2, 132, 199, 0.04), transparent 35%),
    linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 50%, var(--bg-primary) 100%);
  color: var(--text-main);
  font-family: 'Cairo', 'Inter', system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color 0.25s ease, color 0.25s ease;
}

[data-theme="dark"] body {
  background-image: 
    radial-gradient(ellipse at 50% 0%, rgba(245, 158, 11, 0.12), transparent 45%),
    radial-gradient(circle at 90% 80%, rgba(56, 189, 248, 0.08), transparent 35%),
    linear-gradient(180deg, var(--bg-primary) 0%, #0c1220 50%, var(--bg-primary) 100%);
}

.mono {
  font-family: 'JetBrains Mono', 'Inter', monospace;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
}

.shell {
  width: 100%;
  max-width: 1260px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* --------------------------------------------------------------------------
   4. Header & Topbar
   -------------------------------------------------------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--topbar-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.75rem 0;
  transition: var(--transition);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-decoration: none;
  color: inherit;
}

.brand-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--amber-surface);
  border: 1px solid rgba(217, 119, 6, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--amber-primary);
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

[data-theme="dark"] .brand-icon {
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border-color: rgba(245, 158, 11, 0.4);
}

.brand-info h1 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.25;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brand-info h1 .badge {
  font-size: 0.68rem;
  font-weight: 700;
  background: var(--amber-surface);
  color: var(--amber-primary);
  border: 1px solid rgba(217, 119, 6, 0.3);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.brand-info p {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.control-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 0.4rem 0.85rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.control-pill:hover, .control-pill:focus-within {
  border-color: var(--amber-primary);
  color: var(--text-main);
  box-shadow: 0 0 10px rgba(217, 119, 6, 0.15);
}

.control-pill select {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  outline: none;
}

.control-pill select option {
  background-color: var(--bg-card);
  color: var(--text-main);
}

/* --------------------------------------------------------------------------
   5. Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.55rem 1.1rem;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--amber-primary), #b45309);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(217, 119, 6, 0.28);
}

[data-theme="dark"] .btn-primary {
  background: linear-gradient(135deg, var(--amber-primary), #d97706);
  color: #0b0f17;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #f59e0b, var(--amber-primary));
  box-shadow: 0 6px 18px rgba(217, 119, 6, 0.38);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  background: var(--bg-surface);
  border-color: var(--amber-primary);
  color: var(--amber-primary);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border-subtle);
}

.btn-ghost:hover {
  color: var(--text-main);
  border-color: var(--amber-primary);
  background: var(--amber-surface);
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

/* --------------------------------------------------------------------------
   6. Ads Container
   -------------------------------------------------------------------------- */
.ad-container {
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  margin: 1.25rem auto;
  width: 100%;
}

/* --------------------------------------------------------------------------
   7. Hero Section
   -------------------------------------------------------------------------- */
.hero {
  padding: 2rem 0 1.25rem;
  text-align: center;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--amber-surface);
  border: 1px solid rgba(217, 119, 6, 0.3);
  color: var(--amber-text);
  padding: 0.35rem 1rem;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: 0.85rem;
}

.hero h2 {
  font-size: 2.2rem;
  font-weight: 900;
  color: var(--text-main);
  letter-spacing: -0.02em;
  margin-bottom: 0.65rem;
}

.hero h2 span {
  background: linear-gradient(135deg, #b45309, var(--amber-primary) 50%, var(--cyan-primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

[data-theme="dark"] .hero h2 span {
  background: linear-gradient(135deg, #fbbf24, #f59e0b 50%, #38bdf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 720px;
  margin: 0 auto;
}

/* Formula Banner */
.formula-banner {
  display: inline-flex;
  align-items: center;
  gap: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-lg);
  margin-top: 1.25rem;
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
  justify-content: center;
}

.formula-step {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-main);
}

.formula-step .badge-step {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--amber-primary);
  color: #ffffff;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
}

.formula-arrow {
  color: var(--amber-primary);
  font-weight: 800;
}

.formula-math {
  background: var(--bg-surface);
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  color: var(--cyan-primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  font-weight: 700;
  border: 1px dashed rgba(2, 132, 199, 0.3);
}

/* --------------------------------------------------------------------------
   8. Navigation Tabs
   -------------------------------------------------------------------------- */
.section-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.75rem;
  overflow-x: auto;
}

.nav-tab {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 0.65rem 1.25rem;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}

.nav-tab:hover {
  color: var(--text-main);
  background: var(--bg-surface);
}

.nav-tab.active {
  background: var(--amber-surface);
  color: var(--amber-primary);
  border-color: rgba(217, 119, 6, 0.3);
}

/* --------------------------------------------------------------------------
   9. Calculator Grid Layout
   -------------------------------------------------------------------------- */
.calc-layout {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 1.5rem;
  margin-top: 1.5rem;
  margin-bottom: 2.5rem;
}

@media (max-width: 960px) {
  .calc-layout {
    grid-template-columns: 1fr;
  }
}

.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 1.75rem;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
  position: relative;
}

.glass-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--amber-primary), transparent);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

.card-title-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.card-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: var(--amber-surface);
  border: 1px solid rgba(217, 119, 6, 0.3);
  color: var(--amber-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.card-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-main);
}

.card-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   10. Input Groups & Controls
   -------------------------------------------------------------------------- */
.input-section {
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
}

.input-block {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.input-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.input-label {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.input-helper {
  font-size: 0.78rem;
  color: var(--amber-primary);
  font-weight: 700;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-control {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  font-family: inherit;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  outline: none;
}

.input-control:focus {
  border-color: var(--amber-primary);
  box-shadow: 0 0 0 3px var(--border-glow);
}

.input-suffix {
  position: absolute;
  left: 1rem;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.88rem;
  pointer-events: none;
}

[dir="rtl"] .input-wrapper .input-control {
  padding-left: 3.8rem;
}

[dir="ltr"] .input-suffix {
  left: auto;
  right: 1rem;
}

[dir="ltr"] .input-wrapper .input-control {
  padding-right: 3.8rem;
}

/* Quick Diameter Chips */
.diameter-chips {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(68px, 1fr));
  gap: 0.5rem;
  margin-top: 0.4rem;
}

.dia-chip {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.35rem;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-muted);
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.dia-chip small {
  font-size: 0.66rem;
  font-weight: 600;
  color: var(--text-dim);
}

.dia-chip:hover {
  background: var(--bg-card);
  color: var(--amber-primary);
  border-color: var(--amber-primary);
  transform: translateY(-1px);
}

.dia-chip.active {
  background: linear-gradient(135deg, var(--amber-primary), #b45309);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.3);
}

[data-theme="dark"] .dia-chip.active {
  background: linear-gradient(135deg, var(--amber-primary), #d97706);
  color: #090d16;
}

.dia-chip.active small {
  color: rgba(255, 255, 255, 0.9);
}

[data-theme="dark"] .dia-chip.active small {
  color: rgba(9, 13, 22, 0.85);
}

/* Presets Bar */
.presets-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 0.4rem;
}

.preset-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.preset-btn:hover {
  background: var(--bg-card);
  color: var(--text-main);
  border-color: var(--amber-primary);
}

.preset-btn.active {
  background: var(--amber-surface);
  color: var(--amber-primary);
  border-color: var(--amber-primary);
  font-weight: 700;
}

/* Stepper buttons */
.stepper-btn-group {
  display: flex;
  gap: 0.35rem;
}

.stepper-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.stepper-btn:hover {
  color: var(--amber-primary);
  border-color: var(--amber-primary);
  background: var(--bg-card);
}

/* --------------------------------------------------------------------------
   11. Live Rebar Visualizer
   -------------------------------------------------------------------------- */
.visualizer-container {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.visualizer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}

.svg-viewport {
  width: 100%;
  height: 160px;
  background: var(--svg-viewport-bg);
  border-radius: var(--radius-md);
  border: 1px dashed var(--svg-viewport-border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.svg-viewport svg {
  width: 100%;
  height: 100%;
}

/* --------------------------------------------------------------------------
   12. Results Panel (Right Column)
   -------------------------------------------------------------------------- */
.results-hero-card {
  background: var(--results-card-bg);
  border: 1px solid var(--results-card-border);
  box-shadow: var(--shadow-md);
  border-radius: var(--radius-xl);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  position: relative;
}

.primary-stat {
  text-align: center;
  padding: 1.25rem;
  background: var(--stat-box-bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
}

.primary-stat-label {
  font-size: 0.88rem;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.35rem;
}

.primary-stat-val {
  font-size: 3rem;
  font-weight: 900;
  color: var(--text-main);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.primary-stat-val span {
  color: var(--amber-primary);
  font-size: 1.4rem;
  font-weight: 700;
  margin-inline-start: 0.35rem;
}

.primary-stat-sub {
  margin-top: 0.4rem;
  font-size: 1.1rem;
  color: var(--cyan-primary);
  font-weight: 700;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.85rem;
}

.stat-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem 0.85rem;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.stat-item:hover {
  border-color: var(--amber-primary);
  transform: translateY(-2px);
}

.stat-item-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
}

.stat-item-val {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
}

.stat-item-val small {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-weight: 600;
  margin-inline-start: 0.25rem;
}

.highlight-stat-box {
  background: var(--green-surface);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.highlight-stat-info h4 {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 700;
}

.highlight-stat-info p {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-main);
}

.results-actions {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

/* Accordion */
.accordion {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  overflow: hidden;
}

.accordion-summary {
  padding: 0.85rem 1rem;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
  list-style: none;
}

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

.accordion-summary:hover {
  color: var(--text-main);
}

.accordion-body {
  padding: 1rem;
  border-top: 1px solid var(--border-subtle);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  background: var(--bg-card);
}

/* --------------------------------------------------------------------------
   13. Bar Bending Schedule (BBS)
   -------------------------------------------------------------------------- */
.schedule-section {
  margin-bottom: 3rem;
}

.schedule-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.schedule-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.schedule-toolbar {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.table-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.rebar-table {
  width: 100%;
  border-collapse: collapse;
  text-align: start;
  font-size: 0.88rem;
}

.rebar-table th {
  background: var(--table-th-bg);
  color: var(--text-muted);
  font-weight: 700;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.rebar-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-main);
  vertical-align: middle;
}

.rebar-table tbody tr {
  transition: var(--transition);
}

.rebar-table tbody tr:hover {
  background: var(--table-hover-bg);
}

.rebar-table td .tag-dia {
  display: inline-block;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  background: var(--amber-surface);
  color: var(--amber-primary);
  font-weight: 700;
  font-size: 0.82rem;
  border: 1px solid rgba(217, 119, 6, 0.25);
}

.table-input {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.6rem;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.85rem;
  width: 100%;
  min-width: 90px;
  outline: none;
  transition: var(--transition);
}

.table-input:focus {
  border-color: var(--amber-primary);
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.table-action-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-dim);
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.table-action-btn:hover {
  color: var(--text-main);
  background: var(--bg-surface);
}

.table-action-btn.delete:hover {
  color: var(--red-primary);
  background: var(--red-surface);
}

.project-summary-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  background: var(--summary-strip-bg);
  border-top: 2px solid var(--amber-primary);
  padding: 1.25rem 1.5rem;
}

.summary-strip-card {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.summary-strip-title {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 700;
}

.summary-strip-val {
  font-size: 1.45rem;
  font-weight: 900;
  color: var(--text-main);
}

.summary-strip-val span {
  font-size: 0.85rem;
  color: var(--amber-primary);
  font-weight: 700;
  margin-inline-start: 0.3rem;
}

/* Diameter Distribution */
.dist-container {
  padding: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  margin-top: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.dist-header {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 1rem;
}

.dist-bars {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.dist-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.82rem;
}

.dist-label {
  min-width: 65px;
  font-weight: 700;
  color: var(--text-main);
}

.dist-progress-wrap {
  flex: 1;
  height: 10px;
  background: var(--border-subtle);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.dist-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--amber-primary), #fbbf24);
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
}

.dist-val {
  min-width: 90px;
  text-align: end;
  font-weight: 700;
  color: var(--cyan-primary);
}

/* --------------------------------------------------------------------------
   14. Standards Table
   -------------------------------------------------------------------------- */
.standards-section {
  margin-bottom: 3rem;
}

.standard-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg-surface);
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
}

.clickable-row {
  cursor: pointer;
}

.clickable-row:hover {
  background: var(--amber-surface) !important;
}

/* --------------------------------------------------------------------------
   15. Toast Notice
   -------------------------------------------------------------------------- */
.toast-notice {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 1100;
  background: var(--bg-card);
  border: 1px solid var(--amber-primary);
  color: var(--text-main);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

[dir="ltr"] .toast-notice {
  right: auto;
  left: 2rem;
}

.toast-notice.show {
  transform: translateY(0);
  opacity: 1;
}

/* --------------------------------------------------------------------------
   16. Footer
   -------------------------------------------------------------------------- */
.footer {
  border-top: 1px solid var(--border-subtle);
  padding: 2.5rem 0;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.85rem;
  background: var(--bg-card);
}

.footer a {
  color: var(--amber-primary);
  text-decoration: none;
  font-weight: 600;
}

.footer a:hover {
  text-decoration: underline;
}

/* --------------------------------------------------------------------------
   17. Print Stylesheet
   -------------------------------------------------------------------------- */
@media print {
  body {
    background: #fff !important;
    color: #000 !important;
  }

  .topbar, .ad-container, .adsbygoogle, .hero, .calc-layout, .section-nav, .schedule-toolbar, .dist-container, .modal-backdrop, .toast-notice, .footer, .table-actions {
    display: none !important;
  }

  .shell {
    max-width: 100% !important;
    padding: 0 !important;
  }

  .print-only-header {
    display: block !important;
    margin-bottom: 2rem;
    border-bottom: 2px solid #000;
    padding-bottom: 1rem;
  }

  .rebar-table {
    border: 1px solid #333 !important;
    font-size: 10pt !important;
  }

  .rebar-table th {
    background: #e2e8f0 !important;
    color: #000 !important;
    border: 1px solid #333 !important;
  }

  .rebar-table td {
    color: #000 !important;
    border: 1px solid #ccc !important;
  }

  .project-summary-strip {
    background: #f8fafc !important;
    border: 1px solid #333 !important;
    color: #000 !important;
  }

  .summary-strip-val {
    color: #000 !important;
  }
}

.print-only-header {
  display: none;
}
