/* ─────────────────────────────────────────────────────────────────────────────
   Guild Roster — Modern Dark UI
   Font: Inter (Google Fonts)
   Palette: Deep navy + teal-green accent + soft violet secondary
───────────────────────────────────────────────────────────────────────────── */

/* ── Reset & base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Backgrounds */
  --bg-base:     #0c0f1a;
  --bg-surface:  #111827;
  --bg-elevated: #1a2035;
  --bg-hover:    #1e2740;
  --bg-input:    #151d2e;

  /* Borders */
  --border:      #1e2d45;
  --border-focus:#00c9a7;

  /* Text */
  --text-primary:  #e2e8f0;
  --text-secondary:#94a3b8;
  --text-muted:    #4a5568;
  --text-inverse:  #0c0f1a;

  /* Accent — teal green */
  --accent:       #00c9a7;
  --accent-dim:   #00a387;
  --accent-glow:  rgba(0,201,167,.15);
  --accent-bg:    rgba(0,201,167,.08);

  /* Secondary — violet */
  --violet:       #7c6af7;
  --violet-dim:   #6655d9;
  --violet-bg:    rgba(124,106,247,.1);

  /* Status */
  --status-active:   #10b981;
  --status-inactive: #64748b;
  --status-pug:      #3b82f6;
  --status-pending:  #f59e0b;
  --status-failed:   #ef4444;
  --status-complete: #10b981;
  --status-processing:#7c6af7;

  /* Guild tags */
  --guild-haya:  #fbbf24;
  --guild-ww:    #22d3ee;
  --guild-jdge:  #4ade80;
  --guild-mimo:  #fb923c;
  --guild-qwak:  #60a5fa;
  --guild-pug:   #94a3b8;

  /* Misc */
  --radius-sm:  6px;
  --radius:     10px;
  --radius-lg:  16px;
  --radius-full:9999px;
  --shadow-sm:  0 1px 3px rgba(0,0,0,.4);
  --shadow:     0 4px 16px rgba(0,0,0,.5);
  --shadow-lg:  0 8px 32px rgba(0,0,0,.6);
  --transition: 150ms ease;
}

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.link { color: var(--accent); font-size: .875rem; }
.link:hover { text-decoration: underline; }

.hidden { display: none !important; }
.sr-only { position: absolute; width:1px; height:1px; clip:rect(0,0,0,0); overflow:hidden; }
.mono { font-family: 'Courier New', monospace; font-size: .8rem; }

/* ── Header ────────────────────────────────────────────────────────────────── */
.app-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.header-inner {
  max-width: 1600px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: .75rem 2.5rem;
  gap: 1rem;
}

.header-brand {
  display: flex; align-items: center; gap: .6rem;
  flex-shrink: 0;
}

.brand-icon {
  width: 24px; height: 24px;
  color: var(--accent);
}

.brand-name {
  font-weight: 700; font-size: 1.05rem;
  color: var(--text-primary);
  letter-spacing: -.01em;
}

.admin-badge {
  font-size: .65rem; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase;
  background: var(--violet-bg);
  color: var(--violet);
  border: 1px solid var(--violet);
  padding: .1rem .45rem;
  border-radius: var(--radius-full);
}

.header-nav {
  display: flex; align-items: center; gap: .25rem; flex-wrap: wrap;
}

.nav-link {
  color: var(--text-secondary);
  padding: .35rem .7rem;
  border-radius: var(--radius-sm);
  font-size: .875rem; font-weight: 500;
  transition: color var(--transition), background var(--transition);
}
.nav-link:hover, .nav-link.active {
  color: var(--text-primary);
  background: var(--bg-hover);
  text-decoration: none;
}
.nav-link.active { color: var(--accent); }

.nav-divider {
  width: 1px; height: 20px;
  background: var(--border);
  margin: 0 .25rem;
}

.nav-user {
  font-size: .8rem; color: var(--text-muted);
  padding: 0 .25rem;
}

/* ── Main layout ───────────────────────────────────────────────────────────── */
.app-main {
  max-width: 1600px; margin: 0 auto;
  padding: 1.5rem;
}

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  font-family: inherit; font-size: .875rem; font-weight: 500;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: .5rem 1rem;
  cursor: pointer; white-space: nowrap;
  transition: background var(--transition), border-color var(--transition),
              box-shadow var(--transition), color var(--transition);
  text-decoration: none;
}

