/* Wall-E dashboard — one stylesheet for the server picker and the server
   pages. Same tokens, fonts and ambient light as the home page (views/index.html)
   so the whole site reads as one product. */

@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,600;12..96,700;12..96,800&family=Geist:wght@400;500;600&family=JetBrains+Mono:wght@500&display=swap');

/* ------------------------------------------------------------------ tokens */

:root,
[data-theme="industrial-gold"] {
    --bg: #0F0E0C;
    --surf: #181613;
    --surf-2: #221F1A;
    --surf-3: #2A2620;
    --glass: rgba(34, 31, 26, 0.6);
    --line: #2F2A23;
    --line-strong: #3D362C;
    --text: #EEE7DB;
    --muted: #A69C8D;
    --dim: #8A8173;
    --accent: #E3A33B;
    --accent-2: #F0C36A;
    --accent-soft: rgba(227, 163, 59, 0.14);
    --ink: #1B1407;
    --good: #7BC98F;
    --good-soft: rgba(123, 201, 143, 0.13);
    --bad: #E88C6B;
    --bad-soft: rgba(232, 140, 107, 0.13);
    --idle: #F0B232;
    --grad: linear-gradient(135deg, #E3A33B, #F0C36A);
    --tint: linear-gradient(160deg, rgba(227, 163, 59, 0.10), rgba(227, 163, 59, 0) 58%);
    --glow-1: radial-gradient(circle, rgba(227, 163, 59, 0.42), rgba(227, 163, 59, 0) 70%);
    --glow-2: radial-gradient(circle, rgba(205, 127, 50, 0.34), rgba(205, 127, 50, 0) 70%);
    --glow-shadow: rgba(227, 163, 59, 0.22);
}

[data-theme="walle-eve"] {
    --bg: #0A0F1A;
    --surf: #111A2A;
    --surf-2: #182335;
    --surf-3: #1F2C42;
    --glass: rgba(24, 35, 53, 0.6);
    --line: #26344D;
    --line-strong: #33445F;
    --text: #E7EDF6;
    --muted: #97A6BD;
    --dim: #7E8DA4;
    --accent: #7CC4F2;
    --accent-2: #A9DDFB;
    --accent-soft: rgba(124, 196, 242, 0.14);
    --ink: #06131E;
    --good: #7BD3A0;
    --good-soft: rgba(123, 211, 160, 0.13);
    --bad: #F0907F;
    --bad-soft: rgba(240, 144, 127, 0.13);
    --grad: linear-gradient(135deg, #7CC4F2, #A9DDFB);
    --tint: linear-gradient(160deg, rgba(124, 196, 242, 0.12), rgba(124, 196, 242, 0) 58%);
    --glow-1: radial-gradient(circle, rgba(124, 196, 242, 0.40), rgba(124, 196, 242, 0) 70%);
    --glow-2: radial-gradient(circle, rgba(232, 160, 32, 0.26), rgba(232, 160, 32, 0) 70%);
    --glow-shadow: rgba(124, 196, 242, 0.22);
}

[data-theme="earth-rebirth"] {
    --bg: #0B100D;
    --surf: #121A15;
    --surf-2: #1A251E;
    --surf-3: #213027;
    --glass: rgba(26, 37, 30, 0.6);
    --line: #27382D;
    --line-strong: #34493B;
    --text: #E4EFE7;
    --muted: #98AD9F;
    --dim: #7F9587;
    --accent: #74D69D;
    --accent-2: #A6E9C2;
    --accent-soft: rgba(116, 214, 157, 0.14);
    --ink: #07150D;
    --good: #74D69D;
    --good-soft: rgba(116, 214, 157, 0.13);
    --bad: #E8977C;
    --bad-soft: rgba(232, 151, 124, 0.13);
    --grad: linear-gradient(135deg, #74D69D, #A6E9C2);
    --tint: linear-gradient(160deg, rgba(116, 214, 157, 0.12), rgba(116, 214, 157, 0) 58%);
    --glow-1: radial-gradient(circle, rgba(116, 214, 157, 0.38), rgba(116, 214, 157, 0) 70%);
    --glow-2: radial-gradient(circle, rgba(212, 168, 67, 0.28), rgba(212, 168, 67, 0) 70%);
    --glow-shadow: rgba(116, 214, 157, 0.22);
}

:root {
    --font-display: 'Bricolage Grotesque', 'Geist', system-ui, sans-serif;
    --font-sans: 'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', monospace;
    --radius-sm: 9px;
    --radius: 11px;
    --radius-lg: 16px;
    --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.5);
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    --sidebar-w: 272px;
    --topbar-h: 64px;
    --gap: 18px;
    --card-pad: 20px 22px;
    --control-h: 42px;

    /* Names the page scripts and inline styles still use. */
    --walle-yellow: var(--accent);
    --walle-yellow-light: var(--accent-2);
    --walle-yellow-glow: var(--accent-soft);
    --walle-rust: var(--accent);
    --bg-dark: var(--bg);
    --bg-card: var(--surf);
    --bg-card-solid: var(--surf);
    --bg-card-hover: var(--surf-2);
    --bg-glass: var(--surf);
    --text-primary: var(--text);
    --text-secondary: var(--muted);
    --text-muted: var(--dim);
    --gradient-walle: var(--grad);
    --gradient-tint: var(--tint);
}

/* Appearance settings (account menu → Appearance) */
[data-density="compact"] {
    --gap: 12px;
    --card-pad: 14px 16px;
    --control-h: 36px;
}

[data-textsize="large"] {
    font-size: 17px;
}

/* ------------------------------------------------------------------- base */

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

html {
    font-size: 15px;
    scroll-behavior: smooth;
    /* Fields and buttons brought into view stay clear of the sticky top bar
       and of the unsaved-changes bar at the bottom. */
    scroll-padding-top: 80px;
    scroll-padding-bottom: 120px;
}

[data-textsize="large"] body {
    font-size: 1rem;
}

body {
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 0.94rem;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
    color: inherit;
}

button {
    cursor: pointer;
}

h1,
h2,
h3 {
    font-family: var(--font-display);
    letter-spacing: -0.02em;
    line-height: 1.15;
}

code {
    font-family: var(--font-mono);
    font-size: 0.85em;
    padding: 1px 6px;
    border-radius: 6px;
    background: var(--surf-2);
    border: 1px solid var(--line);
}

small {
    display: block;
    margin-top: 6px;
    color: var(--dim);
    font-size: 0.8rem;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

input[type="checkbox"],
input[type="radio"] {
    accent-color: var(--accent);
}

::selection {
    background: var(--accent-soft);
}

* {
    scrollbar-width: thin;
    scrollbar-color: var(--line-strong) transparent;
}

[hidden] {
    display: none !important;
}

/* Line icons from the page's sprite: <svg class="i"><use href="#i-name"/></svg> */
.i {
    width: 1.1em;
    height: 1.1em;
    flex-shrink: 0;
    vertical-align: -0.18em;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.toggle-item span .i,
.config-title .i,
.row-title .i,
strong .i {
    margin-right: 8px;
    color: var(--muted);
}

.toggle-item.active span .i {
    color: var(--accent);
}

.btn .i {
    width: 1.05em;
    height: 1.05em;
}

.canvas-avatar .i {
    width: 34px;
    height: 34px;
    color: #b5bac1;
}

.emoji-btn .i {
    width: 18px;
    height: 18px;
    color: var(--muted);
}

/* Search fields: a magnifier drawn inside the field. */
input[data-search] {
    padding-left: 40px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23918877' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 14px center;
}

.icon {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

/* Ambient light, like the home page. Off with Appearance → Background glow. */
.ambient {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.ambient span {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.28;
    animation: drift 22s ease-in-out infinite;
}

.ambient span:nth-child(1) {
    width: 620px;
    height: 620px;
    left: 8%;
    top: -260px;
    background: var(--glow-1);
}

.ambient span:nth-child(2) {
    width: 520px;
    height: 520px;
    right: -120px;
    top: 30%;
    background: var(--glow-2);
    animation-direction: reverse;
    animation-duration: 28s;
}

[data-glow="off"] .ambient {
    display: none;
}

@keyframes drift {
    0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
    50% { transform: translate3d(50px, -30px, 0) scale(1.1); }
}

@keyframes rise {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-8px); }
    40%, 80% { transform: translateX(8px); }
}

[data-motion="reduced"] *,
[data-motion="reduced"] *::before,
[data-motion="reduced"] *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
}

@media (prefers-reduced-motion: reduce) {
    .ambient span { animation: none; }
}

/* ------------------------------------------------------------ app shell */

.app {
    position: relative;
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: color-mix(in srgb, var(--surf) 92%, transparent);
    border-right: 1px solid var(--line);
    z-index: 30;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    height: var(--topbar-h);
    flex-shrink: 0;
    padding: 0 20px;
    border-bottom: 1px solid var(--line);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.12rem;
}

.brand svg {
    flex-shrink: 0;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 16px 12px 28px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Generous rows: the whole line is the target, not just the text. */
.sidebar-category {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 46px;
    padding: 0 14px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--muted);
    font-weight: 500;
    text-align: left;
    transition: background 0.14s ease, color 0.14s ease;
}

.sidebar-category:hover {
    background: rgba(255, 255, 255, 0.045);
    color: var(--text);
}

.sidebar-category.has-active {
    color: var(--text);
}

.sidebar-category .cat-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

.sidebar-category .cat-name {
    flex: 1;
}

.sidebar-category .cat-badge {
    display: none;
    height: 20px;
    padding: 0 7px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 20px;
}

.sidebar-category .cat-badge.visible {
    display: inline-block;
}

.sidebar-category .cat-chevron {
    width: 15px;
    height: 15px;
    stroke: var(--dim);
    stroke-width: 2;
    fill: none;
    transition: transform 0.16s ease;
}

.sidebar-category.collapsed .cat-chevron {
    transform: rotate(-90deg);
}

.nav-group {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 2px 0 12px 30px;
}

.nav-group.collapsed {
    display: none;
}

.nav-link-config {
    display: flex;
    align-items: center;
    min-height: 40px;
    padding: 6px 14px;
    border-radius: 10px;
    color: var(--muted);
    font-size: 0.9rem;
    transition: background 0.14s ease, color 0.14s ease;
}

.nav-link-config:hover {
    background: rgba(255, 255, 255, 0.045);
    color: var(--text);
}

.nav-link-config.active {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
}

.sidebar-overlay {
    display: none;
}

.main {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 14px;
    height: var(--topbar-h);
    padding: 0 32px;
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: blur(14px);
}

.topbar .grow {
    flex: 1;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: transparent;
    color: var(--muted);
}

.icon-btn:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.045);
}

.mobile-only {
    display: none;
}

.server-switcher {
    position: relative;
}

.switcher-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 40px;
    max-width: 320px;
    padding: 0 12px 0 6px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--glass);
    font-weight: 600;
    transition: border-color 0.14s ease;
}

