:root {
  --sidebar-bg: #1e2535;
  --sidebar-text: #a8b3cf;
  --sidebar-active: #ffffff;
  --sidebar-active-bg: #2d3a52;
  --sidebar-hover-bg: #262f44;
  --accent: #4f7cff;
  --accent-hover: #3a64e8;
  --bg: #f4f6fb;
  --card-bg: #ffffff;
  --border: #e2e7f0;
  --text: #1a2035;
  --text-muted: #6b7a99;
  --danger: #e74c3c;
  --success: #27ae60;
  --warning: #f39c12;
  --sidebar-width: 240px;
  --topbar-height: 0px;
  --radius: 8px;
  --shadow: 0 1px 4px rgba(0,0,0,0.08);
  --surface: #ffffff;
  --surface-alt: #f4f6fb;
  --primary: #4f7cff;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

.hidden { display: none !important; }

/* ── Login ── */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e2535 0%, #2d3a52 100%);
}
.login-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 40px;
  width: 380px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo img { height: 64px; margin-bottom: 12px; display: block; margin-inline: auto; }
.login-logo h1 { font-size: 22px; font-weight: 700; color: var(--text); }

/* ── Layout ── */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  z-index: 100;
}
.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  font-weight: 700;
  font-size: 15px;
  color: #fff;
}
.sidebar-logo { height: 32px; width: 32px; object-fit: contain; border-radius: 4px; }
.sidebar-nav { flex: 1; padding: 12px 8px; }
.nav-group { margin-top: 16px; }
.nav-group-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(168,179,207,0.5);
  padding: 0 8px;
  margin-bottom: 4px;
  display: block;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 13.5px;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: var(--sidebar-hover-bg); color: var(--sidebar-active); }
.nav-item.active { background: var(--sidebar-active-bg); color: var(--sidebar-active); }
.nav-icon { width: 16px; height: 16px; flex-shrink: 0; }
.nav-icon svg { width: 16px; height: 16px; display: block; }
.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.07);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--sidebar-text);
}

.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 28px;
  min-height: 100vh;
}

/* ── Page header ── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.page-title { font-size: 22px; font-weight: 700; }
.page-subtitle { color: var(--text-muted); font-size: 13px; margin-top: 2px; }

/* ── Cards ── */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
}
.card-title { font-size: 14px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; }
.card-value { font-size: 28px; font-weight: 700; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card { background: var(--card-bg); border-radius: var(--radius); border: 1px solid var(--border); padding: 20px; box-shadow: var(--shadow); }
.stat-card .label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 6px; }
.stat-card .value { font-size: 30px; font-weight: 700; color: var(--text); }
.stat-card .sub { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.stat-card.accent { border-top: 3px solid var(--accent); }
.stat-card.success { border-top: 3px solid var(--success); }
.stat-card.warning { border-top: 3px solid var(--warning); }
.stat-card.danger { border-top: 3px solid var(--danger); }

/* ── Tables ── */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
  padding: 8px 12px;
}
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8f9fd; }

/* ── Forms ── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], textarea, select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  transition: border-color 0.15s;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79,124,255,0.12);
}
textarea { min-height: 80px; resize: vertical; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background 0.15s, opacity 0.15s;
  text-decoration: none;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-secondary:hover { background: #d5dce9; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #c0392b; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; padding: 10px; }
.btn-link { background: none; border: none; cursor: pointer; color: var(--accent); font-size: inherit; padding: 0; }

/* ── Projects Grid ── */
.projects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }
.project-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; cursor: pointer; transition: box-shadow 0.2s, transform 0.15s; }
.project-card:hover { box-shadow: 0 6px 20px rgba(0,0,0,0.13); transform: translateY(-2px); }
.project-card-img { height: 180px; background: var(--surface-alt); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.project-card-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.project-card-img-placeholder { color: var(--text-muted); opacity: 0.4; display: flex; align-items: center; justify-content: center; }
.project-card-img-placeholder svg { width: 44px; height: 44px; }
.project-card-body { padding: 14px 16px 16px; }
.project-card-title { font-weight: 600; font-size: 15px; margin-bottom: 6px; line-height: 1.3; }
.project-card-desc { font-size: 12px; color: var(--text-muted); margin-bottom: 12px; min-height: 32px; line-height: 1.5; }
.project-card-footer { display: flex; justify-content: space-between; align-items: center; }

/* ── Project Image Upload ── */
.proj-image-wrap { position: relative; cursor: pointer; border-radius: 8px; overflow: hidden; width: 220px; flex-shrink: 0; }
.proj-image-wrap img { width: 220px; height: 160px; object-fit: cover; display: block; }
.proj-image-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.45); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; opacity: 0; transition: opacity 0.2s; font-size: 13px; gap: 4px; }
.proj-image-wrap:hover .proj-image-overlay { opacity: 1; }
.proj-image-placeholder { width: 220px; height: 160px; border: 2px dashed var(--border); border-radius: 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text-muted); font-size: 13px; gap: 8px; cursor: pointer; transition: border-color 0.2s; }
.proj-image-placeholder:hover { border-color: var(--accent); color: var(--accent); }