.btn-icon { width: 15px; height: 15px; flex-shrink: 0; }

.btn-sm { font-size: .8rem; padding: .3rem .7rem; }

.btn-primary {
  background: var(--accent); color: var(--text-inverse);
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-dim); border-color: var(--accent-dim); }

.btn-accent {
  background: var(--accent-bg); color: var(--accent);
  border-color: var(--accent);
}
.btn-accent:hover { background: var(--accent); color: var(--text-inverse); }

.btn-outline {
  background: transparent; color: var(--text-secondary);
  border-color: var(--border);
}
.btn-outline:hover { border-color: var(--text-secondary); color: var(--text-primary); background: var(--bg-hover); }

.btn-ghost {
  background: transparent; color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-danger {
  background: transparent; color: #ef4444;
  border-color: rgba(239,68,68,.3);
}
.btn-danger:hover { background: rgba(239,68,68,.1); border-color: #ef4444; }

.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Forms ─────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-size: .8rem; font-weight: 500; color: var(--text-secondary); margin-bottom: .35rem; }
.form-hint  { font-size: .75rem; color: var(--text-muted); margin-top: .3rem; }

.form-input {
  display: block; width: 100%;
  background: var(--bg-input); color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .55rem .8rem;
  font-size: .875rem; font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-input--narrow { max-width: 160px; }

.form-select-sm {
  background: var(--bg-input); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: .3rem .6rem; font-size: .8rem; font-family: inherit;
  cursor: pointer; outline: none;
}
.form-select-sm:focus { border-color: var(--border-focus); }

.form-check {
  display: flex; align-items: center; gap: .5rem;
  font-size: .875rem; color: var(--text-secondary);
  margin-bottom: .5rem;
}

.form-checkbox {
  width: 16px; height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.form-actions { margin-top: 1.5rem; }

/* ── Alerts ────────────────────────────────────────────────────────────────── */
.alert {
  padding: .7rem 1rem; border-radius: var(--radius-sm);
  font-size: .875rem; margin-bottom: 1rem;
  border: 1px solid transparent;
}
.alert-success { background: rgba(16,185,129,.1); color: #34d399; border-color: rgba(16,185,129,.3); }
.alert-error   { background: rgba(239,68,68,.1);  color: #f87171; border-color: rgba(239,68,68,.3);  }

/* ── Auth page ─────────────────────────────────────────────────────────────── */
.auth-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
  background: radial-gradient(ellipse at top, #0e1d33 0%, var(--bg-base) 70%);
}

.auth-container { width: 100%; max-width: 420px; padding: 1.5rem; }

.auth-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem 2rem 2.5rem;
  box-shadow: var(--shadow-lg);
}

.auth-logo {
  display: flex; justify-content: center; margin-bottom: 1rem;
}
.auth-logo svg { width: 48px; height: 48px; color: var(--accent); }

.auth-title {
  text-align: center; font-size: 1.5rem; font-weight: 700;
  color: var(--text-primary); margin-bottom: .25rem;
}

.auth-subtitle {
  text-align: center; font-size: .8rem; color: var(--text-muted);
  letter-spacing: .05em; margin-bottom: 1.5rem;
}

.auth-tabs {
  display: flex; border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.auth-tab {
  flex: 1; background: none; border: none; color: var(--text-secondary);
  padding: .6rem; font-size: .875rem; font-weight: 500; font-family: inherit;
  cursor: pointer; border-bottom: 2px solid transparent;
  transition: color var(--transition), border-color var(--transition);
  margin-bottom: -1px;
}
.auth-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.auth-tab:hover:not(.active) { color: var(--text-primary); }

.auth-form { /* nothing extra */ }

.auth-note {
  font-size: .75rem; color: var(--text-muted);
  margin-bottom: .75rem;
}

/* Password requirements */
.pw-requirements {
  display: flex; flex-wrap: wrap; gap: .35rem;
  margin-top: .5rem;
}
.req {
  font-size: .7rem; padding: .15rem .45rem;
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  color: var(--text-muted);
  border: 1px solid var(--border);
  transition: all var(--transition);
}
.req.met { background: rgba(16,185,129,.1); color: #34d399; border-color: rgba(16,185,129,.4); }

/* ── Roster page ───────────────────────────────────────────────────────────── */
.roster-page { }

/* Controls bar */
.controls-bar {
  display: flex; align-items: center; gap: .75rem;
  flex-wrap: wrap; margin-bottom: .75rem;
}

.controls-left  { display: flex; align-items: center; gap: .5rem; flex: 1; flex-wrap: wrap; }
.controls-right { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }

/* Search */
.search-wrap {
  position: relative; display: flex; align-items: center;
  flex: 1; min-width: 200px; max-width: 480px;
}

.search-icon {
  position: absolute; left: .6rem;
  width: 16px; height: 16px; color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  background: var(--bg-input); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: .45rem .7rem .45rem 2.2rem;
  font-size: .875rem; font-family: inherit; outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.search-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-clear {
  position: absolute; right: .5rem;
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; padding: .2rem;
  display: flex; align-items: center; justify-content: center;
}
.search-clear svg { width: 14px; height: 14px; }
.search-clear:hover { color: var(--text-primary); }

.toggle-label {
  display: flex; align-items: center; gap: .35rem;
  font-size: .8rem; color: var(--text-secondary);
  cursor: pointer; user-select: none; white-space: nowrap;
}

/* Last parsed bar */
.last-parsed-bar {
  font-size: .75rem; color: var(--text-muted);
  margin-bottom: .75rem;
}
.last-parsed-bar strong { color: var(--text-secondary); }

/* Tab bar */
.tab-bar {
  display: flex; align-items: center; gap: .25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}

.tab {
  background: none; border: none; font-family: inherit;
  font-size: .875rem; font-weight: 500; color: var(--text-secondary);
  padding: .55rem .9rem;
  cursor: pointer; border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--transition), border-color var(--transition);
}
.tab:hover:not(.active) { color: var(--text-primary); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.tab-count {
  margin-left: auto; font-size: .75rem; color: var(--text-muted);
  padding-bottom: .5rem;
}

/* ── Roster table ──────────────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-surface);
}

.roster-table {
  width: 100%; border-collapse: collapse;
  font-size: .835rem;
}

.roster-table thead {
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}

.roster-table th {
  padding: .65rem .9rem;
  text-align: left; font-weight: 600;
  font-size: .75rem; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-muted); white-space: nowrap;
}

.roster-table th.sortable { cursor: pointer; user-select: none; }
.roster-table th.sortable:hover { color: var(--text-secondary); }
.roster-table th.active-sort { color: var(--accent); }

.sort-arrow { display: inline-block; margin-left: .25rem; opacity: .4; font-size: .7rem; }
.active-sort .sort-arrow { opacity: 1; }
.asc  .sort-arrow::after { content: '↑'; }
.desc .sort-arrow::after { content: '↓'; }

.roster-table td {
  padding: .6rem .9rem;
  border-top: 1px solid var(--border);
  vertical-align: middle;
}

.roster-table tbody tr {
  transition: background var(--transition);
}
.roster-table tbody tr:hover {
  background: var(--bg-hover);
}

.loading-row td, .empty-row td {
  text-align: center; color: var(--text-muted);
  padding: 3rem; font-size: .875rem;
}

/* Column widths */
.col-pic     { width: 48px; }
.col-account { min-width: 160px; }
.col-raids   { width: 80px; }
.col-last    { width: 110px; }
.col-guilds  { min-width: 100px; }
.col-classes { min-width: 140px; }
.col-status  { width: 90px; }
.col-discord { min-width: 100px; }
.col-notes   { min-width: 160px; }

/* Profile picture */
.profile-pic {
  width: 36px; height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  transition: border-color var(--transition), box-shadow var(--transition);
  cursor: pointer;
  display: block;
}
.profile-pic:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.profile-emoji {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  transition: border-color var(--transition);
}

/* Avatar wrapper with upload overlay */
.avatar-wrap {
  position: relative;
  width: 36px; height: 36px;
  display: inline-block;
}
.avatar-upload-btn {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem;
  opacity: 0;
  cursor: pointer;
  transition: opacity var(--transition);
}
.avatar-wrap:hover .avatar-upload-btn { opacity: 1; }
.avatar-delete-btn {
  position: absolute;
  top: -4px; right: -4px;
  width: 15px; height: 15px;
  border-radius: 50%;
  background: var(--danger, #e53e3e);
  color: #fff;
  border: none;
  font-size: .55rem;
  line-height: 1;
  cursor: pointer;
  display: none;
  align-items: center; justify-content: center;
  padding: 0;
}
.avatar-wrap:hover .avatar-delete-btn { display: flex; }

/* Account name */
.account-name { font-weight: 500; color: var(--text-primary); font-size: .835rem; }
.account-sub  { font-size: .7rem; color: var(--text-muted); margin-top: .1rem; }

/* Raid count */
.raids-count { font-weight: 600; color: var(--text-primary); }
.raids-sub   { font-size: .7rem; color: var(--text-muted); }

/* Guild badges */
.guild-badges { display: flex; flex-wrap: wrap; gap: .3rem; }

.guild-badge {
  font-size: .68rem; font-weight: 700; letter-spacing: .04em;
  padding: .15rem .45rem;
  border-radius: var(--radius-full);
  border: 1px solid currentColor;
  white-space: nowrap;
}

.guild-HAYA { color: var(--guild-haya); background: rgba(251,191,36,.1); }
.guild-WW   { color: var(--guild-ww);   background: rgba(34,211,238,.1); }
.guild-JDGE { color: var(--guild-jdge); background: rgba(74,222,128,.1); }
.guild-MIMO { color: var(--guild-mimo); background: rgba(251,146,60,.1); }
.guild-QWAK { color: var(--guild-qwak); background: rgba(96,165,250,.1); }
.guild-PUG  { color: var(--guild-pug);  background: rgba(148,163,184,.08); }

.wvw-badge {
  font-size: .65rem; font-weight: 600;
  padding: .1rem .35rem; border-radius: var(--radius-full);
  background: rgba(34,211,238,.15); color: var(--guild-ww);
  border: 1px solid rgba(34,211,238,.4);
  margin-left: .2rem;
}
.wvw-nonrep {
  background: rgba(239,68,68,.1); color: #f87171;
  border-color: rgba(239,68,68,.3);
}

/* Status badge */
.status-pill {
  display: inline-flex; align-items: center;
  font-size: .7rem; font-weight: 600; letter-spacing: .04em;
  padding: .2rem .55rem; border-radius: var(--radius-full);
  text-transform: capitalize;
}
.status-active     { background: rgba(16,185,129,.12); color: var(--status-active);     border: 1px solid rgba(16,185,129,.3); }
.status-inactive   { background: rgba(100,116,139,.1); color: var(--status-inactive);   border: 1px solid rgba(100,116,139,.3); }
.status-pug        { background: rgba(59,130,246,.1);  color: var(--status-pug);         border: 1px solid rgba(59,130,246,.3); }
.status-pending    { background: rgba(245,158,11,.1);  color: var(--status-pending);     border: 1px solid rgba(245,158,11,.3); }
.status-failed     { background: rgba(239,68,68,.1);   color: var(--status-failed);      border: 1px solid rgba(239,68,68,.3); }
.status-complete   { background: rgba(16,185,129,.1);  color: var(--status-complete);    border: 1px solid rgba(16,185,129,.3); }
.status-processing { background: rgba(124,106,247,.1); color: var(--status-processing);  border: 1px solid rgba(124,106,247,.3); }
.status-admin      { background: rgba(124,106,247,.12); color: var(--violet);            border: 1px solid rgba(124,106,247,.3); }

/* Classes cell */
.classes-list { display: flex; flex-wrap: wrap; gap: .25rem; }
.class-tag {
  display: inline-flex; align-items: center; gap: .25rem;
  font-size: .7rem; color: var(--text-secondary);
  background: var(--bg-elevated); border: 1px solid var(--border);
  padding: .15rem .45rem; border-radius: var(--radius-sm);
}
.class-icon { width: 14px; height: 14px; object-fit: contain; }
.class-count { color: var(--text-muted); font-size: .65rem; }

.classes-toggle {
  font-size: .7rem; color: var(--accent); cursor: pointer;
  background: none; border: none; font-family: inherit;
  padding: 0; margin-top: .2rem; display: block;
}
.classes-toggle:hover { text-decoration: underline; }

/* Inline editable fields */
.editable-field {
  display: flex; align-items: flex-start; gap: .35rem;
}

.editable-text {
  flex: 1; font-size: .8rem; color: var(--text-secondary);
  white-space: pre-wrap; word-break: break-word;
  min-height: 1.2em; cursor: text;
  border-radius: 3px;
  transition: background var(--transition);
}
.editable-text:hover {
  background: var(--bg-hover);
}
.editable-text:empty::before {
  content: '—'; color: var(--text-muted);
}

.editable-textarea {
  flex: 1; background: var(--bg-input); color: var(--text-primary);
  border: 1px solid var(--accent); border-radius: var(--radius-sm);
  padding: .3rem .45rem; font-size: .8rem; font-family: inherit;
  resize: vertical; min-height: 2.5rem; outline: none;
}

.edit-btn {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; padding: .1rem;
  opacity: 0; transition: opacity var(--transition);
}
tr:hover .edit-btn { opacity: 1; }
.edit-btn:hover { color: var(--accent); }
.edit-btn svg { width: 12px; height: 12px; display: block; }

/* ── Pagination ────────────────────────────────────────────────────────────── */
.pagination {
  display: flex; align-items: center; justify-content: center;
  gap: .3rem; padding: 1rem 0;
  flex-wrap: wrap;
}

.page-btn {
  min-width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg-elevated); color: var(--text-secondary);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: .8rem; cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}
.page-btn:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.page-btn.active { background: var(--accent); color: var(--text-inverse); border-color: var(--accent); font-weight: 600; }
.page-btn:disabled { opacity: .35; cursor: default; pointer-events: none; }
.page-btn.ellipsis { cursor: default; pointer-events: none; border-color: transparent; background: none; }

/* ── Modals ────────────────────────────────────────────────────────────────── */
.modal {
  position: fixed; inset: 0; z-index: 500;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.modal.hidden { display: none; }

.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(4px);
}

.modal-box {
  position: relative;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 540px; width: 100%;
  animation: modal-in .15s ease;
}

@keyframes modal-in {
  from { opacity: 0; transform: scale(.96); }
  to   { opacity: 1; transform: scale(1); }
}

.modal-image-box { max-width: 90vmin; width: auto; background: transparent; border: none; }
.modal-image-box img { border-radius: var(--radius); max-width: 90vmin; max-height: 90vmin; display: block; }

/* ── Standalone image viewer modal ─────────────────────────────────────────── */
.image-modal {
  position: fixed; inset: 0; z-index: 600;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.image-modal.hidden { display: none; }

.image-modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.82);
  backdrop-filter: blur(6px);
  cursor: zoom-out;
}

.image-modal-box {
  position: relative;
  display: inline-flex;
  animation: modal-in .15s ease;
}

.image-modal-box img {
  display: block;
  max-width: min(90vw, 600px);
  max-height: 85vh;
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0,0,0,.7);
  object-fit: contain;
}

.image-modal-close {
  position: absolute;
  top: -14px; right: -14px;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 1.2rem; line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.4);
  transition: background var(--transition), transform var(--transition);
  z-index: 1;
}
.image-modal-close:hover {
  background: var(--bg-hover);
  transform: scale(1.1);
}


.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem 1.5rem .75rem;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 1rem; font-weight: 600; }

.modal-close {
  background: none; border: none; color: var(--text-muted);
  font-size: 1.5rem; line-height: 1; cursor: pointer; padding: .1rem .3rem;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
}
.modal-close:hover { color: var(--text-primary); background: var(--bg-hover); }

.modal-body { padding: 1.25rem 1.5rem 1.5rem; }

/* Drop zone */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer; color: var(--text-muted);
  transition: border-color var(--transition), background var(--transition);
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-bg);
  color: var(--text-secondary);
}
.drop-zone svg { width: 40px; height: 40px; margin: 0 auto .75rem; display: block; color: var(--text-muted); }
.drop-zone p { font-size: .875rem; }

.file-label { color: var(--accent); cursor: pointer; font-weight: 500; }
.file-label:hover { text-decoration: underline; }

.upload-status {
  margin-top: 1rem; padding: .75rem;
  background: var(--bg-input); border-radius: var(--radius-sm);
  font-size: .8rem; color: var(--text-secondary);
  white-space: pre-wrap; font-family: monospace;
  border: 1px solid var(--border); max-height: 200px; overflow-y: auto;
}

/* ── Toast notifications ───────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 600;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .75rem 1.25rem;
  font-size: .875rem; color: var(--text-primary);
  box-shadow: var(--shadow);
  max-width: 360px;
  animation: toast-in .2s ease;
}
.toast.hidden { display: none; }
@keyframes toast-in { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:none; } }

/* ── Admin layout ──────────────────────────────────────────────────────────── */
.admin-body .app-main { max-width: none; padding: 0; }
.admin-layout { min-height: calc(100vh - 57px); background: var(--bg-base); }
.admin-main { max-width: 1200px; width: 100%; margin: 0 auto; padding: 2rem 2.5rem; }
.admin-content { }

.page-title {
  font-size: 1.4rem; font-weight: 700; color: var(--text-primary);
  margin-bottom: 1.25rem;
}
.page-title-count { font-size: 1rem; font-weight: 400; color: var(--text-muted); }
.section-title { font-size: 1rem; font-weight: 600; color: var(--text-secondary); margin-bottom: .75rem; }

/* Stat cards */
.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem; margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem;
  transition: border-color var(--transition);
}
.stat-card:hover { border-color: var(--accent); }
.stat-card--warn { border-color: rgba(245,158,11,.4); }

