.stat-card {
  background: var(--panel, #ffffff);
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  min-height: 5.5rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}
.stat-label { color: #64748b; font-size: .85rem; margin-bottom: .35rem; white-space: nowrap; word-break: keep-all; }
.stat-value { color: #0f172a; font-size: 1.45rem; font-weight: 700; letter-spacing: .01em; }
.stat-sub { color: #94a3b8; font-size: .8rem; margin-top: .35rem; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin: 1rem 0 1.5rem;
}

.page-header h1 { margin: 0 0 .25rem; font-size: 1.6rem; color: #0f172a; }
.page-header .muted { margin: 0; color: #64748b; }

.filter-bar {
  display: flex; flex-wrap: wrap; gap: .75rem; align-items: end;
  margin: 1.25rem 0; padding: 1rem;
  background: #ffffff; border: 1px solid #e2e8f0; border-radius: 12px;
}
.filter-bar.wrap { align-items: end; }
.filter-bar label { display: flex; flex-direction: column; gap: .35rem; color: #475569; font-size: .85rem; white-space: nowrap; word-break: keep-all; }
.filter-bar label.grow { flex: 1 1 220px; }
.filter-bar input, .filter-bar select {
  background: #ffffff; color: #0f172a; border: 1px solid #cbd5e1;
  border-radius: 8px; padding: .5rem .65rem; min-width: 140px;
}

.btn {
  border: 1px solid #cbd5e1; background: #ffffff; color: #0f172a;
  border-radius: 8px; padding: .55rem 1rem; cursor: pointer;
}
.btn:hover { background: #f8fafc; }
.btn.primary { background: #2563eb; border-color: #2563eb; color: #ffffff; }
.btn.primary:hover { background: #1d4ed8; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.panel {
  background: #ffffff; border: 1px solid #e2e8f0; border-radius: 12px;
  padding: 1rem 1.1rem; margin-bottom: 1rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}
.panel h2 { margin: 0 0 .85rem; font-size: 1.05rem; color: #0f172a; }
.panel-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }
.panel-toolbar { display: flex; justify-content: space-between; margin-bottom: .75rem; color: #475569; }
.sub-nav-list { margin: 0; padding-left: 1.25rem; color: #334155; }
.sub-nav-list li { margin: .4rem 0; }
.sub-nav-list a { color: #2563eb; text-decoration: none; }
.sub-nav-list a:hover { text-decoration: underline; }

.data-table { width: 100%; border-collapse: collapse; font-size: .92rem; background: #ffffff; }
.data-table th, .data-table td {
  border-bottom: 1px solid #e2e8f0; padding: .55rem .4rem; text-align: left; color: #334155;
}
.data-table th { color: #64748b; font-weight: 600; background: #f8fafc; white-space: nowrap; word-break: keep-all; }
.data-table .num, .num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table.compact td { font-size: .85rem; }
.row-warn { background: #fffbeb; }
.warn { color: #b45309; }
.strong { font-weight: 700; color: #0f172a; }
.badge {
  display: inline-block; padding: .15rem .45rem; border-radius: 999px;
  background: #f1f5f9; color: #475569; font-size: .75rem; border: 1px solid #e2e8f0;
}
.alert.error {
  background: #fef2f2; color: #991b1b; border: 1px solid #fecaca;
  padding: .75rem 1rem; border-radius: 8px; margin: .75rem 0;
}
.muted { color: #64748b; }
.small { font-size: .8rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.truncate { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pager { display: flex; gap: 1rem; align-items: center; justify-content: center; margin-top: 1rem; color: #475569; }

.master-status-toggle {
  border: 0; border-radius: 999px; padding: .2rem .65rem;
  font-size: .8125rem; cursor: pointer; white-space: nowrap;
}
.master-status-toggle.on { background: #dcfce7; color: #166534; }
.master-status-toggle.off { background: #fee2e2; color: #991b1b; }
.master-status-toggle:disabled { opacity: .6; cursor: wait; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .45);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-panel {
  background: #fff;
  border-radius: 12px;
  width: min(820px, 100%);
  max-height: 92vh;
  overflow: auto;
  padding: 1.25rem 1.4rem;
  box-shadow: 0 20px 40px rgba(15, 23, 42, .2);
}
.modal-panel h3 { margin: 0 0 1rem; font-size: 1.05rem; }
.modal-actions { display: flex; gap: .5rem; margin-top: 1rem; flex-wrap: wrap; }
