/* CONTENT_CHANGED 대시보드 — 디스코드 어두운 테마 + 봇 메인 컬러(#74ffbd) */
:root {
    --bg-deep: #1e1f22;
    --bg-panel: #2b2d31;
    --bg-main: #313338;
    --bg-card: #2b2d31;
    --bg-raised: #383a40;
    --bg-input: #1e1f22;
    --bg-float: #111214;
    --bg-hover: rgba(78, 80, 88, 0.3);
    --bg-active: rgba(78, 80, 88, 0.6);
    --line: #3f4147;
    --line-soft: rgba(255, 255, 255, 0.06);

    --text: #f2f3f5;
    --text-2: #dbdee1;
    --text-muted: #949ba4;
    --text-dim: #80848e;

    --accent: #74ffbd;
    --accent-hover: #8dffca;
    --accent-press: #5be8a6;
    --accent-ink: #062c1c;
    --accent-soft: rgba(116, 255, 189, 0.1);
    --accent-line: rgba(116, 255, 189, 0.35);

    --danger: #f23f43;
    --danger-hover: #da373c;
    --warn: #f0b232;
    --mention-bg: rgba(88, 101, 242, 0.3);
    --mention-text: #c9cdfb;

    --radius-sm: 4px;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    --font: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Noto Sans KR', 'Segoe UI', sans-serif;
    --mono: 'Cascadia Code', Consolas, 'SFMono-Regular', Menlo, monospace;
    color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    background: var(--bg-main);
    color: var(--text-2);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { color: var(--text); margin: 0; letter-spacing: -0.01em; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--accent-line); }

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