.switcher-btn:hover,
.switcher-btn[aria-expanded="true"] {
    border-color: var(--line-strong);
}

.switcher-btn .server-name {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.switcher-btn svg {
    flex-shrink: 0;
    stroke: var(--dim);
}

.server-avatar {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 8px;
    background: var(--surf-3);
    font-size: 0.72rem;
    font-weight: 700;
}

.server-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 50;
    min-width: 280px;
    max-height: 420px;
    overflow-y: auto;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surf);
    box-shadow: var(--shadow-lg);
    animation: rise 0.16s var(--ease);
}

.menu-label {
    padding: 8px 10px 4px;
    color: var(--dim);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 40px;
    padding: 6px 10px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--text);
    text-align: left;
}

.menu-item:hover,
.menu-item:focus-visible {
    background: var(--surf-2);
}

.menu-item.current {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
}

.menu-sep {
    height: 1px;
    margin: 6px 4px;
    background: var(--line);
}

.search-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    width: min(380px, 34vw);
    height: 40px;
    padding: 0 10px 0 12px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surf);
    color: var(--dim);
    text-align: left;
}

.search-trigger:hover {
    border-color: var(--line-strong);
    color: var(--muted);
}

.search-trigger span {
    flex: 1;
}

kbd,
.kbd {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    padding: 2px 6px;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--dim);
    background: transparent;
}

