/* ── Maintenance Overlay ─────────────────────────────────── */
.maint-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.92);
  z-index: 99999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.maint-overlay.visible { display: flex; }
.maint-card {
  background: #ffffff;
  border-radius: 14px;
  padding: 36px 44px;
  text-align: center;
  max-width: 460px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  font-family: 'Sora', -apple-system, BlinkMacSystemFont, sans-serif;
}
.maint-icon {
  display: block;
  margin: 0 auto 14px;
}
.maint-title {
  font-size: 22px;
  font-weight: 700;
  color: #1a1d26;
  margin-bottom: 10px;
}
.maint-body {
  font-size: 13px;
  color: #6b7280;
  line-height: 1.6;
}
.maint-body:empty { display: none; }

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f5f7fa;
  --bg-surface: #ffffff;
  --bg-elevated: #f0f2f5;
  --bg-hover: #eaecf0;
  --border: #e2e5ea;
  --border-light: #d0d4db;
  --text: #1a1d26;
  --text-muted: #6b7280;
  --text-dim: #9ca3af;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-bg: rgba(59,130,246,0.08);
  --success: #16a34a;
  --success-bg: rgba(22,163,74,0.08);
  --warning: #f59e0b;
  --warning-bg: rgba(217,119,6,0.08);
  --danger: #dc2626;
  --danger-bg: rgba(220,38,38,0.08);
  --info: #2563eb;
  --info-bg: rgba(37,99,235,0.06);
  --topbar-h: 48px;
  --sidebar-w: 220px;
  --sidebar-collapsed: 52px;
  --filter-w: 280px;
  --footer-h: 140px;
  --radius: 6px;
  --radius-sm: 4px;
  --transition: 0.2s ease;
  --font: 'Sora', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'SF Mono', 'Cascadia Code', Consolas, monospace;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.1);
  --overlay-bg: rgba(255,255,255,.7);
  --ui-highlight: #f0f2f5;
}

[data-theme="dark"] {
  --bg: #0b0b0c;
  --bg-surface: #141416;
  --bg-elevated: #1c1c1f;
  --bg-hover: #242428;
  --border: #2a2a2e;
  --border-light: #34343a;
  --text: #f1f1f1;
  --text-muted: #a1a1aa;
  --text-dim: #71717a;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-bg: rgba(59,130,246,0.12);
  --success: #22c55e;
  --success-bg: rgba(34,197,94,0.12);
  --warning: #f59e0b;
  --warning-bg: rgba(245,158,11,0.12);
  --danger: #ef4444;
  --danger-bg: rgba(239,68,68,0.12);
  --info: #38bdf8;
  --info-bg: rgba(56,189,248,0.12);
  --shadow-sm: 0 1px 0 rgba(255,255,255,0.03);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.6);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.7);
  --overlay-bg: rgba(0,0,0,.7);
  --ui-highlight: #27272a;
}

html, body {
  height: 100%;
  font-family: var(--font);
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  overflow: hidden;
}

/* ── Top Bar ─────────────────────────────────────────────── */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 100;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-toggle {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  transition: var(--transition);
}
.sidebar-toggle:hover { color: var(--text); background: var(--bg-hover); }

.topbar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.3px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-elevated);
  padding: 4px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--warning);
  flex-shrink: 0;
}

.status-dot.online {
  background: var(--success);
  box-shadow: 0 0 6px rgba(22,163,74,0.4);
}

.status-dot.offline {
  background: var(--danger);
  box-shadow: 0 0 6px rgba(220,38,38,0.4);
}