/* 스크롤바 (디스코드 느낌) */
* { scrollbar-width: thin; scrollbar-color: #1a1b1e transparent; }
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-thumb { background: #1a1b1e; border: 3px solid transparent; border-radius: 8px; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ===================== 로딩 ===================== */
.boot, .loading { display: grid; place-items: center; min-height: 40vh; }
.boot { min-height: 100vh; }
.spinner {
    width: 32px; height: 32px; border-radius: 50%;
    border: 3px solid var(--accent-soft); border-top-color: var(--accent);
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===================== 버튼 ===================== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 38px; padding: 0 16px; border: 0; border-radius: var(--radius);
    font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap;
    transition: background-color 0.15s, color 0.15s, transform 0.05s;
    text-decoration: none !important;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; gap: 6px; }
.btn-lg { height: 46px; padding: 0 24px; font-size: 16px; border-radius: var(--radius); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-primary:active:not(:disabled) { background: var(--accent-press); }
.btn-secondary { background: #4e5058; color: var(--text); }
.btn-secondary:hover:not(:disabled) { background: #6d6f78; }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--bg-hover); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: var(--danger-hover); }

.icon-btn {
    display: inline-grid; place-items: center; width: 32px; height: 32px;
    background: transparent; border: 0; border-radius: var(--radius-sm);
    color: var(--text-muted); cursor: pointer; transition: background-color 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.icon-btn.danger:hover { color: var(--danger); }

/* 툴팁 */
[data-tip] { position: relative; }
[data-tip]:hover::after {
    content: attr(data-tip);
    position: absolute; z-index: 50; pointer-events: none;
    bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
    padding: 6px 10px; border-radius: var(--radius-sm);
    background: var(--bg-float); color: var(--text); box-shadow: var(--shadow);
    font-size: 13px; font-weight: 600; white-space: nowrap;
}

/* ===================== 로그인 ===================== */
.login { position: relative; min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; overflow: hidden; background: var(--bg-deep); }
.login-bg {
    position: absolute; inset: -40px;
    background: radial-gradient(60% 50% at 70% 20%, rgba(116, 255, 189, 0.18), transparent 70%), radial-gradient(50% 60% at 15% 90%, rgba(88, 101, 242, 0.18), transparent 70%), var(--bg-deep);
    background-size: cover; background-position: center;
    filter: blur(28px) saturate(1.1); opacity: 0.55;
}
.login-card {
    position: relative; width: min(420px, 100%);
    padding: 40px 32px 32px; border-radius: var(--radius-lg);
    background: rgba(43, 45, 49, 0.92); backdrop-filter: blur(12px);
    border: 1px solid var(--line-soft); box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
    display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px;
}
.login-logo { width: 104px; height: 104px; object-fit: contain; filter: drop-shadow(0 8px 24px rgba(116, 255, 189, 0.35)); }
.login-card h1 { font-size: 26px; font-weight: 800; }
.login-sub { color: var(--text-muted); }
.login-features { list-style: none; padding: 0; margin: 6px 0 10px; display: grid; gap: 8px; width: 100%; }
.login-features li { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--radius); background: var(--bg-deep); color: var(--text-2); font-size: 14px; text-align: left; }
.login-features .icon { color: var(--accent); }
.login-card .btn-lg { width: 100%; }
.login-invite { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--text-muted); }
.login-invite:hover { color: var(--accent); }
.login-error { display: flex; align-items: center; gap: 8px; width: 100%; padding: 10px 12px; border-radius: var(--radius); background: rgba(242, 63, 67, 0.12); color: #ff9c9e; font-size: 14px; }

/* ===================== 기본 틀 ===================== */
:root { --topnav-h: 64px; }
.page { width: 100%; max-width: 1240px; margin: 0 auto; padding: 32px 32px 80px; }

.guild-icon { border-radius: 30%; object-fit: cover; flex-shrink: 0; background: var(--bg-raised); }
.guild-acronym { display: grid; place-items: center; color: var(--text); font-weight: 700; font-size: 14px; letter-spacing: -0.02em; overflow: hidden; }
.avatar { border-radius: 50%; object-fit: cover; flex-shrink: 0; background: var(--bg-raised); }
.color-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.2); }
.user-name { color: var(--text); font-weight: 600; font-size: 14px; }

/* 상단 내비게이션 */
.topnav {
    position: sticky; top: 0; z-index: 40; height: var(--topnav-h);
    background: rgba(30, 31, 34, 0.86); backdrop-filter: blur(14px) saturate(1.2);
    border-bottom: 1px solid var(--line-soft);
}
.topnav-inner { height: 100%; max-width: 1240px; margin: 0 auto; padding: 0 32px; display: flex; align-items: center; gap: 14px; }
.topnav-spacer { flex: 1; }
.topnav-divider { width: 1px; height: 24px; background: var(--line); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 800; letter-spacing: -0.01em; text-decoration: none !important; flex-shrink: 0; }
.brand-logo { width: 34px; height: 34px; object-fit: contain; }
.brand-name { font-size: 16px; }
.brand:hover .brand-name { color: var(--accent); }

.switcher-trigger, .user-trigger {
    display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 10px 0 8px; max-width: 320px;
    border: 1px solid var(--line-soft); border-radius: 10px; background: var(--bg-panel); color: var(--text); cursor: pointer;
    font-weight: 600; font-size: 14px; transition: border-color 0.15s, background-color 0.15s;
}
.switcher-trigger:hover, .user-trigger:hover, .dropdown.open > .switcher-trigger, .dropdown.open > .user-trigger { border-color: var(--accent-line); background: var(--bg-raised); }
.switcher-trigger > .icon:last-child, .user-trigger > .icon:last-child { color: var(--text-muted); transition: transform 0.15s; }
.dropdown.open > button > .icon:last-child { transform: rotate(180deg); }
.switcher-trigger .guild-icon { width: 24px; height: 24px; font-size: 10px; }
.switcher-trigger > .icon:first-child { color: var(--accent); }
.switcher-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-trigger { padding: 0 8px 0 5px; border-radius: 22px; }
.user-trigger-name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 드롭다운 */
.dropdown { position: relative; }
.dropdown-menu {
    display: none; position: absolute; top: calc(100% + 8px); z-index: 60; min-width: 260px; max-height: min(480px, 70vh); overflow-y: auto;
    padding: 6px; border-radius: var(--radius-lg); background: var(--bg-panel); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.dropdown-menu.align-left { left: 0; }
.dropdown-menu.align-right { right: 0; }
.dropdown.open .dropdown-menu { display: block; animation: drop 0.14s ease-out; }
@keyframes drop { from { opacity: 0; transform: translateY(-4px); } }
.dropdown-label { padding: 8px 10px 4px; color: var(--text-muted); font-size: 12px; font-weight: 700; }
.dropdown-item {
    width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 0; border-radius: var(--radius);
    background: transparent; color: var(--text-2); font-size: 14px; text-align: left; cursor: pointer; text-decoration: none !important;
}
.dropdown-item:hover { background: var(--bg-hover); color: var(--text); }
.dropdown-item.active { background: var(--accent-soft); color: var(--text); }
.dropdown-item > .icon:last-child { color: var(--accent); margin-left: auto; }
.dropdown-item.danger:hover { color: #ff8a8d; background: rgba(242, 63, 67, 0.12); }
.dropdown-item .guild-icon { width: 28px; height: 28px; font-size: 11px; }
.dropdown-item-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.dropdown-item-text > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.dropdown-item-text .muted { font-size: 12px; }
.dropdown-icon { width: 28px; display: inline-grid; place-items: center; color: var(--text-muted); }
.dropdown-sep { height: 1px; margin: 6px 4px; background: var(--line-soft); }
.dropdown-empty { padding: 10px; color: var(--text-muted); font-size: 13px; }
.dropdown-profile { display: flex; align-items: center; gap: 12px; padding: 10px; }

/* 서버 헤더 + 탭 */
.band { position: relative; overflow: hidden; border-bottom: 1px solid var(--line-soft); background: var(--bg-panel); }
.band-bg {
    position: absolute; inset: 0; background-size: cover; background-position: center; opacity: 0.35;
    background-image: radial-gradient(60% 140% at 90% 0%, rgba(116, 255, 189, 0.22), transparent 70%), radial-gradient(50% 120% at 0% 100%, rgba(88, 101, 242, 0.16), transparent 70%);
}
.band::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent, var(--bg-panel) 92%); pointer-events: none; }
.band-inner { position: relative; z-index: 1; max-width: 1240px; margin: 0 auto; padding: 28px 32px 0; }
.band-title { display: flex; align-items: center; gap: 16px; }
.band-title .guild-icon { width: 56px; height: 56px; font-size: 18px; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35); }
.band-title h1 { font-size: 24px; font-weight: 800; }
.band-title p { color: var(--text-muted); font-size: 14px; margin-top: 2px; }
.tabs { display: flex; gap: 4px; margin-top: 20px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
    display: flex; align-items: center; gap: 8px; padding: 10px 14px 12px; color: var(--text-muted); font-weight: 600; font-size: 14px;
    border-bottom: 2px solid transparent; white-space: nowrap; text-decoration: none !important; transition: color 0.15s, border-color 0.15s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.tab.active .icon { color: var(--accent); }

.back-link { display: inline-flex; align-items: center; gap: 2px; width: 100%; margin-bottom: -4px; color: var(--text-muted); font-size: 13px; font-weight: 600; }
.back-link .icon { transform: rotate(90deg); }
.back-link:hover { color: var(--accent); text-decoration: none; }

/* ===================== 페이지 공용 ===================== */
.page-header { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-heading { flex: 1; min-width: 200px; }
.page-heading h1 { font-size: 24px; font-weight: 800; }
.page-heading p { color: var(--text-muted); margin-top: 4px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.header-dot { width: 16px; height: 16px; border-radius: 50%; box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.2); }

.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 36px 0 14px; }
.section-head h2 { font-size: 13px; font-weight: 700; color: var(--text-muted); letter-spacing: 0.04em; }

.card { background: var(--bg-card); border-radius: var(--radius-lg); padding: 20px; border: 1px solid var(--line-soft); }
.card + .card, .card + .save-bar, .card + section { margin-top: 16px; }
.card-head { margin-bottom: 16px; }
.card-head h2 { font-size: 16px; font-weight: 700; }
.card-head p { color: var(--text-muted); font-size: 14px; margin-top: 4px; }

.badge {
    display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 10px;
    background: var(--accent-soft); color: var(--accent); font-size: 11px; font-weight: 700; white-space: nowrap;
}

.pills { display: flex; flex-wrap: wrap; gap: 4px; }
.pill {
    display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px; border-radius: var(--radius-sm);
    background: var(--bg-deep); color: var(--text-2); font-size: 13px; font-weight: 500; white-space: nowrap; max-width: 100%;
}
.pill .icon { color: var(--text-muted); }
.pill-role { --role-color: var(--mention-text); color: var(--role-color); background: color-mix(in srgb, var(--role-color) 14%, transparent); }
.pill-missing { color: var(--text-dim); text-decoration: line-through; }

.note { display: flex; align-items: center; gap: 8px; margin-top: 14px; color: var(--text-muted); font-size: 14px; }
.inline-note { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px; border-radius: var(--radius); background: var(--bg-deep); font-size: 14px; margin-bottom: 12px; }
.row-gap { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row-gap .select { flex: 1; min-width: 200px; }
.narrow { max-width: 760px !important; margin-left: 0 !important; }

.empty { text-align: center; padding: 48px 24px; border-radius: var(--radius-lg); border: 2px dashed var(--line); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty-icon { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 4px; }
.empty h3 { font-size: 17px; }
.empty p { color: var(--text-muted); max-width: 420px; }
.empty .btn { margin-top: 8px; }

/* ===================== 홈 ===================== */
.hero { position: relative; border-radius: var(--radius-lg); overflow: hidden; min-height: 220px; display: flex; align-items: flex-end; background: var(--bg-deep); }
.hero-bg {
    position: absolute; inset: 0; background-size: cover; background-position: center;
    background-image: radial-gradient(70% 90% at 85% 10%, rgba(116, 255, 189, 0.35), transparent 60%), radial-gradient(60% 80% at 10% 100%, rgba(88, 101, 242, 0.3), transparent 60%);
}
.hero::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(17, 18, 20, 0) 20%, rgba(17, 18, 20, 0.85)); }
.hero-content { position: relative; z-index: 1; display: flex; align-items: center; gap: 20px; padding: 28px; }
.hero-logo { width: 88px; height: 88px; object-fit: contain; filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.5)); flex-shrink: 0; }
.hero-eyebrow { color: var(--accent); font-weight: 700; font-size: 14px; }
.hero h1 { font-size: 28px; font-weight: 800; margin: 2px 0 6px; }
.hero p { color: var(--text-2); max-width: 560px; }

.guild-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.guild-card {
    display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: var(--radius-lg);
    background: var(--bg-card); border: 1px solid var(--line-soft); color: inherit; text-decoration: none !important;
    transition: transform 0.15s, border-color 0.15s, background-color 0.15s;
}
.guild-card:hover { transform: translateY(-2px); border-color: var(--accent-line); background: #2f3136; }
.guild-card-text { min-width: 0; }
.guild-card-name { color: var(--text); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.guild-card-meta { display: flex; align-items: center; gap: 6px; color: var(--text-muted); font-size: 13px; margin-top: 2px; }
.guild-card-invite { border-style: dashed; border-color: var(--line); background: transparent; }

/* ===================== 서버 개요 ===================== */
.ann-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.ann-card { display: flex; flex-direction: column; background: var(--bg-card); border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--line-soft); transition: border-color 0.15s; }
.ann-card:hover { border-color: color-mix(in srgb, var(--c) 45%, transparent); }
.ann-card-strip { height: 6px; background: var(--c); }
.ann-card-body { padding: 16px 18px 8px; flex: 1; }
.ann-card-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.ann-card-title h3 { font-size: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ann-card-meta { display: grid; grid-template-columns: 40px 1fr; gap: 8px 10px; margin: 0; font-size: 13px; align-items: start; }
.ann-card-meta dt { color: var(--text-muted); font-weight: 600; line-height: 24px; }
.ann-card-meta dd { margin: 0; min-width: 0; line-height: 24px; }
.ann-card-actions { display: flex; gap: 8px; padding: 14px 18px 18px; }
.ann-card-actions .btn-primary { flex: 1; }

/* 공지 기록 */
.history-list { display: flex; flex-direction: column; gap: 8px; }
.history-row {
    display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 16px;
    padding: 12px 12px 12px 18px; border-radius: var(--radius); background: var(--bg-card);
    border: 1px solid var(--line-soft); position: relative; overflow: hidden;
}
.history-row::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--c); }
.history-main { min-width: 0; }
.history-title { display: block; color: var(--text); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-title:hover { color: var(--accent); text-decoration: none; }
.history-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.history-announcer { font-size: 13px; font-weight: 600; color: var(--c); filter: brightness(1.15); margin-right: 2px; }
.history-side { text-align: right; font-size: 13px; }
.history-author { display: flex; align-items: center; gap: 6px; justify-content: flex-end; color: var(--text-2); font-weight: 500; }
.history-actions { display: flex; gap: 2px; }
.search-wrap { position: relative; margin-bottom: 16px; }
.search-wrap > .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.search-input { padding-left: 38px !important; }

/* ===================== 폼 ===================== */
.field + .field, .field + .setting-row, .setting-row + .field { margin-top: 18px; }
.field-label { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; color: var(--text-muted); font-size: 12px; font-weight: 700; letter-spacing: 0.02em; }
.req { color: var(--danger); }
.counter { font-weight: 500; font-variant-numeric: tabular-nums; color: var(--text-dim); }
.counter.over { color: var(--danger); }
.field-hint { margin-top: 6px; color: var(--text-muted); font-size: 13px; display: flex; gap: 8px; flex-wrap: wrap; }

.input {
    width: 100%; height: 40px; padding: 0 12px; border-radius: var(--radius-sm);
    background: var(--bg-input); border: 1px solid transparent; color: var(--text); outline: none;
    transition: border-color 0.15s;
}
.input::placeholder { color: var(--text-dim); }
.input:focus { border-color: var(--accent-line); }
.input.invalid { border-color: var(--danger); }
.textarea { height: auto; min-height: 240px; padding: 12px; resize: vertical; line-height: 1.5; font-family: var(--font); }
.select { appearance: none; cursor: pointer; padding-right: 36px; 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='%23949ba4' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.select option, .select optgroup { background: var(--bg-panel); color: var(--text); }

.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line-soft); }
.card-head + .setting-row, .setting-row:first-child { border-top: 0; padding-top: 0; }
.setting-title { color: var(--text); font-weight: 600; }
.setting-desc { color: var(--text-muted); font-size: 13px; margin-top: 2px; }
.sub-settings { padding: 4px 0 0 16px; border-left: 2px solid var(--accent-line); margin-top: 4px; }

/* 토글 */
.switch { position: relative; display: inline-flex; flex-shrink: 0; cursor: pointer; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch-track { width: 40px; height: 24px; border-radius: 12px; background: #80848e; transition: background-color 0.2s; display: flex; align-items: center; padding: 3px; }
.switch-thumb { width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform 0.2s; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); }
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(16px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch input:disabled + .switch-track { opacity: 0.5; }

/* 색 고르기 */
.color-picker { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.color-swatch { position: relative; width: 40px; height: 40px; border-radius: var(--radius); cursor: pointer; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1); flex-shrink: 0; }
.color-native { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; border: 0; padding: 0; }
.color-hex { width: 120px; font-family: var(--mono); text-transform: lowercase; }
.color-presets { display: flex; gap: 6px; flex-wrap: wrap; }
.color-preset { width: 24px; height: 24px; border-radius: 50%; border: 0; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2); transition: transform 0.1s; }
.color-preset:hover { transform: scale(1.15); }

/* 구성 고르기 */
.radio-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin-bottom: 8px; }
.radio-card { position: relative; padding: 14px; border-radius: var(--radius); background: var(--bg-deep); border: 2px solid transparent; cursor: pointer; transition: border-color 0.15s, background-color 0.15s; }
.radio-card:hover { background: #26272b; }
.radio-card input { position: absolute; opacity: 0; }
.radio-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.radio-card:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.radio-card-title { color: var(--text); font-weight: 700; font-size: 14px; }
.radio-card-desc { color: var(--text-muted); font-size: 12px; margin-top: 4px; line-height: 1.4; }

/* 다중 선택 */
.ms { position: relative; }
.ms-control {
    display: flex; flex-wrap: wrap; align-items: center; gap: 4px; min-height: 40px; padding: 4px 36px 4px 6px;
    border-radius: var(--radius-sm); background: var(--bg-input); border: 1px solid transparent; cursor: text; position: relative;
}
.ms.open .ms-control, .ms-control:focus-within { border-color: var(--accent-line); }
.ms-chips { display: contents; }
.ms-lead { color: var(--text-muted); padding: 0 2px 0 4px; display: inline-flex; }
.ms-search { flex: 1; min-width: 120px; height: 30px; border: 0; outline: none; background: transparent; color: var(--text); padding: 0 6px; }
.ms-search::placeholder { color: var(--text-dim); }
.ms-caret { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; transition: transform 0.15s; }
.ms.open .ms-caret { transform: translateY(-50%) rotate(180deg); }
.chip {
    --chip-color: var(--text-2);
    display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 4px 0 8px; border-radius: var(--radius-sm);
    background: var(--bg-raised); color: var(--chip-color); font-size: 13px; font-weight: 500; max-width: 100%;
}
.chip .icon { color: var(--text-muted); }
.chip-warn { box-shadow: inset 0 0 0 1px var(--warn); }
.chip-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-avatar { margin-left: -4px; }
.chip-x { display: grid; place-items: center; width: 20px; height: 20px; border: 0; border-radius: 50%; background: transparent; color: var(--text-muted); cursor: pointer; }
.chip-x:hover { background: rgba(255, 255, 255, 0.1); color: var(--text); }
.ms-list {
    display: none; position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px);
    max-height: 300px; overflow-y: auto; padding: 6px; border-radius: var(--radius);
    background: var(--bg-panel); border: 1px solid var(--bg-deep); box-shadow: var(--shadow);
}
.ms.open .ms-list { display: block; }
.ms-group { padding: 10px 8px 4px; color: var(--text-muted); font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.ms-option { display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: var(--radius-sm); cursor: pointer; color: var(--text-2); }
.ms-option:hover { background: var(--bg-hover); color: var(--text); }
.ms-option.selected { background: var(--accent-soft); }
.ms-option.disabled { opacity: 0.4; cursor: not-allowed; }
.ms-option .icon { color: var(--text-muted); }
.ms-option-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-option-hint { color: var(--text-dim); font-size: 12px; }
.ms-option-warn { color: var(--warn) !important; display: inline-flex; }
.ms-option-warn .icon { color: var(--warn); }
.ms-check { width: 16px; display: inline-flex; color: var(--accent); }
.ms-check .icon { color: var(--accent); }
.ms-empty, .ms-limit { padding: 10px 8px; color: var(--text-muted); font-size: 13px; }
.ms-limit { color: var(--warn); }
.role-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }

/* 작성기 */
.editor { border-radius: var(--radius-sm); background: var(--bg-input); border: 1px solid transparent; transition: border-color 0.15s; }
.editor:focus-within { border-color: var(--accent-line); }
.editor .textarea { border: 0; background: transparent; }
.toolbar { display: flex; align-items: center; gap: 2px; padding: 6px; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; }
.tool { min-width: 30px; height: 28px; padding: 0 8px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text-muted); cursor: pointer; font-weight: 700; font-size: 13px; }
.tool:hover { background: var(--bg-hover); color: var(--text); }
.tool-i { font-style: italic; }
.tool-u { text-decoration: underline; }
.tool-s { text-decoration: line-through; }
.toolbar-sep { width: 1px; height: 18px; background: var(--line); margin: 0 4px; }
.tool-divider { color: var(--accent); font-weight: 600; }

