*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --sidebar-bg: #0d1117;
  --sidebar-width: 232px;
  --sidebar-text: #8b949e;
  --sidebar-hover: #161b22;
  --sidebar-active-bg: rgba(56,139,253,.15);
  --sidebar-active-text: #58a6ff;
  --sidebar-border: #21262d;
  --header-height: 56px;

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --danger-light: #fef2f2;
  --success: #22c55e;
  --warning: #f59e0b;

  --border: #e5e7eb;
  --border-light: #f3f4f6;
  --bg: #f9fafb;
  --bg-subtle: #f3f4f6;
  --white: #ffffff;
  --text: #111827;
  --text-secondary: #374151;
  --text-muted: #6b7280;
  --text-xs: #9ca3af;

  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  --shadow-xs: 0 1px 2px rgba(0,0,0,.05);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow: 0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -1px rgba(0,0,0,.05);
  --shadow-md: 0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -2px rgba(0,0,0,.04);
  --shadow-lg: 0 20px 25px -5px rgba(0,0,0,.10), 0 10px 10px -5px rgba(0,0,0,.04);

  --transition: all .18s cubic-bezier(.4,0,.2,1);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  display: flex;
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  overflow-x: hidden;
  border-right: 1px solid var(--sidebar-border);
}

.sidebar-logo {
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-logo .logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(37,99,235,.4);
}

.sidebar-logo span {
  color: #e6edf3;
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: -.01em;
}

.menu-group { padding: 10px 0 4px; }

.menu-group-title {
  padding: 4px 16px 6px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #484f58;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  margin: 1px 8px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  cursor: pointer;
  transition: var(--transition);
  font-size: 13px;
  font-weight: 450;
}

.menu-item:hover {
  background: var(--sidebar-hover);
  color: #c9d1d9;
}

.menu-item.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
  font-weight: 500;
}

.menu-item svg { width: 15px; height: 15px; flex-shrink: 0; opacity: .85; }
.menu-item.active svg { opacity: 1; }

/* ===== MAIN LAYOUT ===== */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.header {
  height: var(--header-height);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 12px;
  flex-shrink: 0;
  box-shadow: var(--shadow-xs);
}

.header-title {
  font-size: 15px;
  font-weight: 650;
  color: var(--text);
  flex: 1;
  letter-spacing: -.01em;
}

.header-subtitle {
  font-size: 12.5px;
  color: var(--text-muted);
  background: var(--bg-subtle);
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
}

.content { flex: 1; overflow-y: auto; padding: 24px 28px; }

/* ===== CARDS ===== */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--white);
}

.card-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
  letter-spacing: -.01em;
}

.card-body { padding: 18px 20px; }

/* ===== PAGE HEADER ===== */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.page-header h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.02em;
}

/* ===== SEARCH BAR ===== */
.search-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
}

.search-bar .form-input,
.search-bar .form-select { height: 34px; width: 180px; }
.search-bar .btn { height: 34px; }

/* ===== TABLE ===== */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

thead tr { background: var(--bg-subtle); }

th {
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-secondary);
  vertical-align: middle;
}

tbody tr { transition: background .12s; }
tbody tr:hover { background: #f8faff; }
tbody tr:last-child td { border-bottom: none; }

.td-actions {
  display: flex;
  gap: 4px;
  white-space: nowrap;
}

/* ===== PAGINATION ===== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  padding: 14px 20px;
  border-top: 1px solid var(--border-light);
  font-size: 12.5px;
  color: var(--text-muted);
}

.pagination span { margin-right: auto; }

.page-btn {
  padding: 5px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--white);
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 12.5px;
  transition: var(--transition);
}

.page-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 600; }
.page-btn:disabled { opacity: .35; cursor: not-allowed; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  transition: var(--transition);
  white-space: nowrap;
  letter-spacing: -.01em;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 1px 3px rgba(37,99,235,.3), 0 0 0 0 rgba(37,99,235,0);
}
.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 12px rgba(37,99,235,.35);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }

.btn-danger {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 1px 3px rgba(239,68,68,.25);
}
.btn-danger:hover {
  background: var(--danger-hover);
  box-shadow: 0 4px 10px rgba(239,68,68,.3);
  transform: translateY(-1px);
}

.btn-default {
  background: var(--white);
  border-color: var(--border);
  color: var(--text-secondary);
  box-shadow: var(--shadow-xs);
}
.btn-default:hover {
  border-color: #d1d5db;
  background: var(--bg-subtle);
  color: var(--text);
}

.btn-text {
  background: transparent;
  border-color: transparent;
  color: var(--primary);
  padding: 5px 8px;
}
.btn-text:hover { background: var(--primary-light); border-radius: var(--radius-sm); }

.btn-text-danger {
  background: transparent;
  border-color: transparent;
  color: var(--danger);
  padding: 5px 8px;
}
.btn-text-danger:hover { background: var(--danger-light); border-radius: var(--radius-sm); }

.btn-text-check {
  color: #059669 !important;
}
.btn-text-check:hover { background: #f0fdf4 !important; border-radius: var(--radius-sm); }

.btn svg { width: 14px; height: 14px; }
.btn-sm { padding: 4px 10px; font-size: 12.5px; }

/* ===== TAGS ===== */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 500;
}

