:root {
  --bg-dark: #0f1117;
  --bg-card: #181b26;
  --bg-card-hover: #1e2230;
  --sidebar-bg: #13151f;
  --border-color: #262a3b;
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --success: #10b981;
  --warning: #f59e0b;
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

/* 登入介面 */
.auth-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  background: radial-gradient(circle at top right, #1e1b4b 0%, #0f1117 60%);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
}

.logo-area {
  text-align: center;
  margin-bottom: 24px;
}

.logo-area .app-icon {
  font-size: 40px;
  display: block;
  margin-bottom: 8px;
}

.logo-area h2 {
  font-size: 22px;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  color: var(--text-muted);
  font-size: 13px;
}

/* 表單元件 */
.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text-main);
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 10px 14px;
  background: #11131c;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-main);
  font-size: 14px;
  outline: none;
  transition: all 0.2s ease;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.form-group-checkbox {
  margin-bottom: 18px;
}

.form-group-checkbox label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--text-muted);
}

.label-with-action {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.label-with-action label {
  margin-bottom: 0;
}

.btn-link-action {
  background: transparent;
  border: none;
  color: #818cf8;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  transition: color 0.2s ease;
}

.btn-link-action:hover {
  color: #a5b4fc;
  text-decoration: underline;
}

.password-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.password-input-wrapper input {
  padding-right: 42px;
}

.btn-copy-input {
  position: absolute;
  right: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-main);
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.btn-copy-input:hover {
  background: rgba(255, 255, 255, 0.16);
}

.input-error-msg {
  color: #f87171;
  font-size: 12px;
  margin-top: 4px;
  display: block;
}

.app-icon {
  font-size: 48px;
  margin-bottom: 12px;
  display: inline-block;
}

.admin-login-logo {
  width: 56px;
  height: 56px;
  max-width: 56px;
  max-height: 56px;
  border-radius: 12px;
  margin-bottom: 12px;
  display: inline-block;
  object-fit: contain;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.admin-sidebar-logo {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  object-fit: contain;
  margin-right: 8px;
  vertical-align: middle;
}

.text-primary {
  color: #818cf8;
}

/* ─── 提示氣泡 Tooltip 樣式 ─── */
.tooltip-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.2);
  color: #818cf8;
  font-size: 11px;
  font-weight: 700;
  cursor: help;
  position: relative;
  vertical-align: middle;
  margin-left: 6px;
  transition: all 0.2s ease;
}

.tooltip-trigger:hover {
  background: var(--primary);
  color: #ffffff;
  transform: scale(1.1);
}

.tooltip-trigger .tooltip-content {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  bottom: 130%;
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  width: 270px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 12px 14px;
  color: #334155;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.6;
  box-shadow: 0 12px 28px -4px rgba(0, 0, 0, 0.5), 0 4px 10px -2px rgba(0, 0, 0, 0.2);
  z-index: 100;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
  text-align: left;
  white-space: normal;
}

.tooltip-trigger .tooltip-content::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px;
  border-style: solid;
  border-color: #ffffff transparent transparent transparent;
}

.tooltip-trigger:hover .tooltip-content {
  visibility: visible;
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.tooltip-title {
  color: #0f172a;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
  display: block;
}

.tooltip-badge {
  display: block;
  width: fit-content;
  background: #ede9fe;
  color: #5b21b6;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 8px;
  font-family: monospace;
}

.tooltip-desc {
  display: block;
  color: #334155;
  font-size: 12px;
  line-height: 1.6;
}

/* 多磁碟網格佈局 */
.disks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.disk-item-card {
  background: #11131c;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 14px 16px;
}

.disk-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.disk-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-main);
}