/* ── Kanban board ── */
.kanban-board { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 16px; align-items: flex-start; }
.kanban-col { flex: 0 0 260px; border-radius: 8px; border: 1px solid var(--border); overflow: hidden; }
.kanban-col-header { padding: 10px 14px; display: flex; justify-content: space-between; align-items: center; font-size: 13px; font-weight: 600; letter-spacing: 0.2px; border-bottom: 1px solid var(--border); }
.kanban-col-count { border-radius: 12px; padding: 1px 8px; font-size: 11px; color: #fff; font-weight: 700; }
.kanban-col-body { padding: 8px; min-height: 80px; }
.kanban-col.drag-over .kanban-col-body { outline: 2px dashed var(--accent); outline-offset: -4px; border-radius: 4px; }
.kanban-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 6px; padding: 12px; margin-bottom: 8px; cursor: grab; transition: box-shadow 0.15s, transform 0.1s; }
.kanban-card:active { cursor: grabbing; }
.kanban-card:hover { box-shadow: 0 3px 10px rgba(0,0,0,0.1); transform: translateY(-1px); }
.kanban-card.dragging { opacity: 0.3; }
.kanban-card-title { font-weight: 600; font-size: 13px; line-height: 1.4; margin-bottom: 6px; color: var(--accent); cursor: pointer; background: none; border: none; padding: 0; text-align: left; }
.kanban-card-title:hover { text-decoration: underline; }
.kanban-card-img { width: 100%; height: 80px; object-fit: cover; border-radius: 4px; display: block; margin-bottom: 8px; }
.kanban-card-img-ph { width: 100%; height: 60px; background: var(--bg); border-radius: 4px; display: flex; align-items: center; justify-content: center; color: var(--text-muted); margin-bottom: 8px; }
.kanban-card-meta { font-size: 12px; color: var(--text-muted); display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-top: 4px; }
.kanban-empty { color: var(--text-muted); font-size: 12px; text-align: center; padding: 24px 8px; }
@media (max-width: 768px) { .kanban-board { gap: 10px; } .kanban-col { flex: 0 0 220px; } }

/* ── Badges / Status ── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge-open { background: #dbeafe; color: #1d4ed8; }
.badge-in-progress { background: #fef3c7; color: #92400e; }
.badge-resolved { background: #d1fae5; color: #065f46; }
.badge-deferred { background: #f3f4f6; color: #374151; }
.badge-active { background: #d1fae5; color: #065f46; }
.badge-planning { background: #dbeafe; color: #1d4ed8; }
.badge-on-hold { background: #fef3c7; color: #92400e; }
.badge-completed { background: #d1fae5; color: #065f46; }
.badge-inactive { background: #f3f4f6; color: #374151; }
.badge-high { background: #fee2e2; color: #991b1b; }
.badge-medium { background: #fef3c7; color: #92400e; }
.badge-low { background: #d1fae5; color: #065f46; }

/* ── Alerts ── */
.alert { padding: 10px 14px; border-radius: 6px; font-size: 13px; margin-bottom: 12px; }
.alert-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}
.modal {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 28px;
  width: 560px;
  max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 16px 48px rgba(0,0,0,0.2);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.modal-title { font-size: 18px; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text-muted); line-height: 1; }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; }

/* ── Misc ── */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-state .empty-icon { margin-bottom: 12px; display: flex; justify-content: center; }
.empty-state .empty-icon svg { width: 40px; height: 40px; opacity: 0.4; }
.empty-state p { font-size: 15px; }
.inline-select {
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  cursor: pointer;
  max-width: 130px;
}
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
.text-muted { color: var(--text-muted); }
.text-right { text-align: right; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.flex { display: flex; }
.flex-gap { gap: 8px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* ── Contractor contacts grid ── */
.contractor-contacts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.contractor-contact-card { display: flex; align-items: flex-start; gap: 14px; padding: 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); }
.contractor-contact-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 16px; flex-shrink: 0; }
.contractor-logo-wrap img { object-fit: contain !important; background: var(--surface-alt); }