.tag-active { background: #dcfce7; color: #15803d; }
.tag-inactive { background: #f3f4f6; color: #6b7280; }
.tag-success { background: #dcfce7; color: #15803d; }
.tag-warning { background: #fef9c3; color: #a16207; }
.tag-danger { background: #fee2e2; color: #b91c1c; }
.tag-info { background: #dbeafe; color: #1d4ed8; }
.tag-blue { background: #dbeafe; color: #1d4ed8; }
.tag-gray { background: #f3f4f6; color: #6b7280; }

/* ===== FORM ===== */
.form-row { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 16px; }
.form-item { display: flex; flex-direction: column; gap: 5px; min-width: 200px; flex: 1; }
.form-item.full { flex: 0 0 100%; }
.form-item.half { flex: 0 0 calc(50% - 8px); min-width: 200px; }

.form-label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-label.required::after { content: ' *'; color: var(--danger); }

.form-input,
.form-select,
.form-textarea {
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: var(--text);
  background: var(--white);
  transition: var(--transition);
  width: 100%;
  box-shadow: var(--shadow-xs);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

.form-input::placeholder { color: #9ca3af; }

.form-textarea {
  height: auto;
  padding: 9px 12px;
  resize: vertical;
  min-height: 84px;
}

.form-select { cursor: pointer; }
.form-hint { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeIn .15s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 680px;
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  animation: slideUp .2s cubic-bezier(.4,0,.2,1);
}

@keyframes slideUp { from { transform: translateY(12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal-lg { max-width: 900px; }
.modal-xl { max-width: 1100px; }

.modal-header {
  padding: 18px 22px 16px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
}

.modal-header h3 {
  font-size: 15.5px;
  font-weight: 650;
  flex: 1;
  color: var(--text);
  letter-spacing: -.02em;
}

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 5px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  line-height: 1;
}

.modal-close:hover { background: var(--bg-subtle); color: var(--text); }

.modal-body { padding: 22px; overflow-y: auto; flex: 1; }

.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: var(--bg-subtle);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

/* ===== DETAIL PAGE ===== */
.detail-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.detail-header .back-btn {
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.detail-header .back-btn:hover { background: var(--bg-subtle); color: var(--primary); }

.detail-title {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--text);
}

.desc-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0;
}

.desc-item {
  padding: 13px 18px;
  border-bottom: 1px solid var(--border-light);
}

.desc-item:nth-child(odd) { border-right: 1px solid var(--border-light); }
.desc-label { font-size: 11.5px; color: var(--text-muted); margin-bottom: 4px; font-weight: 500; }
.desc-value { font-size: 13.5px; color: var(--text); font-weight: 500; }

.section-title {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: .07em;
}

/* ===== INLINE TABLE ===== */
.inline-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }

.inline-table th {
  background: var(--bg-subtle);
  padding: 7px 11px;
  font-weight: 600;
  color: var(--text-muted);
  border: 1px solid var(--border);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.inline-table td {
  padding: 8px 11px;
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
}

/* ===== DYNAMIC LIST ===== */
.dynamic-list {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}

.dynamic-list-header {
  background: var(--bg-subtle);
  padding: 9px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.dynamic-list-item {
  padding: 13px 14px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-start;
  transition: background .12s;
}

.dynamic-list-item:hover { background: #fafafa; }
.dynamic-list-item:last-child { border-bottom: none; }
.dynamic-list-item .form-item { min-width: 140px; }

.remove-btn {
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 5px;
  border-radius: var(--radius-sm);
  margin-top: 22px;
  flex-shrink: 0;
  transition: var(--transition);
}

.remove-btn:hover { color: var(--danger); background: var(--danger-light); }

/* ===== MULTI SELECT ===== */
.multi-select-tags {
  min-height: 36px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  cursor: pointer;
  background: var(--white);
  transition: var(--transition);
  box-shadow: var(--shadow-xs);
}

.multi-select-tags:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

.multi-select-tag {
  display: flex;
  align-items: center;
  gap: 3px;
  background: #dbeafe;
  color: #1d4ed8;
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 11.5px;
  font-weight: 500;
}

.multi-select-tag button {
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  line-height: 1;
  padding: 0 1px;
  font-size: 13px;
  opacity: .7;
}

.multi-select-tag button:hover { opacity: 1; }

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 56px 20px;
  color: var(--text-muted);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  margin-bottom: 14px;
  opacity: .25;
}

.empty-state p { font-size: 14px; color: var(--text-muted); }

/* ===== TOAST ===== */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 16px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  font-size: 13.5px;
  font-weight: 500;
  max-width: 340px;
  animation: toastIn .22s cubic-bezier(.4,0,.2,1);
  display: flex;
  align-items: center;
  gap: 10px;
}

@keyframes toastIn {
  from { transform: translateX(110%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

.toast-success { background: #14532d; color: #fff; border-left: 3px solid #22c55e; }
.toast-error   { background: #7f1d1d; color: #fff; border-left: 3px solid #ef4444; }
.toast-info    { background: #1e3a8a; color: #fff; border-left: 3px solid #60a5fa; }

/* ===== CONFIRM DIALOG ===== */
.confirm-dialog {
  background: var(--white);
  border-radius: var(--radius-xl);
  padding: 28px;
  max-width: 390px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  animation: slideUp .2s cubic-bezier(.4,0,.2,1);
}

.confirm-dialog h4 {
  font-size: 16px;
  font-weight: 650;
  margin-bottom: 8px;
  letter-spacing: -.02em;
  color: var(--text);
}

.confirm-dialog p {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-bottom: 22px;
  line-height: 1.6;
}

.confirm-dialog .actions { display: flex; justify-content: flex-end; gap: 10px; }

/* ===== TABS ===== */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
  gap: 2px;
}

.tab {
  padding: 9px 16px;
  cursor: pointer;
  font-size: 13.5px;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: var(--transition);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.tab:hover { color: var(--text); background: var(--bg-subtle); }

.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

/* ===== LOADING ===== */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  color: var(--text-muted);
  gap: 10px;
  font-size: 13.5px;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .65s linear infinite;
}

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

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

/* ===== INFO BOX ===== */
.info-box {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-left: 3px solid var(--primary);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  color: #1d4ed8;
  margin-bottom: 16px;
}

/* ===== RESOURCE CONFIGURATION ===== */
.resource-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.resource-section {
  background: var(--bg-subtle);
  border-radius: var(--radius);
  padding: 16px;
  border: 1px solid var(--border);
}

.resource-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border);
}

/* ===== TOPOLOGY VIEW ===== */
.topology-container {
  padding: 24px;
  max-height: 75vh;
  overflow-y: auto;
  background: linear-gradient(150deg, #f9fafb 0%, #f3f4f6 100%);
  border-radius: var(--radius-lg);
}

.topology-root {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

.topology-connector {
  width: 2px;
  height: 28px;
  background: linear-gradient(to bottom, #2563eb, #93c5fd);
  margin: 0 auto 20px;
  border-radius: 2px;
}

.topology-layers {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.topology-layer {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1.5px solid transparent;
  transition: var(--transition);
}

.topology-layer:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.cmc-layer {
  border-color: #a78bfa;
  background: linear-gradient(135deg, #ffffff 0%, #faf5ff 100%);
}

.partition-layer {
  border-color: #60a5fa;
  background: linear-gradient(135deg, #ffffff 0%, #eff6ff 100%);
}

.access-layer {
  border-color: #2dd4bf;
  background: linear-gradient(135deg, #ffffff 0%, #f0fdfa 100%);
}

.layer-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-light);
  text-transform: uppercase;
  letter-spacing: .08em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.cmc-layer .layer-title::before      { content: '🏢'; font-size: 16px; }
.partition-layer .layer-title::before { content: '🔷'; font-size: 16px; }
.access-layer .layer-title::before    { content: '🔌'; font-size: 16px; }

.layer-content { display: flex; flex-direction: column; gap: 16px; }

.node-children {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-left: 32px;
  padding-left: 16px;
  border-left: 2px solid var(--border);
}

.child-group { display: flex; flex-direction: column; gap: 10px; }

.group-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: .08em;
}

.sub-nodes {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-left: 32px;
  padding-left: 16px;
  border-left: 2px dashed #e5e7eb;
}

.service-grid,
.partition-grid,
.access-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
  gap: 12px;
}

/* ===== TOPOLOGY NODE ===== */
.topology-node {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 15px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-xs);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.topology-node::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,.6) 0%, transparent 60%);
  pointer-events: none;
}

.topology-node:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.node-icon {
  font-size: 26px;
  line-height: 1;
  flex-shrink: 0;
}

.node-content { flex: 1; min-width: 0; }

.node-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 3px;
  word-break: break-word;
  line-height: 1.35;
}

.node-code {
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'SF Mono', 'Fira Code', monospace;
  background: var(--bg-subtle);
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 3px;
}

.node-subtitle { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }

.node-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--border);
}

.node-status {
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-top: 6px;
  display: inline-block;
}

.status-active   { background: #dcfce7; color: #15803d; }
.status-inactive { background: #f3f4f6; color: #6b7280; }

.node-badges { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }

.badge {
  font-size: 10.5px;
  padding: 3px 8px;
  border-radius: 5px;
  font-weight: 500;
  display: inline-block;
}

.badge-read      { background: #dbeafe; color: #1e40af; }
.badge-write     { background: #fef3c7; color: #92400e; }
.badge-sub-write { background: #fed7aa; color: #9a3412; }
.badge-sub-read  { background: #e0e7ff; color: #4338ca; }

/* Node type variants */
.tenant-node {
  border-color: #2563eb;
  border-width: 2px;
  background: linear-gradient(135deg, #ffffff, #eff6ff);
  box-shadow: 0 4px 14px rgba(37,99,235,.15);
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 20px;
  min-width: 240px;
}

.tenant-node .node-icon  { font-size: 38px; margin-bottom: 8px; }
.tenant-node .node-title { font-size: 16px; margin-bottom: 6px; font-weight: 700; }

.cmc-node {
  border-color: #a78bfa;
  background: linear-gradient(135deg, #faf5ff, #f3e8ff);
  color: #6b21a8;
}

.dc-node {
  border-color: #22d3ee;
  background: linear-gradient(135deg, #ecfeff, #cffafe);
  color: #0e7490;
}

.group-node {
  border-color: #34d399;
  background: linear-gradient(135deg, #f0fdf4, #dcfce7);
  color: #15803d;
  min-width: 140px;
}

.service-node {
  border-color: #fbbf24;
  background: linear-gradient(135deg, #fffbeb, #fef3c7);
  color: #92400e;
}

.outside-node {
  border-color: #f472b6;
  background: linear-gradient(135deg, #fdf4ff, #fce7f3);
  color: #9f1239;
}

.partition-node {
  border-color: #60a5fa;
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  color: #1e40af;
  flex-direction: column;
  align-items: flex-start;
}

.partition-node.cmc-partition {
  border-color: #a78bfa;
  background: linear-gradient(135deg, #faf5ff, #f3e8ff);
  color: #6b21a8;
}

.access-node {
  border-color: #2dd4bf;
  background: linear-gradient(135deg, #f0fdfa, #ccfbf1);
  color: #0f766e;
}

/* ===== CHECK MODAL ===== */
.check-modal {
  padding: 8px 0 4px;
}

.check-steps {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.check-step {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
  position: relative;
}
.check-step:last-child { border-bottom: none; }

.check-step-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
  font-size: 13px;
  transition: var(--transition);
}

.check-step-icon.pending {
  background: var(--bg-subtle);
  color: var(--text-muted);
  border: 2px solid var(--border);
}

.check-step-icon.running {
  background: #eff6ff;
  border: 2px solid var(--primary);
  color: var(--primary);
}

.check-step-icon.success {
  background: #f0fdf4;
  border: 2px solid var(--success);
  color: var(--success);
}

.check-step-body {
  flex: 1;
  min-width: 0;
}

.check-step-name {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
}

.check-step-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.4;
}

.check-step-status {
  font-size: 12px;
  font-weight: 500;
  margin-top: 4px;
  min-height: 16px;
}

.check-step-status.running { color: var(--primary); }
.check-step-status.success { color: var(--success); }

.check-result {
  margin-top: 20px;
  padding: 14px 16px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .3s ease, transform .3s ease;
}

.check-result.show {
  opacity: 1;
  transform: translateY(0);
}

.check-result.success {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #15803d;
}

.check-result-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--success);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Spinner animation */
@keyframes spin {
  to { transform: rotate(360deg); }
}

.spin {
  animation: spin .7s linear infinite;
  display: inline-block;
}

/* ===== WIZARD ===== */
.wizard-container {
  padding: 0;
}

.wizard-progress {
  height: 4px;
  background: var(--border-light);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 24px;
}

.wizard-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #60a5fa);
  transition: width .3s ease;
}

.wizard-steps-indicator {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 32px;
}

.wizard-step-dot {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-subtle);
  border: 2px solid var(--border);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  transition: var(--transition);
}

.wizard-step-dot.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  transform: scale(1.1);
}

.wizard-step-dot.completed {
  background: var(--success);
  border-color: var(--success);
  color: white;
}

.wizard-content {
  min-height: 320px;
}

.wizard-step-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.wizard-step-desc {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.wizard-empty-state {
  text-align: center;
  padding: 48px 20px;
  background: var(--bg-subtle);
  border-radius: var(--radius);
  margin-bottom: 20px;
}

.wizard-empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.wizard-empty-state .empty-text {
  font-size: 14px;
  color: var(--text-muted);
}

.wizard-action-section {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border-light);
}

.wizard-empty-hint {
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 13px;
}

/* Form sections for wizard */
.form-section {
  margin-bottom: 24px;
  padding: 16px;
  background: #f8f9fa;
  border-radius: 8px;
}

.section-title {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 12px;
  color: #2c3e50;
  display: flex;
  align-items: center;
}

/* Checkbox group */
.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.checkbox-label:hover {
  background: #f5f5f5;
  border-color: #4a90e2;
}

.checkbox-label input[type="checkbox"] {
  margin-right: 8px;
}

/* Small empty state */
.wizard-empty-state-sm {
  padding: 16px;
  text-align: center;
  color: #999;
  font-size: 14px;
  background: white;
  border: 1px dashed #ddd;
  border-radius: 6px;
}

/* Info box */
.wizard-info-box {
  padding: 16px;
  background: #e3f2fd;
  border-left: 4px solid #2196f3;
  border-radius: 4px;
  margin-top: 16px;
}

/* Small button */
.btn-sm {
  padding: 4px 12px;
  font-size: 13px;
  height: auto;
}

/* Wizard summary */
.wizard-summary {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.summary-section {
  padding: 16px;
  background: #f8f9fa;
  border-radius: 8px;
}

.summary-title {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 12px;
  color: #2c3e50;
  padding-bottom: 8px;
  border-bottom: 2px solid #e0e0e0;
}

.summary-item {
  display: flex;
  padding: 8px 0;
  border-bottom: 1px solid #e8e8e8;
}

.summary-item:last-child {
  border-bottom: none;
}

.summary-label {
  flex: 0 0 120px;
  color: #666;
  font-size: 14px;
}

.summary-value {
  flex: 1;
  color: #333;
  font-size: 14px;
  font-weight: 500;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .service-grid,
  .partition-grid,
  .access-grid { grid-template-columns: 1fr; }

  .node-children { margin-left: 16px; padding-left: 12px; }
  .sub-nodes     { margin-left: 16px; padding-left: 12px; }
}

/* ============================================================
   Tenant Dashboard Styles
   ============================================================ */

.dashboard-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.tenant-selector-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.dashboard-progress-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
}

.config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.config-card {
  position: relative;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  cursor: default;
}

.config-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.config-card.required-item {
  border-color: #fca5a5;
  background: linear-gradient(135deg, #fff5f5, #fee2e2);
}

.config-card.optional-item {
  border-color: #93c5fd;
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
}

.config-card.completed {
  border-color: #86efac;
  background: linear-gradient(135deg, #f0fdf4, #dcfce7);
}

.required-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 99px;
  background: #fee2e2;
  color: #b91c1c;
  font-weight: 600;
  border: 1px solid #fca5a5;
}

.check-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
}

.check-hint {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: #eff6ff;
  border-left: 3px solid var(--primary);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

.dashboard-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 24px;
  text-align: center;
}

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

/* ===== BSS STYLES ===== */

.system-switch-btn {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: var(--radius);
  background: var(--primary-light);
  color: var(--primary);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: var(--transition);
  white-space: nowrap;
}
.system-switch-btn:hover {
  background: var(--primary);
  color: #fff;
}

/* BSS Header Selectors */
.bss-selectors {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}
.bss-selector-group {
  display: flex;
  align-items: center;
  gap: 6px;
}
.bss-selector-label {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}
.bss-selector-select {
  padding: 4px 28px 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: var(--white);
  color: var(--text);
  min-width: 140px;
  max-width: 200px;
  cursor: pointer;
}

/* BSS Two-column layout */
.bss-two-col {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

/* Org Tree */
.org-tree {
  padding: 8px 0;
}
.org-node {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.org-node:hover { background: var(--bg-subtle); }
.org-node-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text);
}
.org-node-actions { display: flex; gap: 4px; opacity: 0; transition: var(--transition); }
.org-node:hover .org-node-actions { opacity: 1; }

/* Message matrix */
.msg-matrix-table thead th {
  background: var(--bg-subtle);
  font-weight: 600;
  text-align: center;
  padding: 12px 8px;
  border-bottom: 2px solid var(--border);
}

.msg-matrix-table tbody td {
  vertical-align: middle;
}

.msg-cell {
  min-height: 56px;
  padding: 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
}
.msg-cell:hover { border-color: var(--primary); background: var(--primary-light); }
.msg-cell-filled { border-color: #86efac; background: #f0fdf4; }
.msg-cell-empty { background: var(--bg-subtle); border-style: dashed; }
.msg-cell-title { font-size: 12px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.msg-cell-body { font-size: 11px; color: var(--text-muted); line-height: 1.4; }
.msg-cell-placeholder { font-size: 12px; color: var(--text-xs); display: block; text-align: center; padding: 8px 0; }

/* Package cards */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.pkg-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  background: var(--white);
  box-shadow: var(--shadow-xs);
  transition: var(--transition);
}
.pkg-card:hover { box-shadow: var(--shadow); }
.pkg-card-default { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(37,99,235,.12); }
.pkg-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.pkg-card-header h3 { font-size: 15px; font-weight: 600; }
.pkg-card-price { font-size: 20px; font-weight: 700; color: var(--primary); }
.pkg-card-meta { display: flex; flex-wrap: wrap; gap: 8px; font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.pkg-card-products { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 12px; }
.pkg-card-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* Detail grid */
.detail-grid { display: flex; flex-direction: column; gap: 10px; }
.detail-row { display: flex; gap: 16px; align-items: flex-start; }
.detail-label { font-size: 13px; color: var(--text-muted); min-width: 80px; }

/* Badge variants */
.badge-warning { background: #fef9c3; color: #854d0e; }

/* Empty state */
.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 240px;
}

/* Flex utilities */
.flex { display: flex; }
.gap-2 { gap: 8px; }

/* Extra small button */
.btn-xs {
  padding: 2px 8px;
  font-size: 11px;
  border-radius: var(--radius-sm);
}

/* BSS textarea variants */
.bss-textarea-large {
  font-size: 14px;
  line-height: 1.6;
  min-height: 120px;
}

.bss-textarea-code {
  font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
  font-size: 13px;
  line-height: 1.5;
  min-height: 140px;
}
