:root {
  --bg: #0b0b0d; --surface: #131317; --surface-2: #1a1a20; --surface-3: #22222a; --border: #26262e; --border-2: #33333d;
  --text: #ececf1; --muted: #8d8d99; --primary: #f2f2f5; --primary-ink: #0b0b0d; --silver: linear-gradient(135deg, #ffffff, #b9b9c6);
  --ok: #3ecf8e; --err: #ff5d6c; --warn: #f5b544; --info: #6ea8fe; --radius: 12px;
  --font: 'IBM Plex Sans Arabic', Tahoma, 'Segoe UI', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.6; -webkit-text-size-adjust: 100%; }
body { padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.3; }
h1 { font-size: 1.6rem; } h3 { font-size: 1.05rem; }
p { margin: 0; }
code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .8em; }
button { font-family: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.row { display: flex; align-items: center; } .gap { gap: .6rem; } .wrap { flex-wrap: wrap; } .end { justify-content: flex-end; } .between { justify-content: space-between; }
.grid { display: grid; gap: 1rem; } .grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); } .grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 1rem; }
::-webkit-scrollbar { width: 10px; height: 10px; } ::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 8px; }

/* ---------- buttons & inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; border: 1px solid transparent; border-radius: 10px; padding: .55rem 1.1rem; font-size: .92rem; font-weight: 600; cursor: pointer; transition: .15s; white-space: nowrap; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: var(--primary-ink); } .btn-primary:hover:not(:disabled) { background: #fff; transform: translateY(-1px); }
.btn-ghost { background: var(--surface-2); color: var(--text); border-color: var(--border-2); } .btn-ghost:hover:not(:disabled) { background: var(--surface-3); }
.btn-danger { background: rgba(255,93,108,.12); color: var(--err); border-color: rgba(255,93,108,.35); } .btn-danger:hover:not(:disabled) { background: rgba(255,93,108,.22); }
.btn-sm { padding: .3rem .7rem; font-size: .82rem; border-radius: 8px; }
.icon-btn { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 1.1rem; padding: .3rem .5rem; border-radius: 8px; } .icon-btn:hover { background: var(--surface-3); color: var(--text); }
.input { width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--border-2); border-radius: 10px; padding: .55rem .8rem; font: inherit; font-size: .92rem; outline: none; transition: border-color .15s; }
.input:focus { border-color: #8a8a99; box-shadow: 0 0 0 3px rgba(255,255,255,.06); }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: 14px 52%, 9px 52%; background-size: 5px 5px; background-repeat: no-repeat; padding-inline-start: 1.9rem; }
textarea.input { resize: vertical; min-height: 70px; }
.input-inline { width: auto; min-width: 140px; flex: 1; }
.form { display: flex; flex-direction: column; gap: 1rem; }
.field { display: flex; flex-direction: column; gap: .35rem; }
.field-inline { flex-direction: row; align-items: center; justify-content: space-between; gap: 1rem; padding: .3rem 0; }
.label { font-weight: 600; font-size: .88rem; } .req { color: var(--err); } .help { color: var(--muted); font-size: .78rem; }
.form-actions { margin-top: .4rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.switch { position: relative; width: 44px; height: 24px; flex-shrink: 0; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; inset: 0; background: var(--surface-3); border: 1px solid var(--border-2); border-radius: 24px; cursor: pointer; transition: .2s; }
.slider::before { content: ''; position: absolute; width: 16px; height: 16px; top: 3px; inset-inline-start: 3px; background: #9a9aa6; border-radius: 50%; transition: .2s; }
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider::before { background: var(--primary-ink); transform: translateX(-20px); }
.color-input { width: 42px; height: 38px; padding: 2px; background: var(--bg); border: 1px solid var(--border-2); border-radius: 10px; cursor: pointer; }
.tags { display: flex; flex-wrap: wrap; gap: .4rem; padding: .4rem; border: 1px solid var(--border-2); border-radius: 10px; background: var(--bg); align-items: center; min-height: 42px; }
.tag-input { flex: 1; min-width: 120px; background: none; border: 0; outline: none; color: var(--text); font: inherit; padding: .2rem; }
.tags .input-inline { border: 0; background: var(--surface-2); padding: .25rem .6rem; }
.chip { display: inline-flex; align-items: center; gap: .35rem; background: var(--surface-3); border: 1px solid var(--border-2); border-radius: 999px; padding: .15rem .65rem; font-size: .82rem; }
.chip .chip { border: 0; padding: 0; background: none; }
.chip-x { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0 .1rem; font-size: .75rem; } .chip-x:hover { color: var(--err); }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.picker { position: relative; } .picker .chip-user { padding: .3rem .8rem; }
.picker-results { position: absolute; z-index: 50; inset-inline: 0; top: calc(100% + 4px); background: var(--surface-2); border: 1px solid var(--border-2); border-radius: 10px; max-height: 260px; overflow: auto; box-shadow: 0 12px 30px rgba(0,0,0,.5); }
.picker-item { display: flex; align-items: center; gap: .6rem; width: 100%; background: none; border: 0; color: var(--text); padding: .5rem .8rem; cursor: pointer; text-align: start; font: inherit; } .picker-item:hover { background: var(--surface-3); }
.picker-empty { padding: .8rem; color: var(--muted); text-align: center; }

/* ---------- cards & tables */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .8rem; flex-wrap: wrap; padding: .9rem 1.1rem; border-bottom: 1px solid var(--border); }
.card-body { padding: 1.1rem; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.3rem; }
.page-head .muted { margin-top: .2rem; font-size: .9rem; }
.table-wrap { overflow-x: auto; border-radius: 10px; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: start; color: var(--muted); font-weight: 500; font-size: .78rem; padding: .6rem .8rem; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: .65rem .8rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; } .table tbody tr:hover { background: rgba(255,255,255,.02); }
.table .actions { text-align: end; white-space: nowrap; } .table .actions .btn { margin-inline-start: .3rem; }
.badge { display: inline-block; padding: .1rem .6rem; border-radius: 999px; font-size: .75rem; font-weight: 600; border: 1px solid transparent; white-space: nowrap; }
.badge-ok { color: var(--ok); background: rgba(62,207,142,.1); border-color: rgba(62,207,142,.3); }
.badge-off, .badge-err { color: var(--err); background: rgba(255,93,108,.1); border-color: rgba(255,93,108,.3); }
.badge-warn { color: var(--warn); background: rgba(245,181,68,.1); border-color: rgba(245,181,68,.3); }
.badge-info { color: var(--info); background: rgba(110,168,254,.1); border-color: rgba(110,168,254,.3); }
.badge-muted { color: var(--muted); background: var(--surface-2); border-color: var(--border-2); }
.avatar { border-radius: 50%; background: var(--surface-3); object-fit: cover; flex-shrink: 0; vertical-align: middle; }
.user-cell { display: inline-flex; align-items: center; gap: .5rem; } .user-cell .id, .id { color: var(--muted); direction: ltr; }
.id-chip { background: var(--surface-2); border: 1px solid var(--border-2); color: var(--muted); border-radius: 6px; padding: .05rem .5rem; font-family: ui-monospace, Menlo, monospace; font-size: .75rem; cursor: pointer; direction: ltr; } .id-chip:hover { color: var(--text); }
.pager { display: flex; justify-content: center; align-items: center; gap: 1rem; margin-top: 1rem; }
.tabs { display: flex; gap: .3rem; border-bottom: 1px solid var(--border); margin-bottom: 1.2rem; overflow-x: auto; }
.tab { background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted); padding: .6rem 1rem; cursor: pointer; font: inherit; font-weight: 600; white-space: nowrap; margin-bottom: -1px; } .tab:hover { color: var(--text); } .tab.active { color: var(--text); border-bottom-color: var(--primary); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .9rem; margin-bottom: 1.2rem; }
.stat { display: flex; gap: .9rem; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem; }
.stat-icon { width: 42px; height: 42px; border-radius: 12px; background: var(--surface-3); display: grid; place-items: center; font-size: 1.25rem; flex-shrink: 0; }
.stat-value { font-size: 1.35rem; font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; } .stat-label { color: var(--muted); font-size: .8rem; } .stat-hint { color: var(--muted); font-size: .72rem; }
.empty { text-align: center; padding: 2.2rem 1rem; color: var(--muted); } .empty-icon { font-size: 2rem; margin-bottom: .4rem; opacity: .7; }
.loader-wrap { display: grid; place-items: center; padding: 4rem 0; }
.spinner { width: 34px; height: 34px; border: 3px solid var(--border-2); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toasts { position: fixed; z-index: 200; bottom: 1.2rem; inset-inline-start: 1.2rem; display: flex; flex-direction: column; gap: .5rem; max-width: calc(100vw - 2.4rem); }
.toast { background: var(--surface-2); border: 1px solid var(--border-2); border-radius: 10px; padding: .7rem 1rem; box-shadow: 0 10px 30px rgba(0,0,0,.5); animation: pop .2s ease; transition: opacity .4s; }
.toast-ok { border-inline-start: 3px solid var(--ok); } .toast-err { border-inline-start: 3px solid var(--err); } .toast.out { opacity: 0; }
@keyframes pop { from { transform: translateY(10px); opacity: 0; } }
.overlay { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.65); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 1rem; overflow-y: auto; }
.modal { background: var(--surface); border: 1px solid var(--border-2); border-radius: 16px; width: 100%; max-width: 520px; max-height: calc(100vh - 2rem); display: flex; flex-direction: column; box-shadow: 0 30px 80px rgba(0,0,0,.6); animation: pop .18s ease; }
.modal-wide { max-width: 760px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: .9rem 1.2rem; border-bottom: 1px solid var(--border); }
.modal-body { padding: 1.2rem; overflow-y: auto; }
.confirm-text { margin-bottom: 1.2rem; line-height: 1.8; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .5rem 1.2rem; font-size: .9rem; } .kv dt { color: var(--muted); } .kv dd { margin: 0; overflow-wrap: anywhere; }
.preview-img { width: 100%; border-radius: 10px; border: 1px solid var(--border-2); background: var(--surface-2); display: block; }
.notice { background: var(--surface-2); border: 1px solid var(--border-2); border-inline-start: 3px solid var(--warn); border-radius: 10px; padding: .7rem 1rem; font-size: .85rem; color: #d0d0da; margin-bottom: 1rem; }
.notice-info { border-inline-start-color: var(--info); }
.sub-card { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: .9rem 1rem; }
.rule-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .2rem; } .rule-head h3 { font-size: .98rem; }
.clip { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; vertical-align: bottom; }
.chart { width: 100%; height: 190px; display: block; } .chart text { fill: var(--muted); font-size: 10px; font-family: var(--font); } .chart .bar { fill: #d4d4de; } .chart .bar:hover { fill: #fff; } .chart .grid-line { stroke: var(--border); stroke-width: 1; }
.log-line { display: flex; gap: .7rem; align-items: baseline; padding: .5rem 0; border-bottom: 1px solid var(--border); font-size: .86rem; flex-wrap: wrap; } .log-line:last-child { border: 0; }

/* ---------- landing */
.landing { min-height: 100vh; display: flex; flex-direction: column; background: radial-gradient(900px 500px at 80% -10%, rgba(255,255,255,.07), transparent), radial-gradient(700px 400px at 0% 100%, rgba(140,140,170,.08), transparent); }
.land-nav { display: flex; justify-content: space-between; align-items: center; padding: 1.2rem clamp(1rem, 5vw, 4rem); }
.hero { flex: 1; display: grid; place-items: center; text-align: center; padding: 3rem 1.2rem; }
.hero h1 { font-size: clamp(2.2rem, 6vw, 3.8rem); background: var(--silver); -webkit-background-clip: text; background-clip: text; color: transparent; margin-bottom: 1rem; }
.hero p { max-width: 560px; margin: 0 auto 2rem; color: var(--muted); font-size: 1.1rem; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1rem; max-width: 980px; margin: 3rem auto 0; text-align: start; }
.feature { background: rgba(19,19,23,.7); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem; } .feature b { display: block; margin: .3rem 0; } .feature span { color: var(--muted); font-size: .85rem; }
.alert { max-width: 480px; margin: 0 auto 1.5rem; background: rgba(255,93,108,.1); border: 1px solid rgba(255,93,108,.35); color: #ffb3bb; border-radius: 10px; padding: .7rem 1rem; }
.logo { display: inline-flex; align-items: center; gap: .6rem; font-weight: 700; font-size: 1.2rem; }
.logo-mark { width: 32px; height: 32px; border-radius: 9px; background: var(--silver); color: #0b0b0d; display: grid; place-items: center; font-weight: 800; }

/* ---------- servers */
.container { width: 100%; max-width: 1100px; margin: 0 auto; padding: 1.5rem clamp(1rem, 4vw, 2rem) 4rem; }
.guild-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1rem; }
.guild-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 1.2rem; display: flex; flex-direction: column; align-items: center; gap: .7rem; text-align: center; transition: .15s; }
.guild-card:hover { border-color: #55555f; transform: translateY(-2px); }
.guild-icon { width: 68px; height: 68px; border-radius: 20px; background: var(--surface-3); display: grid; place-items: center; font-size: 1.5rem; font-weight: 700; overflow: hidden; } .guild-icon img { width: 100%; height: 100%; object-fit: cover; }
.section-title { margin: 2rem 0 1rem; font-size: 1.1rem; color: var(--muted); }

/* ---------- shell */
.topbar { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .65rem clamp(.8rem, 3vw, 1.5rem); background: rgba(11,11,13,.85); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.top-user { display: flex; align-items: center; gap: .7rem; }
.shell { display: grid; grid-template-columns: 250px 1fr; min-height: calc(100vh - 58px); }
.sidebar { border-inline-end: 1px solid var(--border); padding: 1rem .7rem; position: sticky; top: 58px; align-self: start; height: calc(100vh - 58px); overflow-y: auto; }
.side-guild { display: flex; align-items: center; gap: .7rem; padding: .6rem; margin-bottom: .8rem; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; } .side-guild b { display: block; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 140px; }
.nav-item { display: flex; align-items: center; gap: .7rem; padding: .55rem .8rem; border-radius: 10px; color: #b4b4c0; font-weight: 500; font-size: .93rem; cursor: pointer; }
.nav-item:hover { background: var(--surface-2); color: var(--text); } .nav-item.active { background: var(--surface-3); color: #fff; }
.nav-icon { width: 22px; text-align: center; }
.content { padding: 1.6rem clamp(1rem, 3vw, 2rem) 4rem; min-width: 0; }
.burger { display: none; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 60; top: 0; bottom: 0; inset-inline-start: 0; width: 270px; height: auto; background: var(--bg); transform: translateX(100%); transition: transform .2s; padding-top: 4.2rem; }
  [dir=ltr] .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none !important; box-shadow: 0 0 60px rgba(0,0,0,.7); }
  .burger { display: inline-flex; }
}
@media (max-width: 700px) {
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { border: 1px solid var(--border); border-radius: 10px; margin-bottom: .7rem; padding: .4rem .2rem; background: var(--surface); }
  .table td { display: flex; justify-content: space-between; align-items: center; gap: 1rem; border: 0; padding: .35rem .8rem; text-align: end; }
  .table td::before { content: attr(data-label); color: var(--muted); font-size: .75rem; flex-shrink: 0; }
  .table td.actions { justify-content: flex-end; flex-wrap: wrap; } .table td.actions::before { display: none; }
  .page-head h1 { font-size: 1.3rem; } .field-inline { align-items: flex-start; }
  .toasts { inset-inline: 1rem; }
}

/* ---------- legal pages (privacy) */
.doc { max-width: 820px; margin: 0 auto; padding: 2rem clamp(1rem, 4vw, 2rem) 5rem; line-height: 1.85; color: #d4d4dc; }
.doc h1 { font-size: clamp(1.7rem, 4vw, 2.3rem); color: var(--text); margin-bottom: .6rem; }
.doc h2 { font-size: 1.2rem; color: var(--text); margin: 2.2rem 0 .7rem; padding-top: 1.4rem; border-top: 1px solid var(--border); }
.doc h3 { font-size: 1rem; color: var(--text); margin: 1.3rem 0 .4rem; }
.doc p { margin: 0 0 .85rem; }
.doc ul { margin: 0 0 1rem; padding-inline-start: 1.4rem; }
.doc li { margin-bottom: .3rem; }
.doc li::marker { color: var(--muted); }
.doc a { color: #fff; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--border-2); } .doc a:hover { text-decoration-color: #fff; }
.doc-meta { color: var(--muted); font-size: .9rem; margin-bottom: 1.6rem !important; }
.doc-end { border: 0; border-top: 1px solid var(--border-2); margin: 2.5rem 0 1.2rem; }
.doc-foot { color: var(--muted); font-size: .92rem; } .doc-foot b { color: var(--text); }
.legal-links { display: flex; gap: 1.2rem; justify-content: center; padding: 1.4rem 1rem 2rem; color: var(--muted); font-size: .85rem; } .legal-links a:hover { color: var(--text); }
.form-section { margin-top: .8rem; padding-top: .9rem; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: .15rem; } .form-section h4 { margin: 0; font-size: .98rem; }
.panel-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 1rem; overflow: hidden; }
.panel-box-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; padding: 1rem 1.1rem; border-bottom: 1px solid var(--border); }
.panel-box-head p { color: var(--muted); font-size: .85rem; margin-top: .2rem; max-width: 640px; overflow-wrap: anywhere; }
.panel-box .card-body { padding: .4rem 1rem 1rem; }
