@import url('./compact-detail-identity.css');
@import url('./board-settings-dialog.css');

.section-board-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding-block: 3px 14px;
  border-bottom: 1px solid var(--line);
}

.section-board-tabs a, .section-editor-tabs button {
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 8px 12px;
  background: var(--orders-theme-panel, #242e38);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.section-board-tabs a[aria-current="page"], .section-editor-tabs button[aria-pressed="true"] {
  border-color: #aa6437;
  background: #3a2d28;
  color: #ffbb8b;
}

.section-board-tabs a:hover, .section-editor-tabs button:hover { color: var(--text); }
.section-board-status { color: var(--muted); font-size: 13px; margin: 13px 0; }
.section-board-status .is-error { color: #ffac9e; }
.section-column .board-column-header { justify-content: space-between; }
.section-empty { color: var(--muted); font-size: 12px; margin: 8px 5px; }

:root.workspace-board-integrated .sections-workspace {
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  grid-template-rows:auto minmax(0,1fr);
  gap:7px 10px;
  padding-block-start:8px;
}
:root.workspace-board-integrated .sections-workspace :is(.breadcrumb,.board-title-row,.board-search,#sectionSettings,#sectionTabs) {display:none}
:root.workspace-board-integrated .sections-workspace .board-heading {grid-area:1 / 2;margin:0;padding:0;border:0}
:root.workspace-board-integrated .sections-workspace .board-toolbar {margin:0}
:root.workspace-board-integrated .section-board-status {grid-area:1 / 1;align-self:center;margin:0;font-size:12px}
:root.workspace-board-integrated .section-scroll {grid-column:1 / -1;min-height:0}
:root.workspace-board-integrated .sections-workspace:has(.board-column-navigation:not([hidden])) {
  grid-template-rows:auto auto minmax(0,1fr);
}
:root.workspace-board-integrated .sections-workspace .board-column-navigation {grid-column:1 / -1;margin:0}

.section-card-order {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.section-card-order:hover { color: var(--orange); }
.section-card.board-card-layout { grid-template-columns:minmax(0,1fr); }
.section-card .board-card-tools { min-width: 0; min-height: 0; padding: 0; border: 0; }
.section-card .board-card-tools .section-card-order { flex: 1; }
.section-card .board-card-tools > [data-card-menu-trigger] { margin-inline-start: 0; }
.section-card .board-card-footer { padding-top: 0; border-top: 0; }
.section-card-progress { position:relative; flex: 1 1 auto; min-width: 0; display: grid; gap: 3px; color: var(--muted); font-size: 11px; }
.section-card-progress span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.section-card-progress .section-batch-inspection { white-space: normal; overflow-wrap: anywhere; }
.section-card-progress progress { display: block; width: 100%; height: 4px; accent-color: var(--green); }
.section-card-people { display: inline-flex; align-items: center; margin: 0; color: var(--muted); }
.section-card .board-card-footer .section-card-people { flex: 0 1 auto; min-width: 0; gap: 5px; }
.section-card-people .avatar { width: 22px; height: 22px; border-radius: 50%; font-size: 9px; }
.section-card-people .assignee-avatar-stack .avatar + .avatar { margin-inline-start: -7px; }
.section-card-people small { margin-inline-start: 4px; }
.section-card-people svg { width: 15px; height: 15px; }
.section-batch-label {
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
}
.section-batch-operation {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.section-card[data-card-batch] .section-card-people:disabled { opacity: 1; }
.section-card[data-card-batch] .section-card-people:disabled:has(.assignee-add) { display: none; }
.detail-section-row .button { min-height: 29px; padding: 3px 8px; font-size: 12px; }

.detail-card:has(.detail-section-row) { flex-wrap: wrap; row-gap: 0; }
.detail-section-row {
  flex-basis: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 10px;
  margin: 0 0 7px 14px;
  padding-top: 7px;
  border-top: 1px solid var(--line);
}
.detail-section-row a { min-width: 0; color: var(--orders-theme-text, #b9cfe3); font-size: 12px; overflow-wrap: anywhere; }
.detail-section-row a:hover { color: var(--orange); }
.details-sections-link { flex: none; }

.section-dialog { width: min(570px, 94vw); overflow: auto; }
.section-dialog .dialog-heading { padding: 15px 18px; margin: 0; }
.section-dialog .dialog-heading h2 { font-size: 19px; margin: 0; }
.section-dialog .dialog-heading p { margin: 4px 0 0; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.section-dialog-close { font-size: 23px; flex: none; }
.section-dialog-body { display: grid; gap: 12px; padding: 16px 18px; }
.section-dialog .dialog-footer { padding: 11px 18px; margin: 0; }
.section-dialog label.field { display: grid; grid-template-columns: minmax(0, 1fr); }
.section-dialog input:not([type="checkbox"]):not([type="radio"]), .section-dialog select {
  width: 100%;
  min-height: 38px;
  padding: 6px 9px;
}
.section-dialog input[type="checkbox"] { accent-color: var(--orange); }
.section-dialog .board-dialog-error { color: #ffad9f; font-size: 13px; margin: 0; }
.section-place, .section-rule-preview {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  background: var(--orders-theme-panel, #1e2831);
  border: 1px solid var(--line);
  border-radius: 5px;
}
.section-rule-preview { border-color: #7b593d; }
.section-place span, .section-rule-preview span, .section-rule-preview small { color: var(--muted); font-size: 12px; }
.section-place strong, .section-rule-preview strong { font-size: 14px; }
.section-transfer-history, .section-source-picker { color: var(--muted); font-size: 13px; }
.section-transfer-history summary, .section-source-picker summary { cursor: pointer; color: var(--text); }
.section-transfer-history ol { display: grid; gap: 8px; list-style: none; padding: 0; }
.section-transfer-history li { display: grid; gap: 3px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.section-transfer-history time { font-size: 11px; }

.section-editor-tabs { display: flex; flex-wrap: wrap; gap: 7px; padding: 13px 18px 0; }
#sectionEditFields { display: grid; gap: 11px; }
.section-source-picker .form-hint { margin-top: 6px; }
.section-source-list { display: grid; grid-template-columns: repeat(auto-fit,minmax(180px,1fr)); gap: 7px; margin-top: 8px; }
.section-source-group, .section-assignee-settings { min-width: 0; border: 1px solid var(--line); border-radius: 5px; padding: 7px 9px; margin: 0; }
.section-source-group legend, .section-assignee-settings legend { padding: 0 4px; color: var(--text); font-size: 12px; }
.section-source-group label, .section-check { display: flex; align-items: baseline; gap: 6px; padding: 4px 0; font-size: 12px; }
.section-assignee-settings { display: grid; gap: 7px; }
.section-delete-rule { margin-inline-end: auto; color: #ffad9f; }

.section-card[draggable="true"] { cursor: grab; }
.section-card .board-card-grip { flex:none; }
.section-drop-target { outline:2px solid #e8955d; outline-offset:-2px; }
.section-board-tabs .section-drop-target { background:#49382e; color:#ffd1ac; }
.section-stickers { display:flex; flex-wrap:wrap; gap:5px; min-width:0; }
.section-stickers:empty { display:none; }
.detail-section-row > .section-stickers { flex-basis:100%; }
.technology-stickers { padding:0 0 7px; }
.order-heading-stickers { margin-top:5px; }
.sticker-chip {
  display:inline-flex; align-items:center; padding:2px 7px; min-height:22px;
  border:1px solid var(--orders-theme-line, #576777); border-radius:4px; background:var(--orders-theme-raised, #374652); color:var(--orders-theme-text, #e1ebf3);
  font:inherit; font-size:11px; line-height:1.25; max-width:100%; overflow-wrap:anywhere;
}
button.sticker-chip { cursor:pointer; }
.sticker-add { min-width:24px; justify-content:center; background:transparent; color:var(--orders-theme-text, #c6d6e6); font-size:14px; }
.sticker-state-fields > button { margin-top:9px; }
.sticker-state-row { display:grid; grid-template-columns:minmax(0,1fr) 120px auto; gap:6px; align-items:end; margin-bottom:6px; }
.sticker-rule-fields { display:grid; gap:7px; margin-top:7px; }
.transfer-rule-fieldset { min-width:0; margin:0; padding:0; border:0; }
.transfer-rule-fieldset legend { color:var(--muted); font-size:12px; margin-bottom:6px; }
.transfer-rule-list { max-height:245px; overflow:auto; display:grid; gap:4px; }
.transfer-rule-option { display:flex; align-items:center; gap:9px; border:1px solid var(--line); border-radius:5px; padding:6px 9px; cursor:pointer; }
.transfer-rule-option:has(:checked) { background:#48382c; border-color:#b17347; }
.transfer-rule-option > span { display:grid; gap:3px; }
.transfer-rule-option small { color:var(--muted); font-size:11px; }
.transfer-rule-option strong { font-size:13px; }

.transfer-rule-option input[type="radio"] { width:16px; height:16px; padding:0; flex:none; accent-color:var(--orange); }

/* Section settings share the same index and editing space. */
.section-settings-dialog {
  width: min(1040px, 96vw);
  max-width: 96vw;
  height: min(730px, 92dvh);
  overflow: hidden;
}
.section-settings-dialog[open] {
  display: grid;
  grid-template-rows: auto auto minmax(0,1fr);
  background: var(--bg);
}
.section-settings-dialog .dialog-heading { background: var(--panel); }
.section-settings-dialog .section-editor-tabs {
  padding: 8px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.section-settings-dialog .section-editor-tabs button[aria-pressed="true"],
.section-rule-workspace-tabs button[aria-pressed="true"] {
  border-color: color-mix(in srgb,var(--orange) 45%,var(--line));
  background: color-mix(in srgb,var(--orange) 10%,var(--field));
  color: var(--orange);
}
.section-settings-layout {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(235px,27%) minmax(0,1fr);
}
.section-rule-index {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto auto minmax(0,1fr);
  align-content: start;
  gap: 9px;
  padding: 13px 12px;
  border-inline-end: 1px solid var(--line);
  background: var(--panel);
}
.section-rule-index-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.section-rule-index-heading h3 { margin: 0; font-size: 14px; }
.section-rule-index-heading .button {
  min-height: 30px;
  padding: 4px 8px;
  font-size: 12px;
}
.section-rule-search { min-width: 0; }
.section-rule-count { margin: 0; color: var(--muted); font-size: 11px; }
.section-rule-index-list {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 4px;
  overflow: auto;
  padding: 2px;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
.section-rule-index-row {
  min-width: 0;
  min-height: 32px;
  display: grid;
  grid-template-columns: 16px minmax(0,1fr) auto;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--field);
  color: var(--text);
  text-align: left;
}
.section-rule-index-row:hover { background: var(--panel-hover); }
.section-rule-index-row[aria-current="true"] {
  border-color: color-mix(in srgb,var(--orange) 54%,var(--line));
  background: color-mix(in srgb,var(--orange) 8%,var(--field));
}
.section-rule-index-row svg { width: 15px; height: 15px; color: var(--muted); }
.section-rule-index-row[aria-current="true"] svg { color: var(--orange); }
.section-rule-index-row:focus-visible { outline-offset: -2px; }
.section-rule-index-info { min-width: 0; }
.section-rule-index-info strong {
  display: block;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.section-sticker-row { grid-template-columns: auto minmax(0,1fr) auto; }
.section-sticker-row.is-dragging { opacity: .55; }
.section-sticker-row-icons { display: flex; align-items: center; gap: 5px; }
.section-sticker-row-icons .board-card-grip { padding: 1px 2px; }
.section-sticker-row-icons .board-card-grip svg { pointer-events: none; }
.section-rule-index-list:has(> .kanban-drop-slot) { overflow-anchor: none; }
.section-sticker-hidden { color: var(--muted); font-size: 11px; }
.section-settings-list-status { margin-block-start: 4px; overflow-wrap: anywhere; }
.section-settings-list-status.is-error { color: light-dark(#a43f30,#ffb7a8); }
.sticker-board-visibility {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px 10px;
  padding-block-end: 8px;
  border-bottom: 1px solid var(--line);
}
.sticker-board-visibility .section-check { align-items: center; font-weight: 600; }
.sticker-board-visibility .form-hint { margin: 0; }
.sticker-board-visibility input[role="switch"] {
  appearance: none;
  position: relative;
  width: 28px;
  height: 16px;
  margin: 0;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--field);
  cursor: pointer;
}
.sticker-board-visibility input[role="switch"]::before {
  content: "";
  position: absolute;
  inset-block-start: 2px;
  inset-inline-start: 2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--muted);
}
.sticker-board-visibility input[role="switch"]:checked { background: var(--orange); }
.sticker-board-visibility input[role="switch"]:checked::before {
  inset-inline-start: 14px;
  background: var(--bg);
}
.section-rule-toggle-row {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  gap: 4px;
}
.section-rule-state {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 48px;
  min-height: 32px;
  padding: 3px 5px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--field);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.15;
  white-space: nowrap;
}
.section-rule-state::before {
  content: '';
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
}
.section-rule-state[aria-checked="true"] { color: light-dark(#246142,#a2d8b2); }
.section-rule-state:hover { background: var(--panel-hover); }
.section-settings-main {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0,1fr);
}
.section-rule-empty {
  grid-row: 1 / -1;
  place-self: center;
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 18px;
  color: var(--muted);
  text-align: center;
}
.section-rule-empty svg { width: 26px; height: 26px; color: var(--orange); }
.section-rule-empty h3, .section-rule-empty p { margin: 0; }
.section-rule-empty h3 { color: var(--text); font-size: 16px; }
.section-rule-empty p { font-size: 13px; line-height: 1.4; }
.section-rule-workspace-heading {
  grid-row: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.section-rule-workspace-tabs { display: flex; flex-wrap: wrap; gap: 5px; }
.section-rule-workspace-tabs button, .section-rule-back {
  min-height: 31px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--field);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.section-rule-workspace-tabs button:hover, .section-rule-back:hover {
  background: var(--panel-hover);
  color: var(--text);
}
.section-settings-main :is(.section-dialog-form,.section-rule-preview-pane) { grid-row: 2; min-height: 0; }
.section-settings-main .section-dialog-form {
  display: grid;
  grid-template-rows: minmax(0,1fr) auto;
}
.section-settings-main .section-dialog-form > .section-dialog-body, .section-rule-preview-pane {
  align-content: start;
  padding: 12px 16px;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
.section-settings-dialog .section-editor-footer {
  padding: 8px 16px;
  background: var(--panel);
  flex-wrap: wrap;
}
.section-editor-footer .board-dialog-error { flex-basis: 100%; }
.section-settings-dialog .section-editor-footer .button { min-height: 32px; padding: 5px 9px; font-size: 12px; }
.section-settings-dialog :is(.section-delete-rule,.board-dialog-error) { color: light-dark(#a43f30,#ffb7a8); }
.section-rule-save-status { margin-inline-end: auto; color: var(--muted); font-size: 12px; }
.section-rule-preview-pane .section-rule-check-heading > span {
  color: var(--orange);
  background: color-mix(in srgb,var(--orange) 8%,var(--panel));
}
.section-appearance-pane {
  min-height: 0;
  align-content: start;
  grid-template-columns: minmax(0, 1fr);
  overflow: auto;
}

@media (min-width: 771px) {
  .section-rule-workspace-heading .section-rule-back { display: none; }
}
@media (max-width: 770px) {
  .section-settings-layout { grid-template-columns: minmax(0,1fr); }
  .section-settings-layout[data-rule-open="true"] .section-rule-index,
  .section-settings-layout[data-rule-open="false"] .section-settings-main { display: none; }
  .section-rule-index { border-inline-end: 0; }
}
@media (max-width: 440px) {
  .section-settings-dialog .dialog-heading,
  .section-settings-dialog .section-editor-tabs,
  .section-rule-workspace-heading,
  .section-settings-main .section-dialog-form > .section-dialog-body,
  .section-rule-preview-pane,
  .section-settings-dialog .section-editor-footer { padding-inline: 10px; }
  .section-settings-dialog .section-editor-tabs { gap: 4px; }
  .section-settings-dialog .section-editor-tabs button { padding: 5px 6px; font-size: 11px; }
}
.section-settings-dialog:is([data-editor-mode="boards"],[data-editor-mode="stickers"]) #sectionEditFields {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 9px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
}
button.section-card-progress {padding:4px 0;border:0;background:transparent;text-align:left;cursor:pointer;font-family:inherit}
button.section-card-progress:focus-visible {outline:2px solid var(--orange);outline-offset:2px}

/* Keep each lot a direct, draggable lane child. The brace only links adjacent siblings. */
.section-card[data-lot-family] {margin-inline-start:10px}
.section-card[data-lot-family="first"] {margin-block-start:20px}
.section-family-caption {
  position:absolute;inset-block-end:calc(100% + 4px);inset-inline:0;
  color:var(--muted);font-size:11px;font-weight:600;line-height:15px;
  white-space:nowrap;text-overflow:ellipsis;overflow:hidden;pointer-events:none;
}
.section-family-brace {
  position:absolute;inset-inline-start:-9px;width:6px;inset-block:-1px -20px;
  border-inline-start:2px solid color-mix(in srgb,var(--orange) 60%,var(--line));
  color:color-mix(in srgb,var(--orange) 60%,var(--line));pointer-events:none;
}
[data-lot-family="first"] > .section-family-brace {
  inset-block-start:22px;border-block-start:2px solid;border-start-start-radius:4px;
}
[data-lot-family="last"] > .section-family-brace {
  inset-block-end:22px;border-block-end:2px solid;border-end-start-radius:4px;
}