.disk-tag {
  font-size: 11px;
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.disk-mount-path {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.disk-meta-text {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* 按鈕風格 */
.btn-primary {
  width: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--accent-gradient);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.2s ease, transform 0.1s ease;
}

.auth-card .btn-primary {
  width: 100%;
}

.btn-primary:hover {
  opacity: 0.9;
}

.btn-secondary {
  padding: 8px 14px;
  background: #252a3b;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-main);
  cursor: pointer;
  transition: background 0.2s ease;
}

.btn-secondary:hover {
  background: #2f354a;
}

.btn-ghost {
  padding: 8px 14px;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-muted);
  cursor: pointer;
}

.btn-ghost:hover {
  color: var(--text-main);
  border-color: #3b4259;
}

.btn-danger {
  padding: 8px 14px;
  background: var(--danger);
  border: none;
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
}

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

.btn-sm {
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 6px;
  background: #252a3b;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  cursor: pointer;
}

.btn-sm:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.alert-error {
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  font-size: 13px;
  margin-bottom: 16px;
}

/* 後台主介面排版 */
.app-container {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
}

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

.sidebar-title {
  font-weight: 700;
  font-size: 16px;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sidebar-nav {
  padding: 16px 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 8px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.nav-item:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
  color: #fff;
  background: var(--primary);
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.user-info .username {
  display: block;
  font-weight: 600;
  font-size: 13px;
}

.role-tag {
  font-size: 11px;
  color: var(--primary);
}

.btn-logout {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
}

.btn-logout:hover {
  color: var(--danger);
}

/* 主工作區內容 */
.main-content {
  flex: 1;
  padding: 32px 40px;
  overflow-y: auto;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.section-header > div:first-child {
  flex: 1;
  min-width: 260px;
}

.section-header button {
  flex-shrink: 0;
}

.section-header h2 {
  font-size: 20px;
  font-weight: 700;
}

.text-muted {
  color: var(--text-muted);
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}

/* 篩選列 */
.filter-bar {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filter-group label {
  font-size: 12px;
  color: var(--text-muted);
}

.filter-group input,
.filter-group select {
  padding: 8px 12px;
  background: #11131c;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-main);
  font-size: 13px;
}

.filter-bar .btn-primary,
.filter-bar .btn-ghost {
  width: auto;
  height: 36px;
}

/* 批次操作提示列 */
.bulk-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 8px;
  margin-bottom: 16px;
}

/* 表格樣式 */
.table-responsive {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.data-table th.sortable {
  cursor: pointer;
  user-select: none;
  transition: color 0.15s ease, background 0.15s ease;
}

.data-table th.sortable:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.04);
}

.data-table th .sort-icon {
  display: inline-block;
  margin-left: 4px;
  font-size: 11px;
  opacity: 0.35;
  transition: opacity 0.15s ease, transform 0.15s ease, color 0.15s ease;
}

.data-table th.sortable:hover .sort-icon {
  opacity: 0.7;
}

.data-table th.sort-asc .sort-icon,
.data-table th.sort-desc .sort-icon {
  opacity: 1;
  color: var(--primary);
  font-weight: 700;
}

.data-table td {
  padding: 14px;
  border-bottom: 1px solid rgba(38, 42, 59, 0.6);
  font-size: 13px;
}

.data-table tbody tr:hover {
  background: var(--bg-card-hover);
}

.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}

.badge-admin {
  background: rgba(99, 102, 241, 0.2);
  color: #818cf8;
}

.badge-user {
  background: rgba(156, 163, 175, 0.2);
  color: #9ca3af;
}

.badge-active {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

.badge-disabled {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

.text-right {
  text-align: right;
}

.action-btns {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.pagination-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

/* Modal */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 24px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 22px;
  cursor: pointer;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}

.modal-actions button {
  width: auto;
}

.copy-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 16px 0;
}

.copy-box textarea,
.copy-box input {
  width: 100%;
  background: #11131c;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--success);
  font-family: monospace;
  font-size: 14px;
  line-height: 1.5;
  resize: none;
  box-sizing: border-box;
}

.copy-box button {
  align-self: flex-end;
}

/* --- 第二階段新增樣式 --- */

.grid-2-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 900px) {
  .grid-2-col {
    grid-template-columns: 1fr;
  }
}

.stats-overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat-card-lg {
  padding: 20px;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-main);
}

.text-warning { color: var(--warning) !important; }
.text-danger { color: var(--danger) !important; }
.text-success { color: var(--success) !important; }

/* 即時在線裝置卡片 */
.now-playing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  margin-top: 10px;
}

