:root {
  --bg: #f4f5f7; --surface: #ffffff; --surface2: #eceef2; --text: #1f232b; --muted: #636b79; --line: #dcdfe5;
  --accent: #4a5f8f; --accent-ink: #ffffff; --accent-soft: #e4e9f3; --danger: #b8453a; --warn: #a8731e; --ok: #3d7d5a;
  --shadow: 0 1px 2px rgba(20,25,40,.05), 0 4px 14px -8px rgba(20,25,40,.1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14161b; --surface: #1b1e25; --surface2: #242830; --text: #e5e8ee; --muted: #9aa2b1; --line: #2d323c;
    --accent: #8ea4d6; --accent-ink: #12151d; --accent-soft: #252c3d; --danger: #e8776b; --warn: #d9a950; --ok: #74c29a;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 20px -10px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #14161b; --surface: #1b1e25; --surface2: #242830; --text: #e5e8ee; --muted: #9aa2b1; --line: #2d323c;
  --accent: #8ea4d6; --accent-ink: #12151d; --accent-soft: #252c3d; --danger: #e8776b; --warn: #d9a950; --ok: #74c29a;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 20px -10px rgba(0,0,0,.6);
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.55 "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; } a:hover { text-decoration: underline; }
h1 { font-size: 1.7rem; margin: .2rem 0 .6rem; text-wrap: balance; } h2 { font-size: 1.15rem; margin: 0 0 .6rem; } h3 { margin: 0; font-size: 1.05rem; }
code { background: var(--surface2); padding: .1em .4em; border-radius: 6px; font-size: .88em; }
.muted { color: var(--muted); } .small { font-size: .82rem; } .pad { padding: .6rem .8rem; }

.top { display: flex; align-items: center; justify-content: space-between; gap: .8rem; flex-wrap: wrap; padding: .7rem 1rem; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 800; font-size: 1.15rem; color: var(--text); } .brand:hover { text-decoration: none; } .leaf { margin-right: .2rem; }
.top-r { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg a { padding: .25rem .65rem; font-size: .8rem; font-weight: 700; color: var(--muted); } .seg a.on { background: var(--accent); color: var(--accent-ink); } .seg a:hover { text-decoration: none; }
.icon-btn { border: 1px solid var(--line); background: var(--surface); color: var(--text); width: 34px; height: 34px; border-radius: 50%; cursor: pointer; font-size: 1rem; }
.inline { display: inline; margin: 0; }

.shell { max-width: 1120px; margin: 0 auto; padding: 1.2rem 1rem 3rem; }
.shell.with-side { max-width: none; padding: 0; display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 0; align-items: start; }
.shell.with-side > main { padding: 1.2rem 1.6rem 3rem; max-width: 1500px; }
.mod-ic { filter: grayscale(1) contrast(1.15); }
.side { display: flex; flex-direction: column; gap: .2rem; position: sticky; top: 3.6rem; height: calc(100vh - 3.6rem); overflow-y: auto; padding: .8rem .6rem; background: var(--surface); border-right: 1px solid var(--line); }
.side a { padding: .5rem .7rem; border-radius: 10px; color: var(--text); font-weight: 600; } .side a:hover { background: var(--surface2); text-decoration: none; }
.side a.on { background: var(--accent-soft); color: var(--accent); } .side a.muted { color: var(--muted); font-weight: 500; margin-top: .6rem; }
.guild-chip { display: flex !important; align-items: center; gap: .6rem; margin-bottom: .5rem; background: var(--surface); border: 1px solid var(--line); }
.guild-chip img, .ph { border-radius: 50%; } .ph { display: inline-grid; place-items: center; width: 36px; height: 36px; background: var(--accent-soft); color: var(--accent); font-weight: 800; }
.guild-chip b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
main { min-width: 0; }

.btn { display: inline-block; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); padding: .5rem 1rem; border-radius: 10px; font: inherit; font-weight: 700; cursor: pointer; }
.btn:hover { filter: brightness(1.06); text-decoration: none; }
.btn.ghost { background: transparent; color: var(--accent); } .btn.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn.sm { padding: .25rem .65rem; font-size: .82rem; } .btn.big { padding: .75rem 1.4rem; font-size: 1.02rem; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }

.hero { padding: 2.5rem 0 1.5rem; } .hero h1 { font-size: 2.3rem; max-width: 18ch; } .hero.small { padding: 3rem 0; }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 60ch; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 1.1rem 1.2rem; margin-bottom: 1rem; box-shadow: var(--shadow); }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; margin-bottom: 1rem; } .grid3 .card { margin: 0; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; } .grid2 .card { margin: 0; }
.stat { display: flex; flex-direction: column; } .num { font-size: 2rem; font-weight: 800; color: var(--accent); line-height: 1.1; }
.srv-h { display: flex; align-items: center; gap: .7rem; margin-bottom: .8rem; } .srv-h img { border-radius: 50%; }
.list { list-style: none; margin: 0; padding: 0; } .list li { display: flex; justify-content: space-between; align-items: center; padding: .55rem 0; border-top: 1px solid var(--line); } .list li:first-child { border-top: 0; }

