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

/* ── Design tokens ──────────────────────────────────────── */
:root {
  --hp-primary:        #5865f2;
  --hp-primary-hover:  #4752c4;

  --hp-bg:             #f5f6fa;
  --hp-surface:        #ffffff;
  --hp-surface-2:      #f0f2f7;
  --hp-border:         rgba(0, 0, 0, 0.08);
  --hp-border-strong:  rgba(0, 0, 0, 0.14);

  --hp-text:           #11131a;
  --hp-text-2:         #5a6072;
  --hp-text-3:         #9aa0b0;

  --hp-success:        #57f287;
  --hp-success-bg:     rgba(87, 242, 135, 0.12);
  --hp-success-text:   #1a7a40;

  --hp-danger:         #ed4245;
  --hp-danger-bg:      rgba(237, 66, 69, 0.10);
  --hp-danger-text:    #b71c1e;

  --hp-warning:        #faa81a;
  --hp-warning-bg:     rgba(250, 168, 26, 0.10);
  --hp-warning-text:   #8a5a00;

  --hp-info:           #5865f2;
  --hp-info-bg:        rgba(88, 101, 242, 0.10);
  --hp-info-text:      #2a35b0;

  --hp-muted-bg:       rgba(90, 96, 114, 0.08);
  --hp-muted-text:     #5a6072;

  --hp-radius-sm:      6px;
  --hp-radius-md:      10px;
  --hp-radius-lg:      14px;
  --hp-radius-pill:    99px;

  --hp-font:           'Inter', system-ui, sans-serif;
  --hp-font-mono:      'Menlo', 'Consolas', monospace;

  --hp-sidebar-w:      210px;
}

/* dark-mode overrides */
@media (prefers-color-scheme: dark) {
  :root {
    --hp-bg:            #0f1117;
    --hp-surface:       #1b2130;
    --hp-surface-2:     #141820;
    --hp-border:        rgba(255, 255, 255, 0.07);
    --hp-border-strong: rgba(255, 255, 255, 0.13);

    --hp-text:          #f0f2f9;
    --hp-text-2:        #8d97ae;
    --hp-text-3:        #4e5669;

    --hp-success-text:  #57f287;
    --hp-danger-text:   #ed4245;
    --hp-warning-text:  #faa81a;
    --hp-info-text:     #7b89f5;
    --hp-muted-text:    #8d97ae;
  }
}

/* ── Outer wrapper ──────────────────────────────────────── */
.hp-wrap {
  display: grid;
  grid-template-columns: var(--hp-sidebar-w) 1fr;
  gap: 20px;
  padding: 20px;
  min-height: 100%;
  background: var(--hp-bg);
  font-family: var(--hp-font);
  font-size: 14px;
  color: var(--hp-text);
}

/* ── Sidebar ────────────────────────────────────────────── */
.hp-sidebar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: sticky;
  top: 20px;
  height: fit-content;
}

.hp-server-card {
  background: var(--hp-surface);
  border: 0.5px solid var(--hp-border);
  border-radius: var(--hp-radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.hp-avatar {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--hp-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: 500;
  color: #fff;
  flex-shrink: 0;
}

.hp-server-name {
  font-size: 13px;
  font-weight: 500;
}

.hp-badge {
  font-size: 11px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: var(--hp-radius-pill);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.hp-badge.on  { background: var(--hp-success-bg);  color: var(--hp-success-text); }
.hp-badge.off { background: var(--hp-danger-bg);   color: var(--hp-danger-text);  }

/* nav card */
.hp-nav-card {
  background: var(--hp-surface);
  border: 0.5px solid var(--hp-border);
  border-radius: var(--hp-radius-lg);
  overflow: hidden;
}

.hp-nav-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--hp-text-3);
  text-transform: uppercase;
  letter-spacing: .07em;
  padding: 12px 12px 4px;
}

.hp-nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  color: var(--hp-text-2);
  border: none;
  background: none;
  font-family: var(--hp-font);
  font-size: 13px;
  width: 100%;
  text-align: left;
  transition: background .12s, color .12s;
}
.hp-nav-item:hover        { background: var(--hp-surface-2); color: var(--hp-text); }
.hp-nav-item.active       { background: var(--hp-surface-2); color: var(--hp-text); font-weight: 500; }
.hp-nav-item i            { font-size: 15px; width: 16px; flex-shrink: 0; }

.hp-nav-divider {
  height: 0.5px;
  background: var(--hp-border);
  margin: 4px 0;
}