.now-playing-card {
  background: #12141e;
  border: 1px solid #282d3f;
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.now-playing-avatar {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: rgba(99, 102, 241, 0.2);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.now-playing-info {
  flex: 1;
  overflow: hidden;
}

.now-playing-user {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.now-playing-track {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-main);
}

/* 熱門榜單 */
.rank-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.rank-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
}

.rank-num {
  font-weight: 700;
  color: var(--primary);
  width: 20px;
}

.rank-info {
  flex: 1;
}

.rank-title {
  font-weight: 600;
  font-size: 13px;
}

.rank-artist {
  font-size: 11px;
  color: var(--text-muted);
}

.rank-count {
  font-size: 12px;
  color: var(--success);
  font-weight: 600;
}

/* 進度條 */
.progress-bar-container {
  width: 100%;
  height: 8px;
  background: #11131c;
  border-radius: 4px;
  overflow: hidden;
  margin: 14px 0 8px 0;
}

.progress-bar {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  transition: width 0.4s ease;
}

.bg-accent { background: #8b5cf6 !important; }
.bg-success { background: var(--success) !important; }

.progress-text {
  font-size: 13px;
  color: var(--text-muted);
}

.font-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
}

/* 折線圖 */
.chart-container {
  width: 100%;
  height: 180px;
  position: relative;
  margin-top: 10px;
}

.chart-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* 聯邦管理面板樣式 */
.federation-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 20px;
  margin-top: 16px;
}

.federation-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.federation-card:hover {
  transform: translateY(-2px);
  border-color: rgba(99, 102, 241, 0.4);
}

.federation-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.federation-node-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.federation-node-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
}

.federation-url {
  font-size: 12px;
  color: var(--text-muted);
  font-family: ui-monospace, monospace;
  margin-top: 2px;
  word-break: break-all;
}

.badge-arbiter {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}

.badge-online {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
}

.badge-offline {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
}

.federation-metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  background: #11131c;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.federation-metric-item {
  display: flex;
  flex-direction: column;
}

.federation-metric-label {
  font-size: 11px;
  color: var(--text-muted);
}

.federation-metric-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  margin-top: 2px;
}

.federation-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-muted);
  border-top: 1px solid var(--border-color);
  padding-top: 12px;
}

/* ═══════════════════════════════════════════════
   手機版行動端全面適配 (Mobile Responsive Layout)
   ═══════════════════════════════════════════════ */

.mobile-header {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(19, 21, 31, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.mobile-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-hamburger {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-main);
  font-size: 18px;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.btn-hamburger:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--primary);
}

.btn-logout-mobile {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1100;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.sidebar-overlay.active {
  display: block;
  opacity: 1;
}

@media (max-width: 768px) {
  .mobile-header {
    display: flex;
  }

  .app-container {
    flex-direction: column;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 270px;
    z-index: 1200;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 35px rgba(0, 0, 0, 0.85);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    padding: 16px 12px;
    width: 100%;
    overflow-x: hidden;
  }

  .section-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 16px;
  }

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

  .section-header button,
  .section-header .header-actions {
    width: 100%;
  }

  .section-header select {
    width: 100%;
  }

  .card {
    padding: 14px;
    border-radius: 10px;
    margin-bottom: 14px;
  }

  .grid-2-col {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .stats-overview-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .stat-card {
    padding: 12px 14px;
  }

  .stat-value {
    font-size: 18px;
  }

  .filter-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .filter-group {
    width: 100%;
  }

  .filter-bar .btn-primary,
  .filter-bar .btn-ghost {
    width: 100%;
  }

  .federation-metrics-grid {
    grid-template-columns: 1fr 1fr;
  }

  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 6px;
  }

  .data-table th,
  .data-table td {
    padding: 10px 8px;
    font-size: 12px;
    white-space: nowrap;
  }

  .action-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: flex-end;
  }

  .action-btns button {
    padding: 5px 8px;
    font-size: 11px;
  }
}

