/* Mod dashboard — matches obsidianoverseer.com theme */
:root {
  --bg: #06070a;
  --bg-gradient: radial-gradient(ellipse 100% 80% at 50% 0%, rgba(15, 12, 20, 0.98) 0%, transparent 50%),
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(212, 140, 60, 0.08), transparent);
  --surface: #0f1115;
  --surface2: #161a20;
  --surface-hover: #1c2028;
  --border: #2a2520;
  --text: #f0ebe5;
  --text-muted: #9a8f82;
  --accent: #d4943c;
  --accent-bright: #e8a84a;
  --accent-dim: #b87828;
  --accent-rgb: 232, 168, 74;
  --discord-blurple: #5865F2;
  --success: #6bcf7f;
  --warn: #fbbf24;
  --danger: #f87171;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
}

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

body.dash-body {
  font-family: 'Outfit', sans-serif;
  background: var(--bg);
  background-image: var(--bg-gradient);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

.dash-wrap {
  position: relative;
  z-index: 1;
  max-width: 1120px;
  margin: 0 auto;
  padding: 20px 20px 64px;
}

.dash-page-header { margin-bottom: 24px; }
.dash-page-header h1 { font-size: 1.75rem; font-weight: 700; margin-bottom: 6px; }
.dash-page-header p { color: var(--text-muted); max-width: 560px; font-size: 0.95rem; }

/* Login */
.dash-login-panel {
  max-width: 420px;
  margin: 48px auto;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 32px;
  box-shadow: var(--shadow);
}
.dash-login-panel .dash-logo {
  width: 64px;
  height: 64px;
  margin-bottom: 16px;
}

/* Top bar */
.dash-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.dash-guild-picker {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 200px;
}
.dash-guild-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface2);
  object-fit: cover;
  border: 1px solid var(--border);
}
.dash-guild-icon.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--accent);
  font-size: 1rem;
}
.dash-guild-select {
  flex: 1;
  min-width: 160px;
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font: inherit;
}
.dash-topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.dash-user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 6px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.85rem;
}
.dash-user-chip img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
}
.dash-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Buttons */
.dash-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 999px;
  border: none;
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
  transition: filter 0.15s, background 0.15s;
}
.dash-btn-primary { background: var(--discord-blurple); color: #fff; }
.dash-btn-primary:hover { filter: brightness(1.08); }
.dash-btn-ghost {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}
.dash-btn-ghost:hover { background: var(--surface-hover); }
.dash-btn-sm { padding: 8px 14px; font-size: 0.85rem; }
.dash-btn-discord { background: var(--accent); color: #06070a; }
.dash-btn-discord:hover { filter: brightness(1.1); }
.dash-btn-danger { background: rgba(248, 113, 113, 0.15); color: var(--danger); border: 1px solid rgba(248, 113, 113, 0.35); }
.dash-btn-danger:hover { background: rgba(248, 113, 113, 0.25); }

/* Alerts */
.dash-alerts { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.dash-alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid;
  font-size: 0.9rem;
}
.dash-alert-danger {
  background: rgba(248, 113, 113, 0.1);
  border-color: rgba(248, 113, 113, 0.35);
  color: #fca5a5;
}
.dash-alert-warn {
  background: rgba(251, 191, 36, 0.1);
  border-color: rgba(251, 191, 36, 0.35);
  color: #fcd34d;
}
.dash-alert-info {
  background: rgba(88, 101, 242, 0.1);
  border-color: rgba(88, 101, 242, 0.35);
  color: #a5b4fc;
}

/* Tabs */
.dash-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 20px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.dash-tab {
  padding: 10px 18px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
.dash-tab:hover { color: var(--text); background: var(--surface2); }
.dash-tab.active {
  color: var(--accent-bright);
  background: var(--surface2);
}
.dash-tab-panel { display: none; animation: dashFade 0.2s ease; }
.dash-tab-panel.active { display: block; }
@keyframes dashFade {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

/* Stats */
.dash-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.dash-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
}
.dash-stat:hover { border-color: var(--accent); transform: translateY(-1px); }
.dash-stat-icon { font-size: 1.25rem; margin-bottom: 6px; }
.dash-stat-value {
  display: block;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--accent-bright);
  line-height: 1.2;
}
.dash-stat-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }
.dash-stat.danger .dash-stat-value { color: var(--danger); }
.dash-stat.warn .dash-stat-value { color: var(--warn); }

/* Panels & tables */
.dash-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.dash-panel h2 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.dash-table-wrap { overflow-x: auto; }
.dash-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.dash-table th,
.dash-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.dash-table th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.dash-table tr:last-child td { border-bottom: none; }
.dash-table tr:hover td { background: var(--surface2); }

.dash-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.dash-badge-urgent { background: rgba(248, 113, 113, 0.2); color: var(--danger); }
.dash-badge-escalated { background: rgba(251, 191, 36, 0.2); color: var(--warn); }
.dash-badge-awaiting { background: rgba(88, 101, 242, 0.2); color: #a5b4fc; }
.dash-badge-ok { background: rgba(107, 207, 127, 0.2); color: var(--success); }
.dash-badge-missing { background: rgba(248, 113, 113, 0.15); color: var(--danger); }
.dash-badge-warn { background: rgba(251, 191, 36, 0.15); color: var(--warn); }

.dash-empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
}
.dash-empty-icon { font-size: 2rem; margin-bottom: 8px; opacity: 0.6; }

/* Features */
.dash-feature-groups { display: flex; flex-direction: column; gap: 20px; }
.dash-feature-group h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.dash-feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}
.dash-feature-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.dash-feature-info strong { display: block; font-size: 0.95rem; }
.dash-feature-info span { font-size: 0.8rem; color: var(--text-muted); display: block; margin-top: 4px; }
.dash-feature-hint {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.72rem;
  color: var(--accent-bright, var(--accent));
}
.dash-feature-card-static { align-items: center; }
.dash-feature-card-static .dash-badge { flex-shrink: 0; }

