/* Dashboard — Grim server management UI */

/* ── sidebar ── */
.sidebar {
  width: 260px;
  background: var(--s0);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  z-index: 900;
  overflow-y: auto;
}
.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
}
.sidebar-server {
  display: flex;
  align-items: center;
  gap: 12px;
}
.sidebar-server-icon {
  width: 40px; height: 40px;
  border-radius: var(--r-sm);
  background: var(--s2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}
.sidebar-server-info h3 { font-size: .9rem; font-weight: 600; }
.sidebar-server-info p { font-size: .7rem; color: var(--ink-3); }
.sidebar-switch {
  display: block;
  margin-top: 12px;
  font-size: .75rem;
  color: var(--signal);
  cursor: pointer;
}
.sidebar-section { padding: 16px 12px 4px; }
.sidebar-section-label {
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--ink-4);
  padding: 0 8px;
  margin-bottom: 4px;
}
.sidebar-nav { list-style: none; padding: 0 4px; }
.sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  color: var(--ink-2);
  font-size: .85rem;
  font-weight: 500;
  transition: color .15s, background .15s;
}
.sidebar-nav li a:hover {
  color: var(--ink);
  background: rgba(255,255,255,.04);
}
.sidebar-nav li a.active {
  color: var(--ink);
  background: rgba(220,38,38,.1);
}
.sidebar-nav li a .nav-icon {
  width: 18px;
  text-align: center;
  font-size: .85rem;
  color: var(--ink-3);
}
.sidebar-nav li a.active .nav-icon { color: var(--signal); }

.sidebar-footer {
  margin-top: auto;
  padding: 16px;
  border-top: 1px solid var(--border);
}
.sidebar-donate {
  display: flex;
  gap: 8px;
}
.sidebar-donate a {
  flex: 1;
  padding: 6px;
  border-radius: var(--r-sm);
  text-align: center;
  font-size: .75rem;
  font-weight: 600;
}
.btn-donate { background: #f97316; color: #fff; }
.btn-support { background: var(--signal); color: #fff; }

.sidebar-toggle-btn {
  display: none;
  position: fixed;
  top: 16px; left: 16px;
  z-index: 950;
  background: var(--s1);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 8px 12px;
  color: var(--ink);
  cursor: pointer;
  font-size: 1rem;
}

/* ── main ── */
.dashboard-main {
  flex: 1;
  margin-left: 260px;
  padding: 32px;
  min-height: 100vh;
}
.dashboard-greeting h1 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 4px;
}
.dashboard-greeting p {
  color: var(--ink-2);
  font-size: .9rem;
}
.dashboard-period-toggle {
  display: flex;
  gap: 4px;
  margin-left: auto;
  background: var(--s1);
  border-radius: var(--r-sm);
  padding: 4px;
  border: 1px solid var(--border);
}
.dashboard-period-toggle button {
  padding: 6px 16px;
  border-radius: var(--r-xs);
  border: none;
  background: transparent;
  color: var(--ink-3);
  font-size: .8rem;
  font-weight: 500;
  cursor: pointer;
  transition: color .15s, background .15s;
}
.dashboard-period-toggle button.active {
  background: var(--signal);
  color: #fff;
}
.dashboard-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
}

/* ── overview cards ── */
.overview-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.overview-card {
  padding: 20px;
  border-radius: var(--r-md);
  background: var(--s1);
  border: 1px solid var(--border);
}
.overview-card .icon-wrap {
  width: 44px; height: 44px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  font-size: 1.1rem;
}
.overview-card .icon-wrap.red    { background: rgba(220,38,38,.15); color: var(--signal); }
.overview-card .icon-wrap.green  { background: rgba(34,197,94,.15); color: var(--alive); }
.overview-card .icon-wrap.blue   { background: rgba(96,165,250,.15); color: #60a5fa; }
.overview-card .icon-wrap.orange { background: rgba(249,115,22,.15); color: #f97316; }
.overview-card .value {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
}
.overview-card .label {
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-3);
  margin-top: 2px;
}

/* ── metric cards ── */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.metric-card {
  padding: 20px;
  border-radius: var(--r-md);
  background: var(--s1);
  border: 1px solid var(--border);
}
.metric-card .metric-label {
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--ink-3);
  margin-bottom: 4px;
}
.metric-card .metric-value {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
}
.metric-change { font-size: .75rem; margin-top: 4px; }
.metric-change.positive, .positive { color: var(--alive); }
.metric-change.negative, .negative { color: var(--danger); }

/* ── engagement chart ── */
.engagement-card {
  padding: 24px;
  border-radius: var(--r-md);
  background: var(--s1);
  border: 1px solid var(--border);
  margin-bottom: 24px;
}
.engagement-card h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 4px;
}
.engagement-card .big-value {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 700;
}
.engagement-card .change-text {
  font-size: .8rem;
  color: var(--alive);
  margin-bottom: 16px;
}
.chart-container {
  width: 100%;
  height: 200px;
  position: relative;
}
.chart-legend {
  display: flex;
  gap: 16px;
  justify-content: flex-end;
  margin-top: 8px;
  font-size: .75rem;
  color: var(--ink-3);
}
.chart-legend span { display: flex; align-items: center; gap: 6px; }
.chart-legend .dot { width: 8px; height: 8px; border-radius: 50%; }
.chart-legend .dot.messages { background: var(--signal); }
.chart-legend .dot.reactions { background: var(--alive); }
.chart-legend .dot.voice { background: #f97316; }

/* ── channel tables ── */
.tables-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin-bottom: 24px;
}
.table-card {
  padding: 24px;
  border-radius: var(--r-md);
  background: var(--s1);
  border: 1px solid var(--border);
}
.table-card h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 4px;
}
.table-card .table-desc {
  font-size: .8rem;
  color: var(--ink-3);
  margin-bottom: 16px;
}
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left;
  padding: 8px 12px;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-4);
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 10px 12px;
  font-size: .85rem;
  border-bottom: 1px solid var(--border);
  color: var(--ink-2);
}
.data-table tr:last-child td { border-bottom: none; }
.channel-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  border-radius: var(--r-xs);
  font-size: .8rem;
  font-weight: 500;
  background: rgba(220,38,38,.08);
  color: var(--signal-soft);
}

