/* ==========================================================================
   Keifa Civil & Finish Tools - Universal Engineering Design System
   Brand: Keifa Tools (keifa.net)
   ========================================================================== */

:root {
  --bg: #071311;
  --bg-2: #0b1c19;
  --bg-3: #112521;
  --ink: #f7fbf4;
  --ink-secondary: #d1ded7;
  --muted: #8ea59b;
  --soft: #e2ece3;
  --panel: rgba(12, 29, 26, 0.85);
  --panel-solid: #10231f;
  --panel-glass: rgba(16, 35, 31, 0.72);
  --panel-border: rgba(255, 255, 255, 0.12);
  --line: rgba(255, 255, 255, 0.12);
  --line-focus: rgba(115, 199, 223, 0.6);

  --amber: #f0bf63;
  --amber-soft: rgba(240, 191, 99, 0.16);
  --amber-ink: #211604;
  --teal: #73c7df;
  --teal-soft: rgba(115, 199, 223, 0.16);
  --teal-glow: rgba(115, 199, 223, 0.3);
  --coral: #f87171;
  --green: #4ade80;
  --green-glow: rgba(74, 222, 128, 0.25);
  --blue: #38bdf8;
  --slate: #94a3b8;

  --shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 12px 36px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 24px 70px rgba(0, 0, 0, 0.55);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-pill: 9999px;
  --trans: 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% 0%, rgba(115, 199, 223, 0.12), transparent 45%),
    linear-gradient(180deg, var(--bg) 0%, #091715 45%, #0d1b18 100%);
  font-family: Cairo, Inter, system-ui, -apple-system, sans-serif;
  overflow-x: hidden;
  line-height: 1.6;
}

/* Engineering Blueprint Grid Background Overlay */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at 50% 30%, #000 40%, transparent 85%);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 85% 15%, rgba(240, 191, 99, 0.06), transparent 45%),
    radial-gradient(ellipse at 15% 80%, rgba(115, 199, 223, 0.06), transparent 45%);
}

button, input, select {
  font: inherit;
  color: inherit;
}

.shell {
  width: min(1260px, calc(100% - 32px));
  margin-inline: auto;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 10;
}

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

.brand .logo {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--amber) 0%, #d49f3e 100%);
  color: var(--amber-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(240, 191, 99, 0.35);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-text b {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--ink);
}

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

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.control-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--panel-glass);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: var(--trans);
}

.control-pill:hover {
  border-color: var(--teal);
  background: rgba(255, 255, 255, 0.08);
}

.control-pill select {
  background: transparent;
  border: none;
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
}

.control-pill select option {
  background: #0d1e1a;
  color: var(--ink);
}

.pill-icon {
  font-size: 0.95rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  transition: var(--trans);
  border: 1px solid transparent;
  text-decoration: none;
}

.btn-ghost {
  background: var(--panel-glass);
  border-color: var(--panel-border);
  color: var(--ink-secondary);
}

.btn-ghost:hover {
  border-color: var(--teal);
  color: #fff;
  background: rgba(115, 199, 223, 0.12);
}

.btn-sm {
  padding: 5px 12px;
  font-size: 0.8rem;
}

.btn-outline {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--ink-secondary);
}

.btn-outline:hover {
  background: var(--amber-soft);
  border-color: var(--amber);
  color: var(--amber);
}

/* ==========================================================================
   Ad Banner Wrapper
   ========================================================================== */

.ad-wrapper {
  margin: 16px auto;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-md);
  border: 1px dashed rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

/* ==========================================================================
   Hero & Navigation Tabs
   ========================================================================== */

.hero {
  padding: 24px 0 16px;
  text-align: center;
}

.hero-copy {
  max-width: 820px;
  margin: 0 auto 24px;
}

.eyebrow {
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--amber);
  background: var(--amber-soft);
  padding: 4px 14px;
  border-radius: var(--radius-pill);
  margin-bottom: 12px;
  border: 1px solid rgba(240, 191, 99, 0.28);
}