.bot-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 32px;
    padding: 0 12px;
    border-radius: 999px;
    background: var(--surf-2);
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}

.bot-status .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--dim);
}

.bot-status.online {
    background: var(--good-soft);
    color: var(--good);
}

.bot-status.online .dot {
    background: var(--good);
}

.bot-status.offline {
    background: var(--bad-soft);
    color: var(--bad);
}

.bot-status.offline .dot {
    background: var(--bad);
}

.content {
    width: 100%;
    max-width: 1240px;
    margin: 0 auto;
    padding: 28px 32px 140px;
}

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 24px;
    animation: rise 0.35s var(--ease);
}

.crumbs {
    display: flex;
    gap: 8px;
    margin-bottom: 6px;
    color: var(--dim);
    font-size: 0.8rem;
}

.page-head h1 {
    font-size: 1.95rem;
    font-weight: 700;
}

.page-head p {
    max-width: 680px;
    margin-top: 6px;
    color: var(--muted);
}

.cmd-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 34px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--glass);
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 0.78rem;
    white-space: nowrap;
}

.cmd-chip svg {
    stroke: var(--accent);
}

/* ------------------------------------------------------------ sections */

.section {
    display: none;
}

.section.active {
    display: flex;
    flex-direction: column;
    gap: var(--gap);
    animation: rise 0.3s var(--ease);
}

/* Cards in a section are spaced by the gap above, not by their own margins. */
.section > * {
    margin-top: 0 !important;
}

.two-col {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: var(--gap);
}

.three-col {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--gap);
}

.config-card,
.panel {
    position: relative;
    padding: var(--card-pad);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surf);
    transition: border-color 0.2s ease, box-shadow 0.3s ease;
}

.config-card.saved {
    animation: saved-flash 0.9s ease;
}

@keyframes saved-flash {
    0% { box-shadow: 0 0 0 0 var(--good-soft); border-color: var(--good); }
    100% { box-shadow: 0 0 0 10px transparent; }
}

.config-card.dirty {
    border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
}

.config-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.config-title,
.panel h2 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.config-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 26px;
    padding: 0 10px;
    border-radius: 999px;
    background: var(--surf-2);
    color: var(--dim);
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.config-status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.config-status.active {
    background: var(--good-soft);
    color: var(--good);
}

.card-hint {
    margin: -6px 0 16px;
    color: var(--muted);
    font-size: 0.87rem;
    line-height: 1.55;
}

.empty-line {
    color: var(--dim);
    font-size: 0.88rem;
}

/* ---------------------------------------------------------------- forms */

.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 500;
}

.form-select,
.form-input,
.form-textarea,
.ss-display {
    width: 100%;
    min-height: var(--control-h);
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surf-2);
    color: var(--text);
    font-size: 0.92rem;
    transition: border-color 0.14s ease, box-shadow 0.14s ease;
}

select.form-select {
    appearance: none;
    padding-right: 40px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23918877' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    cursor: pointer;
}

select.form-select option {
    background: var(--surf);
    color: var(--text);
}

textarea.form-select,
.form-textarea {
    min-height: 96px;
    padding: 11px 14px;
    resize: vertical;
    line-height: 1.5;
}

input[type="color"].form-select {
    padding: 4px;
    cursor: pointer;
}

input[type="color"].form-select::-webkit-color-swatch-wrapper {
    padding: 0;
}

input[type="color"].form-select::-webkit-color-swatch {
    border: 0;
    border-radius: 8px;
}

.form-select:hover,
.form-input:hover {
    border-color: var(--line-strong);
}

.form-select:focus,
.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.form-select::placeholder,
.form-input::placeholder {
    color: var(--dim);
}

