/* ===========================
   Global Layout & Typography
   =========================== */

body {
  margin: 0;
  padding: 0;
  font-family: "Inter", "Segoe UI", Roboto, sans-serif;
  background: #f3f4f6;
  color: #1e293b;
  line-height: 1.5;
}

h1, h2 {
  font-weight: 600;
  color: #0f172a;
  margin-bottom: 0.5rem;
}

h1 {
  font-size: 1.9rem;
  margin-top: 1.5rem;
  text-align: center;
}

h2.section-title {
  margin-top: 2rem;
  font-size: 1.4rem;
}

/* ===========================
   Card Containers
   =========================== */

.card {
  background: #ffffff;
  border-radius: 10px;
  padding: 1.5rem;
  margin: 1.5rem auto;
  max-width: 1200px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* ===========================
   Instructions Block
   =========================== */

.instructions {
  max-width: 900px;
  margin: 1rem auto;
  padding: 1rem 1.5rem;
  background: #e2e8f0;
  border-left: 4px solid #3b82f6;
  border-radius: 6px;
  font-size: 0.95rem;
}

/* ===========================
   Diagram Styling
   =========================== */

.diagram-container {
  display: flex;
  justify-content: center;
  margin-top: 1rem;
}

#ishikawaSvg {
  width: 100%;
  max-width: 1100px;
  background: #ffffff;
  border-radius: 10px;
  padding: 1rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.editable {
  cursor: text;
  transition: background 0.2s ease;
}

.editable:hover {
  background: #e0f2fe;
}

/* Category labels */
[data-role="category-name"] {
  background: #e2e8f0;
  padding: 2px 6px;
  border-radius: 4px;
}

/* ===========================
   Controls Bar
   =========================== */

.controls-bar {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  margin: 1rem auto;
  max-width: 1100px;
}

.controls-bar button,
.export-buttons button {
  background: #3b82f6;
  color: white;
  border: none;
  padding: 0.55rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.2s ease;
}

.controls-bar button:hover,
.export-buttons button:hover {
  background: #2563eb;
}

.controls-bar select {
  padding: 0.45rem;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: white;
}

/* ===========================
   FMEA Table
   =========================== */

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 6px;
  font-size: 0.9rem;
}

thead th {
  background: #1e293b;
  color: white;
  padding: 0.6rem;
  text-align: left;
  font-weight: 500;
  position: sticky;
  top: 0;
}

tbody tr {
  background: #ffffff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

tbody td {
  padding: 0.5rem;
  vertical-align: middle;
}

tbody td .editable {
  padding: 4px;
  border-radius: 4px;
}

tbody td input[type="number"],
tbody td input[type="date"] {
  width: 100%;
  padding: 4px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
}

/* RPN danger highlight */
td.numeric.danger {
  background: #fee2e2;
  color: #b91c1c;
  font-weight: 600;
}

/* ===========================
   Export Buttons
   =========================== */

.export-buttons {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  margin: 2rem 0;
}

/* ===========================
   Footer Note
   =========================== */

.footer-note {
  text-align: center;
  font-size: 0.85rem;
  color: #475569;
  margin-bottom: 2rem;
}

/* ===========================
   Micro-interactions
   =========================== */

tbody tr {
  transition: transform 0.15s ease, background 0.2s ease;
}

tbody tr:hover {
  transform: scale(1.01);
  background: #f8fafc;
}

/* ===========================
   Responsive
   =========================== */

@media (max-width: 900px) {
  #ishikawaSvg {
    padding: 0.5rem;
  }

  .controls-bar {
    flex-direction: column;
    align-items: stretch;
  }
}
.table-wrapper {
  overflow-x: auto;
}
