:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #eef2f5;
  --line: #d8dee6;
  --text: #17202a;
  --muted: #657283;
  --free: #1f9d63;
  --busy: #c64035;
  --blocked: #7b8492;
  --selected: #2563eb;
  --warn: #b7791f;
  --slot-bg: #fbfcfd;
  --shadow: 0 14px 35px rgba(23, 32, 42, 0.08);
  font-family: "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

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

button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 7px;
  cursor: pointer;
  min-height: 38px;
  padding: 0 14px;
}

button:hover {
  border-color: #9aa8b8;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  align-items: center;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 20px;
  justify-content: space-between;
  padding: 18px 26px;
  position: sticky;
  top: 0;
  z-index: 20;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0;
}

h2 {
  font-size: 16px;
  letter-spacing: 0;
}

#snapshotMeta {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.live-meta {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.live-meta button {
  font-size: 12px;
  font-weight: 700;
  min-height: 28px;
  padding: 0 9px;
}

.live-status {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  display: inline-flex;
  font-size: 11px;
  font-weight: 800;
  min-height: 26px;
  padding: 5px 9px;
}

.live-status-live {
  background: #eaf8f0;
  border-color: rgba(31, 157, 99, 0.45);
  color: #12613d;
}

.live-status-local {
  background: #fff8e8;
  border-color: rgba(183, 121, 31, 0.45);
  color: #8a5a13;
}

.live-status-error {
  background: #fdeceb;
  border-color: rgba(198, 64, 53, 0.45);
  color: #85281f;
}

.searchbar {
  align-items: end;
  display: grid;
  gap: 8px;
  grid-template-columns: 90px minmax(240px, 360px) auto auto auto;
}

.searchbar label,
.form-grid label {
  color: var(--muted);
  display: grid;
  font-size: 12px;
  font-weight: 600;
  gap: 6px;
  text-transform: uppercase;
}

.searchbar input,
.searchbar textarea,
.site-picker-menu input,
.form-grid input,
.form-grid select,
.form-grid textarea {
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  min-height: 38px;
  padding: 8px 10px;
  width: 100%;
}

.searchbar textarea {
  line-height: 1.25;
  max-height: 72px;
  min-height: 52px;
  resize: vertical;
}

.site-picker {
  position: relative;
}

.site-picker-menu {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 3px;
  box-shadow: 0 8px 24px rgba(23, 32, 42, 0.18);
  display: grid;
  gap: 7px;
  min-width: 255px;
  padding: 8px;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 50;
}

.site-picker-count {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.site-picker-list {
  border: 1px solid var(--line);
  border-radius: 0;
  display: grid;
  max-height: 270px;
  overflow: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
}

.site-picker-option {
  align-items: center;
  border-bottom: 1px solid #eef2f5;
  color: var(--text);
  display: flex;
  cursor: pointer;
  font-size: 12px;
  gap: 6px;
  justify-content: flex-start;
  line-height: 1;
  min-height: 24px;
  padding: 3px 7px;
  text-transform: none;
  user-select: none;
  width: 100%;
}

.site-picker-option:last-child {
  border-bottom: 0;
}

.site-picker-option:hover {
  background: #eef5ff;
}

.site-picker-option-selected {
  background: #eaf2ff;
}

.site-picker-option-selected:hover {
  background: #dfeeff;
}

.site-picker-select-all {
  background: #ffffff;
  border-bottom-color: #d8dee6;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 1;
}

.site-picker-empty {
  color: var(--muted);
  font-size: 13px;
  padding: 9px 10px;
}

.site-picker-box {
  align-items: center;
  background: #ffffff;
  border: 1px solid #7b8492;
  color: #17202a;
  display: inline-flex;
  flex: 0 0 auto;
  height: 13px;
  justify-content: center;
  line-height: 1;
  width: 13px;
}

.site-picker-option-selected .site-picker-box {
  border-color: #2563eb;
  color: #2563eb;
  font-size: 11px;
  font-weight: 900;
}

.site-picker-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-picker-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

main {
  padding: 18px 26px 32px;
}

.summary-band {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(4, minmax(110px, 1fr)) auto;
  margin-bottom: 18px;
  padding: 14px;
}

.summary-band strong {
  display: block;
  font-size: 22px;
  line-height: 1.15;
  margin-top: 3px;
}

.eyebrow {
  color: var(--muted);
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.summary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.summary-actions button,
#backupPlannerBtn,
#exportBtn,
#saveAssignmentBtn,
#saveNewShelfBtn,
#saveNewSiteBtn,
#tdSaveBtn {
  background: var(--selected);
  border-color: var(--selected);
  color: #ffffff;
}

.summary-actions button:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
}