.dropzone { border-radius: var(--radius); border: 2px dashed var(--line); transition: border-color 0.15s, background-color 0.15s; }
.dropzone.dragging { border-color: var(--accent); background: var(--accent-soft); }
.dropzone-empty { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 22px; border: 0; background: transparent; color: var(--text-2); cursor: pointer; font-size: 14px; }
.dropzone-empty .icon { color: var(--accent); }
.dropzone-empty .muted { font-size: 12px; }
.dropzone-preview { display: flex; align-items: center; gap: 14px; padding: 10px; }
.dropzone-preview img { width: 96px; height: 72px; object-fit: cover; border-radius: var(--radius-sm); background: var(--bg-deep); }
.dropzone-info { display: flex; flex-direction: column; gap: 8px; font-size: 14px; color: var(--text-2); }

.target-bar { display: flex; gap: 24px; flex-wrap: wrap; padding: 12px 16px; border-radius: var(--radius); background: var(--bg-card); margin-bottom: 16px; border: 1px solid var(--line-soft); font-size: 14px; }
.target-bar > div { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.split-view { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 480px); gap: 24px; align-items: start; }
.split-side { align-self: stretch; }
.split-side .sticky { position: sticky; top: calc(var(--topnav-h) + 16px); }
.preview-label { display: flex; align-items: center; gap: 6px; margin: 0 0 8px; color: var(--text-muted); font-size: 12px; font-weight: 700; letter-spacing: 0.04em; }
.preview-stack .preview-label:not(:first-child) { margin-top: 18px; }

