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

:root {
  --bg:        #1e1f22;
  --bg-card:   #2b2d31;
  --bg-input:  #1e1f22;
  --border:    #3f4147;
  --text:      #dbdee1;
  --text-muted:#949ba4;
  --primary:   #5865f2;
  --primary-h: #4752c4;
  --ok:        #23a55a;
  --warn:      #f0b232;
  --error:     #da373c;
  --radius:    8px;
  --shadow:    0 2px 10px rgba(0,0,0,.4);
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

code {
  font-family: "Fira Mono", "Consolas", monospace;
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85em;
}

/* ── Navbar ── */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  height: 56px;
  background: #111214;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}

.nav-links { display: flex; gap: 1.5rem; }
.nav-links a { color: var(--text-muted); font-size: 0.9rem; }
.nav-links a:hover { color: var(--text); text-decoration: none; }

/* ── Layout ── */
main { padding: 2rem 1rem; }

.container { max-width: 960px; margin: 0 auto; }

.page-header { margin-bottom: 1.5rem; }
.page-header h1 { font-size: 1.6rem; margin-bottom: .25rem; }

.back-link {
  display: inline-block;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: .5rem;
}
.back-link:hover { color: var(--text); text-decoration: none; }

.subtitle { color: var(--text-muted); font-size: 0.9rem; }

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

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

/* ── Card ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.card h2 { font-size: 1rem; margin-bottom: 1rem; color: var(--text); }

.mt-1 { margin-top: 1rem; }

/* ── Login ── */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  width: 100%;
  max-width: 380px;
  text-align: center;
}

.login-card h1 { font-size: 1.5rem; margin-bottom: .25rem; }

/* ── Forms ── */
.form-group { margin-bottom: 1rem; text-align: left; }

label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  margin-bottom: .4rem;
}

input[type="text"],
input[type="password"] {
  width: 100%;
  padding: .55rem .75rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  transition: border-color .15s;
}

input:focus { border-color: var(--primary); }

.field-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: .4rem;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .55rem 1.2rem;
  border: none;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-h); }
.btn-full { width: 100%; justify-content: center; }

/* ── Alerts ── */
.alert {
  padding: .75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.alert-error   { background: rgba(218,55,60,.15);  border: 1px solid var(--error);  color: #f5a3a5; }
.alert-success { background: rgba(35,165,90,.15);  border: 1px solid var(--ok);     color: #7fdb9e; }

/* ── Badges ── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 600;
}

.badge-ok   { background: rgba(35,165,90,.2);  color: #7fdb9e; }
.badge-warn { background: rgba(240,178,50,.2); color: #f7d57a; }

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

.guild-card {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  cursor: pointer;
  transition: border-color .15s, transform .1s;
  text-decoration: none;
  color: var(--text);
}

.guild-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  text-decoration: none;
}

.guild-icon { font-size: 2rem; flex-shrink: 0; }
.guild-info h2 { font-size: 1rem; margin-bottom: .2rem; }
.guild-id { font-size: 0.75rem; color: var(--text-muted); margin-bottom: .5rem; font-family: monospace; }
.guild-status { display: flex; flex-wrap: wrap; gap: .3rem; }

/* ── Status List ── */
.status-list { list-style: none; display: flex; flex-direction: column; gap: .75rem; }
.status-list li { display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }
.status-label { font-size: 0.85rem; color: var(--text-muted); }

/* ── Table ── */
.table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.table th {
  text-align: left;
  padding: .5rem .75rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.table td {
  padding: .6rem .75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: rgba(255,255,255,.02); }

.mono  { font-family: monospace; }
.small { font-size: 0.8rem; color: var(--text-muted); }

/* ── Misc ── */
.hint {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  line-height: 1.5;
}

.empty-state, .empty {
  color: var(--text-muted);
  text-align: center;
  padding: 1rem 0;
}

/* ── Stats ── */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
.text-center { text-align: center; }
.stat-number {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 0.25rem;
}
.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.btn-secondary {
  background: var(--card-bg);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  text-decoration: none;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-block;
}
.btn-secondary:hover { background: var(--border); }

.badge-err { background: rgba(220,50,50,.15); color: #e05555; }

.btn-danger {
  background: rgba(220,50,50,.85);
  color: #fff;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-block;
  text-decoration: none;
}
.btn-danger:hover { background: rgba(200,30,30,.9); }

.btn-action {
  border: none;
  border-radius: 4px;
  padding: 0.25rem 0.5rem;
  font-size: 0.78rem;
  cursor: pointer;
  white-space: nowrap;
}
.btn-action-ok   { background: rgba(50,200,100,.2); color: #4caf82; }
.btn-action-warn { background: rgba(220,160,0,.2);  color: #c89b00; }
.btn-action-err  { background: rgba(220,50,50,.2);  color: #e05555; }
.btn-action-ok:hover   { background: rgba(50,200,100,.35); }
.btn-action-warn:hover { background: rgba(220,160,0,.35); }
.btn-action-err:hover  { background: rgba(220,50,50,.35); }

.btn-discord {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #5865F2;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  margin-top: 1.5rem;
  transition: background 0.15s;
}
.btn-discord:hover { background: #4752c4; }

.role-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.2rem 0.5rem;
  cursor: pointer;
  font-size: 1rem;
  color: var(--text-muted);
  transition: all 0.15s;
}
.role-toggle.active {
  border-color: #4caf82;
  background: rgba(50,200,100,.1);
}
.role-toggle:hover { background: rgba(255,255,255,.05); }
.role-toggle:disabled { opacity: 0.5; cursor: not-allowed; }
