:root {
    --bg: #0f1115;
    --bg2: #161a22;
    --card: #1a1f2b;
    --card2: #202634;
    --text: #e6e9f0;
    --muted: #8b94a8;
    --border: #272e3d;
    --accent: #7c5cff;
    --accent2: #9d85ff;
    --green: #a3e635;
    --danger: #f87171;
    --warn: #fbbf24;
    --radius: 12px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

a { color: var(--accent2); text-decoration: none; }
a:hover { text-decoration: none; }

code.mono { background: #232a38; padding: 1px 6px; border-radius: 5px; font-size: 12px; }

.container { max-width: 960px; margin: 0 auto; padding: 24px 16px 64px; }

/* ---------- top bar (public pages) ---------- */
header.top { background: var(--bg2); border-bottom: 1px solid var(--border); }
header.top .container { display: flex; align-items: center; justify-content: space-between; max-width: 1080px; padding: 14px 16px; }
header.top .brand { font-weight: 800; font-size: 20px; letter-spacing: 0.5px; color: var(--text); }
header.top nav a { margin-left: 16px; color: var(--muted); }
header.top nav a:hover { color: var(--text); }

/* ---------- landing ---------- */
.hero-dark {
    background: radial-gradient(1200px 500px at 70% -10%, #2a2050 0%, var(--bg) 55%);
    text-align: center; padding: 90px 16px 60px;
}
.hero-dark h1 { font-size: 46px; margin: 0 0 12px; line-height: 1.15; }
.hero-dark h1 .hl { color: var(--green); }
.hero-dark .sub { font-weight: 700; font-size: 20px; margin: 0 0 6px; }
.hero-dark .stats { color: var(--muted); font-size: 14px; margin: 0 0 32px; }
.hero-cta .btn { margin: 0 6px; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-top: 40px; }
.features .card { margin-top: 0; }
.features h3 { margin: 0 0 6px; font-size: 15px; }
.features p { margin: 0; color: var(--muted); font-size: 13px; }
.hero-showcase {
    margin: 48px auto 0; max-width: 820px; height: 320px; border-radius: var(--radius);
    background: linear-gradient(135deg, var(--accent) 0%, #1a1030 70%);
    display: flex; align-items: center; justify-content: center;
    color: rgba(255,255,255,0.85); font-size: 22px; font-weight: 700; letter-spacing: 2px;
    border: 1px solid var(--border);
}
footer { text-align: center; color: var(--muted); font-size: 13px; padding: 40px 0; }

/* ---------- buttons ---------- */
.btn {
    display: inline-block; border: none; border-radius: 9px; cursor: pointer;
    background: var(--accent); color: #fff !important; padding: 10px 18px; font-size: 14px; font-weight: 600;
}
.btn:hover { background: var(--accent2); text-decoration: none; }
.btn.secondary { background: transparent; color: var(--accent2) !important; border: 1px solid var(--accent); }
.btn.secondary:hover { background: rgba(124,92,255,0.12); }
.btn.small { padding: 6px 12px; font-size: 13px; }

/* ---------- cards & forms ---------- */
.card {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 20px 24px; margin-top: 20px;
}
.card h2 { margin: 0 0 4px; font-size: 17px; }
.card .sub { color: var(--muted); font-size: 13px; margin-bottom: 14px; }

label { display: block; font-weight: 600; font-size: 13px; margin: 16px 0 4px; }
label .hint { font-weight: 400; color: var(--muted); }
input[type=text], input[type=password], textarea, select {
    width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px;
    font-size: 14px; font-family: inherit; background: var(--bg2); color: var(--text);
}
textarea { min-height: 70px; resize: vertical; }
select { width: auto; min-width: 160px; }
input:focus, textarea:focus, select:focus { outline: 2px solid rgba(124,92,255,0.4); border-color: var(--accent); }
.checkbox { display: flex; align-items: flex-start; gap: 10px; margin-top: 14px; font-size: 14px; }
.checkbox input { width: auto; margin-top: 4px; }
.actions { margin-top: 24px; display: flex; gap: 10px; align-items: center; }

.flash { padding: 12px 16px; border-radius: 9px; margin: 16px 0; font-size: 14px; }
.flash.error { background: rgba(248,113,113,0.12); color: var(--danger); border: 1px solid rgba(248,113,113,0.35); }
.flash.ok { background: rgba(163,230,53,0.1); color: var(--green); border: 1px solid rgba(163,230,53,0.3); }

/* ---------- dashboard shell: sidebar + content ---------- */
.shell { display: flex; min-height: 100vh; }
aside.side {
    width: 230px; flex-shrink: 0; background: var(--bg2); border-right: 1px solid var(--border);
    padding: 16px 12px; display: flex; flex-direction: column; gap: 4px;
}
aside.side .brand { font-weight: 800; font-size: 20px; letter-spacing: 0.5px; color: var(--text); padding: 2px 12px 16px; }
aside.side .guild {
    background: var(--card); border: 1px solid var(--border); border-radius: 9px;
    padding: 10px 12px; font-size: 13px; font-weight: 600; margin-bottom: 14px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
aside.side .guild .gname { overflow: hidden; text-overflow: ellipsis; max-width: 130px; }
aside.side .guild .gid { display: block; width: 100%; font-weight: 400; color: var(--muted); font-size: 11px; }
.side-icon, .list-icon { width: 22px; height: 22px; border-radius: 6px; vertical-align: middle; }
.list-icon { width: 20px; height: 20px; }
aside.side a.nav {
    display: block; padding: 8px 12px; border-radius: 8px; color: var(--muted); font-size: 14px;
}
aside.side a.nav:hover { color: var(--text); background: var(--card); }
aside.side a.nav.active { background: rgba(124,92,255,0.18); color: var(--accent2); font-weight: 600; }
aside.side .section { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 1px; padding: 14px 12px 4px; }
aside.side .foot { margin-top: auto; padding: 12px; font-size: 12px; color: var(--muted); }
main.content { flex: 1; padding: 26px 32px 64px; max-width: 980px; }

/* ---------- overview welcome header ---------- */
.welcome { display: flex; align-items: center; gap: 16px; margin-top: 4px; }
.welcome-icon { width: 56px; height: 56px; border-radius: 14px; }
.welcome-hi { color: var(--muted); font-size: 14px; }
.welcome-name { font-size: 26px; font-weight: 800; line-height: 1.2; }

.callout {
    margin-top: 16px; padding: 13px 16px; border-radius: 9px; font-size: 14px;
    background: rgba(124,92,255,0.12); border: 1px solid rgba(124,92,255,0.4);
}

/* ---------- pickers ---------- */
.pickgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 4px 14px; margin-top: 6px; max-height: 260px; overflow-y: auto; }
label.pick { display: flex; align-items: center; gap: 8px; font-weight: 400; font-size: 13px; margin: 0; cursor: pointer; padding: 3px 4px; border-radius: 6px; }
label.pick:hover { background: var(--card2); }
label.pick input { width: auto; margin: 0; }

/* ---------- stat cards ---------- */
.statgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-top: 20px; }
.stat {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 16px 18px;
}
.stat .num { font-size: 26px; font-weight: 800; }
.stat .lbl { color: var(--muted); font-size: 13px; }

/* ---------- checklist ---------- */
ul.checklist { list-style: none; margin: 16px 0 0; padding: 0; }
ul.checklist li { display: flex; gap: 14px; padding: 13px 4px; border-bottom: 1px solid var(--border); align-items: flex-start; }
ul.checklist li:last-child { border-bottom: none; }
ul.checklist .mark { font-size: 19px; line-height: 1.2; color: var(--muted); }
ul.checklist li.done .mark { color: var(--green); }
ul.checklist li.done strong { color: var(--muted); text-decoration: line-through; }
ul.checklist .hint { color: var(--muted); font-size: 13px; }

.pill { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; margin-left: 8px; vertical-align: middle; }
.pill.ok { background: rgba(163,230,53,0.12); color: var(--green); }
.pill.warn { background: rgba(251,191,36,0.12); color: var(--warn); }

/* ---------- presets ---------- */
.presets { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.preset { border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; background: var(--bg2); }
.preset .hint { margin: 6px 0 12px; font-size: 13px; color: var(--muted); }
.preset strong { font-size: 14px; }
.checkbox .hint { color: var(--muted); font-weight: 400; font-size: 13px; }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 12px; }
table th { text-align: left; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 2px solid var(--border); }
table td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
table tr:last-child td { border-bottom: none; }
td.last-msg { max-width: 260px; overflow-wrap: anywhere; color: var(--muted); }

/* ---------- tier editor ---------- */
.tier-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.tier-row select { width: auto; min-width: 150px; }
.tier-at input { width: 70px; text-align: right; }

/* ---------- guides / collapsibles ---------- */
details.guide { background: var(--bg2); border: 1px solid var(--border); border-radius: 9px; padding: 12px 16px; margin: 14px 0 18px; }
details.guide summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--accent2); }
details.guide .guide-steps { margin: 14px 0 4px; padding-left: 22px; font-size: 14px; }
details.guide .guide-steps li { margin-bottom: 14px; }
details.guide .guide-steps .hint { color: var(--muted); font-size: 13px; }

@media (max-width: 860px) {
    .shell { flex-direction: column; }
    aside.side { width: 100%; flex-direction: row; flex-wrap: wrap; align-items: center; }
    aside.side .guild { margin: 0 8px 0 0; }
    main.content { padding: 20px 16px 60px; }
}