/* ── Main content ───────────────────────────────────────── */
.hp-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

/* ── Section header ─────────────────────────────────────── */
.hp-section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.hp-section-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.hp-section-icon i { font-size: 15px; }
.hp-section-icon.blue   { background: var(--hp-info-bg);    color: var(--hp-info-text);    }
.hp-section-icon.green  { background: var(--hp-success-bg); color: var(--hp-success-text); }
.hp-section-icon.amber  { background: var(--hp-warning-bg); color: var(--hp-warning-text); }
.hp-section-icon.red    { background: var(--hp-danger-bg);  color: var(--hp-danger-text);  }
.hp-section-icon.purple { background: rgba(99,89,233,.10);  color: #6359e9;                }
.hp-section-icon.teal   { background: rgba(29,158,117,.10); color: #1d9e75;                }

.hp-section-title { font-size: 14px; font-weight: 500; }
.hp-section-desc  { font-size: 12px; color: var(--hp-text-2); margin-top: 1px; }
.hp-section-line  { flex: 1; height: 0.5px; background: var(--hp-border); }

/* ── Card ───────────────────────────────────────────────── */
.hp-card {
  background: var(--hp-surface);
  border: 0.5px solid var(--hp-border);
  border-radius: var(--hp-radius-lg);
  overflow: hidden;
}

.hp-card + .hp-card { margin-top: 8px; }

/* card sub-header */
.hp-subheader {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--hp-surface-2);
  border-bottom: 0.5px solid var(--hp-border);
}
.hp-subheader i                { font-size: 14px; color: var(--hp-text-2); }
.hp-subheader-title            { font-size: 11px; font-weight: 600; color: var(--hp-text-2); text-transform: uppercase; letter-spacing: .05em; }
.hp-subheader-note             { margin-left: auto; font-size: 11px; color: var(--hp-text-3); }

/* border-top variant */
.hp-subheader.border-top { border-top: 0.5px solid var(--hp-border); }

/* ── Stats grid ─────────────────────────────────────────── */
.hp-stats-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  padding: 14px;
}

.hp-stat {
  border-radius: var(--hp-radius-md);
  padding: 12px 10px;
  border: 0.5px solid var(--hp-border);
  background: var(--hp-surface-2);
}
.hp-stat-val { font-size: 22px; font-weight: 500; line-height: 1.2; }
.hp-stat-lbl { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--hp-text-3); margin-top: 2px; }

.hp-stat.banned  .hp-stat-val { color: var(--hp-danger-text);  }
.hp-stat.kicked  .hp-stat-val { color: var(--hp-warning-text); }
.hp-stat.muted   .hp-stat-val { color: var(--hp-info-text);    }
.hp-stat.logged  .hp-stat-val { color: var(--hp-text-3);       }

/* ── Toggle rows ────────────────────────────────────────── */
.hp-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  gap: 20px;
  border-bottom: 0.5px solid var(--hp-border);
}
.hp-toggle-row:last-child { border-bottom: none; }

.hp-tinfo > span  { font-size: 13px; font-weight: 500; display: block; }
.hp-tinfo > small { font-size: 12px; color: var(--hp-text-2); margin-top: 2px; display: block; }

/* toggle switch */
.hp-switch           { position: relative; width: 36px; height: 20px; flex-shrink: 0; }
.hp-switch input     { opacity: 0; width: 0; height: 0; }
.hp-track            { position: absolute; inset: 0; background: var(--hp-border-strong); border-radius: var(--hp-radius-pill); cursor: pointer; transition: background .18s; }
.hp-track::before    { content: ""; position: absolute; width: 14px; height: 14px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform .18s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.hp-switch input:checked + .hp-track                { background: var(--hp-primary); }
.hp-switch input:checked + .hp-track::before        { transform: translateX(16px); }

/* ── Threshold pills ────────────────────────────────────── */
.hp-threshold-row {
  display: flex;
  gap: 6px;
  padding: 10px 14px;
  background: var(--hp-surface-2);
  border-bottom: 0.5px solid var(--hp-border);
  align-items: center;
  flex-wrap: wrap;
}
.hp-threshold-label { font-size: 11px; color: var(--hp-text-3); margin-right: 2px; }

.hp-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: var(--hp-radius-pill);
  border: 0.5px solid transparent;
}
.hp-pill i { font-size: 11px; }
.hp-pill.log  { background: var(--hp-muted-bg);   color: var(--hp-muted-text);   border-color: var(--hp-border); }
.hp-pill.mute { background: var(--hp-info-bg);    color: var(--hp-info-text);    }
.hp-pill.kick { background: var(--hp-warning-bg); color: var(--hp-warning-text); }
.hp-pill.ban  { background: var(--hp-danger-bg);  color: var(--hp-danger-text);  }