.hero h1 {
  font-size: clamp(1.6rem, 3.5vw, 2.4rem);
  font-weight: 900;
  line-height: 1.25;
  margin: 0 0 12px;
  background: linear-gradient(135deg, #ffffff 40%, var(--teal) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p {
  color: var(--muted);
  font-size: 1rem;
  margin: 0;
  line-height: 1.6;
}

/* Calculator Tabs Bar */
.nav-tabs-wrapper {
  overflow-x: auto;
  scrollbar-width: thin;
  padding: 4px 0 12px;
}

.nav-tabs {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: max-content;
  margin: 0 auto;
  padding: 6px;
  background: var(--panel-glass);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(12px);
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: transparent;
  border: none;
  border-radius: var(--radius-pill);
  color: var(--ink-secondary);
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--trans);
  white-space: nowrap;
}

.tab-btn .tab-icon {
  font-size: 1.15rem;
}

.tab-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.tab-btn.active {
  background: linear-gradient(135deg, var(--teal) 0%, #0284c7 100%);
  color: #041b24;
  box-shadow: 0 4px 18px var(--teal-glow);
}

/* ==========================================================================
   Calculators Main Container & Panels
   ========================================================================== */

.main-calculator-container {
  margin-top: 10px;
}

.calculator-panel {
  display: none;
  animation: fadeIn 0.25s ease-out;
}

.calculator-panel.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.panel-header-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.header-titles {
  max-width: 780px;
}

.header-titles h2 {
  font-size: 1.55rem;
  font-weight: 800;
  margin: 6px 0;
  color: #ffffff;
}

.header-titles p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.panel-header-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.badge {
  display: inline-block;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
}

.badge-amber {
  background: var(--amber-soft);
  color: var(--amber);
  border: 1px solid rgba(240, 191, 99, 0.3);
}

.badge-teal {
  background: var(--teal-soft);
  color: var(--teal);
  border: 1px solid rgba(115, 199, 223, 0.3);
}

/* Two Column Layout Grid */
.calc-layout-grid {
  display: grid;
  grid-template-columns: 1fr 1.08fr;
  gap: 22px;
  align-items: start;
}

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

/* Cards */
.calc-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(16px);
}

.card-subtitle {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--soft);
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(115, 199, 223, 0.15);
  color: var(--teal);
  font-size: 0.82rem;
  font-weight: 800;
  border: 1px solid rgba(115, 199, 223, 0.3);
}

/* ==========================================================================
   Form Fields, Inputs, Selects
   ========================================================================== */

.form-grid-1 { display: grid; grid-template-columns: 1fr; gap: 14px; }
.form-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.form-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }

@media (max-width: 640px) {
  .form-grid-2, .form-grid-3, .form-grid-4 {
    grid-template-columns: 1fr;
  }
}

.input-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-field label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-secondary);
}

.input-field input,
.input-field select {
  width: 100%;
  padding: 10px 14px;
  background: rgba(7, 19, 17, 0.7);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
  transition: var(--trans);
  outline: none;
}

.input-field select option {
  background: #0d1e1a;
  color: #fff;
}

.input-field input:focus,
.input-field select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(115, 199, 223, 0.2);
  background: rgba(11, 26, 23, 0.9);
}

.input-field input[type="number"] {
  font-family: 'JetBrains Mono', monospace;
  direction: ltr;
  text-align: right;
}

[dir="ltr"] .input-field input[type="number"] {
  text-align: left;
}

/* Radio Pill Group */
.radio-pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  background: rgba(0, 0, 0, 0.25);
  padding: 5px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--panel-border);
}

.radio-pill {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--muted);
  transition: var(--trans);
  text-align: center;
  user-select: none;
}

.radio-pill input {
  display: none;
}

.radio-pill:has(input:checked) {
  background: var(--teal);
  color: #051a22;
  box-shadow: 0 3px 12px var(--teal-glow);
}

/* Custom Checkbox */
.checkbox-box-wrapper {
  display: flex;
  align-items: center;
  height: 100%;
  padding-top: 18px;
}

.custom-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink-secondary);
  user-select: none;
}

.custom-checkbox input {
  display: none;
}

.checkmark {
  width: 20px;
  height: 20px;
  border-radius: var(--radius-sm);
  background: rgba(7, 19, 17, 0.8);
  border: 1px solid var(--panel-border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--trans);
}

.custom-checkbox input:checked + .checkmark {
  background: var(--teal);
  border-color: var(--teal);
}

.custom-checkbox input:checked + .checkmark::after {
  content: "✓";
  color: #03151b;
  font-weight: 900;
  font-size: 13px;
}