/* ── config cards (new) ── */
.config-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.config-card {
  padding: 20px;
  border-radius: var(--r-md);
  background: var(--s1);
  border: 1px solid var(--border);
}
.config-label {
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--ink-3);
  margin-bottom: 8px;
  font-weight: 600;
}
.config-hint {
  font-size: .8rem;
  color: var(--ink-3);
  margin-top: 4px;
  margin-bottom: 8px;
}
.config-row {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 8px;
}
.config-input {
  padding: 8px 16px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--s0);
  color: var(--ink);
  font-size: .9rem;
  outline: none;
  transition: border-color .2s;
}
.config-input:focus { border-color: var(--signal); }
.config-select {
  padding: 8px 16px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--s0);
  color: var(--ink);
  font-size: .9rem;
  outline: none;
  width: 100%;
  max-width: 300px;
  transition: border-color .2s;
}
.config-select:focus { border-color: var(--signal); }
.config-textarea {
  padding: 12px 16px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--s0);
  color: var(--ink);
  font-size: .9rem;
  outline: none;
  width: 100%;
  min-height: 100px;
  resize: vertical;
  font-family: var(--font-sans);
  transition: border-color .2s;
}
.config-textarea:focus { border-color: var(--signal); }
.config-mono { font-family: var(--font-mono); }
.config-toggles {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}
.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .9rem;
  color: var(--ink-2);
  cursor: pointer;
}
.toggle-row input[type="checkbox"] {
  accent-color: var(--signal);
  width: 18px;
  height: 18px;
}
.empty-state {
  font-size: .85rem;
  color: var(--ink-3);
  padding: 12px 0;
}
.btn-sm {
  padding: 6px 14px;
  font-size: .8rem;
}

/* ── embed builder ── */
.embed-builder-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.embed-preview {
  border-radius: 4px;
  background: #2b2d31;
  border: none;
  display: flex;
  overflow: hidden;
  position: relative;
  max-width: 520px;
}
.embed-preview-bar {
  width: 4px;
  background: var(--signal);
  flex-shrink: 0;
  border-radius: 4px 0 0 4px;
}
.embed-preview-body {
  padding: 8px 16px 16px 12px;
  flex: 1;
  min-width: 0;
}
.eb-p-author {
  font-size: .8rem;
  color: #dbdee1;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  font-weight: 500;
}
.eb-p-title {
  font-weight: 700;
  font-size: 1rem;
  color: #00a8fc;
  margin-bottom: 8px;
}
.eb-p-desc {
  font-size: .875rem;
  color: #dbdee1;
  line-height: 1.125rem;
  white-space: pre-wrap;
}
.eb-p-fields {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 8px;
}
.eb-p-field {
  grid-column: 1 / -1;
}
.eb-p-field.inline { grid-column: auto; }
.eb-p-field-name {
  font-size: .75rem;
  font-weight: 700;
  color: #f2f3f5;
  margin-bottom: 2px;
}
.eb-p-field-value {
  font-size: .875rem;
  color: #dbdee1;
  line-height: 1.125rem;
}
.eb-p-image img {
  max-width: 100%;
  border-radius: 4px;
  margin-top: 16px;
}
.eb-p-footer {
  font-size: .75rem;
  color: #b5bac1;
  margin-top: 8px;
  display: flex;
  align-items: center;
}
.eb-p-thumb {
  position: absolute;
  top: 8px;
  right: 16px;
}
.eb-p-thumb img {
  width: 80px;
  height: 80px;
  border-radius: 4px;
  object-fit: cover;
}
.eb-p-buttons {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.eb-btn-preview {
  padding: 2px 16px;
  border-radius: 3px;
  border: none;
  color: #fff;
  font-size: .875rem;
  font-weight: 500;
  cursor: default;
  height: 32px;
  min-width: 60px;
  line-height: 16px;
}
.eb-field-entry {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  margin-bottom: 8px;
  background: var(--s0);
}
.color-picker {
  width: 48px; height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  background: var(--s0);
  cursor: pointer;
}
.embed-preview-content {
  padding: 16px;
  font-size: .85rem;
  color: var(--ink-2);
  border-left: 3px solid var(--signal);
}

/* ── responsive ── */
@media (max-width: 1024px) {
  .overview-cards { grid-template-columns: repeat(2, 1fr); }
  .metrics-row { grid-template-columns: repeat(2, 1fr); }
  .tables-row { grid-template-columns: 1fr; }
  .embed-builder-layout { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform .3s var(--ease-out);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-toggle-btn { display: block; }
  .dashboard-main { margin-left: 0; }
  .overview-cards { grid-template-columns: 1fr; }
  .metrics-row { grid-template-columns: 1fr; }
  .dashboard-top-bar { flex-direction: column; gap: 12px; align-items: flex-start; }
}