.status-dot.connecting {
  background: var(--warning);
  animation: pulse 1.5s ease infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.topbar-account {
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.topbar-account:hover { color: var(--text); background: var(--bg-hover); }

.account-wrapper { position: relative; }

.account-dropdown {
  position: absolute;
  top: 40px;
  right: 0;
  width: 240px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  z-index: 200;
  overflow: hidden;
}
.account-dropdown.hidden { display: none; }

.account-header {
  padding: 14px 16px;
}
.account-name { font-weight: 600; font-size: 13px; color: var(--text); }
.account-email { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.account-divider { height: 1px; background: var(--border); }

.account-info { padding: 10px 16px; }
.account-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  font-size: 12px;
}
.account-label { color: var(--text-muted); }
.account-value { color: var(--text); font-weight: 500; }
.plan-ultra { color: var(--accent); }

.account-action {
  display: block;
  padding: 10px 16px;
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: none;
  transition: var(--transition);
}
.account-action:hover { background: var(--bg-hover); color: var(--text); }
.account-logout { color: var(--danger); }
.account-logout:hover { background: var(--danger-bg); color: var(--danger); }

/* ── Layout ──────────────────────────────────────────────── */
.layout {
  display: flex;
  position: fixed;
  top: var(--topbar-h);
  left: var(--sidebar-w); right: var(--filter-w);
  bottom: var(--footer-h);
  overflow: hidden;
  transition: left var(--transition), right var(--transition);
}

.sidebar.collapsed ~ .layout,
body.sidebar-collapsed .layout {
  left: var(--sidebar-collapsed);
}

/* ── Left Sidebar ────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: var(--topbar-h);
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  box-shadow: 3px 0 10px rgba(0,0,0,0.04);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: width var(--transition);
  overflow: hidden;
  z-index: 95;
}

.sidebar-overlay { display: none; }

.sidebar.collapsed {
  width: var(--sidebar-collapsed);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  padding: 8px;
  gap: 2px;
}

.sidebar-bottom {
  display: flex;
  flex-direction: column;
  padding: 8px;
  gap: 2px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius);
  color: var(--text-muted);
  text-decoration: none;
  transition: var(--transition);
  white-space: nowrap;
  overflow: hidden;
}

.sidebar.collapsed .sidebar-nav,
.sidebar.collapsed .sidebar-bottom {
  padding: 8px 6px;
  align-items: center;
}

.sidebar.collapsed .sidebar-item {
  width: 38px;
  height: 38px;
  padding: 0;
  justify-content: center;
  align-items: center;
  gap: 0;
}
.sidebar-item:hover { color: var(--text); background: var(--bg-hover); }
.sidebar-item.active { color: var(--accent); background: var(--accent-bg); }
.sidebar-item svg { flex-shrink: 0; }

.sidebar-label {
  font-size: 13px;
  transition: opacity var(--transition);
}

.sidebar.collapsed .sidebar-label {
  opacity: 0;
  width: 0;
}

/* ── Sidebar Dropdown Group (Seasonal etc.) ──────────────── */
.sidebar-group { display: flex; flex-direction: column; }
.sidebar-group-toggle .sidebar-chevron {
  margin-left: auto;
  transition: transform 0.18s ease;
  opacity: 0.7;
}
.sidebar-group.expanded .sidebar-group-toggle .sidebar-chevron { transform: rotate(90deg); }
.sidebar-group.has-active > .sidebar-group-toggle { color: var(--accent); }
.sidebar-subgroup {
  display: none;
  flex-direction: column;
  gap: 1px;
  margin: 1px 0 4px 0;
  padding-left: 30px;
}
.sidebar-group.expanded .sidebar-subgroup { display: flex; }
.sidebar.collapsed .sidebar-subgroup { display: none !important; }
.sidebar.collapsed .sidebar-chevron { display: none; }
.sidebar-subitem {
  display: block;
  padding: 6px 10px;
  border-radius: var(--radius);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 12.5px;
  transition: var(--transition);
  white-space: nowrap;
}
.sidebar-subitem:hover { color: var(--text); background: var(--bg-hover); }
.sidebar-subitem.active { color: var(--accent); background: var(--accent-bg); font-weight: 500; }

/* ── Main Content ────────────────────────────────────────── */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

.content-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  background: var(--bg);
}

.content-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.3px;
}

.content-actions {
  display: flex;
  gap: 8px;
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font);
}

.scan-input-group {
  display: flex;
  align-items: center;
  gap: 0;
}

.scan-kingdom-input {
  width: 110px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-right: none;
  border-radius: var(--radius) 0 0 var(--radius);
  font-size: 12px;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg-surface);
  transition: var(--transition);
}
.scan-kingdom-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-bg);
  z-index: 1;
  position: relative;
}
.scan-kingdom-input::placeholder { color: var(--text-dim); }
.scan-kingdom-input::-webkit-outer-spin-button,
.scan-kingdom-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.scan-kingdom-input[type=number] { -moz-appearance: textfield; }