.inline-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.inline-form .form-select,
.inline-form .form-input {
    flex: 1 1 200px;
    width: auto;
}

.channel-picker {
    display: flex;
    gap: 8px;
}

.channel-picker .form-select,
.channel-picker .ss-wrapper {
    flex: 1;
    min-width: 0;
}

.btn-create-channel {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: transparent;
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
}

.btn-create-channel:hover {
    color: var(--text);
    border-color: var(--line-strong);
}

.btn-create-channel svg {
    width: 15px;
    height: 15px;
    stroke: currentColor;
    stroke-width: 2.4;
    stroke-linecap: round;
    fill: none;
}

.cc-input-wrap {
    display: flex;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surf-2);
}

.cc-input-wrap:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.cc-hash {
    padding: 0 4px 0 14px;
    color: var(--dim);
    font-family: var(--font-mono);
}

.cc-input-wrap input {
    flex: 1;
    border: 0 !important;
    background: none !important;
    box-shadow: none !important;
    padding-left: 4px !important;
}

/* Switch rows: a checkbox inside label.toggle-item (the page toggles .active) */
.toggle-group {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 8px;
}

.toggle-group + .card-hint {
    margin: 10px 0 0;
}

.toggle-item {
    display: flex !important;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 46px;
    padding: 8px 12px 8px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surf-2);
    cursor: pointer;
    user-select: none;
    transition: border-color 0.14s ease, background 0.14s ease;
}

.toggle-item:hover {
    border-color: var(--line-strong);
}

.toggle-item input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.toggle-item span {
    flex: 1;
}

.toggle-item::after {
    content: '';
    flex-shrink: 0;
    width: 40px;
    height: 24px;
    border-radius: 999px;
    background: var(--line-strong) radial-gradient(circle at 12px 50%, #fff 8px, transparent 8.6px) no-repeat;
    transition: background-color 0.16s ease;
}

.toggle-item.active {
    border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
}

.toggle-item.active::after {
    background: var(--accent) radial-gradient(circle at 28px 50%, var(--ink) 8px, transparent 8.6px) no-repeat;
}

.toggle-item:focus-within {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 26px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: var(--line-strong);
    cursor: pointer;
    transition: background 0.16s ease;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.16s ease, background 0.16s ease;
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--accent);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(18px);
    background: var(--ink);
}

.toggle-switch input:focus-visible + .toggle-slider {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 8px;
    max-height: 240px;
    overflow-y: auto;
    padding: 2px;
}

.check-chip {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 38px;
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surf-2);
    font-size: 0.86rem;
    cursor: pointer;
    user-select: none;
}

.check-chip input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.check-chip::before {
    content: '';
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    border: 1.5px solid var(--line-strong);
    border-radius: 5px;
}

.check-chip.active {
    border-color: color-mix(in srgb, var(--accent) 50%, var(--line));
    background: var(--accent-soft);
}

.check-chip.active::before {
    border-color: var(--accent);
    background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23111' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 11px no-repeat;
}

.check-chip span {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.roles-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.role-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 32px;
    padding: 0 6px 0 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surf-2);
    font-size: 0.86rem;
}

.role-tag button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--dim);
    font-size: 1rem;
    line-height: 1;
}

.role-tag button:hover {
    background: var(--bad-soft);
    color: var(--bad);
}

/* --------------------------------------------------------------- buttons */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    background: var(--surf-2);
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    transition: transform 0.14s ease, filter 0.14s ease, background 0.14s ease, border-color 0.14s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: var(--grad);
    color: var(--ink);
}

.btn-primary:hover {
    filter: brightness(1.06);
    box-shadow: 0 10px 26px var(--glow-shadow);
}

.btn-secondary {
    background: transparent;
    border-color: var(--line);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--line-strong);
}

.btn-danger {
    background: var(--bad-soft);
    border-color: color-mix(in srgb, var(--bad) 35%, transparent);
    color: var(--bad);
}

.btn-danger:hover {
    background: color-mix(in srgb, var(--bad) 22%, transparent);
}

.btn-success {
    background: var(--good-soft);
    border-color: color-mix(in srgb, var(--good) 35%, transparent);
    color: var(--good);
}

.btn-warning {
    background: var(--accent-soft);
    border-color: color-mix(in srgb, var(--accent) 35%, transparent);
    color: var(--accent);
}

.btn-sm {
    min-height: 32px;
    padding: 0 12px;
    border-radius: 9px;
    font-size: 0.82rem;
}

.btn-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* ------------------------------------------------------------ lists/rows */

.row-list {
    display: grid;
    gap: 8px;
    max-height: 440px;
    overflow-y: auto;
}

.row-item,
.giveaway-item,
.member-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surf-2);
}

.giveaway-item {
    justify-content: space-between;
    margin-bottom: 8px;
}

.row-item .row-main,
.member-item .member-info {
    flex: 1;
    min-width: 0;
}

.row-title,
.member-name {
    font-weight: 600;
    overflow-wrap: anywhere;
}

.row-sub,
.member-roles {
    color: var(--muted);
    font-size: 0.82rem;
    overflow-wrap: anywhere;
}

.row-item img,
.member-avatar {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border-radius: 50%;
    object-fit: cover;
    background: var(--surf-3);
}

.member-list {
    display: grid;
    gap: 8px;
    max-height: 520px;
    overflow-y: auto;
}