.save-bar {
    position: sticky; bottom: 16px; z-index: 5; display: flex; align-items: center; justify-content: flex-end; gap: 8px;
    margin-top: 16px; padding: 12px 16px; border-radius: var(--radius-lg);
    background: rgba(17, 18, 20, 0.92); backdrop-filter: blur(8px); box-shadow: var(--shadow);
}
.save-bar.inline { position: static; background: transparent; box-shadow: none; padding: 16px 0 0; backdrop-filter: none; }
.save-hint { margin-right: auto; font-size: 13px; }
.danger-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.danger-row p { color: var(--text-muted); font-size: 14px; }

.mini-list { display: flex; flex-direction: column; gap: 4px; }
.mini-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--text-2); text-decoration: none !important; }
.mini-row:hover { background: var(--bg-hover); color: var(--text); }
.mini-row > span:nth-child(2) { flex: 1; }
.mini-row .icon { color: var(--text-muted); }

/* ===================== 디스코드 메시지 미리보기 ===================== */
.dc-surface { background: var(--bg-main); border-radius: var(--radius-lg); padding: 16px 16px 16px 0; border: 1px solid var(--line); overflow: hidden; }
.dc-message { display: grid; grid-template-columns: 72px minmax(0, 1fr); font-size: 16px; line-height: 1.375; color: var(--text-2); }
.dc-avatar { width: 40px; height: 40px; border-radius: 50%; margin-left: 16px; object-fit: cover; background: var(--bg-raised); }
.dc-content { min-width: 0; }
.dc-header { display: flex; align-items: center; gap: 6px; margin-bottom: 2px; }
.dc-username { color: var(--text); font-weight: 600; }
.dc-app-tag { height: 15px; padding: 0 4px; border-radius: 3px; background: #5865f2; color: #fff; font-size: 10px; font-weight: 700; display: inline-flex; align-items: center; }
.dc-time { color: var(--text-dim); font-size: 12px; margin-left: 2px; }
.dc-embeds { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.dc-embed { max-width: 516px; border-radius: 4px; background: var(--bg-panel); border-left: 4px solid var(--bar); }
.dc-embed-inner { padding: 8px 16px 16px 12px; display: grid; gap: 8px; }
.dc-embed-author { color: var(--text); font-size: 14px; font-weight: 600; margin-top: 8px; }
.dc-embed-title { color: var(--text); font-weight: 600; font-size: 16px; }
.dc-embed-author + .dc-embed-title { margin-top: -2px; }
.dc-embed-desc { font-size: 14px; color: var(--text-2); }
.dc-embed-inner > :first-child { margin-top: 8px; }
.dc-embed-image { max-width: 100%; max-height: 300px; border-radius: 4px; object-fit: contain; justify-self: start; margin-top: 8px; }
.dc-embed-footer { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 12px; margin-top: 4px; }
.dc-footer-icon { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; }
.dc-container { max-width: 516px; margin-top: 4px; border-radius: 8px; background: var(--bg-panel); border: 1px solid var(--line-soft); border-left: 4px solid var(--bar); padding: 16px; display: grid; gap: 8px; font-size: 16px; }
.dc-sep { height: 1px; background: var(--line); margin: 4px 0; }
.dc-spacer { height: 0; }
.dc-gallery img { max-width: 100%; max-height: 320px; border-radius: 8px; object-fit: contain; display: block; }
.dc-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.dc-button { height: 32px; padding: 0 16px; border-radius: 8px; background: #4e5058; color: #fff; font-size: 14px; font-weight: 500; display: inline-flex; align-items: center; }

/* 디스코드 마크다운 */
.md { overflow-wrap: anywhere; }
.md-line { min-height: 1.375em; white-space: pre-wrap; }
.md-h1 { font-size: 1.5em; font-weight: 700; color: var(--text); margin: 8px 0 4px; line-height: 1.375; }
.md-h2 { font-size: 1.25em; font-weight: 700; color: var(--text); margin: 8px 0 4px; line-height: 1.375; }
.md-h3 { font-size: 1em; font-weight: 700; color: var(--text); margin: 8px 0 4px; }
.md > :first-child { margin-top: 0; }
.md-sub { font-size: 0.8125em; color: var(--text-muted); }
.md-quote { margin: 0; padding: 0 8px 0 12px; border-left: 4px solid #4e5058; }
.md-list { margin: 0; padding-left: 1.5em; }
.md-list li { margin: 2px 0; }
.md-code { padding: 0.1em 0.3em; border-radius: 4px; background: var(--bg-deep); font-family: var(--mono); font-size: 0.85em; }
.md-codeblock { margin: 4px 0; padding: 8px; border-radius: 4px; background: var(--bg-deep); border: 1px solid #1e1f22; font-family: var(--mono); font-size: 0.875em; white-space: pre-wrap; overflow-x: auto; }
.md-link { color: #00a8fc; }
.md-spoiler { background: #1e1f22; color: transparent; border-radius: 3px; cursor: pointer; transition: color 0.1s; }
.md-spoiler:hover, .md-spoiler:focus { color: inherit; background: rgba(255, 255, 255, 0.1); }
.md-emoji { width: 1.375em; height: 1.375em; vertical-align: bottom; object-fit: contain; }
.md-time { padding: 0 2px; border-radius: 3px; background: rgba(255, 255, 255, 0.06); }
.md-divider { height: 1px; background: var(--line); margin: 8px 0; }
.mention { padding: 0 2px; border-radius: 3px; background: var(--mention-bg); color: var(--mention-text); font-weight: 500; }
.mention-role { color: var(--mention-color); background: color-mix(in srgb, var(--mention-color) 15%, transparent); }

/* ===================== 모달 / 토스트 ===================== */
.modal-overlay { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; background: rgba(0, 0, 0, 0.7); animation: fade 0.15s ease-out; }
.modal-overlay.leaving { animation: fade 0.15s ease-in reverse forwards; }
.modal { width: min(460px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; border-radius: var(--radius-lg); background: var(--bg-main); box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5); animation: pop 0.18s cubic-bezier(0.2, 0.9, 0.3, 1.2); }
.modal-wide { width: min(640px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 20px 8px; }
.modal-head h2 { font-size: 20px; font-weight: 700; }
.modal-body { padding: 8px 20px 20px; overflow-y: auto; display: grid; gap: 12px; }
.modal-text { color: var(--text-2); }
.modal-mention { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 20px; background: var(--bg-panel); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(0.94); } }

.invite-list { display: flex; flex-direction: column; gap: 4px; max-height: 360px; overflow-y: auto; }
.invite-row { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: var(--radius); color: var(--text); text-decoration: none !important; }
.invite-row:hover { background: var(--bg-hover); }
.invite-row > span:nth-child(2) { flex: 1; font-weight: 600; }
.invite-cta { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); font-size: 13px; font-weight: 600; }

.result-list { margin: 0; padding-left: 18px; display: grid; gap: 6px; font-size: 14px; }

#toasts { position: fixed; z-index: 200; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.toast {
    display: flex; align-items: flex-start; gap: 10px; max-width: min(420px, calc(100vw - 32px)); padding: 12px 16px;
    border-radius: var(--radius); background: var(--bg-float); color: var(--text); box-shadow: var(--shadow);
    border-left: 4px solid var(--accent); pointer-events: auto; animation: slide-in 0.2s ease-out; font-size: 14px;
}
.toast .icon { color: var(--accent); margin-top: 1px; }
.toast-error { border-left-color: var(--danger); }
.toast-error .icon { color: var(--danger); }
.toast-warn { border-left-color: var(--warn); }
.toast-warn .icon { color: var(--warn); }
.toast-text { white-space: pre-line; }
.toast.leaving { opacity: 0; transform: translateX(16px); transition: opacity 0.25s, transform 0.25s; }
@keyframes slide-in { from { opacity: 0; transform: translateY(12px); } }

/* ===================== 반응형 ===================== */
@media (max-width: 1180px) {
    .split-view { grid-template-columns: minmax(0, 1fr); }
    .split-side .sticky { position: static; }
}

@media (max-width: 860px) {
    .topnav-inner { padding: 0 16px; gap: 10px; }
    .brand-name, .topnav-divider, .user-trigger-name { display: none; }
    .switcher-trigger { max-width: 56vw; }
    .page { padding: 20px 16px 64px; }
    .band-inner { padding: 20px 16px 0; }
    .band-title .guild-icon { width: 48px; height: 48px; }
    .band-title h1 { font-size: 20px; }
    .tabs { margin-top: 14px; }
    .hero-content { flex-direction: column; align-items: flex-start; padding: 20px; }
    .hero-logo { width: 64px; height: 64px; }
    .hero h1 { font-size: 22px; }
    .ann-grid { grid-template-columns: minmax(0, 1fr); }
    .history-row { grid-template-columns: minmax(0, 1fr) auto; }
    .history-side { grid-column: 1; grid-row: 2; text-align: left; display: flex; gap: 10px; align-items: center; }
    .history-actions { grid-row: 1 / span 2; grid-column: 2; flex-direction: column; }
    .dc-message { grid-template-columns: 56px minmax(0, 1fr); }
    .dc-avatar { margin-left: 8px; }
    .save-bar { bottom: 8px; }
    .save-hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