.stat-label { font-size: .75rem; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: .35rem; }
.stat-value { font-size: 1.75rem; font-weight: 700; color: var(--text-primary); }
.stat-value--sm { font-size: 1rem; font-weight: 600; margin-top: .25rem; }
.stat-action { font-size: .75rem; color: var(--accent); display: block; margin-top: .25rem; }

/* Admin table */
.admin-table {
  width: 100%; border-collapse: collapse; font-size: .835rem;
}
.admin-table th {
  padding: .6rem .9rem; text-align: left; font-weight: 600;
  font-size: .72rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-muted); border-bottom: 1px solid var(--border);
}
.admin-table td {
  padding: .6rem .9rem; border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.admin-table tbody tr:hover { background: var(--bg-hover); }
.admin-table .action-cell { white-space: nowrap; }
.admin-table .error-cell { font-size: .75rem; color: #f87171; font-family: monospace; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.empty-cell { text-align: center; color: var(--text-muted); padding: 2rem !important; }

/* Settings form */
.settings-form { max-width: 640px; }
.settings-section { margin-bottom: 2rem; padding: 1.5rem; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius); }
.settings-section-title { font-size: .875rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 1rem; }

/* Parse output */
.parse-actions { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.parse-note { font-size: .8rem; color: var(--text-muted); }
.parse-output {
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: .75rem 1rem;
  font-size: .8rem; font-family: monospace; white-space: pre-wrap;
  max-height: 300px; overflow-y: auto; color: var(--text-secondary);
  margin-bottom: 1rem;
}
.log-output {
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 1rem;
  font-size: .75rem; font-family: monospace; white-space: pre-wrap;
  max-height: 400px; overflow-y: auto; color: var(--text-secondary);
}

/* Search form (admin) */
.search-form { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }

/* ── Scrollbar ─────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: #2a3550; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #3a4a6a; }

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .app-main { padding: 1rem; }
  .header-inner { padding: .6rem 1rem; }
  .header-nav { gap: .1rem; }
  .brand-name { font-size: .95rem; }
  .admin-main { padding: 1.25rem 1rem; }

  /* Collapse table to card layout on small screens */
  .roster-table thead { display: none; }
  .roster-table tbody tr {
    display: grid;
    grid-template-columns: 48px 1fr 1fr;
    gap: .25rem .75rem;
    padding: .75rem .9rem;
    border-bottom: 1px solid var(--border);
  }
  .roster-table td { border: none; padding: .15rem 0; }
  .col-pic { grid-row: 1 / 3; display: flex; align-items: center; justify-content: center; }
  .col-account { grid-column: 2; grid-row: 1; }
  .col-status  { grid-column: 3; grid-row: 1; text-align: right; }
  .col-raids   { grid-column: 2; grid-row: 2; }
  .col-last    { grid-column: 3; grid-row: 2; text-align: right; }
  .col-guilds  { grid-column: 1 / -1; }
  .col-classes { grid-column: 1 / -1; }
  .col-discord { grid-column: 1 / -1; }
  .col-notes   { grid-column: 1 / -1; }
}

@media (max-width: 540px) {
  .controls-bar { flex-direction: column; align-items: stretch; }
  .controls-left, .controls-right { width: 100%; }
  .auth-card { padding: 1.5rem 1rem 2rem; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
}