.member-item {
    width: 100%;
    color: var(--text);
    text-align: left;
    cursor: pointer;
    transition: border-color 0.14s ease, background 0.14s ease;
}

.member-item .member-name,
.member-item .member-roles {
    display: block;
}

.member-item .member-actions {
    color: var(--dim);
}

.member-item:hover {
    border-color: var(--line-strong);
    background: var(--surf-3);
}

.member-actions {
    display: flex;
    gap: 6px;
}

.audit-log {
    display: grid;
    gap: 8px;
    max-height: 560px;
    overflow-y: auto;
}

.audit-item {
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-left: 3px solid var(--accent);
    border-radius: 10px;
    background: var(--surf-2);
}

.audit-action {
    color: var(--accent);
    font-weight: 600;
}

.audit-user {
    color: var(--muted);
    font-size: 0.86rem;
}

.audit-time {
    color: var(--dim);
    font-family: var(--font-mono);
    font-size: 0.75rem;
}

.lock-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 40px;
    padding: 6px 10px;
    border-radius: 10px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.14s ease;
}

.lock-row:hover {
    background: var(--surf-2);
}

.lock-row span {
    flex: 1;
}

.lock-row .i {
    color: var(--muted);
}

.progress-track {
    height: 8px;
    margin-top: 12px;
    border-radius: 999px;
    background: var(--surf-2);
    overflow: hidden;
}

.progress-fill {
    width: 0;
    height: 100%;
    background: var(--grad);
    transition: width 0.4s ease;
}

.skeleton {
    border-radius: 10px;
    background: linear-gradient(90deg, var(--surf-2) 25%, var(--surf-3) 50%, var(--surf-2) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s ease-in-out infinite;
}

.skeleton-card {
    height: 56px;
    margin-bottom: 8px;
}

/* -------------------------------------------------------------- overview */

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.kpi {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 132px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surf);
    transition: transform 0.16s ease, border-color 0.16s ease;
}

.kpi:hover {
    transform: translateY(-2px);
    border-color: var(--line-strong);
}

.kpi-hero {
    background: var(--tint), var(--surf);
}

.kpi-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 0.85rem;
}

.kpi-label svg {
    width: 15px;
    height: 15px;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

.kpi-value {
    font-family: var(--font-mono);
    font-size: 1.95rem;
    letter-spacing: -0.03em;
    line-height: 1.2;
}

.kpi-sub {
    color: var(--dim);
    font-size: 0.8rem;
}

.kpi-bar {
    display: flex;
    height: 5px;
    margin-top: auto;
    border-radius: 3px;
    background: var(--surf-2);
    overflow: hidden;
}

.kpi-bar span {
    background: var(--grad);
    transition: width 0.6s var(--ease);
}

.overview-row {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: 14px;
}

.panel-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.panel-head .link {
    color: var(--accent);
    font-size: 0.82rem;
    font-weight: 600;
    background: none;
    border: 0;
}

.panel-note {
    color: var(--dim);
    font-size: 0.8rem;
}

.module-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.module {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-height: 104px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surf-2);
    text-align: left;
    transition: transform 0.14s ease, border-color 0.14s ease;
}

.module:hover {
    transform: translateY(-2px);
    border-color: var(--line-strong);
}

.module.off {
    border-color: var(--accent-soft);
}

.module-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.module-name .dot {
    width: 7px;
    height: 7px;
    margin-left: auto;
    border-radius: 50%;
    background: var(--good);
}

.module.off .dot {
    background: var(--accent);
}

.module-detail {
    color: var(--muted);
    font-size: 0.8rem;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.module-action {
    margin-top: auto;
    color: var(--dim);
    font-size: 0.8rem;
    font-weight: 600;
}

.module.off .module-action {
    color: var(--accent);
}

.chart-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 300px;
    margin: 0 auto;
}

.feed {
    display: flex;
    flex-direction: column;
}

.feed-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 6px 0;
    border-top: 1px solid var(--line);
}

.feed-row:first-child {
    border-top: 0;
}

.feed-avatar {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--surf-2);
    font-size: 0.72rem;
    font-weight: 700;
}

.feed-main {
    flex: 1;
    min-width: 0;
    font-size: 0.86rem;
}

.feed-main .muted {
    color: var(--muted);
}

.feed-time {
    color: var(--dim);
    font-size: 0.75rem;
    white-space: nowrap;
}

/* ------------------------------------------------------------ settings */

.settings-stack {
    display: flex;
    flex-direction: column;
    gap: var(--gap);
}

#reset-sections {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.setting-row .setting-text {
    flex: 1;
    min-width: 0;
}

.setting-row .setting-text p {
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.87rem;
}

.setting-row .setting-control {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.choice-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.choice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surf-2);
    cursor: pointer;
    transition: border-color 0.14s ease, background 0.14s ease;
}

.choice:hover {
    border-color: var(--line-strong);
}

.choice input {
    margin-top: 3px;
    accent-color: var(--accent);
}