/* ── Landing page grid ── */
.landing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}
.landing-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px 16px 20px;
  text-decoration: none;
  color: var(--text);
  transition: box-shadow 0.2s, transform 0.15s, border-color 0.15s;
  cursor: pointer;
}
.landing-card:hover {
  box-shadow: 0 6px 20px rgba(0,0,0,0.11);
  transform: translateY(-3px);
  border-color: var(--accent);
}
.landing-icon {
  width: 52px; height: 52px;
  background: #eef2ff;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 12px;
  color: var(--accent);
}
.landing-icon svg { width: 26px; height: 26px; }
.landing-label { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.landing-desc { font-size: 12px; color: var(--text-muted); line-height: 1.4; }

/* favourite star on landing cards */
.landing-card { position: relative; }
.landing-fav { position: absolute; top: 8px; right: 8px; background: none; border: none; cursor: pointer; padding: 3px; border-radius: 4px; color: var(--text-muted); opacity: 0.25; transition: opacity 0.15s, color 0.15s; line-height: 1; z-index: 1; }
.landing-card:hover .landing-fav { opacity: 0.7; }
.landing-fav.active { opacity: 1 !important; color: #f39c12; }
.landing-fav.active svg { fill: #f39c12; }

/* landing page section headers */
.landing-section { margin-bottom: 28px; }
.landing-section-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-muted); margin-bottom: 10px; display: flex; align-items: center; gap: 5px; }

/* stat cards as links */
a.stat-card { text-decoration: none; transition: box-shadow 0.2s, transform 0.15s; }
a.stat-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,0.12); transform: translateY(-2px); }

/* ── Card section header (title + action button on same row) ── */
.card-section-hdr {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}
.card-section-hdr > :last-child { flex-shrink: 0; }

/* ── Detail info flex (image/logo alongside text) ── */
.detail-info-flex {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  align-items: flex-start;
}
.detail-info-flex-text { flex: 1; min-width: 200px; }

/* ── Responsive table — rows become cards below 640px ── */
@media (max-width: 640px) {
  table.table-resp thead { display: none; }
  table.table-resp tr {
    display: block;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 10px;
    padding: 4px 0 8px;
    background: var(--card-bg);
  }
  table.table-resp tr:hover td { background: transparent; }
  table.table-resp td {
    display: flex;
    align-items: baseline;
    padding: 5px 14px;
    border: none;
    font-size: 13px;
    line-height: 1.4;
    gap: 8px;
    word-break: break-word;
  }
  table.table-resp td[data-label]:not([data-label=""])::before {
    content: attr(data-label);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    min-width: 82px;
    flex-shrink: 0;
    padding-top: 2px;
  }
  table.table-resp td.text-right { justify-content: flex-start; }
  table.table-resp td[data-label=""] {
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 6px;
  }
}

/* ── Inline link-row in forms (two selects + button) ── */
.link-row {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
  align-items: flex-start;
}
/* Override the global select { width:100% } so flex sizing works */
.link-row select { width: auto; min-width: 0; }
.link-row .link-row-type { flex: 1 1 120px; }
.link-row .link-row-entity { flex: 2 1 140px; }

@media (max-width: 500px) {
  .link-row { flex-direction: column; }
  .link-row select, .link-row .link-row-type, .link-row .link-row-entity { width: 100%; flex: none; }
  .link-row button { align-self: flex-start; }
}

/* ── Utility ── */
.hide-mobile { }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Mobile hamburger button ── */
.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text);
  padding: 4px;
}
.hamburger svg { width: 24px; height: 24px; display: block; }
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 99;
}

