/* Infirmary Ward — UI spike v2 (Town Hall kanban + drawer pattern) */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

.infirmary-page {
  width: 100%;
  margin: 0 auto;
  padding: 0 0 60px;
}

.spike-banner {
  margin: 0 0 16px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--warn, #f59e0b) 35%, var(--line));
  background: color-mix(in srgb, var(--warn, #f59e0b) 10%, var(--surface));
  color: var(--ink);
  font-size: 0.82rem;
  line-height: 1.45;
}
.spike-banner strong { color: var(--ink); }

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 8px;
}
.page-header h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--ink);
}
.subtitle {
  margin: 6px 0 16px;
  color: var(--muted);
  font-size: 0.92rem;
}

/* Sync status (Town Hall pattern) */
.sync-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.sync-info {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
}
.sync-stat {
  font-size: 0.82rem;
  color: var(--muted);
}
.sync-stat strong { color: var(--ink); }
.sync-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}
.sync-dot.ok {
  background: var(--ok);
  box-shadow: 0 0 8px color-mix(in srgb, var(--ok) 50%, transparent);
}
.sync-dot.warn {
  background: var(--warn, #f59e0b);
  box-shadow: 0 0 8px color-mix(in srgb, var(--warn, #f59e0b) 40%, transparent);
}
.sync-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.ward-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}
.stat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 14px 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  text-align: center;
}
.stat-card .stat-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 4px;
}
.stat-card .stat-value {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.1;
}
.stat-card.stat-warn .stat-value { color: var(--fail, #dc2626); }

.layout-toggle {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface);
}
.layout-toggle button {
  border: none;
  background: transparent;
  padding: 8px 14px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}
.layout-toggle button.active {
  background: linear-gradient(90deg, var(--brand1), var(--brand2));
  color: #fff;
}

.kanban-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.kanban-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.kanban-filter-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}
.kanban-filter-chip:hover { border-color: var(--link); color: var(--ink); }
.kanban-filter-chip.active {
  border-color: transparent;
  background: linear-gradient(90deg, var(--brand1), var(--brand2));
  color: #fff;
}
.kanban-filter-search {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  justify-content: flex-end;
  min-width: 200px;
}
.kanban-filter-search input {
  width: min(220px, 100%);
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: 0.85rem;
}
.kanban-filter-count {
  font-size: 0.7rem;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}
.kanban-fs-expand-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}
.kanban-fs-expand-btn:hover { border-color: var(--link); }

#wardWorkspace {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 300px);
}

/* Full-height kanban shell */
.ward-board-shell {
  flex: 1;
  min-height: calc(100vh - 340px);
  display: flex;
  flex-direction: column;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
@media (max-width: 800px) {
  .ward-board-shell { min-height: calc(100vh - 380px); }
}

.kanban-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}
@media (max-width: 1200px) { .kanban-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 800px) { .kanban-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .kanban-grid { grid-template-columns: 1fr; } }
.kanban-grid.is-stretch {
  flex: 1;
  min-height: 0;
  align-items: stretch;
  align-content: stretch;
  grid-template-columns: repeat(var(--kanban-cols, 5), minmax(190px, 1fr));
}

@media (max-width: 800px) {
  .kanban-grid,
  .kanban-grid.is-stretch {
    grid-template-columns: repeat(var(--kanban-cols, 5), minmax(240px, 1fr));
    width: max-content;
    min-width: 100%;
  }
}

.kanban-col {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  min-height: 200px;
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
  display: flex;
  flex-direction: column;
}
.kanban-col.is-empty {
  background: color-mix(in srgb, var(--surface) 82%, var(--bg));
}
.kanban-grid.is-stretch .kanban-col {
  min-height: 100%;
  height: 100%;
}
.kanban-col-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  flex: 0 0 auto;
}
.kanban-col-head .status-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink);
}
.kanban-col-head .status-count {
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand1), var(--brand2));
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.kanban-col.is-empty .status-count {
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--line);
}
.kanban-col-body {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 auto;
  min-height: 120px;
  overflow-y: auto;
}
.kanban-col-body.drag-over {
  background: color-mix(in srgb, var(--link) 8%, var(--surface));
  outline: 2px dashed var(--link);
  outline-offset: -4px;
  border-radius: 10px;
}
.kanban-empty-lane {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--line);
  border-radius: 10px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  background: color-mix(in srgb, var(--bg) 65%, transparent);
}

.case-card {
  position: relative;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  flex: 0 0 auto;
}
.case-card:hover {
  border-color: var(--link);
  box-shadow: 0 0 0 1px var(--link), 0 2px 8px rgba(0,0,0,0.08);
  transform: translateY(-1px);
}
.case-card.is-selected {
  border-color: var(--link);
  box-shadow: 0 0 0 2px var(--link), 0 4px 12px rgba(0,0,0,0.12);
}
.case-card[draggable="true"] { cursor: grab; }
.case-card.dragging {
  opacity: 0.4;
  transform: scale(0.97);
}
.case-card-id {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--link);
  margin-bottom: 4px;
}
.case-card-reason {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--ink);
  margin-bottom: 4px;
}
.case-card-contact {
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 6px;
  word-break: break-all;
}
.case-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 6px;
}
.case-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}

.tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 0.68rem;
  font-weight: 600;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
}
.tag.urgent { color: var(--fail, #dc2626); border-color: color-mix(in srgb, var(--fail, #dc2626) 30%, transparent); background: color-mix(in srgb, var(--fail, #dc2626) 8%, transparent); }
.tag.chat { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.tag.manual { color: var(--link); border-color: color-mix(in srgb, var(--link) 30%, transparent); }
.tag.sla-ok { color: #167c43; border-color: color-mix(in srgb, #20a35a 30%, transparent); }
.tag.sla-soon { color: var(--warn, #d97706); border-color: color-mix(in srgb, var(--warn, #d97706) 30%, transparent); }
.tag.sla-over { color: var(--fail, #dc2626); border-color: color-mix(in srgb, var(--fail, #dc2626) 30%, transparent); }

.empty-ward {
  text-align: center;
  padding: 48px 24px;
  border: 1px dashed var(--line);
  border-radius: 16px;
  background: var(--surface);
}
.empty-ward h2 {
  margin: 0 0 8px;
  font-size: 1.25rem;
}
.empty-ward p {
  margin: 0 0 20px;
  color: var(--muted);
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.5;
}
.empty-ward-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.table-wrap {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface);
}
.table-scroll { overflow-x: auto; }
.ward-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.ward-table th,
.ward-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}
.ward-table th {
  background: var(--bg);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.ward-table tbody tr { cursor: pointer; }
.ward-table tbody tr:hover {
  background: color-mix(in srgb, var(--link) 5%, var(--surface));
}

/* Detail drawer — Town Hall pattern */
.detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.detail-overlay.open { opacity: 1; pointer-events: auto; }
.detail-drawer {
  position: fixed;
  top: 0; right: 0;
  width: min(620px, 100%);
  height: 100vh;
  background: var(--bg);
  border-left: 1px solid var(--line);
  box-shadow: -10px 0 50px rgba(0,0,0,0.15);
  overflow-y: auto;
  z-index: 10001;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.detail-overlay.open .detail-drawer { transform: translateX(0); }

/* Fullscreen expand: case detail slides in from the left, above the board */
.detail-overlay.detail-overlay--fs-left {
  z-index: 10350;
  background: transparent;
  pointer-events: none;
}
.detail-overlay.detail-overlay--fs-left.open {
  opacity: 1;
  pointer-events: none;
}
.detail-overlay.detail-overlay--fs-left .detail-drawer {
  left: 0;
  right: auto;
  border-left: none;
  border-right: 1px solid var(--line);
  box-shadow: 12px 0 48px rgba(0,0,0,0.28);
  transform: translateX(-100%);
  z-index: 10351;
  pointer-events: auto;
}
.detail-overlay.detail-overlay--fs-left.open .detail-drawer {
  transform: translateX(0);
}
.kanban-fullscreen.has-detail-open .kanban-fs-main {
  position: relative;
}
.kanban-fullscreen.has-detail-open .kanban-fs-main::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.18);
  pointer-events: none;
  z-index: 2;
}

.detail-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 1;
}
.detail-head-copy {
  min-width: 0;
  flex: 1;
}
.detail-head h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.35;
  word-break: break-word;
}
.detail-subtitle {
  margin: 6px 0 0;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.4;
  word-break: break-word;
}
.detail-body { padding: 20px 24px 40px; }
.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 20px;
}
.detail-section { margin-bottom: 24px; }
.detail-section h3 {
  margin: 0 0 12px;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.kv-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
@media (max-width: 500px) { .kv-grid { grid-template-columns: 1fr; } }
.kv {
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.kv .k {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.kv .v {
  margin-top: 3px;
  font-size: 0.88rem;
  color: var(--ink);
  word-break: break-word;
}
.detail-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.detail-field label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.detail-field select,
.detail-field textarea {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}
.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.empty-state-inline {
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.85rem;
}

/* Linked conversation deep link (UI spike — Town Hall B.4 lite pattern) */
.conversation-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.conversation-link-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 0.82rem;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.conversation-link-chip:hover {
  border-color: var(--link);
  background: color-mix(in srgb, var(--link) 8%, var(--surface));
}
.conv-id-mono {
  font-family: ui-monospace, monospace;
  font-size: 0.78rem;
  color: var(--link);
}
.conv-link-icon { font-size: 0.85rem; color: var(--link); }
.conv-deeplink-hint {
  margin: 8px 0 0;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.4;
}
.conv-deeplink-hint code {
  font-size: 0.7rem;
  padding: 1px 4px;
  border-radius: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.conv-inline-link {
  color: var(--link);
  font-weight: 600;
  text-decoration: none;
}
.conv-inline-link:hover { text-decoration: underline; }

/* Create case modal (Town Hall pattern) */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10200;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}
.modal {
  width: min(560px, 100%);
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.28);
  transform: translateY(8px) scale(0.98);
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal-overlay.open .modal {
  transform: translateY(0) scale(1);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
.modal-header h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 800;
}
.modal-close {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  width: 32px;
  height: 32px;
  cursor: pointer;
  font: inherit;
  line-height: 1;
}
.modal-close:hover { color: var(--ink); border-color: var(--link); }
.modal-body {
  padding: 18px 22px;
  overflow-y: auto;
}
.modal-intro {
  margin: 0 0 16px;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.5;
}
.modal-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 14px;
}
@media (max-width: 520px) {
  .modal-form { grid-template-columns: 1fr; }
}
.modal-form .field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.modal-form .field.full { grid-column: 1 / -1; }
.modal-form label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.modal-form input,
.modal-form select,
.modal-form textarea {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.88rem;
}
.modal-form input:focus,
.modal-form select:focus,
.modal-form textarea:focus {
  outline: none;
  border-color: var(--link);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--link) 15%, transparent);
}
.field-hint {
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.35;
}
.modal-form-error {
  margin: 14px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--fail, #dc2626) 35%, var(--line));
  background: color-mix(in srgb, var(--fail, #dc2626) 8%, var(--surface));
  color: var(--fail, #dc2626);
  font-size: 0.82rem;
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  flex: 0 0 auto;
}

/* Support milestones */
.support-milestones {
  background: linear-gradient(135deg, rgba(16,185,129,0.08), rgba(59,130,246,0.06));
  border-radius: 10px;
  padding: 16px;
  border: 1px solid rgba(16,185,129,0.15);
}
.ms-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ms-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--surface);
  border-radius: 8px;
  border-left: 3px solid #3b82f6;
}
.ms-icon { font-size: 1.2rem; flex: 0 0 auto; }
.ms-copy { flex: 1; min-width: 0; }
.ms-label { font-weight: 600; font-size: 0.85rem; color: var(--ink); }
.ms-detail { font-size: 0.72rem; color: var(--muted); margin-top: 2px; }
.ms-badge {
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}
.ms-badge.done { color: #10b981; }
.ms-badge.upcoming { color: #3b82f6; font-weight: 500; }
.ms-badge.overdue { color: #dc2626; }
.ms-badge.pending { color: var(--muted); font-weight: 500; }

/* Timeline — Town Hall pattern */
.timeline {
  position: relative;
  padding-left: 28px;
  max-height: 420px;
  overflow-y: auto;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 8px; top: 0; bottom: 0;
  width: 2px;
  background: var(--line);
  border-radius: 2px;
}
.tl-item {
  position: relative;
  padding: 12px 14px;
  margin-bottom: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.tl-item::before {
  content: '';
  position: absolute;
  left: -24px; top: 16px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--link);
  border: 2px solid var(--bg);
  box-shadow: 0 0 8px color-mix(in srgb, var(--link) 30%, transparent);
}
.tl-item.created::before,
.tl-item.customer_email_sent::before { background: var(--ok); }
.tl-item.delivery_failed::before,
.tl-item.status_changed.needs_attention::before { background: var(--fail, #dc2626); }
.tl-item.resolved::before { background: #10b981; }
.tl-date {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--link);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.tl-note {
  font-size: 0.82rem;
  color: var(--ink);
  margin-top: 4px;
  line-height: 1.4;
}
.tl-note.muted { color: var(--muted); font-size: 0.8rem; }

/* Fullscreen kanban */
.kanban-fullscreen {
  position: fixed; inset: 0; z-index: 9999;
  display: flex;
  background: var(--bg);
  animation: kanbanFsIn .25s ease both;
}
@keyframes kanbanFsIn { from { opacity: 0; transform: scale(.97); } }
.kanban-fs-sidebar {
  width: 240px;
  min-width: 200px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}
.kanban-fs-crumb {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--brand-orange, var(--link));
}
.fs-hea-name {
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--ink);
  line-height: 1.3;
  word-break: break-word;
}
.fs-subtitle {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: -4px;
}
.kanban-fs-sidebar hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 4px 0;
}
.kanban-fs-stage-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.kanban-fs-stage {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
}
.kanban-fs-stage .fs-count {
  background: linear-gradient(90deg, var(--brand1), var(--brand2));
  color: #fff;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 800;
  min-width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}
.kanban-fs-close {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: auto;
}
.kanban-fs-close:hover { background: var(--line); }
.kanban-fs-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.kanban-fs-topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  flex: 0 0 auto;
}
.kanban-fs-topbar-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink);
}
.kanban-fs-topbar-chip {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
}
.kanban-fs-main .kanban-grid {
  flex: 1;
  min-height: 0;
  margin: 0;
  padding: 16px 20px 20px;
  overflow-x: auto;
  align-items: stretch;
  grid-template-columns: repeat(var(--kanban-cols, 5), minmax(240px, 1fr));
}
.kanban-fs-main .kanban-col-body {
  max-height: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { border-color: var(--link); }
.btn.primary {
  border-color: transparent;
  background: linear-gradient(90deg, var(--brand1), var(--brand2));
  color: #fff;
}
.btn.sm { padding: 6px 10px; font-size: 0.78rem; height: auto; }

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 11000;
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--bg);
  font-size: 0.85rem;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
  animation: fadeInUp 0.25s ease;
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