.choice:has(input:checked) {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.choice-title {
    font-weight: 600;
}

.choice-desc {
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.8rem;
}

.admin-only-note {
    display: none;
    margin-bottom: 14px;
    padding: 10px 12px;
    border: 1px dashed var(--line-strong);
    border-radius: 10px;
    color: var(--muted);
    font-size: 0.82rem;
}

.is-delegate .admin-only-note {
    display: block;
}

.is-delegate .admin-only :is(input, select, button, .choice),
.is-delegate .admin-only-btn {
    pointer-events: none;
    opacity: 0.45;
}

.danger-zone {
    border-color: color-mix(in srgb, var(--bad) 40%, var(--line));
}

.danger-zone .config-title {
    color: var(--bad);
}

.confirm-name {
    color: var(--text);
    font-weight: 700;
    overflow-wrap: anywhere;
}

/* --------------------------------------------------------- member card */

.member-card {
    max-width: 640px !important;
}

.mc-head {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
}

.mc-head img {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--surf-3);
}

.mc-name {
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.mc-user {
    color: var(--muted);
    font-size: 0.86rem;
}

.mc-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.badge {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 8px;
    border-radius: 999px;
    background: var(--surf-2);
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 600;
}

.badge.accent {
    background: var(--accent-soft);
    color: var(--accent);
}

.badge.bad {
    background: var(--bad-soft);
    color: var(--bad);
}

.mc-facts {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 18px;
}

.mc-fact {
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surf-2);
}

.mc-fact span {
    display: block;
    color: var(--dim);
    font-size: 0.72rem;
}

.mc-fact strong {
    font-size: 0.86rem;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.mc-block {
    margin-bottom: 18px;
}

.mc-block h4 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.85rem;
    font-weight: 600;
}

.mc-block h4 span {
    color: var(--dim);
    font-weight: 500;
}

.mc-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.mc-action {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surf-2);
}

.mc-action .inline-form {
    margin-top: 8px;
}

.mc-action-title {
    font-weight: 600;
    font-size: 0.88rem;
}

.mc-action-desc {
    color: var(--dim);
    font-size: 0.78rem;
}

/* --------------------------------------------------------------- modals */

.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.62);
    backdrop-filter: blur(6px);
}

.modal.active {
    display: flex;
    animation: fade 0.18s ease;
}

@keyframes fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    width: 100%;
    max-width: 520px;
    max-height: 88vh;
    overflow-y: auto;
    padding: 22px 24px 24px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surf);
    box-shadow: var(--shadow-lg);
    animation: rise 0.22s var(--ease);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.modal-header h3 {
    font-size: 1.15rem;
}

.modal-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--dim);
    font-size: 1.4rem;
    line-height: 1;
}

.modal-close:hover {
    background: var(--surf-2);
    color: var(--text);
}

/* --------------------------------------------------- unsaved changes bar */

.unsaved-bar {
    position: fixed;
    left: calc(var(--sidebar-w) + 24px);
    right: 24px;
    bottom: 20px;
    z-index: 60;
    display: flex;
    align-items: center;
    gap: 14px;
    max-width: 1100px;
    margin: 0 auto;
    padding: 12px 14px 12px 16px;
    border: 1px solid color-mix(in srgb, var(--accent) 55%, var(--line));
    border-radius: 16px;
    background: var(--surf);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
    animation: rise 0.2s var(--ease);
}

.unsaved-bar.shake {
    animation: shake 0.4s ease;
    border-color: var(--bad);
}

.unsaved-icon {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 800;
}

.unsaved-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.unsaved-text span {
    color: var(--muted);
    font-size: 0.82rem;
}

/* --------------------------------------------------------------- toasts */

.toast-container {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    pointer-events: none;
}

.has-unsaved .toast-container {
    bottom: 104px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 420px;
    padding: 12px 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surf-2);
    box-shadow: var(--shadow-lg);
    font-size: 0.88rem;
    pointer-events: auto;
    animation: rise 0.22s var(--ease);
}

.toast.success { border-color: var(--good); }
.toast.error { border-color: var(--bad); }

.toast-icon {
    display: inline-flex;
    flex-shrink: 0;
    color: var(--muted);
}

.toast.success .toast-icon { color: var(--good); }
.toast.error .toast-icon { color: var(--bad); }

@keyframes toast-out {
    to { opacity: 0; transform: translateY(8px); }
}

/* ------------------------------------------------------ command palette */

.cmd-overlay {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 16vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
}

.cmd-overlay.open {
    display: flex;
}

.cmd-box {
    width: min(560px, 92vw);
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surf);
    box-shadow: var(--shadow-lg);
    animation: rise 0.18s var(--ease);
}

.cmd-input-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
}

.cmd-input {
    flex: 1;
    border: 0;
    outline: none;
    background: none;
    font-size: 1rem;
}

.cmd-results {
    max-height: 360px;
    overflow-y: auto;
    padding: 6px;
}

.cmd-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: 10px;
    color: var(--muted);
    cursor: pointer;
}

.cmd-item.active {
    background: var(--accent-soft);
    color: var(--text);
}

.cmd-icon {
    width: 22px;
    text-align: center;
}

.cmd-label {
    flex: 1;
}