/* Toggle switch */
.dash-switch {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.dash-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.dash-switch-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s;
}
.dash-switch-slider::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: var(--text);
  border-radius: 50%;
  transition: transform 0.2s;
}
.dash-switch input:checked + .dash-switch-slider { background: var(--accent); }
.dash-switch input:checked + .dash-switch-slider::before { transform: translateX(20px); }
.dash-switch input:focus-visible + .dash-switch-slider { outline: 2px solid var(--accent-bright); }

/* Setup */
.dash-setup-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}
.dash-progress-bar {
  flex: 1;
  height: 8px;
  background: var(--surface2);
  border-radius: 999px;
  overflow: hidden;
}
.dash-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-dim, #b87828), var(--accent-bright));
  border-radius: 999px;
  transition: width 0.3s ease;
}
.dash-setup-section { margin-bottom: 20px; }
.dash-setup-section h3 { font-size: 0.95rem; margin-bottom: 10px; color: var(--accent); }
.dash-setup-list { list-style: none; }
.dash-setup-list li {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
  color: var(--text-muted);
}
.dash-setup-list li:last-child { border-bottom: none; }

/* Skeleton */
.dash-skeleton {
  background: linear-gradient(90deg, var(--surface2) 25%, var(--surface-hover) 50%, var(--surface2) 75%);
  background-size: 200% 100%;
  animation: dashShimmer 1.2s infinite;
  border-radius: var(--radius-sm);
}
@keyframes dashShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.dash-skeleton-stat { height: 100px; }
.dash-skeleton-row { height: 48px; margin-bottom: 8px; }