.mod.is-off { opacity: .85; } .mod-h { display: flex; gap: .8rem; align-items: center; } .mod h3 a { color: var(--text); }
.mod-ic { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--accent-soft); font-size: 1.4rem; } .mod-ic.big { width: 56px; height: 56px; font-size: 1.8rem; }
.mod-top { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; } .mod-top h1 { margin: 0; }
.crumb { margin: 0 0 .4rem; }
.badge { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .74rem; font-weight: 800; background: var(--surface2); color: var(--muted); border: 1px solid var(--line); }
.badge.on, .badge.st-active { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.badge.off, .badge.st-cancelled { background: transparent; color: var(--danger); border-color: var(--danger); }

.tabs { display: flex; flex-wrap: wrap; gap: .3rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; }
.tabs a { padding: .55rem 1rem; color: var(--muted); font-weight: 700; border-bottom: 3px solid transparent; margin-bottom: -1px; } .tabs a.on { color: var(--accent); border-color: var(--accent); } .tabs a:hover { text-decoration: none; }

.tbl-wrap { overflow-x: auto; } .tbl { width: 100%; border-collapse: collapse; } .tbl th { text-align: left; font-size: .75rem; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding: .5rem .6rem; }
.tbl td { padding: .7rem .6rem; border-top: 1px solid var(--line); vertical-align: top; } .tbl tr.sub td { border-top: 0; padding-top: 0; }
.acts { white-space: nowrap; }

.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem 1.4rem; margin-bottom: 1rem; }
.field { display: flex; flex-direction: column; gap: .3rem; min-width: 0; } .field.wide, .row.wide { grid-column: 1 / -1; }
.lab { font-weight: 800; }
input[type=text], input[type=number], input[type=url], select, textarea { width: 100%; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: .5rem .7rem; font: inherit; }
input[type=color] { width: 64px; height: 38px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 2px; }
input:focus-visible, select:focus-visible, textarea:focus-visible, .btn:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch { position: relative; display: inline-block; width: 46px; height: 26px; } .switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--line); border-radius: 999px; transition: background .15s; cursor: pointer; }
.switch span::before { content: ""; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform .15s; }
.switch input:checked + span { background: var(--accent); } .switch input:checked + span::before { transform: translateX(20px); } .switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.picker { position: relative; } .picker summary { list-style: none; cursor: pointer; border: 1px solid var(--line); border-radius: 10px; padding: .5rem .7rem; background: var(--surface); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker summary::-webkit-details-marker { display: none; } .picker summary::after { content: "▾"; float: right; color: var(--muted); }
.picker-list { position: fixed; z-index: 50; min-width: 220px; max-height: 260px; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--line) transparent; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: .3rem; }
.picker-list::-webkit-scrollbar { width: 8px; } .picker-list::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; }
.picker-list .opt { min-width: 0; overflow-wrap: anywhere; }
.opt { display: flex; align-items: center; gap: .5rem; padding: .3rem .5rem; border-radius: 8px; cursor: pointer; } .opt:hover { background: var(--surface2); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: none; }

.flash { padding: .7rem 1rem; border-radius: 12px; margin-bottom: 1rem; border: 1px solid var(--line); background: var(--surface); font-weight: 600; }
.flash.ok { border-color: var(--ok); color: var(--ok); } .flash.warn { border-color: var(--warn); color: var(--warn); } .flash.error { border-color: var(--danger); color: var(--danger); }
summary.h2 { font-size: 1.15rem; font-weight: 800; cursor: pointer; margin-bottom: .6rem; }
.foot { text-align: center; color: var(--muted); padding: 1.5rem 1rem 2rem; font-size: .85rem; }

@media (max-width: 760px) {
  .shell.with-side { grid-template-columns: 1fr; }
  .side { flex-direction: row; flex-wrap: wrap; position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); } .shell.with-side > main { padding: 1rem; } .guild-chip { flex-basis: 100%; }
  .hero h1 { font-size: 1.8rem; }
}