.cmd-cat {
    color: var(--dim);
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.cmd-empty {
    padding: 28px;
    color: var(--dim);
    text-align: center;
}

.cmd-footer {
    display: flex;
    justify-content: center;
    gap: 18px;
    padding: 8px;
    border-top: 1px solid var(--line);
    color: var(--dim);
    font-size: 0.72rem;
}

/* ---------------------------------------------- searchable select widget */

.ss-wrapper {
    position: relative;
    width: 100%;
}

.ss-display {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-right: 40px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23918877' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    cursor: pointer;
}

.ss-wrapper.open .ss-display {
    border-color: var(--accent);
}

.ss-placeholder {
    color: var(--dim);
}

.ss-dropdown {
    position: fixed;
    z-index: 99999;
    display: none;
    max-height: 260px;
    overflow-y: auto;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    background: var(--surf);
    box-shadow: var(--shadow-lg);
}

.ss-dropdown.ss-open {
    display: block;
}

.ss-search {
    width: 100%;
    height: 38px;
    padding: 0 12px;
    border: 0;
    border-bottom: 1px solid var(--line);
    outline: none;
    background: var(--surf-2);
}

.ss-option {
    padding: 8px 12px;
    color: var(--muted);
    cursor: pointer;
}

.ss-option:hover,
.ss-option.selected {
    background: var(--accent-soft);
    color: var(--text);
}

/* --------------------------------- Discord previews (look like Discord) */

.discord-preview {
    margin-top: 14px;
    padding: 14px 16px;
    border-radius: 12px;
    background: #313338;
    font-family: 'gg sans', 'Noto Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

.discord-preview-header {
    margin-bottom: 10px;
    color: #949ba4;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.discord-message {
    display: flex;
    gap: 14px;
}

.discord-avatar {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 50%;
    background: var(--grad);
    color: var(--ink);
    font-weight: 700;
}

.discord-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.discord-msg-content {
    flex: 1;
    min-width: 0;
}

.discord-msg-header {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 2px;
}

.discord-username {
    color: #f2f3f5;
    font-weight: 600;
}

.discord-bot-tag {
    padding: 1px 5px;
    border-radius: 4px;
    background: #5865F2;
    color: #fff;
    font-size: 0.6rem;
    font-weight: 600;
}

.discord-timestamp {
    color: #949ba4;
    font-size: 0.72rem;
}

.discord-text {
    color: #dbdee1;
    line-height: 1.375;
    overflow-wrap: anywhere;
}

.discord-mention {
    padding: 0 2px;
    border-radius: 3px;
    background: rgba(88, 101, 242, 0.3);
    color: #c9cdfb;
    font-weight: 500;
}

.discord-embed,
.embed-preview-box {
    max-width: 520px;
    margin-top: 6px;
    padding: 10px 14px;
    border-left: 4px solid var(--accent);
    border-radius: 4px;
    background: #2b2d31;
}

.discord-embed-title,
.embed-preview-title {
    margin-bottom: 4px;
    color: #f2f3f5;
    font-weight: 600;
}

.discord-embed-desc,
.embed-preview-desc {
    color: #dbdee1;
    font-size: 0.875rem;
    white-space: pre-wrap;
}

.discord-embed-footer {
    margin-top: 6px;
    color: #949ba4;
    font-size: 0.75rem;
}

.rm-preview-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 2px;
    padding: 4px 12px;
    border: 0;
    border-radius: 4px;
    background: #4e5058;
    color: #fff;
    font-size: 0.82rem;
    cursor: default;
}

.rm-preview-select {
    display: flex;
    align-items: center;
    max-width: 300px;
    padding: 8px 12px;
    border: 1px solid #1e1f22;
    border-radius: 4px;
    background: #1e1f22;
    color: #949ba4;
    font-size: 0.85rem;
}

.rm-role-item {
    display: flex !important;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
}

.rm-role-remove {
    margin-left: auto;
}

.canvas-preview {
    max-width: 480px;
    margin-top: 8px;
    overflow: hidden;
    border-radius: 8px;
}

.canvas-preview-img {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 26px;
    background: linear-gradient(135deg, #1a1a2e 0%, #2d1b4e 50%, #1a1a2e 100%);
}

.canvas-avatar {
    width: 72px;
    height: 72px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 4px solid var(--accent);
    border-radius: 50%;
    background: #2f3136;
    font-size: 1.8rem;
}

.canvas-welcome {
    color: #949ba4;
    font-size: 0.85rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.canvas-username {
    margin: 2px 0;
    color: #fff;
    font-size: 1.4rem;
    font-weight: 700;
}

.canvas-server {
    color: var(--accent);
    font-size: 0.85rem;
}

.build-option-card {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surf-2);
}

.giveaway-category {
    margin: 4px 0 10px;
    color: var(--dim);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* ------------------------------------------------------- emoji picker */

.emoji-btn {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surf-2);
    font-size: 1.2rem;
    cursor: pointer;
    transition: transform 0.14s ease, border-color 0.14s ease;
}

.emoji-btn:hover {
    transform: scale(1.06);
    border-color: var(--accent);
}

.emoji-picker {
    position: fixed;
    z-index: 10000;
    width: 364px;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surf);
    box-shadow: var(--shadow-lg);
}

.emoji-picker-header {
    padding: 10px;
    border-bottom: 1px solid var(--line);
}

.emoji-picker .emoji-search {
    width: 100%;
    height: 36px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    outline: none;
    background: var(--surf-2);
    font-size: 0.86rem;
}

.emoji-tabs {
    display: flex;
    gap: 2px;
    padding: 6px 8px;
    border-bottom: 1px solid var(--line);
}

.emoji-tab {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--dim);
}

.emoji-tab:hover {
    background: var(--surf-2);
    color: var(--text);
}

.emoji-tab[aria-selected="true"] {
    background: var(--accent-soft);
    color: var(--accent);
}

