/* ============================================
   Wilo Roadmap Platform - v2.0 Styles
   Based on v1.2 design system
   ============================================ */

:root {
  --wilo-green: #009c82;
  --wilo-dark: #173d38;
  --bg-light: #f3f6f5;
  --line-color: #dce6e3;
  --gold: #d4af37;
  --gold-dark: #987d19;
  --delay-red: #e5412d;
  --delay-light: #ffc7be;
  /* CI 调色板（对齐 v3.0 色板） */
  --cool: #787878;
  --gun: #505050;
  --yellow: #ffb400;
  --green30: #b3e1da;
  --cool30: #cccccc;
  --green50: #80cec1;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Verdana, sans-serif;
  font-size: 14px;
  background: var(--bg-light);
  color: #192724;
}

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

/* ============================================
   Login Page
   ============================================ */
.login-container {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #0a3e37, #00a98f);
}

.login-card {
  background: #fff;
  border-radius: 18px;
  padding: 24px;
  width: 390px;
  max-width: 96vw;
}

.login-logo {
  height: 48px;
  margin-bottom: 10px;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.login-card h1 {
  text-align: center;
  margin: 0 0 20px;
  font-size: 20px;
  color: var(--wilo-dark);
}

.field {
  display: grid;
  gap: 6px;
  margin: 10px 0;
}

.field span {
  font-size: 12px;
  font-weight: 600;
  color: #4f625e;
}

.field input, .field select, .field textarea {
  padding: 9px;
  border: 1px solid #c8d7d3;
  border-radius: 8px;
  width: 100%;
}

.field small {
  font-size: 11px;
  color: #888;
}

/* ============================================
   Buttons
   ============================================ */
.btn {
  border: 0;
  border-radius: 9px;
  padding: 9px 13px;
  cursor: pointer;
  font-weight: 500;
  transition: opacity 0.15s;
}

.btn:hover { opacity: 0.85; }

.btn-primary {
  background: var(--wilo-green);
  color: #fff;
}

.btn-ghost {
  background: #fff;
  border: 1px solid var(--line-color);
}

.btn-danger {
  background: #fee8e5;
  color: #a52a1b;
  border: 1px solid #e5c5c2;
}

/* ============================================
   Layout
   ============================================ */
.top {
  height: 68px;
  background: #fff;
  border-bottom: 1px solid var(--line-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
}

.logo {
  height: 42px;
  width: auto;
}

.shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: calc(100vh - 68px);
}

.side {
  background: var(--wilo-dark);
  color: #fff;
  padding: 16px 10px;
}

.side button {
  width: 100%;
  background: transparent;
  border: 0;
  color: #dff2ef;
  text-align: left;
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
}

.side button:hover { background: #ffffff20; }

.side button.active { background: #ffffff30; font-weight: 600; }

.main {
  padding: 14px;
  min-width: 0;
}

.toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  background: white;
  border: 1px solid var(--line-color);
  border-radius: 12px;
  padding: 10px;
  margin-bottom: 10px;
  align-items: center;
}

.quick.active {
  background: var(--wilo-green);
  color: white;
}

.search-input {
  padding: 8px 12px;
  border: 1px solid var(--line-color);
  border-radius: 8px;
  min-width: 200px;
}

.card {
  background: white;
  border: 1px solid var(--line-color);
  border-radius: 14px;
  overflow: hidden;
}

/* ============================================
   Roadmap layout (v3: two-column flex, sticky left)
   .scroll = single horizontal+vertical scroller
   .roadmap = flex row: [left 400px fixed | right timeline]
   Left column: sticky-top headers + product cards
   Right column: sticky-top axis header + timeline rows
   ============================================ */
:root {
  --lane-h: 30px;
  --left-w: 400px;
}

.scroll {
  overflow: auto;
  max-height: calc(100vh - 170px);
  scroll-behavior: smooth;
  background: white;
}

.roadmap {
  display: flex;
  min-width: max-content;
  background: white;
}

/* ── Left column (fixed width, stays put on horizontal scroll) ── */
.roadmap-left {
  flex: none;
  width: var(--left-w);
  position: sticky;
  left: 0;
  z-index: 60;
  background: white;
}

.head-left {
  position: sticky;
  top: 0;
  z-index: 70;
  display: grid;
  grid-template-columns: 120px 1fr;
  background: var(--wilo-green);
  border-bottom: 2px solid var(--wilo-dark);
  min-height: 76px;
  height: 76px;
  align-items: center;
}

.head-sub, .head-prod {
  padding: 0 12px;
  font-weight: 700;
  font-size: 12px;
  display: flex;
  align-items: center;
  color: #fff;
}
.head-sub { border-right: 1px solid rgba(255,255,255,0.3); }

.left-row {
  display: grid;
  grid-template-columns: 120px 1fr;
}
.right-row {
  display: block;
}
/* 子段块之间：6px 白色粗分隔线（iOS 卡片留白风格），左右两列统一 */
.left-row + .left-row,
.right-row + .right-row {
  margin-top: 10px;
  border-top: 4px solid #fff;
  box-shadow: 0 -4px 8px -4px rgba(0,0,0,0.06);
}

/* sub-block: 竖排标签（下→上），跨整段高度，贴在产品堆左侧 */
.sub-block {
  background: var(--green30);
  border-right: 1px solid var(--cool30);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 4px;
  color: var(--gun);
  font-weight: 800;
  letter-spacing: 1px;
  font-size: 13px;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  text-orientation: mixed;
}

/* 产品卡纵向堆叠容器 */
.prod-stack {
  display: flex;
  flex-direction: column;
}

.sub-block.cross { background: var(--green30); color: var(--gun); }
.cross-section-sep { height: 2px; background: linear-gradient(90deg, #b7ccc7, transparent); margin: 4px 0; }

.sub-name { }

/* ── Product card stack (vertical, inside one sub-segment row) ── */
.prod-stack {
  display: flex;
  flex-direction: column;
  border-left: 1px solid #e8efed;
}

.family-card {
  display: grid;
  grid-template-columns: 74px 1fr;
  gap: 11px;
  padding: 14px 16px;
  align-items: center;
  cursor: pointer;
  transition: background 0.15s;
  background: white;
  border-bottom: 1px solid #eef3f2;
}

.prod-stack .family-card:last-child { border-bottom: none; }

/* Cross-segment products: visually identical to primary products, only "Edit" hint hidden */
.family-card.readonly { opacity: 1; }
.family-card.readonly:hover { background: #f4fbf9; cursor: default; }
.family-card.readonly .photo { border-style: solid; color: #a0b4af; }

.family-card:hover { background: #f4fbf9; }
.family-card:nth-child(odd) { background: #fafcfc; }
.family-card:nth-child(odd):hover { background: #f2f8f7; }

.family-card .photo {
  width: 72px;
  height: 72px;
  background: #eef5f3;
  border: 1px solid #d8e4e1;
  border-radius: 10px;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: #78908b;
  font-size: 10px;
  flex: none;
}

.family-card .photo.no-step { border-style: dashed; }
.family-card .photo img { width: 100%; height: 100%; object-fit: contain; }

.family-card .product-info h3 {
  font-size: 13px;
  margin: 0 0 4px;
  word-break: break-word;
}

.family-card .product-info .family {
  font-size: 11px;
  color: #687b77;
  margin-bottom: 6px;
}

.family-card .edit-hint {
  display: none;
  font-size: 10px;
  color: var(--wilo-green);
  font-weight: 600;
}

.family-card:hover .edit-hint { display: inline; }
/* Cross-segment products render exactly like primary products (no visual downgrade).
   Only the "Edit" hint is hidden in JSX when not the owner. */
.family-card.readonly { opacity: 1; }
.family-card.readonly:hover { background: #f4fbf9; cursor: pointer; }
.family-card.readonly .photo { border-style: solid; color: #78908b; }

/* ── Right column (timeline, scrolls horizontally) ── */
.roadmap-right {
  flex: none;
  position: relative;
}

.head-axis {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  background: var(--wilo-green);
  border-bottom: 2px solid #0d6b5b;
  min-height: 76px;
  height: 76px;
}

/* Quarter cells in header axis */
.q {
  flex: none;
  text-align: center;
  border-left: 1px solid rgba(255, 255, 255, 0.25);
  display: grid;
  grid-template-rows: 38px 36px;
  align-items: start;
  height: 74px;
  color: #fff;
}
/* Current quarter highlighted with darker shade + top arrow marker */
.q.current {
  background: #0d7d6a;
  position: relative;
}
.q.current::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 7px solid #fff;
}

.q b {
  padding-top: 10px;
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.3px;
}

.q span {
  font-size: 11px;
  font-weight: 600;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.35);
  color: rgba(255, 255, 255, 0.9);
}

.right-row {
  display: block;
}

.timeline-row {
  position: relative;
  border-bottom: 1px solid #eef3f2;
  background: white;
}
.right-row .timeline-row:last-child { border-bottom: none; }

/* Chips */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.chip {
  display: inline-block;
  font-size: 9px;
  padding: 3px 6px;
  border-radius: 10px;
  line-height: 1;
}

.pcd { background: var(--wilo-green); color: #fff; }
.gos { background: #fff; color: #007765; border: 1px solid var(--wilo-green); }
.step { background: #175f88; color: white; }
.step.no-step { background: #d4a76a; color: #5a3e1a; }

/* ── Sub-segment zebra striping + iOS-style spacing ── */
.left-row.zebra { background: #f7fcfb; }
.left-row.zebra .family-card { background: #f7fcfb; }
.left-row.zebra .family-card:nth-child(odd) { background: #f1f8f5; }
.left-row.zebra .family-card:hover, .left-row.zebra .family-card:nth-child(odd):hover { background: #e9f5f1; }
.right-row.zebra { background: #f7fcfb; }
.right-row.zebra .timeline-row { background: #f7fcfb; }

/* Thick white separator between sub-segment blocks (iOS "inset" feel) */
.roadmap-left {
  padding: 12px 0 20px;
}
.left-row:not(:last-child) {
  margin-bottom: 14px;
}
.roadmap-right {
  padding: 12px 0 20px;
}
.right-row:not(:last-child) {
  margin-bottom: 14px;
}

/* ── Chip input (type + Enter to add, × to remove) ── */
.chip-input {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
  border: 1px solid #c8d7d3;
  border-radius: 8px;
  padding: 5px 8px;
  background: #fff;
  min-height: 40px;
}
.chip-input.disabled { background: #f5f7f6; }
.chip-input input {
  border: none;
  outline: none;
  flex: 1;
  min-width: 80px;
  font: inherit;
  padding: 4px 2px;
}
.chip-input-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #e8f5f2;
  color: var(--wilo-dark);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid var(--green50);
}
.chip-input-tag button {
  border: none;
  background: transparent;
  color: #687b77;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  border-radius: 4px;
}
.chip-input-tag button:hover { color: var(--delay-red); background: var(--delay-light); }
.priority { background: #ffe6a7; color: #624500; }
.tag { background: #edf2f1; color: #4f625e; }

/* ── Cross-segment picker (assign to existing sub-segments of other segments) ── */
.cross-field { margin-top: 6px; }
.cross-field > span {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #4f625e;
  margin-bottom: 6px;
}
.cross-picker {
  display: grid;
  grid-template-columns: 150px 1fr;
  border: 1px solid #c8d7d3;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  min-height: 130px;
}
.cross-segs {
  border-right: 1px solid #d8e4e1;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: #f8faf9;
}
.cross-seg-btn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 8px 10px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 12px;
  color: #173d38;
  cursor: pointer;
  text-align: left;
}
.cross-seg-btn:hover { background: #eaf4f1; }
.cross-seg-btn.active { background: var(--wilo-green); color: #fff; }
.cross-count {
  background: rgba(255,255,255,0.25);
  border-radius: 10px;
  padding: 1px 7px;
  font-size: 11px;
}
.cross-subs {
  padding: 12px 14px;
}
.cross-subs > b {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #173d38;
  margin-bottom: 8px;
}
.cross-sub-empty { font-size: 12px; color: #888; font-style: italic; }
.cross-sub-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  color: #192724;
}
.cross-sub-label:hover { background: #f4fbf9; }
.cross-sub-label input {
  width: 16px;
  height: 16px;
  accent-color: var(--wilo-green);
}
.cross-chips { margin-top: 8px; }
.cross-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #e8f5f2;
  border: 1px solid var(--green50);
  color: var(--wilo-dark);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 10px;
}
.cross-chip-x {
  border: none;
  background: transparent;
  color: #687b77;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
}
.cross-chip-x:hover { color: var(--delay-red); }

/* Stacked step-lane timeline */
.timeline.multi {
  position: relative;
  min-height: 112px;
}

.step-lane {
  position: absolute;
  left: 0;
  right: 0;
  height: 4px;
}

/* Each step line (horizontal) */
.bar {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  height: 6px;
  border-radius: 6px;
  background: var(--wilo-green);
  cursor: pointer;
  transition: opacity 0.15s;
}

.bar:hover { opacity: 0.75; }

/* Bar color by product status (CI legend) */
.bar.complete { background: #009C82; }
.bar.ongoing  { background: #808080; }
.bar.candidate{ background: #FFB400; }
.bar.delay {
  background: repeating-linear-gradient(135deg, #F53600, #F53600 5px, #ffd0c7 5px, #ffd0c7 10px);
}

/* Step label above each line */
.step-label {
  position: absolute;
  top: -18px;
  font-size: 10px;
  font-weight: 600;
  color: #175f88;
  white-space: nowrap;
}

/* D1 diamond on each lane */
.d1 {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%) rotate(45deg);
  width: 16px;
  height: 16px;
  background: var(--gold);
  border: 2px solid white;
  box-shadow: 0 0 0 1px var(--gold-dark);
  cursor: pointer;
  z-index: 3;
}

.now {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #111;
  z-index: 4;
}

/* ============================================
   Table View
   ============================================ */
.table {
  width: 100%;
  border-collapse: collapse;
}

.table th, .table td {
  padding: 9px;
  border-bottom: 1px solid #e7efed;
  text-align: left;
}

.table th {
  background: #f8faf9;
  font-weight: 600;
}

.table tr { cursor: pointer; }
.table tr:hover { background: #f0faf8; }
.table tr.no-step { opacity: 0.75; }

/* ============================================
   Modals
   ============================================ */
.modal-bg {
  position: fixed;
  inset: 0;
  background: #001e1977;
  display: grid;
  place-items: center;
  z-index: 100;
  padding: 20px;
}

.modal {
  background: #fff;
  border-radius: 18px;
  padding: 24px;
  width: min(980px, 96vw);
  max-height: 94vh;
  overflow: auto;
}

.modal h2 {
  margin: 0 0 16px;
  color: var(--wilo-dark);
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.preview {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.preview img {
  width: 100%;
  max-width: 320px;
  aspect-ratio: 1;
  object-fit: contain;
  border: 1px solid var(--line-color);
  border-radius: 8px;
}

.preview-placeholder {
  width: 100%;
  max-width: 320px;
  aspect-ratio: 1;
  background: repeating-conic-gradient(#eee 0 25%, #fff 0 50%) 0/20px 20px;
  border: 1px solid var(--line-color);
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #999;
}

.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  justify-content: flex-end;
}

/* Settings panel */
.settings-tabs {
  display: flex;
  gap: 8px;
  margin: 12px 0;
}

.settings-tabs button.active {
  background: var(--wilo-green);
  color: #fff;
}

.settings-content {
  margin: 16px 0;
}

.family-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fff;
  border: 1px solid var(--line-color);
  border-radius: 10px;
  padding: 10px 12px;
  margin: 8px 0;
}

.add-form {
  display: flex;
  gap: 8px;
  margin: 12px 0;
}

.add-form input, .add-form select {
  flex: 1;
  padding: 9px;
  border: 1px solid #c8d7d3;
  border-radius: 8px;
}

.seg-block {
  margin: 14px 0;
  padding: 12px;
  border: 1px solid var(--line-color);
  border-radius: 12px;
}

.seg-block h4 {
  margin: 0 0 8px;
  color: var(--wilo-dark);
}

.sub-item {
  display: flex;
  justify-content: space-between;
  background: #fff;
  border-radius: 8px;
  padding: 8px 10px;
  margin: 6px 0;
}

/* ============================================
   Utilities
   ============================================ */
.error-box {
  background: #fee8e5;
  color: #a52a1b;
  padding: 9px;
  border-radius: 8px;
  margin: 10px 0;
}

.loading-container {
  min-height: 60vh;
  display: grid;
  place-items: center;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--line-color);
  border-top-color: var(--wilo-green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
  grid-column: 1 / -1;
  padding: 40px;
  text-align: center;
  color: #78908b;
}

.empty-state.roadmap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  text-align: center;
  color: #78908b;
}

/* ============================================
   Presentation Mode
   ============================================ */
.presentation .side,
.presentation .toolbar {
  display: none;
}

.presentation .shell {
  grid-template-columns: 1fr;
}

.presentation .main {
  padding: 0;
}

.presentation .scroll {
  max-height: calc(100vh - 68px);
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  :root { --left-w: 300px; }
  .grid2 { grid-template-columns: 1fr; }
  .head-sub, .head-prod, .head-axis { font-size: 12px; padding: 10px; }
}

/* ============================================
   v2.0.2 — Rounded iOS-ish surfaces, tag palette,
   D1 label, StepManager. Appended only; nothing above removed.
   ============================================ */

/* Tag palette: 4 fixed colours, deterministic (no regex guessing at render time) */
.chip.pcd     { background: var(--wilo-green); color: #fff; }
.chip.gos     { background: #005acd; color: #fff; }
.chip.priority{ background: #ffb400; color: #3d2c00; }
.chip.tag     { background: #edf1f0; color: #4f625e; }

/* Rounded surfaces */
.modal,
.login-card,
.card,
.chip-input,
.cross-picker,
.family-card .photo,
.step-manager .btn,
.toolbar,
.field input,
.field select,
.field textarea,
.chip-input-tag,
.cross-chip,
.cross-seg-btn,
.sm-row {
  border-radius: 12px;
}
.field input,
.field select,
.field textarea { border-radius: 10px; }

.q {
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
}

/* Product card: larger name, softer block */
.family-card .product-info h3 {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.1px;
}
.family-card .product-info .family { font-size: 12px; }

/* Rounded product rows inside a sub-segment block (keeps row dividers intact) */
.prod-stack { gap: 6px; padding: 6px 8px; }
.family-card {
  border: 1px solid #e4ecea;
  border-radius: 12px;
  border-bottom: 1px solid #e4ecea;
  overflow: hidden;
}
.prod-stack .family-card:last-child { border-bottom: 1px solid #e4ecea; }

/* "Manage Steps" affordance — always visible for owners (clear entry point) */
.edit-hint {
  cursor: pointer;
  padding: 3px 9px;
  border-radius: 8px;
  background: #eaf6f3;
  color: var(--wilo-green);
  font-size: 10px;
  font-weight: 700;
  display: inline-block;
  user-select: none;
}
.edit-hint:hover { background: var(--wilo-green); color: #fff; }

/* D1 label on delayed bars */
.d1-text {
  position: absolute;
  font-size: 10px;
  font-weight: 700;
  color: #b32700;
  background: #fff3ef;
  border: 1px solid #f5c6b8;
  padding: 1px 5px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
}

/* ── StepManager ── */
.step-manager { width: min(620px, 96vw); }
.step-manager .sm-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
}
.step-manager .sm-head h2 { margin: 0 0 2px; }
.step-manager .sm-head small { color: #68807a; font-size: 12px; }
.sm-list { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.sm-row {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 10px;
  border: 1px solid #dfe9e7;
  padding: 10px 12px;
  background: #fbfdfd;
}
.sm-idx {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  background: var(--wilo-green); color: #fff;
  border-radius: 50%;
  font-weight: 700; font-size: 13px;
}
.sm-info b { display: block; font-size: 14px; }
.sm-info small { color: #68807a; font-size: 11px; }
.sm-del { padding: 6px 11px; }
.sm-empty { color: #789; padding: 14px; text-align: center; }
.sm-add-btn { width: 100%; padding: 11px; }
.sm-add-form { display: grid; gap: 10px; margin-top: 8px; }
.sm-add-form input,
.sm-add-form select {
  width: 100%; padding: 9px;
  border: 1px solid #cfdedb; border-radius: 10px;
  font: inherit;
}
.sm-add-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.sm-add-grid label {
  display: grid; gap: 4px;
  font-size: 11px; font-weight: 600; color: #4f625e;
}
.sm-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* v2.0.2 override: Manage Steps must always be reachable (was hover-only) */
.family-card .edit-hint,
.family-card:hover .edit-hint {
  display: inline-block;
}

/* v2.0.2 — give product names/tags room; keep row box == stack box exactly */
.family-card {
  grid-template-columns: 58px 1fr;
  gap: 10px;
  padding: 10px 12px;
}
.family-card .photo { width: 56px; height: 56px; border-radius: 10px; }
.family-card .product-info h3 {
  font-size: 14px;
  margin: 0 0 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.family-card .product-info .family { font-size: 11px; margin-bottom: 4px; }
.chips { gap: 3px; }
.chip { font-size: 9px; padding: 2px 5px; }
/* rows must never outgrow the sub-segment label block */
.left-row, .right-row { align-items: stretch; }
.sub-block { align-self: stretch; }

/* v2.0.2 — widen sub-segment label column so vertical text is centred, not clipped */
.head-left, .left-row { grid-template-columns: 104px 1fr; }

/* v2.0.3 — Manage Steps entry point must ALWAYS be visible (not hover-only).
   !important because an older hover-reveal rule sits earlier in the file. */
.family-card .edit-hint,
.family-card:hover .edit-hint {
  display: inline-block !important;
}

/* v2.0.3 — CRITICAL alignment fix: .prod-stack has padding 6px + gap 6px, so the
   left column is TALLER than the right column unless the timeline side gets the
   same box. Without this the two columns drift apart row after row. */
.right-row {
  padding: 6px 0;
  box-sizing: border-box;
}
.right-row .timeline-row:first-child { margin-top: 0; }

/* ── Inline "create family / evolution group" inside the product form ── */
.inline-add {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  align-items: center;
}
.inline-add input {
  flex: 1;
  min-width: 0;
  padding: 7px 9px !important;
  font-size: 13px;
}
.btn.sm {
  padding: 7px 12px;
  font-size: 12px;
  border-radius: 8px;
  white-space: nowrap;
}

/* ── Steps block inside the product form ── */
.steps-block { margin-top: 4px; }
.steps-block > span {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #4f625e;
  margin-bottom: 6px;
}
.steps-hint {
  font-size: 12px;
  color: #68807a;
  background: #f4f8f7;
  border: 1px dashed #cfe0dc;
  border-radius: 10px;
  padding: 10px 12px;
}
.steps-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.steps-row {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  align-items: center;
  gap: 10px;
  border: 1px solid #dfe9e7;
  border-radius: 10px;
  padding: 8px 10px;
  background: #fbfdfd;
}
.steps-row.current {
  border-color: var(--wilo-green);
  background: #f0f9f7;
}
.steps-idx {
  width: 24px; height: 24px;
  display: grid; place-items: center;
  background: var(--wilo-green); color: #fff;
  border-radius: 50%;
  font-weight: 700; font-size: 12px;
}
.steps-info b { display: block; font-size: 13px; }
.steps-info b em { font-style: normal; color: var(--wilo-green); font-size: 11px; }
.steps-info small { color: #68807a; font-size: 11px; }
.steps-empty { color: #789; padding: 12px; text-align: center; font-size: 12px; }
.steps-add { width: 100%; padding: 10px; }

/* ── Settings: account / users / audit ── */
.stack-form { display: grid; gap: 10px; max-width: 420px; margin-top: 10px; }
.stack-form label { display: grid; gap: 4px; font-size: 11px; font-weight: 600; color: #4f625e; }
.stack-form input, .stack-form select {
  width: 100%; padding: 9px; border: 1px solid #cfdedb; border-radius: 10px; font: inherit;
}
.ok-box {
  background: #eaf7f0; border: 1px solid #b6e0c6; color: #1d6b3f;
  border-radius: 10px; padding: 9px 12px; font-size: 13px;
}
.user-table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 12px; }
.user-table th, .user-table td {
  text-align: left; padding: 8px; border-bottom: 1px solid #eef3f2; vertical-align: middle;
}
.user-table th { font-size: 11px; text-transform: uppercase; color: #68807a; letter-spacing: 0.4px; }
.user-table td b { display: block; font-size: 13px; }
.user-table td small { color: #8a9b97; font-size: 11px; }
.user-table select { padding: 5px; border: 1px solid #cfdedb; border-radius: 8px; font: inherit; }
.user-table tr.inactive { opacity: 0.5; }
.user-table .row-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.user-table .nowrap { white-space: nowrap; }
.user-table .detail { color: #68807a; font-size: 11px; max-width: 260px; }
.pill {
  display: inline-block; background: #eef3f2; color: #4f625e;
  border-radius: 10px; padding: 2px 8px; font-size: 10px; font-weight: 700;
}
.pill.ok { background: #d9f2e4; color: #1d6b3f; }

/* v2.0.5 — left column must not overflow the "Products" header; long names wrap */
.roadmap-left { width: var(--left-w) !important; }
.family-card .product-info { min-width: 0; }
.family-card .product-info h3 {
  white-space: normal !important;
  overflow: visible;
  text-overflow: clip;
  word-break: break-word;
  line-height: 1.25;
}
.family-card .product-info .family { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* v2.0.6 — REAL alignment fix (verified by per-card Y comparison).
   .prod-stack uses `gap: 6px` between cards, so every card after the first sits
   6px lower than a plain stack. The timeline column must repeat that gap or the
   two columns drift apart row by row (measured: +6px per card, 54px by card 10). */
.right-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px 0;
  box-sizing: border-box;
}

/* ── Excel import ── */
.import-modal { width: min(560px, 94vw); }
.import-lead { font-size: 13px; color: #4f625e; margin: 0 0 12px; }
.import-actions { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.import-drop {
  display: grid;
  place-items: center;
  gap: 6px;
  border: 2px dashed #cfe0dc;
  border-radius: 14px;
  padding: 28px 18px;
  background: #f8fcfb;
  cursor: pointer;
  text-align: center;
  margin-bottom: 14px;
}
.import-drop:hover { border-color: var(--wilo-green); background: #f0f9f7; }
.import-drop input { display: none; }
.import-drop span { font-weight: 600; color: var(--wilo-dark); }
.import-drop small { color: #68807a; font-size: 11px; }

.import-toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 200;
  max-width: 460px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(0, 40, 34, 0.22);
  padding: 14px 16px;
  border-left: 5px solid var(--wilo-green);
}
.import-toast.ok { border-left-color: #1d6b3f; }
.import-toast.warn { border-left-color: #d98b00; }
.import-toast.err { border-left-color: var(--delay-red); }
.import-toast.busy { border-left-color: #175f88; }
.import-toast b { display: block; margin-bottom: 6px; font-size: 13px; }
.import-toast ul {
  margin: 0 0 8px;
  padding-left: 18px;
  max-height: 190px;
  overflow: auto;
  font-size: 11px;
  color: #4f625e;
}

/* ── Image upload: 1:1 crop + transparency preview ── */
.keep-bg {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: #4f625e; cursor: pointer; margin-top: 4px;
}
.keep-bg input { width: 14px; height: 14px; accent-color: var(--wilo-green); }
.img-note { display: block; font-size: 11px; color: #68807a; margin-top: 4px; line-height: 1.4; }
.image-preview { margin-top: 8px; }
.image-preview img { border-radius: 10px; }
