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

:root {
  --bg: #0d0a14;
  --bg2: #161122;
  --bg3: #1e1730;
  --border: #322a45;
  --text: #e9e4f5;
  --muted: #9a8fb8;
  --accent: #a855f7;
  --accent2: #7c3aed;
  --accent3: #c084fc;
  --success: #34d399;
  --danger: #f87171;
  --warning: #fbbf24;
  --info: #60a5fa;
  --radius: 10px;
  --glow: 0 0 20px rgba(168,85,247,.25);
}

body {
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 20% -10%, rgba(124,58,237,.15), transparent),
    radial-gradient(ellipse 60% 40% at 90% 110%, rgba(168,85,247,.08), transparent);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
}

.hidden { display: none !important; }

/* ---- Animations ---- */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(168,85,247,.4); }
  50% { box-shadow: 0 0 0 8px rgba(168,85,247,0); }
}
@keyframes glowPulse {
  0%, 100% { box-shadow: var(--glow); }
  50% { box-shadow: 0 0 30px rgba(168,85,247,.45); }
}
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.anim-fade-up { animation: fadeInUp .45s cubic-bezier(.16,1,.3,1) both; }
.anim-fade { animation: fadeIn .5s ease both; }
.anim-slide { animation: slideInRight .4s cubic-bezier(.16,1,.3,1) both; }
.anim-float { animation: float 3s ease-in-out infinite; }

.stat-card { animation: fadeInUp .5s cubic-bezier(.16,1,.3,1) both; }
.stat-card:nth-child(1) { animation-delay: .02s; }
.stat-card:nth-child(2) { animation-delay: .06s; }
.stat-card:nth-child(3) { animation-delay: .1s; }
.stat-card:nth-child(4) { animation-delay: .14s; }
.stat-card:nth-child(5) { animation-delay: .18s; }
.stat-card:nth-child(6) { animation-delay: .22s; }
.stat-card:nth-child(7) { animation-delay: .26s; }
.stat-card:nth-child(8) { animation-delay: .3s; }

.setting-card { animation: fadeInUp .45s cubic-bezier(.16,1,.3,1) both; }
.cd-tab { transition: all .2s ease; }
.cd-btn { transition: transform .15s ease, filter .15s ease; }
.cd-btn:hover { transform: translateY(-1px); filter: brightness(1.15); }
.btn { transition: all .2s ease; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(168,85,247,.3); }
.btn-primary { animation: glowPulse 3s ease-in-out infinite; }
.chart-bar { animation: fadeInUp .6s ease both; }
.toast { animation: slideIn .25s ease, fadeIn .25s ease; }

#page-body > * { animation: fadeInUp .4s cubic-bezier(.16,1,.3,1) both; }
#page-body > *:nth-child(2) { animation-delay: .05s; }
#page-body > *:nth-child(3) { animation-delay: .1s; }

/* ---- Login ---- */
#login-overlay {
  position: fixed; inset: 0;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}
.login-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px;
  width: 360px;
  text-align: center;
}
.login-logo {
  font-size: 28px; font-weight: 800;
  color: var(--accent);
  margin-bottom: 4px;
}
.login-sub { color: var(--muted); margin-bottom: 24px; font-size: 14px; }
.login-card input {
  width: 100%; padding: 12px 16px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text);
  font-size: 15px; margin-bottom: 12px;
  outline: none;
}
.login-card input:focus { border-color: var(--accent); }
.login-card button {
  width: 100%; padding: 12px;
  background: var(--accent); color: #000;
  border: none; border-radius: var(--radius);
  font-size: 15px; font-weight: 700; cursor: pointer;
}
.login-card button:hover { background: var(--accent2); }
.login-error { color: var(--danger); margin-top: 10px; font-size: 13px; }

/* ---- Layout ---- */
#app { display: flex; min-height: 100vh; }