.emoji-picker .emoji-picker-grid {
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 2px;
    height: 250px;
    overflow-y: auto;
    padding: 8px;
    align-content: start;
}

.emoji-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 38px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    font-size: 1.4rem;
    line-height: 1;
    transition: background 0.12s ease, transform 0.12s ease;
}

.emoji-cell:hover,
.emoji-cell:focus-visible {
    background: var(--accent-soft);
    transform: scale(1.12);
}

.emoji-img {
    width: 1.4em;
    height: 1.4em;
    object-fit: contain;
    vertical-align: -0.3em;
}

.emoji-cell .emoji-img {
    width: 28px;
    height: 28px;
}

.emoji-btn .emoji-img,
.rm-preview-btn .emoji-img {
    width: 20px;
    height: 20px;
}

.emoji-empty {
    grid-column: 1 / -1;
    padding: 48px 8px;
    color: var(--dim);
    font-size: 0.86rem;
    text-align: center;
}

.emoji-picker-footer {
    min-height: 34px;
    padding: 8px 12px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---------------------------------------------------- server picker page */

.site-header {
    position: relative;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 24px;
    max-width: 1240px;
    height: 84px;
    margin: 0 auto;
    padding: 0 32px;
}

.site-header .brand {
    height: auto;
    padding: 0;
    border: 0;
    font-size: 1.25rem;
}

.site-nav {
    flex: 1;
    display: flex;
    gap: 24px;
}

.site-nav a {
    color: var(--muted);
    font-weight: 500;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
    color: var(--text);
}

.picker {
    position: relative;
    z-index: 1;
    max-width: 1240px;
    margin: 0 auto;
    padding: 24px 32px 96px;
}

.picker-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 28px;
}

.picker-head h1 {
    font-size: clamp(2rem, 4vw, 2.8rem);
    font-weight: 800;
}

.picker-head p {
    margin-top: 8px;
    color: var(--muted);
}

.segmented {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--glass);
}

.segmented button {
    height: 36px;
    padding: 0 14px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--muted);
    font-weight: 600;
    font-size: 0.88rem;
}

.segmented button[aria-pressed="true"] {
    background: var(--grad);
    color: var(--ink);
}

.segmented .count {
    margin-left: 6px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    opacity: 0.8;
}

.picker-tools {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.picker-tools .form-input {
    width: 240px;
}

.servers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.server-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--tint), var(--surf);
    transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.2s ease;
    animation: rise 0.35s var(--ease) both;
}

.server-card:hover {
    transform: translateY(-3px);
    border-color: var(--line-strong);
    box-shadow: var(--shadow-md);
}

.server-card.absent {
    background: var(--surf);
}

.server-card-top {
    display: flex;
    align-items: center;
    gap: 14px;
}

.server-icon {
    width: 56px;
    height: 56px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 16px;
    background: var(--surf-3);
    font-family: var(--font-display);
    font-weight: 700;
}

.server-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.server-card h3 {
    font-size: 1.1rem;
    overflow-wrap: anywhere;
}

.server-card .meta {
    color: var(--muted);
    font-size: 0.85rem;
}

.server-card .btn {
    width: 100%;
}

.empty-state {
    grid-column: 1 / -1;
    padding: 56px 24px;
    border: 1px dashed var(--line-strong);
    border-radius: 18px;
    color: var(--muted);
    text-align: center;
}

.empty-state h3 {
    margin-bottom: 8px;
    color: var(--text);
}

/* ------------------------------------------------------------ responsive */

@media (max-width: 1100px) {
    .kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .overview-row {
        grid-template-columns: minmax(0, 1fr);
    }

    .module-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .search-trigger span,
    .search-trigger kbd {
        display: none;
    }

    .search-trigger {
        width: 40px;
        padding: 0;
        justify-content: center;
    }
}

@media (max-width: 860px) {
    .app {
        grid-template-columns: minmax(0, 1fr);
    }

    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: min(300px, 86vw);
        transform: translateX(-102%);
        transition: transform 0.24s var(--ease);
        background: var(--surf);
    }

    .sidebar.open {
        transform: none;
        box-shadow: var(--shadow-lg);
    }

    .sidebar-overlay.open {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 25;
        background: rgba(0, 0, 0, 0.55);
    }

    .mobile-only {
        display: inline-flex;
    }

    .topbar {
        padding: 0 14px;
        gap: 10px;
    }

    .bot-status {
        display: none;
    }

    .switcher-btn {
        max-width: 46vw;
    }

    .content {
        padding: 20px 16px 140px;
    }

    .page-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .page-head h1 {
        font-size: 1.6rem;
    }

    .unsaved-bar {
        left: 12px;
        right: 12px;
        bottom: 12px;
        flex-wrap: wrap;
    }

    .unsaved-text {
        flex-basis: calc(100% - 60px);
    }

    .setting-row {
        flex-direction: column;
        align-items: stretch;
    }

    .choice-list,
    .mc-facts,
    .mc-actions {
        grid-template-columns: minmax(0, 1fr);
    }

    .site-header,
    .picker {
        padding-left: 16px;
        padding-right: 16px;
    }

    .site-nav {
        display: none;
    }
}

@media (max-width: 560px) {
    .kpi-grid,
    .module-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .toggle-group,
    .two-col {
        grid-template-columns: minmax(0, 1fr);
    }
}