/* ── Form fields ────────────────────────────────────────── */
.hp-fields {
  padding: 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.hp-fields.single { grid-template-columns: 1fr; }

.hp-field            { display: flex; flex-direction: column; gap: 4px; }
.hp-field.full       { grid-column: 1 / -1; }
.hp-field-label      { font-size: 11px; font-weight: 600; color: var(--hp-text-2); text-transform: uppercase; letter-spacing: .05em; }

.hp-field input,
.hp-field select,
.hp-field textarea {
  font-family: var(--hp-font);
  font-size: 13px;
  padding: 8px 10px;
  border-radius: var(--hp-radius-md);
  background: var(--hp-surface-2);
  border: 0.5px solid var(--hp-border-strong);
  color: var(--hp-text);
  outline: none;
  width: 100%;
  transition: border-color .15s;
}
.hp-field input:focus,
.hp-field select:focus,
.hp-field textarea:focus { border-color: var(--hp-primary); }

.hp-field textarea {
  font-family: var(--hp-font-mono);
  font-size: 12px;
  resize: vertical;
  line-height: 1.6;
}
.hp-field small { font-size: 11px; color: var(--hp-text-3); line-height: 1.5; }

/* ── Two-column chip grid ───────────────────────────────── */
.hp-two-col { display: grid; grid-template-columns: 1fr 1fr; }

.hp-chip-panel {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.hp-chip-panel + .hp-chip-panel { border-left: 0.5px solid var(--hp-border); }

.hp-chip-panel-title { font-size: 12px; font-weight: 500; color: var(--hp-text); }
.hp-chip-panel-desc  { font-size: 11px; color: var(--hp-text-2); margin-top: 1px; }

.hp-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 32px;
  padding: 6px 8px;
  background: var(--hp-surface-2);
  border-radius: var(--hp-radius-md);
  border: 0.5px solid var(--hp-border);
}

.hp-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: var(--hp-radius-pill);
  background: var(--hp-surface);
  border: 0.5px solid var(--hp-border-strong);
  font-size: 11px;
  font-family: var(--hp-font-mono);
  color: var(--hp-text);
}
.hp-chip button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--hp-text-3);
  font-size: 14px;
  line-height: 1;
  padding: 0;
  font-family: var(--hp-font);
}
.hp-chip button:hover { color: var(--hp-danger-text); }

.hp-add-row             { display: flex; gap: 6px; }
.hp-add-row input {
  flex: 1;
  font-family: var(--hp-font-mono);
  font-size: 12px;
  padding: 6px 8px;
  border-radius: var(--hp-radius-md);
  background: var(--hp-surface-2);
  border: 0.5px solid var(--hp-border);
  color: var(--hp-text);
  outline: none;
  transition: border-color .15s;
}
.hp-add-row input:focus { border-color: var(--hp-primary); }
.hp-add-row button {
  font-family: var(--hp-font);
  padding: 5px 10px;
  font-size: 12px;
  border-radius: var(--hp-radius-md);
  background: var(--hp-surface-2);
  border: 0.5px solid var(--hp-border-strong);
  color: var(--hp-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: background .12s;
}
.hp-add-row button:hover { background: var(--hp-border); }

/* two-col top border variant */
.hp-two-col.border-top { border-top: 0.5px solid var(--hp-border); }

/* ── Save bar ───────────────────────────────────────────── */
.hp-save-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px 24px;
  background: #1e1f22;
  border-top: 1px solid rgba(255,255,255,0.08);
  transform: translateY(100%);
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 -4px 24px rgba(0,0,0,0.35);
}
.hp-save-bar.visible { transform: translateY(0); }
.hp-save-bar-msg {
  font-size: 14px;
  color: rgba(255,255,255,0.75);
  flex: 1;
  max-width: 520px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.hp-save-bar-msg i { font-size: 16px; color: #f0b232; }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 900px) {
  .hp-wrap { grid-template-columns: 1fr; }
  .hp-sidebar { position: static; }
  .hp-stats-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 600px) {
  .hp-wrap { padding: 12px; gap: 12px; }
  .hp-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .hp-fields { grid-template-columns: 1fr; }
  .hp-two-col { grid-template-columns: 1fr; }
  .hp-chip-panel + .hp-chip-panel { border-left: none; border-top: 0.5px solid var(--hp-border); }
}

/* ── Hidden textarea (holds newline-separated chip values) ── */
.hp-hidden-ta {
  display: none;
}

/* ── Avatar image (when guild has an icon) ──────────────── */
.hp-avatar-img {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  object-fit: cover;
}

/* ── Discard link styled as a button ────────────────────── */
.hp-btn-discard {
  display: inline-flex;
  align-items: center;
  padding: 9px 18px;
  font-family: var(--hp-font);
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--hp-radius-md);
  border: 0.5px solid var(--hp-border-strong);
  background: var(--hp-surface-2);
  color: var(--hp-text-2);
  text-decoration: none;
  transition: background .12s, color .12s;
}
.hp-btn-discard:hover { background: var(--hp-border); color: var(--hp-text); }