/* ==========================================================================
   Live Results Column, Schematics & Metrics
   ========================================================================== */

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.results-badge {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--amber);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Schematic Live Canvas / SVG Preview */
.schematic-container {
  background: rgba(6, 17, 15, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 16px;
}

.schematic-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 0.8rem;
}

.schematic-title {
  color: var(--muted);
  font-weight: 700;
}

.schematic-stat {
  font-family: 'JetBrains Mono', monospace;
  color: var(--teal);
  font-weight: 700;
  background: rgba(115, 199, 223, 0.12);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}

.schematic-canvas-wrap {
  width: 100%;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.live-svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Metric Tiles Grid */
.metric-tiles-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

@media (max-width: 600px) {
  .metric-tiles-grid {
    grid-template-columns: 1fr;
  }
}

.metric-tile {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  transition: var(--trans);
}

.metric-tile:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.2);
}

.tile-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 4px;
}

.tile-val {
  font-size: 1.55rem;
  font-weight: 900;
  font-family: 'JetBrains Mono', monospace;
  color: #fff;
  line-height: 1.2;
}

.tile-val small {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  margin-inline-start: 4px;
}

.tile-sub {
  font-size: 0.74rem;
  color: var(--muted);
  margin-top: 4px;
}

.accent-teal {
  border-bottom: 3px solid var(--teal);
}
.accent-teal .tile-val { color: var(--teal); }

.accent-amber {
  border-bottom: 3px solid var(--amber);
}
.accent-amber .tile-val { color: var(--amber); }

.accent-green {
  border-bottom: 3px solid var(--green);
}
.accent-green .tile-val { color: var(--green); }

/* Packaging Box */
.packaging-box {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 18px;
}

.box-title {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--soft);
  margin: 0 0 12px;
}

.packaging-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

@media (max-width: 500px) {
  .packaging-grid {
    grid-template-columns: 1fr;
  }
}

.pkg-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.04);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.pkg-icon {
  font-size: 1.6rem;
}

.pkg-details {
  display: flex;
  flex-direction: column;
}

.pkg-details b {
  font-size: 1.25rem;
  font-family: 'JetBrains Mono', monospace;
  color: #fff;
  line-height: 1;
}

.pkg-details span {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 3px;
}

/* BOQ & Materials Tables */
.boq-table-wrapper {
  margin-top: 14px;
}

.table-title {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--soft);
  margin: 0 0 10px;
}

.boq-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.boq-table th {
  background: rgba(0, 0, 0, 0.35);
  color: var(--muted);
  font-weight: 700;
  padding: 9px 12px;
  text-align: right;
  border-bottom: 1px solid var(--panel-border);
}

[dir="ltr"] .boq-table th {
  text-align: left;
}

.boq-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--ink-secondary);
}

.boq-table tr:hover td {
  background: rgba(255, 255, 255, 0.025);
}

.boq-table td b {
  color: #fff;
  font-family: 'JetBrains Mono', monospace;
}

/* Rebar Schedule Grid (Steel) */
.rebar-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

@media (max-width: 500px) {
  .rebar-grid {
    grid-template-columns: 1fr;
  }
}

.rebar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
}

.rebar-tag {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--teal);
}

.rebar-len-input {
  width: 110px;
  padding: 5px 8px;
  background: rgba(7, 19, 17, 0.9);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  color: #fff;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  text-align: center;
}

/* ==========================================================================
   Units Converter Styling
   ========================================================================== */

.unit-cat-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.unit-cat-btn {
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-pill);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink-secondary);
  cursor: pointer;
  transition: var(--trans);
}

.unit-cat-btn:hover {
  border-color: var(--teal);
  color: #fff;
}

.unit-cat-btn.active {
  background: var(--teal);
  color: #03151b;
  box-shadow: 0 2px 10px var(--teal-glow);
}

.converter-box-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 14px;
  align-items: center;
}

@media (max-width: 680px) {
  .converter-box-grid {
    grid-template-columns: 1fr;
  }
}

.unit-box {
  background: rgba(7, 19, 17, 0.8);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  padding: 14px;
}

.unit-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.unit-select {
  background: #0e221e;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  color: #fff;
  padding: 6px 10px;
  font-size: 0.86rem;
  font-weight: 700;
}

.unit-box input {
  width: 100%;
  background: transparent;
  border: none;
  color: #fff;
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.5rem;
  font-weight: 800;
  outline: none;
}

