/* === İSG Hesap · custom styles === */

/* Hazard tape: 45° yellow/black diagonal stripes */
.hazard-tape {
  background-image: repeating-linear-gradient(
    45deg,
    #F5D000 0,
    #F5D000 14px,
    #0B0C0E 14px,
    #0B0C0E 28px
  );
}
.hazard-tape-thin {
  background-image: repeating-linear-gradient(
    45deg,
    #F5D000 0,
    #F5D000 8px,
    #0B0C0E 8px,
    #0B0C0E 16px
  );
}

/* Blueprint dot grid background */
.blueprint-bg {
  background-image:
    radial-gradient(circle at 1px 1px, rgba(231,233,236,0.05) 1px, transparent 0),
    linear-gradient(180deg, transparent 0%, rgba(245,208,0,0.012) 100%);
  background-size: 22px 22px, 100% 100%;
  mask-image: linear-gradient(180deg, black 0%, black 80%, transparent 100%);
}

/* === Nav === */
.nav-cat {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 0.875rem;
  font-family: 'Archivo Black','Archivo',sans-serif;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: #8A9099;
  text-transform: uppercase;
}
.nav-cat .num {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  color: #F5D000;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 1.25rem 0.5rem 1.875rem;
  font-size: 13px;
  color: #E7E9EC;
  border-left: 2px solid transparent;
  cursor: pointer;
  transition: background 120ms, color 120ms, border-color 120ms;
  position: relative;
}
.nav-link:hover {
  background: #1C1F24;
  border-left-color: #F5D000;
}
.nav-link.active {
  background: #1C1F24;
  border-left-color: #F5D000;
  color: #F5D000;
}
.nav-link .idx {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  color: #8A9099;
  width: 18px;
  flex-shrink: 0;
}
.nav-link.active .idx { color: #F5D000; }

/* === Module card === */
.module-card {
  background: #14161A;
  border: 1px solid #2A2E35;
  border-top: 3px solid #F5D000;
  position: relative;
}

/* Formula box */
.formula-box {
  background: #0B0C0E;
  border: 1px solid #2A2E35;
  padding: 1.5rem 1rem 1.25rem;
  text-align: center;
  position: relative;
  margin-top: 12px;
  /* overflow VISIBLE: ::before "FORMÜL" etiketinin kutu dışına çıkabilmesi için
     iç kaydırma .formula-inner'da yapılır */
}
.formula-inner {
  overflow-x: auto;
  max-width: 100%;
}

/* Diyagram kutusu (yan görünüm 2D SVG) */
.diagram-box {
  background: #0B0C0E;
  border: 1px solid #2A2E35;
  padding: 1.5rem 1rem 1rem;
  text-align: center;
  position: relative;
  margin: 1.5rem 0;
}
.diagram-box::before {
  content: "DİYAGRAM";
  position: absolute;
  top: -9px;
  left: 12px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: #F5D000;
  background: #14161A;
  padding: 2px 8px;
  line-height: 1;
  z-index: 2;
}
.diagram-box svg {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}
.diagram-inner {
  overflow-x: auto;
  max-width: 100%;
}
.formula-box::before {
  content: "FORMÜL";
  position: absolute;
  top: -9px;
  left: 12px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: #F5D000;
  background: #14161A;
  padding: 2px 8px;
  line-height: 1;
  z-index: 2;
}
.formula-box .katex { color: #E7E9EC; font-size: 1.15em; }
.formula-box .katex .mord, .formula-box .katex .mbin, .formula-box .katex .mrel { color: #E7E9EC; }
.formula-box .katex .mfrac line { stroke: #F5D000; }

/* Result LCD-style */
.result-box {
  background: linear-gradient(180deg, #0B0C0E 0%, #14161A 100%);
  border: 2px solid #F5D000;
  padding: 1.25rem 1.25rem;
  position: relative;
}
.result-box::before {
  content: "SONUC";
  position: absolute;
  top: -9px;
  left: 14px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.18em;
  color: #0B0C0E;
  background: #F5D000;
  padding: 1px 8px;
  font-weight: 700;
}
.result-value {
  font-family: 'IBM Plex Mono', monospace;
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  color: #F5D000;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  word-break: break-all;
}
.result-unit {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.8rem;
  color: #8A9099;
  margin-top: 0.5rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.result-flash {
  animation: flash 360ms ease-out;
}
@keyframes flash {
  0%   { box-shadow: 0 0 0 0 rgba(245,208,0,0.7); }
  60%  { box-shadow: 0 0 0 10px rgba(245,208,0,0); }
  100% { box-shadow: 0 0 0 0 rgba(245,208,0,0); }
}

/* Threshold bar */
.threshold-track {
  height: 8px;
  background: #1C1F24;
  border: 1px solid #2A2E35;
  position: relative;
  overflow: hidden;
}
.threshold-fill {
  height: 100%;
  transition: width 220ms ease, background 220ms ease;
}
.lvl-ok    { background: #4ADE80; }
.lvl-warn  { background: #F59E0B; }
.lvl-danger{ background: #EF4444; }
.threshold-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.55rem;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 1px solid currentColor;
}
.threshold-label.lvl-ok    { color: #4ADE80; }
.threshold-label.lvl-warn  { color: #F59E0B; }
.threshold-label.lvl-danger{ color: #EF4444; }

/* Inputs */
.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.field-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8A9099;
}
.field-label .sym {
  color: #F5D000;
  font-weight: 700;
}
.field-input {
  display: flex;
  align-items: stretch;
  background: #1C1F24;
  border: 1px solid #2A2E35;
}
.field-input:focus-within {
  border-color: #F5D000;
  box-shadow: 0 0 0 2px rgba(245,208,0,0.18);
}
.field-input input,
.field-input select {
  flex: 1;
  background: transparent;
  border: 0;
  padding: 0.55rem 0.75rem;
  color: #E7E9EC;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 14px;
  outline: none;
  width: 0;
  min-width: 0;
}
.field-input input[type=number]::-webkit-inner-spin-button {
  opacity: 0.4;
}
.field-input .unit-toggle {
  background: #0B0C0E;
  border-left: 1px solid #2A2E35;
  color: #F5D000;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  padding: 0 0.7rem;
  cursor: pointer;
  letter-spacing: 0.05em;
  font-weight: 600;
  min-width: 56px;
}
.field-input .unit-toggle:hover { background: #14161A; }

/* Risk matrix */
.risk-matrix {
  display: grid;
  grid-template-columns: auto repeat(5, 1fr);
  gap: 2px;
  background: #2A2E35;
  border: 1px solid #2A2E35;
}
.risk-cell {
  background: #1C1F24;
  padding: 0.7rem;
  text-align: center;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  cursor: pointer;
  transition: filter 120ms;
  position: relative;
  user-select: none;
}
.risk-cell:hover { filter: brightness(1.4); }
.risk-cell.head {
  background: #0B0C0E;
  color: #F5D000;
  font-size: 11px;
  letter-spacing: 0.1em;
  cursor: default;
}
.risk-cell.head:hover { filter: none; }
.risk-cell.lvl-low    { background: #1d3a1d; color: #4ADE80; }
.risk-cell.lvl-med    { background: #3a2e0f; color: #F59E0B; }
.risk-cell.lvl-high   { background: #3a1313; color: #EF4444; }
.risk-cell.selected {
  outline: 3px solid #F5D000;
  outline-offset: -3px;
  filter: brightness(1.4);
}

/* Reference table */
.ref-table {
  width: 100%;
  border-collapse: collapse;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
}
.ref-table th, .ref-table td {
  border: 1px solid #2A2E35;
  padding: 0.5rem 0.75rem;
  text-align: left;
}
.ref-table th {
  background: #0B0C0E;
  color: #F5D000;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.ref-table tbody tr:nth-child(odd) { background: #14161A; }
.ref-table tbody tr:nth-child(even) { background: #1C1F24; }

/* Note callout */
.note {
  border-left: 3px solid #F5D000;
  background: rgba(245,208,0,0.06);
  padding: 0.7rem 0.9rem;
  font-size: 13px;
  color: #E7E9EC;
}
.note strong { color: #F5D000; }

/* Section heading */
.section-heading {
  font-family: 'Archivo Black', sans-serif;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* Stencil number badge */
.stencil-num {
  display: inline-grid;
  place-items: center;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  background: #F5D000;
  color: #0B0C0E;
  padding: 2px 7px;
  letter-spacing: 0.05em;
}

/* Sidebar item stagger fade */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-stagger > * {
  opacity: 0;
  animation: fadeUp 240ms ease-out forwards;
}

/* Plus row (n-row tables) */
.row-add {
  border: 1px dashed #2A2E35;
  background: transparent;
  color: #F5D000;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  padding: 0.5rem;
  cursor: pointer;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  width: 100%;
}
.row-add:hover { background: rgba(245,208,0,0.06); border-color: #F5D000; }
.row-del {
  background: #1C1F24;
  border: 1px solid #2A2E35;
  color: #8A9099;
  font-family: 'IBM Plex Mono', monospace;
  padding: 0 0.6rem;
  cursor: pointer;
}
.row-del:hover { color: #EF4444; border-color: #EF4444; }

/* Print */
@media print {
  body { background: white !important; color: black !important; }
  #sidebar, .hazard-tape, .blueprint-bg, #legal-modal, .copy-btn, .print-hide { display: none !important; }
  main { color: black; }
  .module-card { border-color: #999; background: white; page-break-inside: avoid; }
  .result-box { border-color: black; background: #f5f5f5; }
  .result-value { color: black; }
  .formula-box { background: #f5f5f5; border-color: #999; }
  .formula-box .katex { color: black; }
  .field-input { background: white; border-color: #999; }
  .field-input input, .field-input select { color: black; }
}

/* Mobile sidebar */
@media (max-width: 1023px) {
  #sidebar {
    position: fixed;
    top: 8px;
    left: 0;
    bottom: 8px;
    width: 280px;
    z-index: 30;
    transform: translateX(-100%);
    transition: transform 200ms ease;
  }
  #sidebar.open {
    transform: translateX(0);
    box-shadow: 0 0 40px rgba(0,0,0,0.7);
  }
  .mobile-burger { display: inline-flex !important; }
}
.mobile-burger { display: none; }

/* Scrollbars */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: #0B0C0E; }
*::-webkit-scrollbar-thumb { background: #2A2E35; border: 2px solid #0B0C0E; }
*::-webkit-scrollbar-thumb:hover { background: #F5D000; }

/* Selection */
::selection { background: #F5D000; color: #0B0C0E; }