#sidebar {
  width: 220px; min-width: 220px;
  background: linear-gradient(180deg, var(--bg2), #120e1c);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar-brand {
  padding: 20px 16px;
  font-size: 18px; font-weight: 800;
  background: linear-gradient(135deg, var(--accent3), var(--accent), var(--accent2));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  border-bottom: 1px solid var(--border);
  text-align: center;
  animation: shimmer 4s linear infinite;
  background-size: 200% auto;
}
#nav { flex: 1; padding: 8px; overflow-y: auto; }
#nav a {
  display: block; padding: 10px 12px;
  color: var(--muted); text-decoration: none;
  border-radius: 8px; font-size: 14px;
  margin-bottom: 2px;
  transition: all .2s ease;
  border-right: 3px solid transparent;
}
#nav a:hover { background: var(--bg3); color: var(--text); transform: translateX(-3px); }
#nav a.active {
  background: linear-gradient(90deg, rgba(168,85,247,.15), transparent);
  color: var(--accent3); font-weight: 600;
  border-right-color: var(--accent);
  box-shadow: inset 0 0 20px rgba(168,85,247,.08);
}
.sidebar-footer { padding: 12px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.btn-lang {
  width: 100%; padding: 8px;
  background: transparent; color: var(--accent3);
  border: 1px solid var(--accent2); border-radius: 8px;
  cursor: pointer; font-size: 13px; transition: all .2s ease;
}
.btn-lang:hover { background: rgba(168,85,247,.15); box-shadow: 0 0 12px rgba(168,85,247,.3); }
.btn-logout {
  width: 100%; padding: 8px;
  background: transparent; color: var(--danger);
  border: 1px solid var(--danger); border-radius: 8px;
  cursor: pointer; font-size: 13px; transition: all .2s ease;
}
.btn-logout:hover { background: var(--danger); color: #fff; }

#content { flex: 1; padding: 24px; overflow-x: auto; }
#page-title {
  font-size: 22px; font-weight: 700;
  margin-bottom: 20px;
}

/* ---- Cards / Stats ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px; margin-bottom: 24px;
}
.stat-card {
  background: linear-gradient(145deg, var(--bg2), #14101f);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  position: relative;
  overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease;
}
.stat-card::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(circle at 100% 0%, rgba(168,85,247,.12), transparent 60%);
  pointer-events: none;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(168,85,247,.2); }
.stat-card .label { color: var(--muted); font-size: 12px; margin-bottom: 6px; position: relative; }
.stat-card .value { font-size: 24px; font-weight: 700; position: relative; }
.stat-card .value.gold { color: var(--accent3); }
.stat-card .value.green { color: var(--success); }
.stat-card .value.red { color: var(--danger); }
.stat-card .value.blue { color: var(--info); }

/* ---- Table ---- */
.table-wrap {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 20px;
}
.table-toolbar {
  display: flex; gap: 10px; padding: 12px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap; align-items: center;
}
.table-toolbar input, .table-toolbar select {
  padding: 8px 12px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text); font-size: 13px;
  outline: none;
}
.table-toolbar input:focus, .table-toolbar select:focus { border-color: var(--accent); }
.table-toolbar input { flex: 1; min-width: 160px; }

table { width: 100%; border-collapse: collapse; }
th, td {
  padding: 10px 12px; text-align: right;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
th { color: var(--muted); font-weight: 600; background: var(--bg3); font-size: 12px; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,.02); }

/* ---- Badges ---- */
.badge {
  display: inline-block; padding: 2px 8px;
  border-radius: 10px; font-size: 11px; font-weight: 600;
}
.badge-pending { background: rgba(210,153,34,.15); color: var(--warning); }
.badge-delivered { background: rgba(63,185,80,.15); color: var(--success); }
.badge-cancelled { background: rgba(248,81,73,.15); color: var(--danger); }
.badge-open { background: rgba(63,185,80,.15); color: var(--success); }
.badge-closed { background: rgba(139,148,158,.15); color: var(--muted); }

/* ---- Buttons ---- */
.btn {
  padding: 7px 14px;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--bg3); color: var(--text);
  font-size: 13px; cursor: pointer;
  transition: all .15s;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; border-color: var(--accent2); font-weight: 600; }