.swap-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--panel-solid);
  border: 1px solid var(--panel-border);
  color: var(--teal);
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin: 0 auto;
  transition: var(--trans);
}

.swap-btn:hover {
  transform: rotate(180deg) scale(1.08);
  border-color: var(--teal);
  background: rgba(115, 199, 223, 0.15);
}

.unit-formula-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(240, 191, 99, 0.08);
  border: 1px solid rgba(240, 191, 99, 0.2);
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--amber);
}

.unit-equiv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.equiv-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
}

.equiv-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff;
}

.equiv-name {
  font-size: 0.74rem;
  color: var(--muted);
  margin-top: 2px;
}

/* ==========================================================================
   Saved Calculations History
   ========================================================================== */

.history-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.history-title-block {
  display: flex;
  align-items: center;
  gap: 10px;
}

.history-title-block h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
}

.text-btn {
  background: transparent;
  border: none;
  color: var(--coral);
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
}

.text-btn:hover {
  text-decoration: underline;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
}

.history-empty {
  color: var(--muted);
  font-size: 0.86rem;
  text-align: center;
  padding: 16px 0;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
  font-size: 0.86rem;
}

.history-item-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.history-tag {
  font-weight: 700;
  color: var(--teal);
  background: rgba(115, 199, 223, 0.1);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 0.76rem;
}

.history-item-date {
  color: var(--muted);
  font-size: 0.76rem;
}

/* ==========================================================================
   Footer
   ========================================================================== */

.footer {
  margin-top: 60px;
  padding: 30px 0 40px;
  border-top: 1px solid var(--line);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
}

.footer-brand b {
  font-size: 1.05rem;
  color: #fff;
}

.footer-brand p {
  color: var(--muted);
  font-size: 0.84rem;
  margin: 4px 0 0;
  max-width: 540px;
}

.footer-links {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

[dir="ltr"] .footer-links {
  align-items: flex-start;
}

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

.footer-copy {
  color: var(--muted);
  font-size: 0.78rem;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #15322c;
  color: #fff;
  padding: 10px 22px;
  border-radius: var(--radius-pill);
  font-weight: 700;
  font-size: 0.9rem;
  border: 1px solid var(--teal);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
  z-index: 1000;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast.hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(12px);
}

/* Utility Helpers */
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 18px; }
.mt-5 { margin-top: 30px; }
.mb-2 { margin-bottom: 8px; }

@media (max-width: 768px) {
  .hidden-mobile {
    display: none !important;
  }
}

/* ==========================================================================
   Print Stylesheet (@media print)
   Generates a pristine, contractor-ready Bill of Quantities / Quotation
   ========================================================================== */

@media print {
  body {
    background: #ffffff !important;
    color: #111827 !important;
    font-size: 11pt;
  }

  body::before, body::after,
  .topbar, .ad-wrapper, .nav-tabs-wrapper, .hero-copy,
  .panel-header-actions, .schematic-container, .history-section,
  .toast, #copyPaintBOQ, #copyTileBOQ, #copyConcreteBOQ,
  #copyBlockBOQ, #copyPlasterBOQ, #copySteelBOQ, #quickPrintBtn {
    display: none !important;
  }

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

  .calculator-panel {
    display: none !important;
  }

  .calculator-panel.active {
    display: block !important;
  }

  .calc-layout-grid {
    display: block !important;
  }

  .calc-card {
    background: #ffffff !important;
    border: 1px solid #d1d5db !important;
    color: #111827 !important;
    box-shadow: none !important;
    margin-bottom: 20px !important;
    page-break-inside: avoid;
  }

  .metric-tiles-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
  }

  .metric-tile {
    background: #f9fafb !important;
    border: 1px solid #e5e7eb !important;
    color: #111827 !important;
  }

  .metric-tile .tile-val {
    color: #111827 !important;
  }

  .boq-table th {
    background: #f3f4f6 !important;
    color: #1f2937 !important;
  }

  .boq-table td {
    color: #111827 !important;
    border-bottom: 1px solid #e5e7eb !important;
  }

  .boq-table td b {
    color: #000000 !important;
  }

  .footer {
    border-top: 1px solid #e5e7eb !important;
    color: #6b7280 !important;
    padding: 10px 0 !important;
  }
}