.hidden-file-input {
  display: none;
}

.workspace-grid {
  align-items: start;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) 340px;
}

.notice {
  background: #fff8e8;
  border: 1px solid #e8c66b;
  border-radius: 8px;
  color: #654c14;
  margin-bottom: 14px;
  padding: 12px 14px;
}

.hidden {
  display: none !important;
}

.shelf-grid {
  display: grid;
  gap: 16px;
}

.site-section {
  display: grid;
  gap: 12px;
}

.site-section-header {
  align-items: center;
  background: #e9eef5;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 10px 12px;
}

.site-section-header h2 {
  font-size: 18px;
}

.site-section-header span {
  color: var(--muted);
  font-size: 13px;
}

.site-section-tools {
  align-items: flex-end;
  display: grid;
  gap: 7px;
  justify-items: end;
}

.site-expand-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.site-expand-controls button {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #263445;
  font-size: 11px;
  min-height: 26px;
  padding: 4px 8px;
}

.shelf-grid-inner {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
}

.shelf-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  min-width: 0;
  overflow: hidden;
}

.shelf-header {
  align-items: start;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 12px 14px;
}

.shelf-title {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.shelf-title strong {
  font-size: 15px;
  overflow-wrap: anywhere;
}

.shelf-title span {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.pill {
  border-radius: 999px;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  padding: 6px 8px;
  white-space: nowrap;
}

.pill.free {
  background: var(--free);
}

.pill.busy {
  background: var(--busy);
}

.pill.blocked {
  background: var(--blocked);
}

.slot-layout {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.layout-mss8 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.layout-mss4 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.layout-single {
  grid-template-columns: minmax(0, 1fr);
}

.slot {
  background: var(--slot-bg);
  border: 2px solid var(--line);
  border-radius: 8px;
  min-height: 152px;
  padding: 10px;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.slot.free {
  border-color: rgba(31, 157, 99, 0.62);
}

.slot.busy {
  border-color: rgba(198, 64, 53, 0.72);
}

.slot.blocked {
  background: #f0f2f4;
  border-color: #b8c0cc;
  color: #657283;
}

.slot.selected {
  border-color: var(--selected);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

.slot-clickable {
  cursor: pointer;
}

.slot-head {
  align-items: start;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  min-height: 42px;
}

.slot-head strong {
  font-size: 13px;
}

.slot-head span {
  color: var(--muted);
  display: block;
  font-size: 11px;
  margin-top: 3px;
  overflow-wrap: anywhere;
}

.assign-slot-button {
  background: #eaf8f0;
  border-color: rgba(31, 157, 99, 0.55);
  color: #12613d;
  font-size: 11px;
  font-weight: 800;
  margin-top: 2px;
  min-height: 24px;
  padding: 0 8px;
  width: 100%;
}

.slot-state {
  border-radius: 6px;
  color: #ffffff;
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: 800;
  padding: 5px 6px;
  text-transform: uppercase;
}

.slot-state.free {
  background: var(--free);
}

.slot-state.busy {
  background: var(--busy);
}

.slot-state.blocked {
  background: var(--blocked);
}

.slot-state.selected {
  background: var(--selected);
}

.port-grid {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 10px;
}

.port {
  align-content: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  min-height: 44px;
  padding: 5px;
  text-align: center;
}

.port.free {
  background: #eaf8f0;
  border-color: rgba(31, 157, 99, 0.45);
  color: #12613d;
}

.port.busy {
  background: #fdeceb;
  border-color: rgba(198, 64, 53, 0.45);
  color: #85281f;
}

.port.blocked {
  background: #eceff3;
  color: #657283;
}

.port.selected {
  background: #e8efff;
  border-color: rgba(37, 99, 235, 0.6);
  color: #1745a8;
}

.port button {
  all: unset;
  cursor: pointer;
  display: grid;
  gap: 2px;
}

.port.blocked button,
.port.busy button {
  cursor: default;
}

.port-number {
  font-size: 12px;
  font-weight: 800;
}

.port-value,
.port-speed {
  font-size: 10px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.speed-10g {
  color: #8b3d00;
  font-weight: 800;
}

.speed-1g-opt {
  color: #315ba7;
  font-weight: 800;
}

.speed-1g-elc {
  color: #276749;
  font-weight: 800;
}

.assignment-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  position: sticky;
  top: 92px;
}

.panel-header {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding: 12px;
}

.panel-header button {
  min-height: 32px;
}

.assignment-list {
  display: grid;
  gap: 10px;
  max-height: calc(100vh - 350px);
  overflow: auto;
  padding: 12px;
}

.validation-panel {
  border-bottom: 1px solid var(--line);
}

.validation-list {
  display: grid;
  gap: 8px;
  max-height: 190px;
  overflow: auto;
  padding: 12px;
}

.validation-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 3px;
  padding: 8px;
}

.validation-item strong {
  font-size: 12px;
}

.validation-item span {
  color: var(--muted);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.validation-ok {
  background: #f0fdf4;
  border-color: rgba(31, 157, 99, 0.5);
}

.validation-error {
  background: #fff1f0;
  border-color: rgba(198, 64, 53, 0.62);
}

.validation-warning {
  background: #fff8e8;
  border-color: rgba(183, 121, 31, 0.55);
}

.validation-info {
  background: #eff6ff;
  border-color: rgba(37, 99, 235, 0.45);
}

.assignment-empty {
  color: var(--muted);
  font-size: 13px;
  padding: 6px 0;
}

.assignment-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 6px;
  padding: 10px;
}

.assignment-item.status-planned,
.assignment-item.status-reserved,
.assignment-item.status-designed {
  border-color: rgba(37, 99, 235, 0.35);
}

.assignment-item.status-implemented {
  border-color: rgba(31, 157, 99, 0.55);
}

.assignment-status-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.planner-status-select {
  min-height: 30px;
  padding: 4px 8px;
}

.status-badge {
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 8px;
}

.status-badge.status-planned,
.status-badge.status-reserved,
.status-badge.status-designed {
  background: #eff6ff;
  color: #1745a8;
}

.status-badge.status-implemented {
  background: #eaf8f0;
  color: #12613d;
}

.assignment-item strong {
  font-size: 13px;
}

.assignment-item span {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.assignment-item .live-change-meta {
  color: #12613d;
  font-weight: 700;
}

.assignment-item button {
  justify-self: start;
  min-height: 30px;
  padding: 0 10px;
}

.td-report-panel {
  background: #ffffff;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 12px;
  padding: 12px;
}

.td-report-actions {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr 1fr;
}

.td-report-actions button {
  background: var(--selected);
  border: 1px solid var(--selected);
  border-radius: 4px;
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
  min-height: 42px;
  padding: 0 8px;
}

.td-report-actions button:hover {
  background: #1745c9;
  border-color: #1745c9;
  color: #ffffff;
}

.td-report-actions button:nth-child(5) {
  font-size: 11px;
}

.planner-dialog {
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(23, 32, 42, 0.22);
  max-width: min(760px, calc(100vw - 32px));
  padding: 0;
  width: 720px;
}

.td-dialog {
  max-width: min(1180px, calc(100vw - 28px));
  width: 1120px;
}

.td-dialog-work-order {
  max-width: min(1260px, calc(100vw - 18px));
  width: 1220px;
}

.td-dialog-actions {
  max-width: min(780px, calc(100vw - 18px));
  width: 720px;
}

.td-dialog-dcn {
  max-width: min(1420px, calc(100vw - 18px));
  width: 1360px;
}

.planner-dialog::backdrop {
  background: rgba(23, 32, 42, 0.45);
}

.dialog-header {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding: 14px 16px;
}

.dialog-hint {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.ghost-button {
  background: transparent;
}

.form-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 16px;
}

.form-grid .wide {
  grid-column: 1 / -1;
}

.assignment-dialog-port #feSiteField,
.assignment-dialog-port #cardTypeField {
  display: none !important;
}

.port-picker {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.port-picker label {
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  display: flex;
  flex-direction: row;
  font-size: 11px;
  gap: 5px;
  justify-content: center;
  min-height: 28px;
  padding: 4px 6px;
  text-transform: none;
}

.port-picker input[type="checkbox"] {
  accent-color: var(--selected);
  flex: 0 0 auto;
  height: 14px;
  margin: 0;
  width: 14px;
}

.port-picker span {
  line-height: 1.1;
  white-space: nowrap;
}

.port-choice-active input:checked + span {
  color: #12613d;
  font-weight: 900;
}

.port-choice-na {
  color: #64748b;
  opacity: 0.65;
}

.port-summary-chip {
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  display: flex;
  font-size: 12px;
  font-weight: 800;
  justify-content: center;
  min-height: 34px;
  padding: 7px 8px;
  text-transform: none;
}

.port-summary-chip.active,
.port-summary-chip.selected {
  background: #ecfdf3;
  border-color: rgba(31, 157, 99, 0.42);
  color: #12613d;
}

.port-summary-chip.na {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #64748b;
}

.dialog-actions {
  border-top: 1px solid var(--line);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 14px 16px;
}

.danger-button {
  background: #c64035;
  border-color: #a9342b;
  color: #ffffff;
}

.danger-button:hover {
  background: #a9342b;
}

.delete-shelf-body {
  display: grid;
  gap: 7px;
  padding: 16px;
}

.delete-shelf-body strong {
  color: #17202a;
  font-size: 14px;
}

.delete-shelf-body span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.td-sheet-table {
  max-height: min(68vh, 640px);
  overflow: auto;
  padding: 12px;
}

.td-sheet-table table {
  border-collapse: collapse;
  min-width: 100%;
  table-layout: fixed;
}

.td-sheet-table th,
.td-sheet-table td {
  border: 1px solid #8b96a7;
  font-size: 12px;
  min-width: 120px;
  padding: 0;
  vertical-align: top;
}

.td-sheet-table th {
  background: #ffffcc;
  color: #111827;
  font-weight: 800;
  padding: 8px;
  position: sticky;
  text-align: left;
  top: 0;
  z-index: 1;
}

.td-template-actions th,
.td-template-dcn th {
  background: #d9d9d9;
  color: #111827;
}

.td-template-idu th,
.td-template-mwLink th {
  background: #ffffcc;
  color: #111827;
}

.td-dialog-actions .td-sheet-table {
  background: #f4f4f4;
  max-height: min(76vh, 760px);
  padding: 8px;
}

.td-dialog-dcn .td-sheet-table {
  background: #f4f4f4;
  max-height: min(76vh, 760px);
  padding: 8px;
}

.action-template {
  background: #ffffff;
  border-collapse: collapse;
  color: #000000;
  min-width: 0;
  width: 100%;
}

.action-template .action-col-type {
  width: 74px;
}

.action-template .action-col-point {
  width: 54px;
}

.action-template .action-col-desc {
  width: 360px;
}

.action-template .action-col-site {
  width: 94px;
}

.action-template td,
.action-template td.readonly {
  border: 1px solid #000000;
  color: #000000;
  font-size: 11px;
  height: 19px;
  line-height: 1.1;
  padding: 1px 4px;
}

.action-template input {
  color: #000000;
  font-size: 11px;
  min-height: 19px;
  padding: 1px 4px;
  text-align: center;
}

.action-title-row td,
.action-title-row td.readonly {
  background: #ddebf7;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.action-header-row td,
.action-header-row td.readonly,
.action-header-row input {
  background: #d9d9d9;
  font-weight: 800;
  text-align: center;
}

.action-type-cell,
.action-point-cell,
.action-date-label,
.action-date-value {
  text-align: center;
}

.action-type-cell {
  font-weight: 800;
}

.action-desc-cell {
  text-align: left;
}

.action-value-cell {
  background: #ffffff;
}

.action-date-row td,
.action-date-row td.readonly {
  border: 0;
  font-size: 12px;
  font-weight: 800;
}

.td-sheet-table td.readonly {
  background: #f1f5f9;
  color: #475569;
  font-weight: 700;
  padding: 8px;
}

.td-sheet-table input,
.td-sheet-table textarea {
  background: #ffffff;
  border: 0;
  color: var(--text);
  display: block;
  font: inherit;
  min-height: 34px;
  outline: none;
  padding: 7px 8px;
  width: 100%;
}

.td-title-row td,
.td-subtitle-row td,
.td-header-row td {
  background: #f8fafc;
  font-weight: 800;
}

.td-title-row td {
  font-size: 13px;
}

.td-header-row td,
.td-header-row td.readonly {
  background: #d9d9d9;
  color: #111827;
}

.td-sheet-table textarea {
  min-height: 58px;
  resize: vertical;
}

.td-sheet-table input:focus,
.td-sheet-table textarea:focus {
  box-shadow: inset 0 0 0 2px var(--selected);
}

.td-sheet-table td[tabindex="0"]:focus {
  box-shadow: inset 0 0 0 2px var(--selected);
  outline: none;
}

.td-sheet-table .action-template td.readonly {
  background: #ffffff;
  color: #000000;
  font-weight: 400;
  padding: 1px 4px;
}

.td-sheet-table .action-template input {
  color: #000000;
  font-size: 11px;
  min-height: 19px;
  padding: 1px 4px;
  text-align: center;
}

.td-sheet-table .action-template .action-title-row td {
  background: #ddebf7;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.td-sheet-table .action-template .action-header-row td,
.td-sheet-table .action-template .action-header-row input {
  background: #d9d9d9;
  font-weight: 800;
  text-align: center;
}

.td-sheet-table .action-template .action-type-cell {
  font-weight: 800;
  text-align: center;
}

.dcn-template {
  background: #ffffff;
  border-collapse: collapse;
  color: #000000;
  font-family: Calibri, Arial, sans-serif;
  min-width: 1360px;
  table-layout: fixed;
}

.dcn-template .dcn-col-1 {
  width: 96px;
}

.dcn-template .dcn-col-2 {
  width: 88px;
}

.dcn-template .dcn-col-3 {
  width: 54px;
}

.dcn-template .dcn-col-4 {
  width: 112px;
}

.dcn-template .dcn-col-5 {
  width: 56px;
}

.dcn-template .dcn-col-6 {
  width: 126px;
}

.dcn-template .dcn-col-7 {
  width: 42px;
}

.dcn-template .dcn-col-8 {
  width: 56px;
}

.dcn-template .dcn-col-9 {
  width: 66px;
}

.dcn-template .dcn-col-10 {
  width: 96px;
}

.dcn-template .dcn-col-11 {
  width: 122px;
}

.dcn-template .dcn-col-12 {
  width: 112px;
}

.dcn-template .dcn-col-13 {
  width: 136px;
}

.dcn-template .dcn-col-14 {
  width: 48px;
}

.dcn-template .dcn-col-15 {
  width: 116px;
}

.dcn-template .dcn-col-16 {
  width: 132px;
}

.dcn-template .dcn-col-17 {
  width: 78px;
}

.dcn-template th,
.dcn-template td {
  border: 1px solid #000000;
  color: #000000;
  font-size: 11px;
  height: 20px;
  line-height: 1.1;
  min-width: 0;
  padding: 0;
  text-align: center;
  vertical-align: middle;
}

.dcn-template th {
  background: #17365d;
  color: #ffffff;
  font-weight: 800;
  padding: 2px 4px;
}

.dcn-template input {
  background: #ffffff;
  color: #000000;
  font-size: 11px;
  min-height: 20px;
  padding: 1px 3px;
  text-align: center;
}

.dcn-template .dcn-yellow-cell,
.dcn-template .dcn-yellow-cell input {
  background: #ffff00;
}

.idu-selector {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 10px;
  padding: 10px;
}

.idu-selector-header {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.idu-selector-header span {
  color: var(--muted);
  font-size: 12px;
  margin-right: auto;
}

.idu-selector-header button {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  min-height: 30px;
  padding: 6px 10px;
}

.idu-shelf-options {
  display: grid;
  gap: 7px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  max-height: 190px;
  overflow: auto;
}

.idu-shelf-option {
  align-items: flex-start;
  background: #ffffff;
  border: 1px solid #d8dee6;
  border-radius: 7px;
  display: flex;
  gap: 8px;
  padding: 8px;
  text-transform: none;
}

.idu-shelf-option input {
  display: inline-block;
  margin-top: 2px;
  min-height: auto;
  padding: 0;
  width: auto;
}

.idu-shelf-option strong,
.idu-shelf-option small {
  display: block;
}

.idu-shelf-option small,
.idu-empty {
  color: var(--muted);
  font-size: 11px;
}

.td-dialog-work-order .dialog-header {
  padding: 10px 14px;
}

.td-dialog-work-order .dialog-actions {
  padding: 10px 14px;
}

.td-dialog-work-order .td-sheet-table {
  background: #f4f4f4;
  max-height: min(72vh, 720px);
  padding: 8px;
}

.td-template-workOrder {
  background: #ffffff;
  border-collapse: collapse;
  color: #000000;
  font-family: Calibri, Arial, sans-serif;
  min-width: 1080px;
  table-layout: fixed;
}

.wo-row-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 8px;
}

.wo-row-tools button {
  background: #ffffff;
  border: 1px solid #9aa6b5;
  color: #17202a;
  min-height: 30px;
  padding: 6px 10px;
}

.wo-row-tools button:hover {
  background: #eef2f5;
  border-color: #657283;
}

.td-template-workOrder .wo-col-item {
  width: 56px;
}

.td-template-workOrder .wo-col-count {
  width: 68px;
}

.td-template-workOrder .wo-col-desc {
  width: 118px;
}

.td-template-workOrder .wo-col-type {
  width: 72px;
}

.td-template-workOrder .wo-col-phase {
  width: 88px;
}

.td-template-workOrder .wo-col-qty {
  width: 44px;
}

.td-template-workOrder .wo-col-rank {
  width: 76px;
}

.td-template-workOrder .wo-col-comments {
  width: 96px;
}

.td-template-workOrder td,
.td-template-workOrder td.readonly {
  background: #ffffff;
  border: 1px solid #000000;
  color: #000000;
  font-size: 11px;
  min-width: 0;
  padding: 2px 4px;
  vertical-align: middle;
}

.td-template-workOrder input,
.td-template-workOrder textarea {
  background: transparent;
  color: #000000;
  font-family: Calibri, Arial, sans-serif;
  font-size: 11px;
  line-height: 1.18;
  min-height: 18px;
  padding: 1px 3px;
}

.td-template-workOrder textarea {
  min-height: 46px;
}

.td-template-workOrder .wo-link-cell {
  border-top-width: 2px;
}

.td-template-workOrder .wo-link-cell input {
  font-weight: 800;
  text-align: center;
}

.td-template-workOrder .wo-info-label,
.td-template-workOrder .wo-site-label,
.td-template-workOrder .wo-section-cell {
  font-weight: 800;
}

.td-template-workOrder .wo-info-value input {
  font-weight: 700;
}

.td-template-workOrder .wo-info-gap {
  background: #ffffff;
}

.td-template-workOrder .wo-spacer-cell {
  background: #ffffff;
  border-left-color: transparent;
  border-right-color: transparent;
  height: 12px;
}

.td-template-workOrder .wo-section-cell {
  border-left-color: transparent;
  border-right-color: transparent;
  height: 22px;
}

.td-template-workOrder .wo-header-row td,
.td-template-workOrder .wo-header-row td.readonly {
  background: #d9d9d9;
  font-weight: 400;
  text-align: center;
}

.td-template-workOrder .wo-header-row .readonly {
  color: #000000;
}

.td-template-workOrder .wo-existing-row td,
.td-template-workOrder .wo-existing-row input,
.td-template-workOrder .wo-existing-row textarea {
  background: #e6b8b7;
  font-weight: 800;
  text-align: center;
}

.td-template-workOrder .wo-existing-row .wo-description-cell input,
.td-template-workOrder .wo-existing-row .wo-description-cell textarea,
.td-template-workOrder .wo-old-link-row .wo-description-cell input,
.td-template-workOrder .wo-old-link-row .wo-description-cell textarea {
  text-align: left;
}

.td-template-workOrder .wo-old-link-row td,
.td-template-workOrder .wo-old-link-row input,
.td-template-workOrder .wo-old-link-row textarea {
  background: #ffffcc;
}

.td-template-workOrder .wo-item-row td:not(.wo-description-cell) input {
  text-align: center;
}

.td-template-workOrder .wo-description-cell input,
.td-template-workOrder .wo-description-cell textarea {
  text-align: left;
}

.td-note {
  background: #fff8e8;
  border: 1px solid #e8c66b;
  border-radius: 8px;
  color: #654c14;
  margin-bottom: 10px;
  padding: 10px 12px;
}

.toast {
  background: #17202a;
  border-radius: 8px;
  bottom: 18px;
  color: #ffffff;
  left: 50%;
  max-width: calc(100vw - 32px);
  padding: 12px 14px;
  position: fixed;
  transform: translateX(-50%);
  z-index: 100;
}

.mns-shelf {
  background: #ffffff;
  width: 100%;
}

.mns-shelf-summary-row {
  align-items: stretch;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
}

.mns-shelf-summary {
  align-items: center;
  background: #ffffff;
  border: 0;
  color: var(--text);
  cursor: pointer;
  display: grid;
  gap: 10px;
  grid-template-columns: auto minmax(220px, 1fr) minmax(420px, auto);
  min-height: 46px;
  padding: 7px 10px;
  text-align: left;
  width: 100%;
}

.delete-shelf-button {
  background: #fff5f4;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0;
  color: #9b1c1c;
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
  min-width: 72px;
  padding: 7px 10px;
}

.delete-shelf-button:hover,
.delete-shelf-button:focus {
  background: #fdeceb;
  outline: none;
}

.delete-shelf-button:focus {
  box-shadow: inset 0 0 0 2px #c64035;
}

.mns-shelf-summary:hover,
.mns-shelf-summary:focus {
  background: #f8fafc;
  outline: none;
}

.mns-shelf-summary:focus {
  box-shadow: inset 0 0 0 2px var(--selected);
}

.shelf-toggle-icon {
  background: #eef2f5;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #334155;
  font-size: 11px;
  font-weight: 800;
  min-width: 62px;
  padding: 4px 7px;
  text-align: center;
}

.shelf-summary-main {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.shelf-summary-main strong,
.shelf-summary-main small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shelf-summary-main strong {
  font-size: 13px;
}

.shelf-summary-main small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.mns-shelf-collapsed {
  box-shadow: none;
}

.mns-shelf-header {
  align-items: center;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(180px, 1fr) minmax(120px, auto) minmax(180px, auto);
  padding: 8px 10px;
}

.mns-shelf-header strong,
.mns-shelf-header span {
  display: block;
  overflow-wrap: anywhere;
}

.mns-shelf-header strong {
  font-size: 13px;
}

.mns-shelf-header span,
.mns-meta,
.mns-type {
  color: var(--muted);
  font-size: 12px;
}

.mns-type {
  color: #2f3b4a;
  font-weight: 700;
  text-align: right;
}

.mns-shelf-stats {
  background: #fbfcfd;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 11px;
  gap: 6px;
  padding: 5px 8px;
}

.shelf-summary-stats {
  background: transparent;
  justify-content: flex-end;
  padding: 0;
}

.site-traffic-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: flex-end;
}

.site-topology-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: flex-end;
}

.site-traffic-summary span,
.site-topology-summary span,
.mns-shelf-stats span {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: inline-flex;
  gap: 5px;
  min-height: 26px;
  padding: 4px 7px;
  white-space: nowrap;
}

.site-topology-summary span {
  border-color: rgba(37, 99, 235, 0.28);
  color: #1745a8;
}

.site-topology-summary .topology-issue-pill {
  border-color: rgba(183, 121, 31, 0.45);
  color: #8a5a12;
}

.site-traffic-summary strong,
.site-topology-summary strong,
.mns-shelf-stats strong {
  color: var(--text);
  font-size: 13px;
}

.shelf-topology-strip {
  background: #f8fafc;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 10px;
}

.topology-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  min-height: 24px;
  padding: 4px 8px;
}

.topology-chip-cascade {
  background: #eaf8f0;
  border-color: rgba(31, 157, 99, 0.45);
  color: #12613d;
}

.topology-chip-service {
  background: #e8efff;
  border-color: rgba(37, 99, 235, 0.45);
  color: #1745a8;
}

.topology-chip-issue {
  background: #fff8e8;
  border-color: rgba(183, 121, 31, 0.45);
  color: #8a5a12;
}

.topology-chip-more {
  background: #ffffff;
  color: var(--muted);
}

.shelf-photo-wrap {
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  padding: 8px 10px 4px;
}

.shelf-photo {
  display: block;
  height: auto;
  max-height: 190px;
  object-fit: contain;
  object-position: left center;
  width: 100%;
}

.mns-shelf-body {
  background: #111827;
  padding: 4px;
}

.mns-shelf-standalone .mns-shelf-summary {
  background: #fbfcfd;
}

.mns-standalone-rack {
  align-items: center;
  background: #f8fafc;
  border: 1px solid #334155;
  border-radius: 6px;
  color: #17202a;
  display: flex;
  justify-content: space-between;
  min-height: 34px;
  padding: 8px 10px;
}

.mns-standalone-rack strong {
  font-size: 12px;
}

.mns-standalone-rack span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.mns-rack {
  background: linear-gradient(#101820, #090d13);
  border: 2px solid #283241;
  border-radius: 7px;
  display: grid;
  gap: 3px;
  padding: 4px;
  position: relative;
}

.chassis-label {
  align-items: center;
  color: #e5edf6;
  display: grid;
  font-size: 11px;
  font-weight: 800;
  gap: 6px;
  grid-template-columns: minmax(130px, 0.75fr) minmax(180px, 1.25fr) minmax(110px, 0.6fr);
  letter-spacing: 0;
  margin-bottom: 3px;
  text-transform: uppercase;
}

.chassis-label span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chassis-label span:nth-child(2) {
  text-align: center;
}

.chassis-label span:nth-child(3) {
  color: #b8c5d6;
  text-align: right;
}

.rack-mss8 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.rack-mss4 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.rack-single {
  grid-template-columns: minmax(0, 1fr);
}

.slot-module {
  background: #f9fbfd;
  border: 2px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 2px;
  min-height: 52px;
  padding: 3px;
  position: relative;
}

.slot-free {
  border-color: rgba(31, 157, 99, 0.6);
}

.slot-busy {
  background: #fff1f0;
  border-color: #c64035;
  box-shadow: inset 0 0 0 1px rgba(198, 64, 53, 0.2);
}

.slot-selected {
  border-color: rgba(37, 99, 235, 0.75);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.slot-blocked {
  background: #ffe4e1;
  border-color: #c64035;
  color: #8f1d15;
  min-height: 28px;
  padding: 2px 4px;
}

.slot-busy .slot-topline,
.slot-blocked .slot-topline {
  color: #8f1d15;
}

.slot-blocked .slot-card-type {
  background: #ffd0cc;
  color: #8f1d15;
  min-height: 14px;
  padding: 1px 4px;
}

.slot-topline {
  align-items: center;
  color: var(--muted);
  display: grid;
  font-size: 10px;
  font-weight: 800;
  gap: 5px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  letter-spacing: 0;
}

.slot-topline span:nth-child(2) {
  font-size: 9px;
  font-weight: 700;
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mns-rack .assign-slot-button {
  background: transparent;
  border: 1px solid rgba(31, 157, 99, 0.75);
  border-radius: 5px;
  color: #12613d;
  font-size: 9px;
  font-weight: 800;
  margin: 0;
  min-height: 19px;
  padding: 1px 7px;
  width: auto;
}

.slot-busy .assign-slot-button {
  background: rgba(255, 255, 255, 0.55);
  border-color: rgba(198, 64, 53, 0.65);
  color: #8f1d15;
}

.slot-selected .assign-slot-button {
  border-color: rgba(37, 99, 235, 0.65);
  color: #1d4ed8;
}

.slot-card-type {
  align-items: center;
  border-radius: 6px;
  display: flex;
  font-size: 10px;
  font-weight: 800;
  justify-content: center;
  min-height: 19px;
  padding: 2px 5px;
  text-align: center;
}

.card-eac {
  background: #eaf4ff;
  color: #17539b;
}

.card-eas {
  background: #fff4df;
  color: #925c0c;
}

.card-corevo {
  background: #eaf8f0;
  color: #12613d;
}

.card-mpt {
  background: #f4ecff;
  color: #6b3ca0;
}

.card-cahd {
  background: #ffecee;
  color: #9b1c31;
}

.card-mss {
  background: #fff1e8;
  color: #9a4a15;
}

.card-other {
  background: #eef2f5;
  color: #475569;
}

.slot-direction {
  color: var(--muted);
  font-size: 11px;
  min-height: 15px;
  overflow-wrap: anywhere;
}

.ports-grid {
  display: grid;
  gap: 2px;
  grid-template-columns: repeat(8, minmax(0, 1fr));
}

.port-cell {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: #334155;
  cursor: pointer;
  display: grid;
  gap: 1px;
  grid-template-columns: minmax(0, 1fr);
  min-height: 20px;
  padding: 1px 2px;
  text-align: center;
}

.port-name {
  font-size: 8px;
  font-weight: 800;
  line-height: 1.05;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.port-label {
  color: #17202a;
  font-size: 8px;
  font-weight: 800;
  grid-column: 1 / -1;
  line-height: 1.05;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.port-topology {
  background: rgba(37, 99, 235, 0.09);
  border-radius: 999px;
  color: #1745a8;
  font-size: 8px;
  font-weight: 900;
  grid-column: 1 / -1;
  line-height: 1.05;
  overflow: hidden;
  padding: 1px 3px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.port-free {
  background: #ecfdf3;
  border-color: rgba(31, 157, 99, 0.35);
  color: #12613d;
}

.port-busy {
  background: #ffdeda;
  border-color: #c64035;
  cursor: default;
  color: #9b1f17;
}

.port-selected {
  background: #eff6ff;
  border-color: rgba(37, 99, 235, 0.55);
  color: #1d4ed8;
}

.port-neutral {
  background: #f1f5f9;
  border-color: #cbd5e1;
  cursor: default;
  color: #64748b;
}

.port-blocked {
  background: #ffdeda;
  border-color: #c64035;
  color: #9b1f17;
  cursor: default;
}

@media (max-width: 1100px) {
  .workspace-grid {
    grid-template-columns: 1fr;
  }

  .assignment-panel {
    position: static;
  }
}

@media (max-width: 760px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
    padding: 14px;
  }

  main {
    padding: 14px;
  }

  .searchbar {
    grid-template-columns: 1fr;
  }

  .site-picker-menu {
    left: 0;
    min-width: 0;
    right: 0;
  }

  .summary-band {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .summary-actions {
    grid-column: 1 / -1;
    justify-content: stretch;
  }

  .summary-actions button {
    flex: 1;
  }

  .shelf-grid-inner {
    grid-template-columns: 1fr;
  }

  .site-section-header,
  .mns-shelf-summary {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .mns-shelf-summary-row {
    grid-template-columns: 1fr;
  }

  .delete-shelf-button {
    border-left: 0;
    border-top: 1px solid var(--line);
    min-height: 34px;
    width: 100%;
  }

  .site-section-header {
    flex-direction: column;
  }

  .site-section-tools,
  .site-traffic-summary,
  .site-expand-controls,
  .shelf-summary-stats {
    justify-content: flex-start;
    justify-items: start;
  }

  .slot-layout {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .mns-shelf-header {
    grid-template-columns: 1fr;
  }

  .mns-type {
    text-align: left;
  }

  .chassis-label {
    grid-template-columns: 1fr;
  }

  .chassis-label span:nth-child(2),
  .chassis-label span:nth-child(3) {
    text-align: left;
  }
}
