:root {
  color-scheme: dark;
  --bg: #0b0d18;
  --bg-2: #111425;
  --panel: rgba(24, 28, 48, .78);
  --panel-solid: #181c30;
  --border: rgba(255,255,255,.09);
  --text: #f6f7ff;
  --muted: #9ba3bd;
  --primary: #8d6cff;
  --primary-2: #5de5f5;
  --success: #60e6a8;
  --danger: #ff6d8a;
  --warning: #ffd269;
  --shadow: 0 24px 80px rgba(0,0,0,.38);
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { margin: 0; min-height: 100vh; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--text); background:
  radial-gradient(circle at 15% 10%, rgba(105, 77, 255, .16), transparent 32rem),
  radial-gradient(circle at 85% 0%, rgba(61, 220, 237, .10), transparent 28rem),
  linear-gradient(145deg, #090b14 0%, #101326 100%); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .46; }
input, select, textarea { width: 100%; color: var(--text); background: rgba(7, 9, 18, .56); border: 1px solid var(--border); border-radius: 13px; padding: 12px 14px; outline: none; transition: border-color .18s, box-shadow .18s, background .18s; }
input:focus, select:focus, textarea:focus { border-color: rgba(141,108,255,.85); box-shadow: 0 0 0 4px rgba(141,108,255,.13); background: rgba(7,9,18,.75); }
textarea { resize: vertical; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 52%, calc(100% - 13px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
label { display: block; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.tiny { font-size: 12px; }
.eyebrow { margin: 0 0 6px; color: #aaa0ff; font-weight: 800; font-size: 11px; letter-spacing: .16em; }
.glass { background: linear-gradient(145deg, rgba(31,35,58,.88), rgba(18,21,38,.80)); border: 1px solid var(--border); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.primary, .ghost, .danger, .mini-button, .icon-button { border: 0; border-radius: 12px; color: var(--text); font-weight: 800; transition: transform .16s, filter .16s, background .16s; }
.primary:hover, .ghost:hover, .danger:hover, .mini-button:hover, .icon-button:hover { transform: translateY(-1px); filter: brightness(1.08); }
.primary { padding: 11px 17px; background: linear-gradient(135deg, var(--primary), #6b58f2 62%, #4cdded); box-shadow: 0 10px 30px rgba(111,85,242,.28); }
.ghost { padding: 10px 15px; background: rgba(255,255,255,.06); border: 1px solid var(--border); }
.danger { padding: 11px 15px; background: rgba(255,109,138,.12); color: #ff9caf; border: 1px solid rgba(255,109,138,.25); }
.wide { width: 100%; }
.icon-button { width: 42px; min-width: 42px; height: 42px; background: rgba(255,255,255,.06); border: 1px solid var(--border); }
.mini-button { width: 30px; height: 30px; background: rgba(141,108,255,.18); color: #d9d1ff; border: 1px solid rgba(141,108,255,.27); }
.brand-mark { display: grid; place-items: center; width: 58px; height: 58px; border-radius: 18px; font-weight: 950; font-size: 28px; background: conic-gradient(from 210deg, #5fe1ef, #7e67f8, #ff63a2, #5fe1ef); box-shadow: inset 0 0 0 4px rgba(255,255,255,.11), 0 14px 34px rgba(109,87,244,.35); }
.brand-mark.small { width: 42px; height: 42px; border-radius: 13px; font-size: 21px; }

.login-body { display: grid; place-items: center; overflow: hidden; }
.login-body::before, .login-body::after { content: ""; position: fixed; width: 22rem; height: 22rem; border-radius: 50%; filter: blur(50px); opacity: .18; pointer-events: none; }
.login-body::before { background: #8b62ff; top: -8rem; right: -6rem; }
.login-body::after { background: #45deee; bottom: -10rem; left: -8rem; }
.login-shell { width: min(92vw, 450px); padding: 28px 0; }
.login-card { border-radius: 28px; padding: 38px; }
.login-card h1 { font-size: 34px; margin: 18px 0 8px; letter-spacing: -.04em; }
.login-card form { margin-top: 28px; }
.login-card label { color: #d9dcef; font-size: 13px; margin-bottom: 8px; font-weight: 700; }
.password-row { display: flex; gap: 9px; margin-bottom: 14px; }
.form-message { min-height: 22px; margin: 12px 0 0; text-align: center; color: #ff9caf; font-size: 13px; }
.security-note { display: flex; align-items: center; gap: 9px; margin-top: 22px; padding-top: 19px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; }
.pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 6px rgba(96,230,168,.08); }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 290px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 22px 16px; border-right: 1px solid var(--border); background: rgba(8,10,19,.73); backdrop-filter: blur(18px); z-index: 10; }
.brand-row { display: flex; align-items: center; gap: 12px; padding: 0 6px 20px; }
.brand-row strong { display: block; font-size: 18px; }
.brand-row span { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .12em; }
.guild-card { display: grid; grid-template-columns: 42px 1fr auto; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: 16px; background: rgba(255,255,255,.035); }
.guild-card strong { display: block; max-width: 145px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.guild-card span:not(.status-pill) { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.guild-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; background: linear-gradient(135deg, #6655d9, #44cfe0); font-weight: 900; overflow: hidden; }
.guild-icon img { width: 100%; height: 100%; object-fit: cover; }
.status-pill { padding: 4px 7px; border-radius: 999px; font-size: 9px; font-weight: 900; letter-spacing: .08em; color: #ffc2ce; background: rgba(255,109,138,.12); }
.status-pill.on { color: #8ff3be; background: rgba(96,230,168,.12); }
.status-pill.warn { color: #ffe09a; background: rgba(255,210,105,.12); }
.side-heading { display: flex; align-items: center; justify-content: space-between; margin: 24px 5px 10px; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; }
.profile-list { display: flex; flex-direction: column; gap: 6px; overflow-y: auto; padding-right: 3px; }
.profile-item { display: grid; grid-template-columns: 38px 1fr auto; gap: 10px; align-items: center; width: 100%; padding: 9px; border: 1px solid transparent; border-radius: 13px; color: var(--text); text-align: left; background: transparent; }
.profile-item:hover { background: rgba(255,255,255,.045); }
.profile-item.active { background: linear-gradient(135deg, rgba(141,108,255,.17), rgba(93,229,245,.07)); border-color: rgba(141,108,255,.25); }
.profile-item img, .avatar-placeholder { width: 38px; height: 38px; border-radius: 12px; object-fit: cover; background: #272b43; }
.avatar-placeholder { display: grid; place-items: center; font-weight: 900; color: #bcb5e8; }
.profile-item strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.profile-item small { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; }
.profile-led { width: 8px; height: 8px; border-radius: 50%; background: #5b6077; }
.profile-led.on { background: var(--success); box-shadow: 0 0 0 5px rgba(96,230,168,.08); }
.sidebar-footer { margin-top: auto; padding-top: 16px; }

.main-area { min-width: 0; padding: 30px clamp(20px, 4vw, 58px) 55px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.topbar h1 { margin: 0; font-size: clamp(28px, 3vw, 42px); letter-spacing: -.04em; }
.top-actions { display: flex; gap: 10px; }
.toast { position: fixed; top: 25px; right: 28px; z-index: 50; max-width: 390px; padding: 13px 16px; border-radius: 13px; background: #252a46; border: 1px solid var(--border); box-shadow: var(--shadow); transform: translateY(-90px); opacity: 0; transition: .25s; pointer-events: none; }
.toast.show { transform: translateY(0); opacity: 1; }
.toast.error { color: #ffbac7; border-color: rgba(255,109,138,.3); }
.empty-state { min-height: 420px; display: grid; place-items: center; align-content: center; text-align: center; border-radius: 24px; padding: 35px; }
.empty-state h2 { margin: 16px 0 8px; font-size: 28px; }
.empty-state p { max-width: 560px; color: var(--muted); line-height: 1.65; margin: 0 0 22px; }
.shield-illustration { width: 84px; height: 84px; display: grid; place-items: center; border-radius: 28px; font-size: 50px; color: #d5ceff; background: linear-gradient(145deg, rgba(141,108,255,.27), rgba(93,229,245,.11)); border: 1px solid rgba(141,108,255,.28); }
.editor { display: flex; flex-direction: column; gap: 18px; }
.hero-card { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 22px; border-radius: 22px; }
.member-identity { display: flex; align-items: center; gap: 16px; }
.member-avatar { width: 70px; height: 70px; border-radius: 20px; object-fit: cover; background: #272b43; border: 1px solid var(--border); }
.member-identity h2 { margin: 0 0 5px; font-size: 25px; }
.member-identity p:last-child { margin: 0; font-size: 12px; }
.hero-controls { display: flex; align-items: center; gap: 12px; }
.master-switch { display: flex; align-items: center; gap: 10px; padding: 11px 13px; border-radius: 13px; background: rgba(255,255,255,.05); border: 1px solid var(--border); }
.master-switch input { display: none; }
.master-switch span { position: relative; width: 38px; height: 22px; border-radius: 999px; background: #4a4f66; }
.master-switch span::after { content: ""; position: absolute; width: 16px; height: 16px; top: 3px; left: 3px; border-radius: 50%; background: white; transition: .18s; }
.master-switch input:checked + span { background: linear-gradient(90deg, #6c5fea, #58dbea); }
.master-switch input:checked + span::after { transform: translateX(16px); }
.master-switch b { font-size: 13px; }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.stat-card { padding: 17px; border-radius: 17px; background: rgba(255,255,255,.035); border: 1px solid var(--border); }
.stat-card span, .stat-card small { display: block; color: var(--muted); font-size: 11px; }
.stat-card strong { display: block; margin: 7px 0 5px; font-size: 20px; }
.panel-section { padding: 22px; border: 1px solid var(--border); border-radius: 20px; background: rgba(18,21,37,.63); }
.section-title { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 17px; }
.section-title.compact { margin-bottom: 13px; }
.section-title h3 { margin: 0; font-size: 20px; }
.section-title > p { max-width: 480px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.option-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; }
.option-card { position: relative; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 15px; border-radius: 15px; background: rgba(255,255,255,.035); border: 1px solid var(--border); cursor: pointer; }
.option-card:hover { background: rgba(255,255,255,.055); }
.option-card b { display: block; margin-bottom: 4px; font-size: 13px; }
.option-card small { display: block; color: var(--muted); font-size: 11px; line-height: 1.45; }
.option-card input { position: absolute; opacity: 0; }
.option-card i, .switch-line i { width: 38px; min-width: 38px; height: 22px; border-radius: 999px; background: #464b61; position: relative; transition: .18s; }
.option-card i::after, .switch-line i::after { content: ""; position: absolute; width: 16px; height: 16px; top: 3px; left: 3px; border-radius: 50%; background: white; transition: .18s; }
.option-card input:checked + i, .switch-line input:checked + i { background: linear-gradient(90deg, #735fee, #52dce9); }
.option-card input:checked + i::after, .switch-line input:checked + i::after { transform: translateX(16px); }
.two-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.two-columns > div + div { border-left: 1px solid var(--border); padding-left: 24px; }
.field-label { margin: 11px 0 7px; color: #c9cde1; font-size: 12px; font-weight: 700; }
.switch-line { display: flex; align-items: center; justify-content: space-between; gap: 13px; padding: 12px 0; cursor: pointer; }
.switch-line span b, .switch-line span small { display: block; }
.switch-line span b { font-size: 13px; }
.switch-line span small { margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.4; }
.switch-line input { position: absolute; opacity: 0; pointer-events: none; }
.role-picker { max-height: 310px; overflow: auto; padding: 6px; border: 1px solid var(--border); border-radius: 14px; background: rgba(7,9,18,.35); }
.role-option { display: flex; align-items: center; justify-content: space-between; padding: 9px 10px; border-radius: 10px; cursor: pointer; }
.role-option:hover { background: rgba(255,255,255,.045); }
.role-option span { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.role-dot { width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.role-option input { width: 16px; height: 16px; accent-color: var(--primary); }
.role-option.disabled { opacity: .38; cursor: not-allowed; }
.danger-zone { display: flex; justify-content: space-between; align-items: center; gap: 20px; border-color: rgba(255,109,138,.2); }
.danger-zone h3 { margin: 0 0 5px; }
.danger-zone p:last-child { margin: 0; color: var(--muted); font-size: 12px; }
.logs-section { margin-top: 20px; }
.live-badge { display: inline-flex; align-items: center; gap: 7px; padding: 6px 9px; border-radius: 999px; color: #8ff3be; background: rgba(96,230,168,.08); font-size: 10px; font-weight: 900; letter-spacing: .1em; }
.live-badge i { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px rgba(96,230,168,.08); }
.logs { display: flex; flex-direction: column; max-height: 430px; overflow: auto; }
.log-row { display: grid; grid-template-columns: 120px 145px 1fr; gap: 13px; padding: 12px 4px; border-top: 1px solid var(--border); font-size: 12px; }
.log-row:first-child { border-top: 0; }
.log-time { color: var(--muted); }
.log-type { color: #bcb3ff; font-family: ui-monospace, monospace; }
.log-message { color: #dfe2f1; }
.log-row.error .log-type { color: #ff9caf; }
.log-empty { padding: 25px; text-align: center; color: var(--muted); }
.limitations { margin-top: 14px; display: grid; gap: 8px; }
.limitation { padding: 10px 13px; border-radius: 11px; color: #c6cadc; background: rgba(255,210,105,.06); border: 1px solid rgba(255,210,105,.12); font-size: 11px; }
.modal { width: min(92vw, 620px); border: 0; padding: 0; background: transparent; color: var(--text); }
.modal::backdrop { background: rgba(3,4,10,.78); backdrop-filter: blur(8px); }
.modal-card { border-radius: 23px; padding: 22px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-head h2 { margin: 0; }
.search-results { display: flex; flex-direction: column; gap: 7px; min-height: 120px; max-height: 350px; overflow: auto; margin-top: 13px; }
.search-member { width: 100%; display: grid; grid-template-columns: 46px 1fr auto; align-items: center; gap: 11px; padding: 10px; border: 1px solid var(--border); border-radius: 13px; background: rgba(255,255,255,.035); color: var(--text); text-align: left; }
.search-member:hover { background: rgba(141,108,255,.11); border-color: rgba(141,108,255,.25); }
.search-member img { width: 46px; height: 46px; border-radius: 13px; }
.search-member strong, .search-member small { display: block; }
.search-member small { margin-top: 3px; color: var(--muted); }
.search-hint { display: grid; place-items: center; min-height: 110px; color: var(--muted); font-size: 13px; }

@media (max-width: 1050px) {
  .option-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 820px) {
  .app-shell { display: block; }
  .sidebar { position: relative; width: 100%; height: auto; border-right: 0; border-bottom: 1px solid var(--border); }
  .profile-list { flex-direction: row; overflow-x: auto; }
  .profile-item { min-width: 210px; }
  .sidebar-footer { display: none; }
  .main-area { padding: 22px 15px 45px; }
  .two-columns { grid-template-columns: 1fr; }
  .two-columns > div + div { border-left: 0; border-top: 1px solid var(--border); padding-left: 0; padding-top: 20px; }
}
@media (max-width: 620px) {
  .topbar, .hero-card, .danger-zone { align-items: stretch; flex-direction: column; }
  .top-actions, .hero-controls { width: 100%; }
  .top-actions button, .hero-controls > * { flex: 1; }
  .stats-grid, .option-grid { grid-template-columns: 1fr; }
  .log-row { grid-template-columns: 1fr; gap: 4px; }
  .login-card { padding: 27px 22px; }
}