/* Toast */
.dash-toast-wrap {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.dash-toast {
  padding: 12px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  font-size: 0.9rem;
  animation: dashFade 0.2s ease;
}
.dash-toast.success { border-color: rgba(107, 207, 127, 0.5); }
.dash-toast.error { border-color: rgba(248, 113, 113, 0.5); }

.dash-loading-bar {
  text-align: center;
  padding: 12px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.dash-footer {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.dash-footer a { color: var(--accent); text-decoration: none; }
.dash-footer a:hover { text-decoration: underline; }

/* Search */
.dash-search-wrap { position: relative; flex: 1; min-width: 180px; max-width: 320px; }
.dash-search {
  width: 100%;
  padding: 10px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
}
.dash-search:focus { outline: none; border-color: var(--accent); }
.dash-search-inline { border-radius: var(--radius-sm); max-width: 360px; }
.dash-search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  max-height: 320px;
  overflow-y: auto;
  z-index: 100;
}
.dash-search-hit {
  display: block;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}
.dash-search-hit:hover { background: var(--surface2); }
.dash-search-hit strong { display: block; font-size: 0.9rem; }
.dash-search-hit span { font-size: 0.8rem; color: var(--text-muted); }

/* Baro widget */
.dash-baro-mini { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; padding: 16px 20px; }
.dash-baro-status { flex: 1; min-width: 200px; }
.dash-baro-status h3 { font-size: 1rem; margin-bottom: 4px; }
.dash-baro-items { display: flex; flex-wrap: wrap; gap: 8px; }
.dash-baro-chip {
  padding: 6px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.dash-cycle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.dash-cycle-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
}
.dash-cycle-card .state { font-size: 1.25rem; font-weight: 700; color: var(--accent-bright); }
.dash-cycle-card .name { font-size: 0.85rem; color: var(--text-muted); margin-top: 4px; }

.dash-wf-banner {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(107, 207, 127, 0.08);
  margin-bottom: 16px;
  font-size: 0.88rem;
}
.dash-wf-banner-warn {
  background: rgba(251, 191, 36, 0.08);
  border-color: rgba(251, 191, 36, 0.35);
  color: var(--warn);
}
.dash-wf-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}
.dash-wf-mission-list {
  list-style: none;
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.dash-wf-mission-list li { font-size: 0.9rem; line-height: 1.45; }
.dash-wf-mini-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.dash-wf-mini-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.dash-wf-mini-card strong { font-size: 0.92rem; }
.dash-wf-mini-card span { font-size: 0.85rem; }
.dash-wf-compact-list {
  list-style: none;
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.dash-wf-tier {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(var(--accent-rgb), 0.15);
  color: var(--accent-bright);
  font-size: 0.78rem;
  font-weight: 700;
}
.dash-wf-feed-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.dash-wf-feed-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.dash-wf-feed-card strong { display: block; font-size: 0.88rem; margin-bottom: 4px; }
.dash-wf-feed-card span { font-size: 0.82rem; color: var(--text-muted); }
.dash-wf-feed-missing { opacity: 0.75; border-style: dashed; }

/* Charts (CSS bars) */
.dash-chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}
.dash-chart-title { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 12px; }
.dash-bar-chart { display: flex; flex-direction: column; gap: 8px; }
.dash-bar-row { display: flex; align-items: center; gap: 10px; font-size: 0.85rem; }
.dash-bar-label { width: 100px; flex-shrink: 0; color: var(--text-muted); text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-bar-track { flex: 1; height: 10px; background: var(--surface2); border-radius: 999px; overflow: hidden; }
.dash-bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent-dim), var(--accent-bright)); border-radius: 999px; min-width: 2px; }
.dash-bar-value { width: 36px; text-align: right; color: var(--text-muted); font-size: 0.8rem; }
.dash-metric-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.dash-metric {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
}
.dash-metric strong { display: block; font-size: 1.4rem; color: var(--accent-bright); }
.dash-metric span { font-size: 0.8rem; color: var(--text-muted); }

/* Audit timeline */
.dash-audit-toolbar { margin-bottom: 16px; }
.dash-audit-list { list-style: none; }
.dash-audit-item {
  display: flex;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.dash-audit-item:last-child { border-bottom: none; }
.dash-audit-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1rem;
}
.dash-audit-body { flex: 1; min-width: 0; }
.dash-audit-body strong { font-size: 0.92rem; }
.dash-audit-meta { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }

.dash-setup-editor {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.dash-setup-editor h3 { margin-bottom: 14px; font-size: 1.05rem; }
.dash-setup-editor h4 {
  margin: 16px 0 10px;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.dash-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.dash-field-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.dash-field-wide { grid-column: 1 / -1; }
.dash-field-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}
.dash-input,
.dash-select,
.dash-setup-editor select,
.dash-form-grid select,
.dash-form-grid input,
.dash-form-grid textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font: inherit;
}
.dash-input:focus,
.dash-select:focus,
.dash-form-grid select:focus,
.dash-form-grid input:focus,
.dash-form-grid textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.dash-setup-create-name {
  margin-top: 2px;
}
.dash-field-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 8px;
}
.dash-table-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

@media (max-width: 640px) {
  .dash-topbar { flex-direction: column; align-items: stretch; }
  .dash-tabs { overflow-x: auto; flex-wrap: nowrap; }
  .dash-tab { white-space: nowrap; }
  .dash-table { font-size: 0.82rem; }
  .dash-table th, .dash-table td { padding: 10px 8px; }
  .dash-form-grid { grid-template-columns: 1fr; }
  .dash-wf-grid-2 { grid-template-columns: 1fr; }
  .dash-wf-mini-grid { grid-template-columns: 1fr; }
  .dash-wf-feed-grid { grid-template-columns: 1fr; }
}

html[data-theme="light"] {
  --bg: #eef1f5;
  --bg-gradient: radial-gradient(ellipse 100% 80% at 50% 0%, rgba(238, 241, 245, 0.98) 0%, transparent 50%),
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(61, 110, 168, 0.1), transparent);
  --surface: #ffffff;
  --surface2: #f2f4f8;
  --surface-hover: #e8ebf1;
  --border: #cfd5df;
  --text: #1a1d24;
  --text-muted: #5a6370;
  --accent: #3d6ea8;
  --accent-bright: #2f5f96;
  --accent-dim: #25507e;
  --accent-rgb: 61, 110, 168;
  --shadow: 0 4px 24px rgba(20, 25, 35, 0.08);
}