.flags { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .25rem .75rem; }
.flags .flag-h { grid-column: 1 / -1; margin: .75rem 0 .1rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; opacity: .7; }
.flag { display: flex; gap: .45rem; align-items: center; font-size: .9rem; }
textarea { width: 100%; font: inherit; }
.chk { display: inline-flex; align-items: center; gap: .4rem; margin-right: 1.2rem; }
fieldset.slot { border: 1px solid var(--line); border-radius: 10px; padding: .6rem .9rem; margin: 0; min-width: 0; }
fieldset.slot .fields { margin-bottom: 0; }
.sv { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 1rem; align-items: start; }
.sv-side { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: .6rem; display: flex; flex-direction: column; gap: .35rem; position: sticky; top: .5rem; max-height: calc(100vh - 1.5rem); }
.sv-head { display: flex; gap: .6rem; align-items: center; text-decoration: none; color: var(--text); padding: .2rem .2rem .5rem; border-bottom: 1px solid var(--line); }
.sv-head > span:last-child { display: flex; flex-direction: column; min-width: 0; } .sv-head small { font-size: .75rem; }
.sv-head img, .ph { border-radius: 50%; width: 36px; height: 36px; flex: none; background: var(--surface2); display: grid; place-items: center; }
.sv-link, a.ch2 { display: flex; gap: .45rem; align-items: center; padding: .3rem .55rem; border-radius: 8px; color: var(--text); text-decoration: none; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sv-link:hover, a.ch2:hover { background: var(--surface2); } .sv-link.on, a.ch2.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.sv-list { overflow-y: auto; display: flex; flex-direction: column; gap: 1px; }
.sv-list h3 { font-size: .7rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: .6rem .4rem .15rem; }
.ci { width: 1.1rem; text-align: center; flex: none; color: var(--muted); }
#sv-search { width: 100%; }
.sv-main { min-width: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .7rem; margin: 1rem 0; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: .8rem 1rem; display: flex; flex-direction: column; }
.stat b { font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.chead { display: flex; gap: .7rem; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 12px 12px 0 0; padding: .6rem .9rem; flex-wrap: wrap; }
.chead > div:nth-child(2) { display: flex; flex-direction: column; min-width: 0; flex: 1; } .chead small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cico { font-size: 1.3rem; color: var(--muted); }
.tog { display: flex; gap: 2px; background: var(--surface2); border-radius: 8px; padding: 2px; }
.tog a { padding: .2rem .6rem; border-radius: 6px; text-decoration: none; color: var(--muted); font-size: .85rem; } .tog a.on { background: var(--surface); color: var(--accent); font-weight: 600; }
.mlog { background: var(--surface); border: 1px solid var(--line); border-top: 0; height: 58vh; overflow-y: auto; padding: .6rem .9rem; display: flex; flex-direction: column; gap: .7rem; }
.msg { display: flex; gap: .65rem; } .msg > img { border-radius: 50%; width: 36px; height: 36px; flex: none; }
.msg-body { min-width: 0; } .mh { display: flex; gap: .5rem; align-items: baseline; flex-wrap: wrap; }
.mt { overflow-wrap: anywhere; } .mt code { background: var(--surface2); padding: 0 .25rem; border-radius: 4px; }
.emb { border-left: 4px solid var(--accent); background: var(--surface2); border-radius: 4px; padding: .4rem .7rem; margin-top: .3rem; max-width: 520px; display: grid; gap: .25rem; }
.att { max-width: min(100%, 400px); border-radius: 6px; margin-top: .25rem; }
.btns { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .3rem; }
.btn2 { background: var(--accent-soft); color: var(--accent); border-radius: 6px; padding: .2rem .7rem; font-size: .85rem; } .btn2.sel { background: var(--surface2); color: var(--muted); min-width: 160px; }
.pad { padding: .5rem; }
.compose { background: var(--surface); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 12px 12px; padding: .7rem .9rem; display: grid; gap: .4rem; }
.cbox { display: flex; gap: .6rem; align-items: flex-end; } .cbox textarea { flex: 1; resize: none; overflow-y: auto; }
@media (max-width: 760px) { .sv { grid-template-columns: 1fr; } .sv-side { position: static; max-height: 40vh; } }
.tag { font-size: .65rem; background: var(--accent-soft); color: var(--accent); border-radius: 4px; padding: 0 .35rem; margin-right: .3rem; }

.sw { position: relative; display: inline-block; width: 46px; height: 26px; cursor: pointer; flex: none; }
.sw input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.sw-track { position: absolute; inset: 0; background: var(--line); border-radius: 999px; transition: background .12s; }
.sw-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .12s; }
.sw input:checked + .sw-track { background: var(--accent); } .sw input:checked + .sw-track::after { transform: translateX(20px); }
.sw input:focus-visible + .sw-track { outline: 2px solid var(--accent); outline-offset: 2px; } .sw input:disabled + .sw-track { opacity: .6; }