/* ============================================================
   Dashboard — server list page
   ============================================================ */

.hp-dash-header {
  margin-bottom: 24px;
}

.hp-dash-title {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -.02em;
  color: var(--hp-text);
  margin-bottom: 6px;
}

.hp-dash-sub {
  font-size: 14px;
  color: var(--hp-text-2);
}

/* ── Guild grid ─────────────────────────────────────────── */
.hp-guild-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}

/* ── Guild card ─────────────────────────────────────────── */
.hp-guild-card {
  background: var(--hp-surface);
  border: 0.5px solid var(--hp-border);
  border-radius: var(--hp-radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-decoration: none;
  color: inherit;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}

.hp-guild-card:not(.hp-guild-card--disabled):hover {
  border-color: var(--hp-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(88, 101, 242, 0.12);
}

.hp-guild-card--disabled {
  opacity: 0.75;
  cursor: default;
}

/* ── Card top row ───────────────────────────────────────── */
.hp-guild-top {
  display: flex;
  align-items: center;
  gap: 14px;
}

.hp-guild-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  object-fit: cover;
  flex-shrink: 0;
}

.hp-guild-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--hp-primary);
  color: #fff;
  font-size: 16px;
  font-weight: 500;
}

.hp-guild-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.hp-guild-name {
  font-size: 15px;
  font-weight: 500;
  color: var(--hp-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Mini stats row (only shown when bot is in server) ─── */
.hp-guild-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 10px;
  background: var(--hp-surface-2);
  border-radius: var(--hp-radius-md);
  border: 0.5px solid var(--hp-border);
}

.hp-guild-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

.hp-guild-stat-val {
  font-size: 15px;
  font-weight: 500;
  color: var(--hp-text);
}

.hp-guild-stat-lbl {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--hp-text-3);
}

.hp-guild-stat.banned .hp-guild-stat-val { color: var(--hp-danger-text);  }
.hp-guild-stat.kicked .hp-guild-stat-val { color: var(--hp-warning-text); }
.hp-guild-stat.muted  .hp-guild-stat-val { color: var(--hp-info-text);    }

/* ── Card footer ────────────────────────────────────────── */
.hp-guild-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 0.5px solid var(--hp-border);
  display: flex;
  align-items: center;
}

.hp-guild-cta {
  font-size: 13px;
  font-weight: 500;
  color: var(--hp-primary);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.hp-guild-cta i { font-size: 14px; transition: transform .15s; }
.hp-guild-card:hover .hp-guild-cta i { transform: translateX(3px); }

.hp-guild-invite {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--hp-radius-md);
  background: var(--hp-surface-2);
  border: 0.5px solid var(--hp-border-strong);
  color: var(--hp-text);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: background .12s, border-color .12s;
}

.hp-guild-invite:hover {
  background: var(--hp-info-bg);
  border-color: var(--hp-primary);
  color: var(--hp-info-text);
}

/* ── Empty state ────────────────────────────────────────── */
.hp-empty {
  background: var(--hp-surface);
  border: 0.5px dashed var(--hp-border-strong);
  border-radius: var(--hp-radius-lg);
  padding: 56px 24px;
  text-align: center;
  margin-top: 8px;
}

.hp-empty-icon {
  font-size: 36px;
  color: var(--hp-text-3);
  margin-bottom: 12px;
}

.hp-empty-title {
  font-size: 18px;
  font-weight: 500;
  color: var(--hp-text);
  margin-bottom: 8px;
}

.hp-empty-desc {
  font-size: 14px;
  color: var(--hp-text-2);
  max-width: 400px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 600px) {
  .hp-guild-grid { grid-template-columns: 1fr; }
}