.scan-input-group .btn {
  border-radius: 0 var(--radius) var(--radius) 0;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover { background: var(--bg-elevated); border-color: var(--border-light); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
}
.btn-ghost:hover { color: var(--text); background: var(--bg-hover); }

/* ── Data Table ──────────────────────────────────────────── */
.table-container {
  flex: 1;
  overflow: auto;
  padding: 0 20px;
}
.table-container table { width: 100%; font-size: 13px; }

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  background: var(--bg-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.data-table thead {
  position: sticky;
  top: 0;
  z-index: 10;
}

.data-table th {
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-weight: 500;
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  user-select: none;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 2px 4px rgba(0,0,0,0.06);
}

.data-table th.sortable { cursor: pointer; }
.data-table th.sortable:hover { color: var(--text); background: var(--bg-hover); }
.data-table th.sort-asc::after { content: ' \25B2'; font-size: 9px; }
.data-table th.sort-desc::after { content: ' \25BC'; font-size: 9px; }

.data-table td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

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

.data-table .empty-row td {
  text-align: center;
  color: var(--text-dim);
  padding: 60px 20px;
  font-size: 14px;
}

/* Row badges */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.badge-shield { background: var(--accent-bg); color: var(--accent); }
.badge-enemy { background: var(--danger-bg); color: var(--danger); }
.badge-gathering { background: var(--warning-bg); color: var(--warning); }
.badge-mud { background: rgba(147,51,234,0.08); color: #7c3aed; }

.shield-on { color: var(--accent); font-weight: 500; }
.shield-off { color: var(--danger); }
.shield-time { display: block; font-size: 10px; color: var(--text-muted); }
.shield-remaining { display: block; font-size: 10px; color: var(--accent); }

.alliance-badge { background: var(--accent-bg); color: var(--accent); padding: 2px 8px; border-radius: 8px; font-size: 11px; font-weight: 500; }

.row-enemy { background: rgba(220,38,38,0.03); }
.row-enemy:hover { background: rgba(220,38,38,0.06) !important; }

.data-table td { cursor: pointer; }

/* Fetch Troops Bar */
.fetch-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(59,130,246,0.03);
  flex-shrink: 0;
  font-size: 12px;
}

.fetch-label {
  color: var(--text-muted);
  font-size: 11px;
  white-space: nowrap;
}

.fetch-input {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 11px;
  padding: 4px 8px;
  width: 180px;
  font-family: var(--font);
  outline: none;
}
.fetch-input:focus { border-color: var(--accent); }

.fetch-info {
  color: var(--text-muted);
  flex: 1;
  font-size: 11px;
}

.btn-sm { padding: 4px 10px; font-size: 11px; }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #b91c1c; }

.btn-stop {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.btn-stop:hover { background: #b91c1c; }

.scan-input-group { gap: 8px; }

/* Troop fetch button in table */
.fetch-btn {
  background: rgba(59,130,246,0.07);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-muted);
  font-size: 10px;
  padding: 2px 6px;
  cursor: pointer;
  font-family: var(--font);
  margin-left: 4px;
}
.fetch-btn:hover { border-color: var(--accent); color: var(--accent); }

.send-btn {
  background: var(--accent);
  border: none;
  border-radius: 4px;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  cursor: pointer;
  margin-left: 4px;
  transition: opacity 0.15s, background 0.15s;
}
.send-btn:hover { background: #2563eb; }

.mobile-queue { display: none; padding: 8px 14px; }
@media (max-width: 1400px) { .mobile-queue { display: block; } }
.mobile-queue:empty { display: none !important; }

/* Kingdom picker — inline checkbox list for kingdom filters */
.kingdom-picker {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px;
  background: var(--bg-surface);
}
.kingdom-picker-empty {
  padding: 16px;
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
}
.kingdom-picker-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  cursor: pointer;
  font-size: 12px;
  border-radius: var(--radius-sm);
}
.kingdom-picker-item:hover { background: var(--bg-hover); }
.kingdom-picker-item input { margin: 0; cursor: pointer; }

/* Seasonal section — tab strip */
.season-empty {
  padding: 60px 30px;
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
}

/* Gathering — resource type colors + mine list */
.rss-iron  { color: #94a3b8; font-weight: 600; }   /* slate */
.rss-food  { color: #16a34a; font-weight: 600; }   /* green */
.rss-gold  { color: #ca8a04; font-weight: 600; }   /* amber */
.gather-mine {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 10px;
  align-items: center;
  padding: 3px 6px;
  border-bottom: 1px solid var(--border-light, rgba(0,0,0,.04));
  font-size: 12px;
  cursor: pointer;
}
.gather-mine:last-child { border-bottom: none; }
.gather-mine:hover { background: var(--bg-hover); }
.gather-mine-rss { white-space: nowrap; }
.gather-mine-coords { color: var(--text-muted); font-family: var(--font-mono); font-size: 11px; }
.gather-mine-card {
  display: inline-flex;
  gap: 6px;
  padding: 3px 8px;
  margin: 2px;
  background: var(--bg-elevated);
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
}
.gather-mine-card:hover { background: var(--bg-hover); }

/* Loading overlay */
.loading-overlay {
  position: fixed; inset: 0; background: var(--overlay-bg);
  z-index: 9998; display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 12px;
}
.loading-overlay .spinner { width: 36px; height: 36px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; }
.loading-overlay .loading-text { font-size: 14px; color: var(--text-dim); }
@keyframes spin { to { transform: rotate(360deg); } }

/* Button loading state */
.btn-loading { opacity: 0.6; pointer-events: none; position: relative; }
.btn-loading::after { content: ''; position: absolute; right: 8px; top: 50%; width: 12px; height: 12px; margin-top: -6px; border: 2px solid rgba(255,255,255,.3); border-top-color: #fff; border-radius: 50%; animation: spin .6s linear infinite; }

/* Page loading skeleton */
.page-loading { display: flex; align-items: center; justify-content: center; padding: 60px; color: var(--text-dim); font-size: 14px; gap: 10px; }
.page-loading .spinner { width: 20px; height: 20px; border: 2px solid #e5e7eb; border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; }

.dm-cell { text-align: center; vertical-align: middle; }
.dm-cell .send-btn { margin: 2px 0; }

.coord-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-height: 24px;
}
.coord-row .send-btn { flex-shrink: 0; }

.badge-gather { background: #15803d; color: #fff; font-size: 10px; padding: 1px 6px; border-radius: 3px; }
.badge-mud { background: #b45309; color: #fff; font-size: 10px; padding: 1px 6px; border-radius: 3px; }
.gather-loc { font-size: 11px; color: #15803d; font-weight: 500; }

.profile-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-dim);
  font-size: 11px;
  padding: 1px 4px;
  cursor: pointer;
  margin-left: 2px;
  transition: color 0.15s, border-color 0.15s;
}
.profile-btn:hover { color: var(--accent); border-color: var(--accent); }

/* Profile Modal */
.profile-modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  z-index: 9999; display: flex; align-items: center; justify-content: center;
}
.profile-modal {
  background: var(--bg); border: 1px solid var(--border); border-radius: 12px;
  width: 420px; max-width: 92vw; max-height: 85vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.profile-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.profile-header h3 { margin: 0; font-size: 16px; font-weight: 700; }
.profile-close {
  background: none; border: none; font-size: 22px; cursor: pointer;
  color: var(--text-dim); line-height: 1;
}
.profile-close:hover { color: var(--text); }
.profile-grid {
  display: grid; grid-template-columns: 1fr; gap: 0;
  padding: 12px 20px 20px;
}
.profile-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--border-light, rgba(0,0,0,.06));
}
.profile-item:last-child { border-bottom: none; }
.profile-label { font-size: 13px; color: var(--text-dim); }
.profile-value { font-size: 14px; font-weight: 600; text-align: right; }

/* Notice card */
.notice-card { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.notice-header { padding: 12px 16px; background: var(--bg2, #f8f9fa); font-size: 14px; border-bottom: 1px solid var(--border); }
.notice-leader { padding: 8px 16px; font-size: 12px; color: var(--text-dim); border-bottom: 1px solid var(--border); }
.notice-section { padding: 12px 16px; border-bottom: 1px solid var(--border); }
.notice-section:last-child { border-bottom: none; }
.notice-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-dim); margin-bottom: 6px; }
.notice-text { font-size: 13px; line-height: 1.6; white-space: pre-wrap; }

.loot-cell { text-align: center; white-space: nowrap; }
.loot-icon { font-size: 16px; margin: 0 1px; cursor: default; }
.loot-ore { filter: hue-rotate(200deg); }

.loot-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; border-bottom: 1px solid var(--border-light, rgba(0,0,0,.06));
  font-size: 13px;
}
.loot-row:last-child { border-bottom: none; }
.loot-highlight { color: #16a34a; font-weight: 600; }

.fetch-spin {
  display: inline-block;
  width: 10px;
  height: 10px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
}

/* ── Scan Progress ───────────────────────────────────────── */
.scan-progress {
  padding: 12px 20px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}
.scan-progress.hidden { display: none; }

.progress-bar {
  flex: 1;
  height: 4px;
  background: var(--bg-elevated);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 2px;
  /* no CSS transition — animated by requestAnimationFrame for smooth real-time progress */
}

.progress-text {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── Right Filter Panel ──────────────────────────────────── */
.filter-panel {
  position: fixed;
  top: var(--topbar-h);
  right: 0;
  bottom: var(--footer-h);
  width: var(--filter-w);
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  box-shadow: -3px 0 10px rgba(0,0,0,0.04);
  overflow-y: scroll;
  overflow-x: hidden;
  z-index: 10;
}

.filter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.filter-header h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.filter-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
}
.filter-close:hover { color: var(--text); background: var(--bg-hover); }

.filter-body {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}
.filter-group label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 500;
}

.filter-input {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: var(--font);
  transition: var(--transition);
}
.filter-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-bg);
}
.filter-input::placeholder { color: var(--text-dim); }

select.filter-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%239ca3af' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

.filter-group input[type="checkbox"] {
  accent-color: var(--accent);
  margin-right: 6px;
}

.filter-apply { width: 100%; justify-content: center; margin-top: 4px; }
.filter-reset { width: 100%; justify-content: center; }

.filter-hint {
  font-weight: 400;
  color: var(--text-dim);
  text-transform: none;
  letter-spacing: 0;
  font-size: 10px;
}

.filter-row {
  display: flex;
  gap: 8px;
}
.filter-row .filter-input {
  flex: 1 1 0;
  min-width: 0;
  width: 100%;
}

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

.filter-radio {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
}

.filter-radio input[type="radio"] {
  accent-color: var(--accent);
  cursor: pointer;
}

/* ── Footer ──────────────────────────────────────────────── */
.footer {
  position: fixed;
  bottom: 0;
  left: var(--sidebar-w);
  right: 0;
  height: var(--footer-h);
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -2px 6px rgba(0,0,0,0.04);
  display: flex;
  z-index: 90;
  transition: left var(--transition);
  overflow: hidden;
}

body.sidebar-collapsed .footer {
  left: var(--sidebar-collapsed);
}

/* Footer top resize handle */
.footer-resize-handle {
  position: absolute;
  top: -4px; left: 0; right: 0;
  height: 8px;
  cursor: ns-resize;
  z-index: 91;
  display: flex;
  align-items: center;
  justify-content: center;
}
.footer-resize-handle::after {
  content: '';
  width: 40px;
  height: 3px;
  border-radius: 2px;
  background: var(--border);
  transition: background var(--transition), width var(--transition);
}
.footer-resize-handle:hover::after,
.footer-resize-handle.active::after {
  background: var(--accent);
  width: 60px;
}


.notifications {
  width: 320px;
  min-width: 150px;
  flex-shrink: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.notifications-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 500;
}

.notifications-list {
  flex: 1;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: hidden;
  background: var(--bg);
}

.toast {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 12px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  animation: slideIn 0.7s cubic-bezier(0.16, 1, 0.3, 1);
  border-left: 3px solid;
  transition: all 0.4s ease;
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
}
.toast-success { border-color: var(--success); color: var(--success); box-shadow: 0 2px 12px rgba(22,163,74,0.1); }
.toast-error { border-color: var(--danger); color: var(--danger); box-shadow: 0 2px 12px rgba(220,38,38,0.1); }
.toast-info { border-color: var(--accent); color: var(--accent); box-shadow: 0 2px 12px rgba(59,130,246,0.1); }
.toast-warning { border-color: var(--warning); color: var(--warning); box-shadow: 0 2px 12px rgba(217,119,6,0.1); }

.toast-icon { flex-shrink: 0; margin-top: 1px; }
.toast-text { flex: 1; line-height: 1.4; color: var(--text); }
.toast-close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 2px;
  border-radius: 3px;
  display: flex;
  align-items: center;
  transition: var(--transition);
}
.toast-close:hover { color: var(--text-muted); background: var(--bg-hover); }

.toast.fade-out {
  animation: fadeOut 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  pointer-events: none;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeOut {
  from { opacity: 1; transform: translateY(0); max-height: 80px; margin-bottom: 6px; }
  40% { opacity: 0; transform: translateY(-4px); }
  to { opacity: 0; transform: translateY(-4px); max-height: 0; margin-bottom: 0; padding: 0; overflow: hidden; }
}

/* ── Queue Section ───────────────────────────────────────── */
.queue-section {
  width: 260px;
  min-width: 150px;
  flex-shrink: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-left: 1px solid var(--border);
}

.queue-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 500;
}

.queue-count {
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.queue-entries {
  flex: 1;
  overflow-y: auto;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.queue-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.queue-item:hover { background: var(--bg-hover); }

.queue-active { background: var(--accent-bg); }
.queue-pending { }

.queue-item-status {
  flex-shrink: 0;
  color: var(--text-dim);
  display: flex;
  align-items: center;
}

.queue-active .queue-item-status { color: var(--accent); }

.queue-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.queue-item-info { flex: 1; min-width: 0; }

.queue-item-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.queue-item-detail {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}

.queue-active .queue-item-detail { color: var(--accent); }

/* ── Log Section ─────────────────────────────────────────── */
.log-section {
  flex: 1 1 auto;
  min-width: 100px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-left: 1px solid var(--border);
}

.log-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 500;
}

.log-clear {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  font-family: var(--font);
}
.log-clear:hover { color: var(--text-muted); }

.log-entries {
  flex: 1;
  overflow-y: auto;
  padding: 6px 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.6;
}

.log-entry {
  padding: 1px 0;
  color: var(--text-dim);
}
.log-entry.log-info { color: var(--accent); }
.log-entry.log-success { color: var(--success); }
.log-entry.log-error { color: var(--danger); }
.log-entry.log-warning { color: var(--warning); }

/* ── Scrollbar ───────────────────────────────────────────── */
/* ── Scan History Section ─────────────────────────────────── */
.history-section {
  width: 260px;
  min-width: 150px;
  flex-shrink: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-left: 1px solid var(--border);
}

.history-header {
  display: flex;
  align-items: center;
  padding: 6px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 500;
}

.history-entries {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
  -webkit-user-select: none;
}
.history-item:hover { background: var(--bg-hover); }

.history-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.history-kingdom {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

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

.history-time {
  font-size: 10px;
  color: var(--text-dim);
  white-space: nowrap;
}

.history-info {
  flex: 1;
  cursor: pointer;
}

.history-delete {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 16px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
}
.history-item:hover .history-delete { opacity: 1; }
.history-delete:hover { color: var(--danger); }

/* ── Stats Section ───────────────────────────────────────── */
.stats-section {
  width: 220px;
  min-width: 120px;
  flex-shrink: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-left: 1px solid var(--border);
}

.stats-header {
  display: flex;
  align-items: center;
  padding: 6px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 500;
}

.stats-body {
  flex: 1;
  padding: 8px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}

.stat-label { color: var(--text-muted); }
.stat-value { font-weight: 600; color: var(--text); }
.stat-shield { color: var(--accent); }
.stat-exposed { color: var(--success); }
.stat-enemy { color: var(--danger); }
.stat-gathering { color: var(--warning); }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ── Responsive ──────────────────────────────────────────── */

/* ── Mobile (< 1400px) ──────────────────────────────────── */
@media (max-width: 1400px) {
  /* Hide desktop components */
  .footer,
  .filter-panel { display: none !important; }

  /* Sidebar: hidden off-screen, slides in on toggle */
  .sidebar {
    width: 0;
    min-width: 0;
    border: none;
    box-shadow: none;
    z-index: 200;
  }
  .sidebar.mobile-open {
    width: var(--sidebar-w);
    border-right: 1px solid var(--border);
    box-shadow: 4px 0 20px rgba(0,0,0,0.12);
  }
  .sidebar .sidebar-label { opacity: 1 !important; width: auto !important; }
  .sidebar .sidebar-item { justify-content: flex-start !important; padding: 9px 10px !important; width: auto !important; height: auto !important; gap: 10px !important; }
  .sidebar .sidebar-nav, .sidebar .sidebar-bottom { align-items: stretch !important; }
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    z-index: 199;
  }
  .sidebar-overlay.visible { display: block; }

  /* Layout: full width, leave room for bottom tabs */
  .layout { left: 0; right: 0; bottom: 56px; }

  /* Show mobile-only components */
  .mobile-tabs { display: flex !important; }
  .mobile-notifications { display: flex !important; }

  /* Content header — compact */
  .content-header { padding: 12px 14px; }
  .content-title { font-size: 16px; }
  .content-actions { gap: 6px; }
  .scan-kingdom-input { width: 90px; font-size: 14px; padding: 8px 10px; }
  .btn { padding: 8px 12px; font-size: 12px; }
  .topbar-title { font-size: 14px; }

  /* Swap table for cards — only inside visible sections */
  .table-container { display: none !important; }
  .section-content .cards-container { display: flex !important; }

  /* Fetch bar — wrap on mobile */
  .fetch-bar { flex-wrap: wrap; padding: 8px 14px; }
  /* Player cards container (outside section divs) — controlled by JS, don't override */

  /* Enable filter sheet */
  .filter-sheet-wrapper { display: block !important; }
}

/* ── Player Cards (mobile) ───────────────────────────────── */
.cards-container {
  display: none;
  flex-direction: column;
  gap: 10px;
  padding: 10px 14px;
  overflow-y: auto;
  flex: 1;
}

.player-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.player-card:active { background: var(--bg-elevated); }
.player-card.card-enemy { border-left: 3px solid var(--danger); }

.card-header {
  display: flex;
  align-items: center;
  padding: 16px;
  cursor: pointer;
  gap: 12px;
}

.card-main {
  flex: 1;
  min-width: 0;
}

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

.card-name {
  font-weight: 600;
  font-size: 16px;
  color: var(--text);
}

.card-alliance {
  font-size: 12px;
  color: var(--accent);
  font-weight: 500;
  background: var(--accent-bg);
  padding: 2px 8px;
  border-radius: 8px;
}

.card-sub {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-size: 14px;
  color: var(--text-muted);
}

.card-dot { color: var(--border-light); }

.card-tags {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.card-arrow {
  color: var(--text-dim);
  flex-shrink: 0;
  transition: transform 0.3s ease;
}
.player-card.expanded .card-arrow {
  transform: rotate(180deg);
}

.card-details {
  display: none;
  padding: 0 16px 16px;
  border-top: 1px solid var(--border);
}
.player-card.expanded .card-details {
  display: block;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 20px;
  padding-top: 14px;
}

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.detail-label {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.detail-value {
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
}

.card-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.card-actions .btn { flex: 1; justify-content: center; font-size: 12px; padding: 10px; }

/* ── Mobile Bottom Tabs ──────────────────────────────────── */
.mobile-tabs {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 56px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
  z-index: 100;
  align-items: center;
  justify-content: space-around;
  padding: 0 8px;
}

.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 12px;
  border-radius: var(--radius);
  color: var(--text-dim);
  text-decoration: none;
  font-size: 10px;
  transition: var(--transition);
  cursor: pointer;
}
.tab-item:hover, .tab-item.active { color: var(--accent); }
.tab-item.active { background: var(--accent-bg); }

.tab-label { font-weight: 500; letter-spacing: 0.2px; }

/* ── Mobile Notifications (collapses when empty) ── */
.mobile-notifications {
  display: none;                          /* shown via media query */
  flex-direction: column;
  gap: 6px;
  padding: 0 14px;
  max-height: 0;
  flex-shrink: 0;
  overflow: hidden;
  background: var(--bg);
  transition: max-height 0.4s ease, padding 0.4s ease;
}

.mobile-notifications.has-items {
  max-height: 120px;
  padding: 8px 14px;
}

.mobile-notifications .toast {
  box-shadow: 0 1px 6px rgba(0,0,0,0.08);
  background: var(--bg-surface);
}

/* ── Filter Sheet (mobile) ───────────────────────────────── */
.filter-sheet-wrapper {
  display: none;
  position: fixed;
  bottom: 56px; left: 0; right: 0;
  top: var(--topbar-h);
  z-index: 110;
  overflow: hidden;                       /* clips the sheet during animation */
  pointer-events: none;
}

.filter-sheet {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  max-height: 60vh;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: all;
}
.filter-sheet.visible {
  transform: translateY(0);
}

.filter-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
}

.filter-sheet-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.filter-sheet-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  transition: var(--transition);
}
.filter-sheet-close:hover { color: var(--text); background: var(--bg-hover); }

.filter-sheet .filter-body { padding: 0 16px 20px; }
.filter-sheet .filter-group label { font-size: 12px; }
.filter-sheet .filter-input { font-size: 14px; padding: 10px 12px; }
.filter-sheet .btn { font-size: 14px; padding: 12px; }
.filter-sheet .filter-group input[type="checkbox"] { width: 18px; height: 18px; }

/* ── Shield Expiry Filter ────────────────────────────────── */
.expiry-buttons { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.expiry-btn {
  font-family: var(--font); font-size: 11px; padding: 4px 10px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--bg-surface); color: var(--text-muted);
  cursor: pointer; transition: var(--transition);
}
.expiry-btn:hover { background: var(--bg-hover); color: var(--text); }
.expiry-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.expiry-custom { display: flex; align-items: center; gap: 4px; margin-top: 6px; }
.expiry-input { width: 48px !important; text-align: center; font-size: 12px !important; padding: 4px 6px !important; }
.expiry-unit { font-size: 11px; color: var(--text-dim); }

/* ── Pagination ──────────────────────────────────────────── */
.pagination {
  display: flex; align-items: center; justify-content: center; gap: 4px;
  padding: 8px 20px; font-size: 12px; flex-shrink: 0;
}
.pagination:empty { display: none; }
.page-btn {
  min-width: 32px; height: 28px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-surface); color: var(--text-muted); cursor: pointer; font-size: 12px;
  font-family: var(--font); transition: var(--transition); padding: 0 8px;
}
.page-btn:hover { background: var(--bg-hover); color: var(--text); }
.page-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }
.page-btn:disabled { opacity: 0.4; cursor: default; }
.page-info { color: var(--text-dim); font-size: 11px; margin: 0 8px; }

/* ── Section Content Areas ───────────────────────────────── */
.section-content { flex: 1; overflow: auto; min-height: 0; padding: 20px; }
@media (max-width: 1400px) { .section-content { padding: 0 14px; } }
.section-toolbar {
  display: flex; align-items: center; gap: 12px; padding: 8px 0; font-size: 12px; color: var(--text-muted);
}
.section-hint { font-size: 11px; color: var(--text-dim); }

/* ── Rarity Badges ───────────────────────────────────────── */
.rarity-blue { color: #3b82f6; font-weight: 600; }
.rarity-purple { color: #8b5cf6; font-weight: 600; }
.rarity-gold { color: #d97706; font-weight: 600; }
.rarity-goldstar { color: #d97706; font-weight: 700; }
.rarity-oil { color: #0d9488; font-weight: 600; }
.rarity-ghost-purple { color: #7c3aed; font-weight: 600; }
.rarity-ghost-gold { color: #b45309; font-weight: 600; }
.rarity-ghost-goldstar { color: #b45309; font-weight: 700; }
.rarity-unknown { color: var(--text-dim); }

.occupied { color: var(--danger); font-size: 11px; }
.vacant { color: var(--text-dim); }

/* ── DS Prep ─────────────────────────────────────────────── */
.dsprep-toolbar {
  display: flex; align-items: center; gap: 10px; padding: 8px 20px; flex-wrap: wrap;
}
.dsprep-inputs { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dsprep-inputs label { font-size: 12px; font-weight: 500; color: var(--text-muted); }
.dsprep-status { font-size: 12px; color: var(--text-dim); }

#ds-card {
  background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); max-width: 720px; margin: 0 auto; font-family: var(--font);
  overflow: hidden;
}
.ds-card-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 20px 24px; border-bottom: 1px solid var(--border); background: var(--bg-elevated);
}
.ds-header-left { display: flex; flex-direction: column; gap: 4px; }
.ds-alliance-name { font-size: 20px; font-weight: 700; color: var(--text); }
.ds-alliance-tag { font-size: 14px; font-weight: 400; color: var(--text-muted); }
.ds-alliance-sub { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.ds-header-right { text-align: right; display: flex; flex-direction: column; gap: 2px; }
.ds-fp-label { font-size: 10px; font-weight: 500; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; }
.ds-fp-value { font-size: 22px; font-weight: 700; color: var(--accent); }
.ds-member-count { font-size: 11px; color: var(--text-muted); }
.ds-member-count span { font-weight: 600; color: var(--text); }

.ds-stats-row {
  display: flex; border-bottom: 1px solid var(--border);
}
.ds-stat-cell { flex: 1; text-align: center; padding: 12px 8px; }
.ds-stat-cell + .ds-stat-cell { border-left: 1px solid var(--border); }
.ds-stat-label { font-size: 10px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 2px; }
.ds-stat-value { font-size: 16px; font-weight: 700; color: var(--text); }

.ds-table-scroll { overflow-x: auto; }
#ds-card table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12px; }
#ds-card thead th {
  text-align: left; padding: 8px 12px; color: var(--text-muted); font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}
#ds-card tbody td { padding: 8px 12px; border-bottom: 1px solid var(--border); }
#ds-card tbody tr:last-child td { border-bottom: none; }
#ds-card tbody tr:hover { background: var(--bg-hover); }
.ds-rank { font-weight: 700; color: var(--text-dim); width: 32px; text-align: center; }
.ds-rank.top { color: var(--accent); }
.ds-name { font-weight: 600; color: var(--text); }
.ds-hp { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.ds-hp.r { text-align: right; }
.ds-hero-name { color: var(--text); font-size: 12px; font-weight: 500; }
.ds-hero-sub { color: var(--text-dim); font-size: 10px; }
.ds-squad { font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 3px; display: inline-block; }
.ds-squad.Aircraft { background: rgba(79,195,247,0.12); color: #2196f3; }
.ds-squad.Missile { background: rgba(239,83,80,0.10); color: #e53935; }
.ds-squad.Tank { background: rgba(76,175,80,0.10); color: #388e3c; }
.ds-squad.TankAir { background: rgba(255,179,0,0.12); color: #f57f17; }

.ds-card-footer {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 24px; border-top: 1px solid var(--border); background: var(--bg-elevated);
}
.ds-footer-note { font-size: 10px; color: var(--text-dim); }
.ds-footer-brand { font-size: 11px; font-weight: 700; color: var(--text-dim); letter-spacing: 2px; }

/* ── Alliance Finder ─────────────────────────────────────── */
.alli-finder-section {
  margin: 24px 20px 0; padding: 20px; background: var(--bg-surface);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.alli-finder-header { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.alli-finder-desc { font-size: 12px; color: var(--text-muted); margin-bottom: 12px; }
.alli-finder-inputs {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.alli-finder-inputs label { font-size: 11px; font-weight: 600; color: var(--text-muted); }
.alli-finder-status { font-size: 12px; color: var(--text-muted); margin-top: 8px; min-height: 18px; }
.alli-finder-progress { margin-top: 8px; }
.alli-finder-bar {
  height: 6px; background: var(--bg-elevated); border-radius: 3px; overflow: hidden;
}
.alli-finder-bar-fill {
  height: 100%; background: var(--accent); width: 0%; transition: width 0.3s;
}
#af-results { margin-top: 12px; }
#af-results table {
  width: 100%; border-collapse: collapse; font-size: 12px;
}
#af-results th {
  text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--border);
  font-size: 10px; text-transform: uppercase; color: var(--text-dim); font-weight: 600;
}
#af-results td { padding: 6px 10px; border-bottom: 1px solid var(--border-subtle, rgba(255,255,255,0.04)); }
#af-results tr:hover { background: var(--bg-elevated); }
#af-results .af-use-btn {
  padding: 2px 10px; font-size: 11px; cursor: pointer;
  background: var(--accent); color: #fff; border: none; border-radius: 4px;
}
#af-results .af-use-btn:hover { opacity: 0.85; }

/* ── Dashboard / Settings ─────────────────────────────────── */
.dash-layout {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 20px;
  align-items: start;
}
@media (max-width: 1400px) { .dash-layout { grid-template-columns: 1fr; } }
.dash-col { display: flex; flex-direction: column; gap: 16px; }

.dash-card {
  background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.dash-card-header {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-dim); padding: 14px 20px 10px;
}

.dash-profile { display: flex; align-items: center; gap: 14px; padding: 0 20px 14px; }
.dash-avatar {
  width: 42px; height: 42px; border-radius: 50%; background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 700;
  flex-shrink: 0;
}
.dash-profile-info { flex: 1; min-width: 0; }
.dash-profile-name { font-size: 15px; font-weight: 600; color: var(--text); }
.dash-profile-tier { margin-top: 3px; }
.dash-badge {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
  padding: 2px 8px; border-radius: 3px; background: var(--accent-bg); color: var(--accent);
}
.dash-badge-soon { background: var(--bg-elevated); color: var(--text-dim); }

.dash-setting {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 20px; border-top: 1px solid var(--border);
}
.dash-setting-info { flex: 1; min-width: 0; }
.dash-setting-title { font-size: 13px; font-weight: 500; color: var(--text); }
.dash-setting-desc { font-size: 11px; color: var(--text-dim); margin-top: 1px; }
.dash-setting-value { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; }

.dash-devices { padding: 0; }
.dash-device {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 20px; border-top: 1px solid var(--border); font-size: 12px;
}
.dash-device-name { color: var(--text); font-weight: 500; }
.dash-device-date { color: var(--text-dim); font-size: 11px; }

/* ── Mission/Cat/Ghost Mobile Cards ──────────────────────── */
.section-content .cards-container { display: none; }
@media (max-width: 1400px) {
  .section-content .table-container { display: none !important; }
  .section-content .cards-container { display: block !important; }
  .section-content .pagination { display: none !important; }
}

.m-card {
  background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 6px; cursor: pointer; transition: var(--transition);
}
.m-card:active { background: var(--bg-hover); }
.m-card-top { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.m-card-mid { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-muted); flex-wrap: wrap; }
.m-rarity-badge { font-size: 12px; font-weight: 600; }
.m-card-lvl { font-size: 11px; color: var(--text-muted); font-weight: 500; }
.m-card-kz { font-size: 11px; color: var(--text-dim); }
.m-card-coords { font-size: 12px; font-family: var(--font-mono); color: var(--text-muted); }
.m-status-cap { color: var(--success); font-size: 11px; font-weight: 600; }
.m-status-ong { color: var(--warning); font-size: 11px; }
.m-status-plund { color: var(--danger); font-size: 11px; }

.cat-slots { font-weight: 700; font-size: 13px; }
.cat-slots.full { color: var(--danger); }
.cat-slots.low { color: var(--warning); }
.cat-slots.open { color: var(--success); }