.btn-primary:hover { background: linear-gradient(135deg, var(--accent2), var(--accent)); color: #fff; box-shadow: 0 4px 16px rgba(168,85,247,.45); }
.btn-danger { border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-success { border-color: var(--success); color: var(--success); }
.btn-success:hover { background: var(--success); color: #fff; }

/* ---- Modal ---- */
#modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 900;
}
#modal {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  width: 520px; max-width: 92vw;
  max-height: 85vh; overflow-y: auto;
}
#modal h2 { font-size: 18px; margin-bottom: 16px; color: var(--accent); }
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block; margin-bottom: 4px;
  font-size: 13px; color: var(--muted);
}
.form-group input, .form-group textarea, .form-group select {
  width: 100%; padding: 10px 12px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text); font-size: 14px;
  outline: none;
}
.form-group textarea { min-height: 80px; resize: vertical; font-family: inherit; }
.form-group input:focus, .form-group textarea:focus { border-color: var(--accent); }
.form-actions { display: flex; gap: 10px; justify-content: flex-start; margin-top: 18px; }

/* ---- Toast ---- */
#toast-container {
  position: fixed; bottom: 20px; left: 20px;
  z-index: 999; display: flex; flex-direction: column; gap: 8px;
}
.toast {
  padding: 12px 18px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  animation: slideIn .2s ease;
  border-right: 3px solid var(--info);
}
.toast.success { border-right-color: var(--success); }
.toast.error { border-right-color: var(--danger); }
@keyframes slideIn { from { transform: translateX(-20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ---- Pagination ---- */
.pagination {
  display: flex; gap: 8px; align-items: center;
  justify-content: center; padding: 12px;
  border-top: 1px solid var(--border);
}
.pagination span { color: var(--muted); font-size: 13px; }

/* ---- Settings ---- */
.settings-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 768px) {
  .settings-grid { grid-template-columns: 1fr; }
  #sidebar { width: 60px; min-width: 60px; }
  #nav a { font-size: 0; padding: 12px; text-align: center; }
  #nav a::first-letter { font-size: 18px; }
  .sidebar-brand { font-size: 0; padding: 12px 4px; }
  .sidebar-brand::first-letter { font-size: 20px; }
}
.setting-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
}
.setting-card h3 {
  font-size: 14px; color: var(--accent);
  margin-bottom: 12px; padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.setting-row {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 8px;
}
.setting-row label { flex: 0 0 160px; font-size: 12px; color: var(--muted); }
.setting-row input {
  flex: 1; padding: 6px 10px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 4px; color: var(--text); font-size: 12px;
  outline: none; direction: ltr;
}
.setting-row input:focus { border-color: var(--accent); }

/* ---- Card Designer ---- */
.card-designer-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 768px) { .card-designer-grid { grid-template-columns: 1fr; } }

/* ---- Chart ---- */
.chart {
  display: flex; align-items: flex-end; gap: 6px;
  height: 160px; padding-top: 10px;
}
.chart-col {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: flex-end; height: 100%;
}
.chart-bar {
  width: 100%; max-width: 32px; min-height: 3px;
  background: linear-gradient(180deg, var(--accent), var(--accent2));
  border-radius: 3px 3px 0 0; transition: height .3s ease;
}
.chart-col:hover .chart-bar { background: var(--info); }
.chart-label { font-size: 9px; color: var(--muted); margin-top: 4px; }

.cd-wrap { display: flex; gap: 16px; align-items: flex-start; }
.cd-sidebar {
  flex: 0 0 220px; display: flex; flex-direction: column; gap: 6px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px;
  position: sticky; top: 80px;
}
.cd-tab {
  text-align: right; padding: 10px 12px; border: 1px solid transparent;
  background: transparent; color: var(--muted); border-radius: 6px;
  font-size: 13px; cursor: pointer; transition: all .15s;
}
.cd-tab:hover { background: var(--bg3); color: var(--text); }
.cd-tab.active { background: var(--bg3); color: var(--accent); border-color: var(--accent); }
.cd-side-actions { display: flex; gap: 8px; margin-top: 10px; }
.cd-side-actions .btn { flex: 1; }
.cd-main { flex: 1; min-width: 0; }
.cd-hint { color: var(--muted); font-size: 12px; margin-bottom: 12px; }
.cd-hint code { background: var(--bg3); padding: 1px 5px; border-radius: 4px; color: var(--accent); }
.cd-group { margin-bottom: 18px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.cd-group:last-child { border-bottom: none; }
.cd-group h4 { font-size: 13px; color: var(--accent); margin-bottom: 10px; }
.cd-reset {
  background: none; border: none; color: var(--warning);
  cursor: pointer; font-size: 13px; padding: 0 4px;
}
.cd-preview-card { position: sticky; top: 80px; }

/* Discord-like preview */
.cd-card {
  background: #313338; border-radius: 8px; padding: 16px;
  font-family: 'gg sans', 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif;
  font-size: 16px; line-height: 1.375; color: #dbdee1;
  max-height: 640px; overflow-y: auto;
  direction: ltr; text-align: left;
}
.cd-banner { border-radius: 6px; overflow: hidden; margin-bottom: 12px; }
.cd-banner img { width: 100%; display: block; }
.cd-banner-ph {
  background: #2b2d31; border: 1px dashed #4e5058;
  text-align: center; padding: 32px 8px; color: #80848e; font-size: 13px;
}
.cd-body { margin-bottom: 12px; }
.cd-title { font-weight: 700; font-size: 16px; margin-bottom: 6px; line-height: 1.375; }
.cd-h1 { font-size: 24px; font-weight: 700; }
.cd-h2 { font-size: 20px; font-weight: 700; }
.cd-h3 { font-size: 16px; font-weight: 600; }
.cd-line { margin-bottom: 2px; word-break: break-word; line-height: 1.375; }
.cd-spacer { min-height: 0.35em; margin-bottom: 0; }
.cd-subtle { color: #949ba4; font-size: 12px; }
.cd-quote {
  border-left: 4px solid #4e5058; padding-left: 8px;
  margin-left: 2px; color: #dbdee1;
}
.cd-sep { border-top: 1px solid #3f4147; margin: 10px 0; }
.cd-footer { color: #949ba4; font-size: 12px; margin-top: 10px; }
.cd-emoji { height: 22px; width: 22px; vertical-align: -5px; display: inline-block; }
.cd-card code {
  background: #2b2d31; border: 1px solid #1e1f22; border-radius: 4px;
  padding: 1px 4px; font-size: 13px; font-family: 'Consolas', monospace;
}
.cd-mention { background: rgba(88,101,242,.3); color: #c9cdfb; border-radius: 3px; padding: 0 3px; }
.cd-btn-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.cd-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 8px 16px; border-radius: 4px; font-size: 14px; font-weight: 500;
  background: #4e5058; color: #fff; border: none;
}
.cd-btn-success { background: #248046; }
.cd-btn-danger { background: #da373c; }
.cd-btn-primary { background: #5865f2; }
.cd-btn-secondary { background: #4e5058; }

@media (max-width: 900px) {
  .cd-wrap { flex-direction: column; }
  .cd-sidebar { position: static; width: 100%; flex: none; }
  .cd-preview-card { position: static; }
}

/* ---- Empty ---- */
.empty {
  text-align: center; padding: 40px;
  color: var(--muted); font-size: 14px;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ---- Topbar: global search + bot status ---- */
#topbar {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 18px;
}
#global-search { position: relative; flex: 1; max-width: 520px; }
#gs-input {
  width: 100%; padding: 9px 14px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 13px; outline: none;
  transition: border-color .2s ease, box-shadow .2s ease;
}
#gs-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(168,85,247,.15); }
#gs-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 10px; z-index: 60; overflow: hidden;
  box-shadow: 0 12px 32px rgba(0,0,0,.45);
  max-height: 380px; overflow-y: auto;
  animation: fadeInUp .18s ease both;
}
.gs-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; cursor: pointer; font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.gs-item:last-child { border-bottom: none; }
.gs-item:hover { background: rgba(168,85,247,.12); }
.gs-item .gs-tag { font-size: 15px; }
.gs-item .gs-meta { margin-inline-start: auto; }
.gs-item code { font-size: 11px; color: var(--muted); }
.gs-empty { padding: 16px; text-align: center; color: var(--muted); font-size: 13px; }

.status-pill {
  margin-inline-start: auto;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 999px; padding: 8px 16px;
  color: var(--text); font-size: 12.5px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.status-pill:hover { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(168,85,247,.15); }
.status-pill.off { color: var(--danger); border-color: rgba(239,68,68,.4); }

/* ---- Overdue stat ---- */
.stat-card.overdue { border-color: rgba(245,158,11,.45); }
.stat-card.overdue::before {
  background: radial-gradient(circle at 100% 0%, rgba(245,158,11,.18), transparent 60%);
}

/* ---- Broadcast preview (Discord-like) ---- */
.broadcast-preview {
  background: #313338; border: 1px solid #1e1f22;
  border-radius: 8px; padding: 16px; min-height: 160px;
  font-family: 'gg sans', 'Segoe UI', sans-serif;
}
.bc-msg { display: flex; gap: 12px; }
.bc-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, #a855f7, #6d28d9);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.bc-body { flex: 1; min-width: 0; }
.bc-name { color: #f2f3f5; font-weight: 600; font-size: 15px; margin-bottom: 2px; }
.bc-bot {
  background: #5865f2; color: #fff; font-size: 10px; font-weight: 600;
  border-radius: 3px; padding: 1px 5px; vertical-align: middle;
}
.bc-time { color: #949ba4; font-size: 11px; font-weight: 400; margin-inline-start: 6px; }
.bc-text { color: #dbdee1; font-size: 14.5px; line-height: 1.45; white-space: normal; direction: ltr; unicode-bidi: normal; }
.bc-embed {
  display: flex; margin-top: 8px; max-width: 480px;
  background: #2b2d31; border-radius: 4px; overflow: hidden;
}
.bc-embed-bar { width: 4px; background: #a855f7; flex-shrink: 0; }
.bc-embed-body { padding: 10px 14px; min-width: 0; }
.bc-embed-title { color: #f2f3f5; font-weight: 600; font-size: 14.5px; margin-bottom: 6px; direction: ltr; unicode-bidi: normal; }
.bc-embed-desc { color: #dbdee1; font-size: 14px; line-height: 1.4; direction: ltr; unicode-bidi: normal; }
.bc-embed-footer { color: #949ba4; font-size: 11px; margin-top: 10px; }

/* ---- Mobile ---- */
@media (max-width: 700px) {
  #topbar { flex-wrap: wrap; }
  #global-search { max-width: 100%; flex: 1 1 100%; }
  .status-pill { margin-inline-start: 0; }
}

/* ---- Tenant dashboard ---- */
.t-center { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.t-link { display: block; margin-top: 12px; color: var(--muted); font-size: 12px; text-decoration: none; text-align: center; }
.t-link:hover { color: var(--accent3); }
.login-card .btn { display: block; width: 100%; margin-top: 8px; text-align: center; text-decoration: none; }
.t-topbar {
  display: flex; justify-content: space-between; align-items: center; padding: 14px 22px;
  background: rgba(22, 17, 34, .88); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 5; backdrop-filter: blur(8px);
}
.t-brand { font-weight: 800; letter-spacing: 1px; }
.t-brand span { color: var(--muted); font-weight: 500; font-size: 12px; }
.t-user { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.t-user img { width: 30px; height: 30px; border-radius: 50%; background: var(--bg3); }
.t-section-title { font-size: 18px; font-weight: 700; margin: 22px; }
.t-guild-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; padding: 0 22px; }
.t-guild-card {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; display: flex; flex-direction: column; align-items: center; gap: 10px;
  transition: .15s; cursor: pointer;
}
.t-guild-card:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: var(--glow); }
.t-guild-card img { width: 56px; height: 56px; border-radius: 50%; background: var(--bg3); }
.t-guild-card .n { font-weight: 700; text-align: center; }
.t-guild-card .m { color: var(--muted); font-size: 12px; }
.t-guild-empty-icon {
  width: 56px; height: 56px; border-radius: 50%; background: var(--bg3);
  display: flex; align-items: center; justify-content: center; font-size: 24px;
}
.t-invite {
  margin: 22px; padding: 18px; border: 1px dashed var(--border); border-radius: var(--radius);
  display: flex; gap: 14px; align-items: center; flex-wrap: wrap; color: var(--muted); background: var(--bg2);
}
.t-panel {
  margin: 0 22px 22px; background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}
.t-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.t-actions { display: flex; gap: 10px; justify-content: flex-start; margin-top: 16px; flex-wrap: wrap; align-items: center; }
.t-tabbar { display: flex; gap: 8px; margin: 18px 22px; flex-wrap: wrap; }
.t-tab {
  background: var(--bg2); border: 1px solid var(--border); color: var(--muted);
  padding: 9px 16px; border-radius: var(--radius); cursor: pointer; font-size: 14px; transition: .15s;
}
.t-tab:hover { color: var(--text); border-color: var(--accent3); }
.t-tab.active { background: var(--accent2); color: #fff; border-color: var(--accent2); }
.t-dash-body { margin: 0 22px 26px; }
.t-guild-chip { display: flex; align-items: center; gap: 10px; margin: 18px 22px 0; }
.t-guild-chip img { width: 34px; height: 34px; border-radius: 50%; background: var(--bg3); }
.muted { color: var(--muted); font-size: 12px; }
.t-logo-preview {
  width: 90px; height: 90px; object-fit: contain; background: var(--bg3);
  border: 1px solid var(--border); border-radius: 12px; padding: 6px;
}
.t-hint { color: var(--muted); font-size: 12px; margin-top: 4px; }
.t-review-row {
  display: flex; justify-content: space-between; gap: 14px; padding: 9px 0;
  border-bottom: 1px solid var(--border); font-size: 13.5px;
}
.t-review-row:last-child { border-bottom: none; }
.t-review-row span { color: var(--muted); }
@media (max-width: 700px) {
  .t-row2 { grid-template-columns: 1fr; }
  .t-guild-grid { grid-template-columns: 1fr; }
}

/* ---- Tenant panel (admin-parity additions) ---- */
.btn-discord {
  background: linear-gradient(135deg, #5865f2, #4752c4);
  border: none; color: #fff; font-weight: 700;
  box-shadow: 0 6px 18px rgba(88,101,242,.35);
}
.btn-discord:hover { background: linear-gradient(135deg, #4752c4, #3c45a4); transform: translateY(-2px); }
.guild-switcher {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; margin: 10px;
  background: var(--bg3); border: 1px solid var(--border); border-radius: 10px;
}
.guild-switcher img { width: 26px; height: 26px; border-radius: 50%; background: var(--bg2); }
.guild-switcher select {
  flex: 1; min-width: 0; background: transparent; color: var(--text);
  border: none; outline: none; font-size: 13px; font-weight: 600; cursor: pointer;
}
.guild-switcher select option { background: var(--bg2); color: var(--text); }
.sidebar-user {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--muted);
  padding: 8px; border: 1px solid var(--border); border-radius: 8px;
}
.sidebar-user img { width: 22px; height: 22px; border-radius: 50%; background: var(--bg3); }
.sidebar-user span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-guild-grid.in-page { padding: 0; }
.t-guild-grid.in-page .empty { grid-column: 1 / -1; padding: 28px; }
.mem-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--bg3); object-fit: cover; display: block; }
.mem-cell { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.role-chip {
  display: inline-block; font-size: 10.5px; padding: 2px 7px;
  border: 1px solid var(--border); border-radius: 99px;
  color: var(--muted); background: var(--bg3); max-width: 130px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle;
}
@media (max-width: 700px) {
  .t-guild-grid.in-page { grid-template-columns: 1fr; }
}