/* ── Mobile topbar ── */
.mobile-topbar {
  display: none;
  position: sticky; top: 0;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  align-items: center;
  gap: 12px;
  z-index: 90;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.mobile-topbar-title { font-weight: 700; font-size: 15px; }

/* ── Responsive breakpoints ── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 200;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-overlay.open {
    display: block;
  }
  .main-content {
    margin-left: 0;
    padding: 16px;
  }
  .mobile-topbar {
    display: flex;
  }
  .hamburger {
    display: flex;
    align-items: center;
  }
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .page-header > button, .page-header > a {
    align-self: flex-start;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .landing-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  .landing-card {
    padding: 20px 12px 16px;
  }
  .modal {
    padding: 20px;
    margin: 0 8px;
  }
  .login-card {
    width: calc(100vw - 40px);
    padding: 28px 20px;
  }
  /* Card section headers — action controls wrap below the title */
  .card-section-hdr {
    align-items: flex-start;
  }
  .card-section-hdr > :last-child {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }
  /* Single-button right sides stay auto-width */
  .card-section-hdr > button:last-child,
  .card-section-hdr > a:last-child {
    width: auto;
  }
  /* Detail image+info: image goes full width on small screens */
  .detail-info-flex { flex-direction: column; }
  .proj-image-wrap, .proj-image-placeholder { width: 100% !important; }
  .proj-image-wrap img { width: 100% !important; height: 200px; }
  /* Contractors grid: single column on mobile */
  .contractor-contacts-grid { grid-template-columns: 1fr; }
  /* Projects grid: 1 column on small phones */
  .projects-grid { grid-template-columns: 1fr; }
  /* Kanban: narrower columns, enable scroll */
  .kanban-board { gap: 8px; }
  .kanban-col { flex: 0 0 240px; }
  /* Tables: ensure cells don't get too cramped */
  td, th { padding: 8px 8px; }
  /* Btn groups don't overflow */
  .btn { white-space: nowrap; }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .landing-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .projects-grid { grid-template-columns: 1fr; }
  /* Page content padding tighter */
  .main-content { padding: 12px; }
  .card { padding: 14px; }
  /* Kanban cols narrower so you can see 1.5 cards */
  .kanban-col { flex: 0 0 200px; }
  /* Modals closer to full-width */
  .modal { margin: 0 4px; padding: 16px; }
}

@media (max-width: 400px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .landing-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ── SOP steps display (read-only render in detail view) ── */
.sop-steps-display {
  line-height: 1.8;
  overflow: hidden;
  word-break: break-word;
  max-width: 100%;
}
.sop-steps-display img {
  max-width: min(100%, 640px);
  height: auto;
  display: block;
  border-radius: 6px;
  margin: 8px 0;
}
.sop-steps-display ul, .sop-steps-display ol { padding-left: 24px; margin: 4px 0; }
.sop-steps-display h3 { font-size: 17px; font-weight: 700; margin: 10px 0 4px; }
.sop-steps-display h4 { font-size: 15px; font-weight: 600; margin: 8px 0 3px; }

/* ── Rich Text Editor (SOP steps) ── */
.rte-wrap { border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.rte-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  padding: 6px 8px;
  background: var(--sidebar-bg);
  border-bottom: 1px solid var(--border);
  align-items: center;
}
.rte-toolbar button {
  padding: 3px 7px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  line-height: 1.4;
  min-width: 26px;
  transition: background 0.1s;
}
.rte-toolbar button:hover { background: var(--hover-bg); }
.rte-toolbar button.rte-active { background: var(--accent); color: #fff; border-color: var(--accent); }
.rte-toolbar select {
  padding: 3px 5px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  border-radius: 4px;
  font-size: 12px;
  height: 26px;
  width: auto;
  cursor: pointer;
}
.rte-sep { width: 1px; background: var(--border); align-self: stretch; margin: 0 3px; flex-shrink: 0; }
.rte-editor {
  min-height: 200px;
  max-height: 400px;
  overflow-y: auto;
  padding: 12px 14px;
  background: var(--bg);
  line-height: 1.8;
  font-size: 14px;
  outline: none;
  color: var(--text);
}
.rte-editor:focus { outline: none; }
.rte-wrap:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 20%, transparent); }
.rte-editor img { max-width: 100%; border-radius: 6px; margin: 6px 0; display: block; cursor: pointer; }
.rte-editor ul, .rte-editor ol { padding-left: 24px; margin: 4px 0; }
.rte-editor h3 { font-size: 17px; font-weight: 700; margin: 10px 0 4px; }
.rte-editor h4 { font-size: 15px; font-weight: 600; margin: 8px 0 3px; }
.rte-editor p { margin: 0 0 6px; }
@media (max-width: 480px) {
  .rte-toolbar { gap: 2px; padding: 5px 6px; }
  .rte-toolbar select { font-size: 11px; }
  .rte-toolbar button { padding: 3px 5px; font-size: 11px; }
}
