/* ============================================================
   Admin Console — Notion × Apple
   생명을 나누는 사람들
============================================================ */

/* ---------- Reset (scoped) ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; margin: 0; padding: 0; }
img { max-width: 100%; display: block; }

/* ---------- Tokens ---------- */
:root {
    /* Notion-ish neutrals + Apple subtle gradients */
    --bg:           #f7f7f5;
    --bg-elev:      #ffffff;
    --bg-soft:      #fbfbfa;
    --bg-hover:     rgba(55, 53, 47, 0.06);
    --bg-active:    rgba(55, 53, 47, 0.09);

    --text:         #2f3437;
    --text-muted:   #787774;
    --text-faint:   #9b9a97;

    --border:       rgba(55, 53, 47, 0.09);
    --border-strong:rgba(55, 53, 47, 0.16);

    /* Apple-like accent (system blue) */
    --accent:       #0a84ff;
    --accent-soft:  rgba(10, 132, 255, 0.10);
    --accent-text:  #0a6fd9;

    /* Status */
    --green:  #2eb67d;
    --orange: #ff9f0a;
    --red:    #ff3b30;
    --purple: #af52de;
    --pink:   #ff2d55;
    --teal:   #5ac8fa;

    /* Role chips (Notion subtle pastels) */
    --r-admin-bg:        #fde8e8; --r-admin-fg:        #c0392b;
    --r-supervisor-bg:   #fff1d6; --r-supervisor-fg:   #b46a00;
    --r-sales-lead-bg:   #e6efff; --r-sales-lead-fg:   #1d4ed8;
    --r-sales-member-bg: #e7f2ff; --r-sales-member-fg: #2563eb;
    --r-donor-bg:        #e8f5ee; --r-donor-fg:        #0a7a40;
    --r-donee-bg:        #f3e8fc; --r-donee-fg:        #6d28d9;

    --shadow-xs:  0 1px 0 rgba(15, 15, 15, 0.04);
    --shadow-sm:  0 1px 2px rgba(15, 15, 15, 0.04), 0 1px 3px rgba(15, 15, 15, 0.05);
    --shadow-md:  0 4px 14px rgba(15, 15, 15, 0.08), 0 1px 2px rgba(15, 15, 15, 0.04);
    --shadow-lg:  0 12px 40px rgba(15, 15, 15, 0.10), 0 2px 6px rgba(15, 15, 15, 0.04);

    --radius-sm: 6px;
    --radius:    10px;
    --radius-lg: 14px;
    --radius-xl: 20px;

    --sidebar-w: 248px;
    --topbar-h:  56px;

    --ease: cubic-bezier(0.32, 0.72, 0, 1); /* Apple ease */
}

/* ---------- Base ---------- */
html { font-size: 14px; }
body.admin-body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'SF Pro Text',
                 'Segoe UI', 'Inter', 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.01em;
    line-height: 1.5;
}

/* ---------- Shell ---------- */
.admin-shell {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    min-height: 100vh;
    transition: grid-template-columns .35s var(--ease);
}
.admin-shell.is-collapsed { grid-template-columns: 64px 1fr; }

/* ---------- Sidebar ---------- */
.admin-sidebar {
    background: var(--bg-soft);
    border-right: 1px solid var(--border);
    height: 100vh;
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-brand {
    height: var(--topbar-h);
    padding: 0 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.brand-link {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 8px; border-radius: var(--radius-sm);
    transition: background .15s var(--ease);
}
.brand-link:hover { background: var(--bg-hover); }
.brand-mark {
    width: 28px; height: 28px;
    display: grid; place-items: center;
    background: linear-gradient(135deg, #ff8a8a 0%, #ff5a5a 100%);
    color: #fff;
    border-radius: 8px;
    font-size: 16px;
    box-shadow: var(--shadow-sm);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 12.5px; font-weight: 600; color: var(--text); white-space: nowrap; }
.brand-text span { font-size: 11px; color: var(--text-faint); letter-spacing: .04em; }

.sidebar-toggle {
    width: 28px; height: 28px;
    border-radius: 6px;
    display: grid; place-items: center;
    color: var(--text-muted);
    transition: background .15s var(--ease);
}
.sidebar-toggle:hover { background: var(--bg-hover); }
.sidebar-toggle span {
    display: block;
    width: 14px; height: 1.5px;
    background: currentColor;
    margin: 2px 0;
    border-radius: 2px;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 8px 8px 14px;
    scrollbar-width: thin;
}
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(0,0,0,.08); border-radius: 99px; }

.nav-group { padding: 10px 0 4px; }
.nav-group + .nav-group { border-top: 1px dashed var(--border); margin-top: 6px; }
.nav-group-title {
    font-size: 11px;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: .08em;
    padding: 4px 10px 6px;
    margin: 0;
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    margin: 1px 0;
    border-radius: 6px;
    font-size: 13.5px;
    color: var(--text);
    transition: background .12s var(--ease), color .12s var(--ease);
}
.nav-item:hover { background: var(--bg-hover); }
.nav-item.is-active {
    background: var(--bg-active);
    font-weight: 600;
}
.nav-item.is-disabled {
    color: var(--text-faint);
    cursor: default;
    pointer-events: none;
}
.nav-ico {
    width: 18px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}
.nav-item.is-active .nav-ico { color: var(--accent); }
.nav-sub { padding-left: 28px; font-size: 13px; color: var(--text-muted); }
.nav-dot {
    width: 7px; height: 7px; border-radius: 99px;
    background: #c1c0bb;
    box-shadow: 0 0 0 2px var(--bg-soft);
}
.nav-dot[data-role="admin"]        { background: var(--r-admin-fg); }
.nav-dot[data-role="supervisor"]   { background: var(--r-supervisor-fg); }
.nav-dot[data-role="sales_lead"]   { background: var(--r-sales-lead-fg); }
.nav-dot[data-role="sales_member"] { background: var(--r-sales-member-fg); }
.nav-dot[data-role="donor"]        { background: var(--r-donor-fg); }
.nav-dot[data-role="donee"]        { background: var(--r-donee-fg); }

.sidebar-foot {
    border-top: 1px solid var(--border);
    padding: 10px;
    flex-shrink: 0;
}
.user-card {
    display: flex; align-items: center; gap: 10px;
    padding: 8px;
    border-radius: var(--radius);
    transition: background .15s var(--ease);
}
.user-card:hover { background: var(--bg-hover); }
.user-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #5ac8fa, #0a84ff);
    color: #fff;
    display: grid; place-items: center;
    font-weight: 600;
    font-size: 13px;
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}
.user-meta { flex: 1; min-width: 0; line-height: 1.25; }
.user-meta strong { display: block; font-size: 13px; font-weight: 600; }
.user-meta span { font-size: 11.5px; color: var(--text-faint); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu-btn {
    width: 26px; height: 26px;
    border-radius: 6px;
    color: var(--text-muted);
}
.user-menu-btn:hover { background: var(--bg-hover); }

/* Collapsed state */
.admin-shell.is-collapsed .brand-text,
.admin-shell.is-collapsed .nav-label,
.admin-shell.is-collapsed .nav-group-title,
.admin-shell.is-collapsed .user-meta,
.admin-shell.is-collapsed .user-menu-btn { display: none; }
.admin-shell.is-collapsed .nav-item { justify-content: center; padding: 8px; }
.admin-shell.is-collapsed .nav-sub { padding-left: 8px; }
.admin-shell.is-collapsed .nav-sub .nav-dot { box-shadow: 0 0 0 2px var(--bg-soft); }

/* ---------- Main ---------- */
.admin-main { display: flex; flex-direction: column; min-width: 0; }

/* ---------- Topbar ---------- */
.admin-topbar {
    height: var(--topbar-h);
    padding: 0 18px;
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 10;
}
.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: 6px; margin-left: auto; }

.icon-btn {
    width: 32px; height: 32px;
    border-radius: 8px;
    display: grid; place-items: center;
    color: var(--text-muted);
    position: relative;
    transition: background .15s var(--ease), color .15s var(--ease);
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.icon-btn-ghost { color: var(--text-muted); }
.hamburger, .hamburger::before, .hamburger::after {
    display: block; width: 14px; height: 1.5px;
    background: currentColor; border-radius: 2px;
    transition: transform .25s var(--ease);
}
.hamburger { position: relative; }
.hamburger::before, .hamburger::after { content: ''; position: absolute; left: 0; }
.hamburger::before { top: -5px; }
.hamburger::after  { top:  5px; }
.badge-dot {
    position: absolute; top: 7px; right: 7px;
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--red);
    box-shadow: 0 0 0 2px rgba(255,255,255,0.95);
}

.breadcrumb ol { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.breadcrumb li { font-size: 13px; color: var(--text-muted); }
.breadcrumb li + li::before { content: '/'; margin-right: 6px; color: var(--text-faint); }
.breadcrumb a { color: var(--text-muted); transition: color .15s var(--ease); }
.breadcrumb a:hover { color: var(--text); }
.breadcrumb [aria-current="page"] { color: var(--text); font-weight: 600; }

.topbar-search {
    flex: 1;
    max-width: 460px;
    height: 34px;
    padding: 0 10px 0 32px;
    background: var(--bg);
    border: 1px solid transparent;
    border-radius: 8px;
    display: flex; align-items: center;
    position: relative;
    transition: background .15s var(--ease), border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.topbar-search:focus-within {
    background: #fff;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-soft);
}
.topbar-search input {
    flex: 1;
    background: transparent;
    border: 0;
    outline: 0;
    font-size: 13px;
    height: 100%;
}
.search-ico {
    position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
    color: var(--text-faint); font-size: 14px;
}
.topbar-search kbd {
    font-size: 11px;
    color: var(--text-faint);
    background: rgba(55,53,47,.08);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: inherit;
}

.btn-ghost-sm {
    height: 30px; padding: 0 12px;
    border-radius: 8px;
    font-size: 12.5px; font-weight: 500;
    color: var(--text-muted);
    display: inline-flex; align-items: center; gap: 4px;
    transition: background .15s var(--ease), color .15s var(--ease);
}
.btn-ghost-sm:hover { background: var(--bg-hover); color: var(--text); }

/* ---------- Content ---------- */
.admin-content { padding: 28px 32px 56px; max-width: 1400px; width: 100%; }

.page-head {
    display: flex; align-items: flex-end; justify-content: space-between;
    gap: 24px; flex-wrap: wrap;
    padding-bottom: 18px;
    margin-bottom: 22px;
    border-bottom: 1px solid var(--border);
}
.page-head h1 {
    font-size: 28px; font-weight: 700; letter-spacing: -0.02em;
    margin: 0 0 4px; color: var(--text);
}
.page-head .page-desc { color: var(--text-muted); font-size: 13.5px; margin: 0; }
.page-head-actions { display: flex; align-items: center; gap: 8px; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    height: 34px; padding: 0 14px;
    border-radius: 8px;
    font-size: 13px; font-weight: 500;
    transition: transform .12s var(--ease), background .15s var(--ease),
                box-shadow .15s var(--ease), border-color .15s var(--ease);
    border: 1px solid transparent;
    white-space: nowrap;
}
.btn:active { transform: scale(.98); }
.btn-primary {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 1px 0 rgba(0,0,0,.04), 0 1px 2px rgba(10,132,255,.25);
}
.btn-primary:hover { background: #006fe6; }
.btn-secondary {
    background: #fff;
    color: var(--text);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-xs);
}
.btn-secondary:hover { background: var(--bg-soft); }
.btn-ghost { color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 6px; }

/* ---------- Stat cards ---------- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 24px;
}
@media (max-width: 1080px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 380px)  { .stat-grid { grid-template-columns: 1fr; } }
.stat-card {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px 18px 16px;
    transition: box-shadow .2s var(--ease), transform .2s var(--ease);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-card-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 10px;
}
.stat-label { font-size: 12.5px; color: var(--text-muted); font-weight: 500; }
.stat-icon {
    width: 28px; height: 28px;
    border-radius: 8px;
    display: grid; place-items: center;
    font-size: 14px;
    background: var(--accent-soft);
    color: var(--accent-text);
}
.stat-icon[data-tone="green"]  { background: rgba(46,182,125,.12);  color: var(--green); }
.stat-icon[data-tone="orange"] { background: rgba(255,159,10,.14);  color: var(--orange); }
.stat-icon[data-tone="purple"] { background: rgba(175,82,222,.12);  color: var(--purple); }
.stat-value { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.stat-foot { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* 컴팩트 변형 — 푸터 없이 라벨+값만 (높이 약 40% 감소) */
.stat-card--compact { padding: 12px 14px 12px; }
.stat-card--compact .stat-card-head { margin-bottom: 4px; }
.stat-card--compact .stat-value { font-size: 22px; line-height: 1.1; }
.stat-card--compact .stat-foot { display: none; }
.stat-card--compact .stat-icon { width: 24px; height: 24px; font-size: 12px; }
.stat-trend.up   { color: var(--green); font-weight: 600; }
.stat-trend.down { color: var(--red);   font-weight: 600; }

/* ---------- Panel / Card ---------- */
.panel {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
}
.panel + .panel { margin-top: 18px; }
.panel-head {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; flex-wrap: wrap;
}
.panel-head h2 {
    font-size: 15px; font-weight: 600; margin: 0;
    letter-spacing: -0.01em;
}
.panel-head .panel-sub { font-size: 12.5px; color: var(--text-muted); margin: 2px 0 0; }
.panel-body { padding: 18px; }
.panel-body.is-flush { padding: 0; }

.panel-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 18px;
}
@media (max-width: 980px) { .panel-grid { grid-template-columns: 1fr; } }

/* ---------- Tabs (Notion-like underlined) ---------- */
.tabs {
    display: flex;
    gap: 2px;
    padding: 0 12px;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
    position: relative;
    padding: 10px 12px;
    font-size: 13px;
    color: var(--text-muted);
    border-radius: 6px 6px 0 0;
    white-space: nowrap;
    display: inline-flex; align-items: center; gap: 6px;
    transition: color .15s var(--ease), background .15s var(--ease);
}
.tab:hover { color: var(--text); background: var(--bg-hover); }
.tab.is-active { color: var(--text); font-weight: 600; }
.tab.is-active::after {
    content: '';
    position: absolute; left: 8px; right: 8px; bottom: -1px;
    height: 2px; border-radius: 2px;
    background: var(--text);
}
.tab .count {
    font-size: 11px;
    color: var(--text-faint);
    background: var(--bg-hover);
    padding: 1px 6px;
    border-radius: 99px;
    font-weight: 500;
}
.tab.is-active .count { color: var(--text); background: rgba(55,53,47,.10); }

/* ---------- Toolbar / Filters ---------- */
.toolbar {
    display: flex; align-items: center; gap: 8px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    background: var(--bg-soft);
}
.toolbar-search {
    flex: 1; min-width: 200px; max-width: 360px;
    position: relative;
}
.toolbar-search input {
    width: 100%;
    height: 32px;
    padding: 0 10px 0 30px;
    background: #fff;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    font-size: 13px;
    transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.toolbar-search input:focus {
    outline: 0;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.toolbar-search .search-ico { left: 10px; }

.filter-pill {
    height: 30px;
    padding: 0 10px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid var(--border-strong);
    font-size: 12.5px;
    color: var(--text-muted);
    display: inline-flex; align-items: center; gap: 6px;
    transition: background .15s var(--ease), color .15s var(--ease);
}
.filter-pill:hover { background: var(--bg-soft); color: var(--text); }
.filter-pill.is-on { background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent); }
.filter-pill::after { content: '▾'; font-size: 9px; color: var(--text-faint); }

.toolbar-spacer { flex: 1; }

/* ---------- Table ---------- */
.data-table-wrap { overflow-x: auto; }
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.data-table thead th {
    text-align: left;
    font-weight: 500;
    color: var(--text-muted);
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-soft);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
    white-space: nowrap;
    position: sticky;
    top: 0;
}
.data-table tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.data-table tbody tr { transition: background .12s var(--ease); }
.data-table tbody tr:hover { background: var(--bg-soft); }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table .col-check { width: 36px; padding-right: 0; }
.data-table .col-actions { width: 80px; text-align: right; }

/* 일시 컬럼 — PC: 한 줄 (날짜 + 공백 + 시각), Mobile: 두 줄 */
.col-date { white-space: nowrap; }
.col-date .dt-d { white-space: nowrap; }
.col-date .dt-t {
    white-space: nowrap;
    color: var(--text-muted);
    margin-left: 6px;
    font-size: 12.5px;
}
@media (max-width: 720px) {
    .col-date .dt-d, .col-date .dt-t { display: block; margin-left: 0; }
    .col-date .dt-t { font-size: 11.5px; line-height: 1.3; margin-top: 2px; }
}

/* 발송 이력 테이블 — 컬럼 폭 고정 (텍스트 길이에 흔들리지 않게) */
#recentLogs { table-layout: fixed; }
#recentLogs .col-date      { width: 156px; }                       /* 일시: 130 × 1.2 */
#recentLogs .col-channel   { width: 120px; }                       /* 채널: 80 × 1.5 */
#recentLogs .col-recipient { width: 30%; word-break: break-all; }  /* 수신자: 30%로 줄임 */
#recentLogs .col-match     { width: 130px; }
@media (max-width: 720px) {
    #recentLogs .col-date      { width: 78px; }
    #recentLogs .col-channel   { width: 96px; }                    /* 채널 모바일: 64 × 1.5 */
    #recentLogs .col-recipient { width: auto; }
    #recentLogs .col-match     { width: 90px; }
    #recentLogs td, #recentLogs th { padding: 8px 8px; font-size: 12.5px; }
}

/* 발송 이력 영역의 최소 높이 — 페이지마다 row 수가 달라도 표 영역 높이는 일정.
   덕분에 페이지네이션이 늘 같은 위치에 머무름 (페이지 클릭 시 위치 흔들림 0). */
#logsPanel .data-table-wrap { min-height: 460px; }
@media (max-width: 720px) {
    #logsPanel .data-table-wrap { min-height: 600px; }
}

.cell-user {
    display: flex; align-items: center; gap: 10px;
}
.cell-avatar {
    width: 30px; height: 30px;
    border-radius: 50%;
    display: grid; place-items: center;
    font-size: 12px; font-weight: 600;
    color: #fff;
    flex-shrink: 0;
}
.cell-user .name { font-weight: 500; }
.cell-user .email { font-size: 12px; color: var(--text-faint); }

/* Role chips */
.role-chip {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 2px 8px;
    border-radius: 99px;
    font-size: 11.5px;
    font-weight: 500;
    line-height: 1.5;
    white-space: nowrap;
}
.role-chip::before {
    content: ''; width: 6px; height: 6px; border-radius: 50%;
    background: currentColor;
    opacity: .7;
}
.role-chip[data-role="admin"]        { background: var(--r-admin-bg);        color: var(--r-admin-fg); }
.role-chip[data-role="supervisor"]   { background: var(--r-supervisor-bg);   color: var(--r-supervisor-fg); }
.role-chip[data-role="sales_lead"]   { background: var(--r-sales-lead-bg);   color: var(--r-sales-lead-fg); }
.role-chip[data-role="sales_member"] { background: var(--r-sales-member-bg); color: var(--r-sales-member-fg); }
.role-chip[data-role="donor"]        { background: var(--r-donor-bg);        color: var(--r-donor-fg); }
.role-chip[data-role="donee"]        { background: var(--r-donee-bg);        color: var(--r-donee-fg); }

/* Status pill */
.status-pill {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 12px;
    color: var(--text-muted);
}
.status-pill::before {
    content: ''; width: 6px; height: 6px; border-radius: 50%;
    background: var(--text-faint);
}
.status-pill.is-active::before    { background: var(--green); box-shadow: 0 0 0 2px rgba(46,182,125,.16); }
.status-pill.is-pending::before   { background: var(--orange); }
.status-pill.is-suspended::before { background: var(--red); }
.status-pill.is-active    { color: var(--green); }
.status-pill.is-pending   { color: var(--orange); }
.status-pill.is-suspended { color: var(--red); }

/* Row action button */
.row-action {
    width: 28px; height: 28px;
    border-radius: 6px;
    color: var(--text-muted);
    display: inline-grid; place-items: center;
}
.row-action:hover { background: var(--bg-hover); color: var(--text); }

/* Checkbox (Notion-ish) */
.chk {
    appearance: none;
    -webkit-appearance: none;
    width: 16px; height: 16px;
    border: 1.5px solid var(--border-strong);
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    transition: background .15s var(--ease), border-color .15s var(--ease);
    position: relative;
}
.chk:checked {
    background: var(--accent);
    border-color: var(--accent);
}
.chk:checked::after {
    content: '';
    position: absolute;
    left: 4px; top: 1px;
    width: 5px; height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.chk:focus-visible {
    outline: 2px solid var(--accent-soft);
    outline-offset: 2px;
}

/* ---------- Pagination ---------- */
.pagination {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 18px;
    border-top: 1px solid var(--border);
    background: var(--bg-soft);
    font-size: 12.5px;
    color: var(--text-muted);
}
.pagination--center { justify-content: center; }
.pagination .pages { display: flex; gap: 4px; }
.pagination .page-btn {
    min-width: 28px; height: 28px;
    padding: 0 8px;
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 12.5px;
    display: inline-grid; place-items: center;
    transition: background .15s var(--ease), color .15s var(--ease);
}
.pagination .page-btn:hover { background: var(--bg-hover); color: var(--text); }
.pagination .page-btn.is-active { background: var(--text); color: #fff; }

/* ---------- Activity (right column) ---------- */
.activity-list { padding: 4px 0; }
.activity-item {
    display: flex; gap: 10px;
    padding: 10px 18px;
    border-bottom: 1px dashed var(--border);
}
.activity-item:last-child { border-bottom: 0; }
.activity-dot {
    width: 8px; height: 8px; border-radius: 50%;
    margin-top: 7px; flex-shrink: 0;
    background: var(--accent);
}
.activity-dot.green  { background: var(--green); }
.activity-dot.orange { background: var(--orange); }
.activity-dot.purple { background: var(--purple); }
.activity-body p { margin: 0; font-size: 13px; }
.activity-body time { font-size: 11.5px; color: var(--text-faint); }

/* ---------- Empty state ---------- */
.empty-state {
    text-align: center;
    padding: 56px 20px;
    color: var(--text-muted);
}
.empty-state .ico {
    font-size: 32px;
    margin-bottom: 8px;
    opacity: .6;
}
.empty-state h3 { font-size: 15px; font-weight: 600; color: var(--text); margin: 0 0 4px; }
.empty-state p { margin: 0; font-size: 13px; }

/* ---------- Responsive ---------- */
@media (max-width: 880px) {
    .admin-shell { grid-template-columns: 1fr; }
    .admin-sidebar {
        position: fixed; left: 0; top: 0;
        width: 280px;
        z-index: 50;
        transform: translateX(-100%);
        transition: transform .3s var(--ease);
        box-shadow: var(--shadow-lg);
    }
    .admin-shell.is-open .admin-sidebar { transform: translateX(0); }
    .admin-shell.is-open::after {
        content: '';
        position: fixed; inset: 0;
        background: rgba(15,15,15,.35);
        z-index: 40;
    }
    .admin-content { padding: 18px; }
    .topbar-search { display: none; }
}

/* ============================================================
   Login page
============================================================ */
.login-body {
    background:
        radial-gradient(1200px 600px at 110% -10%, rgba(10,132,255,.10), transparent 60%),
        radial-gradient(900px 500px at -10% 110%, rgba(255,90,90,.08), transparent 60%),
        var(--bg);
    min-height: 100vh;
}
.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 32px 18px;
}
.login-card {
    width: 100%;
    max-width: 380px;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: 32px 28px 26px;
}
.login-brand {
    text-align: center;
    margin-bottom: 22px;
}
.login-brand .brand-mark {
    width: 44px; height: 44px;
    font-size: 22px;
    border-radius: 12px;
    margin: 0 auto 12px;
}
.login-brand h1 {
    font-size: 17px;
    font-weight: 700;
    margin: 0 0 4px;
    letter-spacing: -0.01em;
}
.login-brand p {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0;
}
.login-error {
    background: rgba(255, 59, 48, 0.08);
    color: var(--red);
    border: 1px solid rgba(255, 59, 48, 0.2);
    border-radius: var(--radius);
    padding: 10px 12px;
    font-size: 12.5px;
    margin-bottom: 16px;
}
.login-form { display: flex; flex-direction: column; gap: 12px; }
.login-form .field { display: flex; flex-direction: column; gap: 6px; }
.login-form .field span {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}
.login-form .field input {
    height: 38px;
    padding: 0 12px;
    border-radius: 10px;
    border: 1px solid var(--border-strong);
    background: #fff;
    font-size: 14px;
    transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.login-form .field input:focus {
    outline: 0;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-soft);
}
.login-submit {
    height: 40px;
    width: 100%;
    margin-top: 6px;
    font-size: 14px;
    font-weight: 600;
    justify-content: center;
}
.login-foot {
    text-align: center;
    font-size: 11.5px;
    color: var(--text-faint);
    margin: 18px 0 0;
}

/* ============================================================
   Form (new/edit member)
============================================================ */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 18px;
}
@media (max-width: 720px) { .form-grid { grid-template-columns: 1fr; } }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}
.field input[type="text"],
.field input[type="email"],
.field input[type="tel"],
.field input[type="password"],
.field select {
    height: 36px;
    padding: 0 10px;
    border-radius: 8px;
    border: 1px solid var(--border-strong);
    background: #fff;
    font-size: 13.5px;
    transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.field select { padding-right: 28px; }
.field input:focus, .field select:focus {
    outline: 0;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.field-help {
    font-size: 11.5px;
    color: var(--text-faint);
}
.req {
    color: var(--red);
    font-style: normal;
    margin-left: 2px;
    font-weight: 600;
}
.req.sales-only, .req.staff-only { visibility: hidden; }

.role-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 8px;
}
.role-card {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 12px;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    cursor: pointer;
    background: #fff;
    transition: background .15s var(--ease), border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.role-card:hover { background: var(--bg-soft); }
.role-card.is-selected {
    border-color: var(--accent);
    background: var(--accent-soft);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.role-card input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 16px; height: 16px;
    border: 1.5px solid var(--border-strong);
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    flex-shrink: 0;
    position: relative;
}
.role-card input[type="checkbox"]:checked {
    background: var(--accent);
    border-color: var(--accent);
}
.role-card input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 4px; top: 1px;
    width: 5px; height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* ============================================================
   Alerts, member detail head, danger zone, link cells
============================================================ */
.alert {
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 13px;
    border: 1px solid transparent;
}
.alert-success {
    background: rgba(46,182,125,.08);
    color: var(--green);
    border-color: rgba(46,182,125,.22);
}
.alert-error {
    background: rgba(255,59,48,.08);
    color: var(--red);
    border-color: rgba(255,59,48,.22);
}

.member-head {
    display: flex;
    align-items: center;
    gap: 14px;
}
.member-avatar {
    width: 48px; height: 48px;
    font-size: 18px;
}

.danger-zone { border-color: rgba(255,59,48,.22); }
.danger-zone .panel-head h2 { color: var(--red); }

.btn-danger {
    background: #fff;
    color: var(--red);
    border-color: rgba(255,59,48,.35);
    box-shadow: var(--shadow-xs);
}
.btn-danger:hover {
    background: var(--red);
    color: #fff;
    border-color: var(--red);
}

.cell-user-link {
    text-decoration: none;
    color: inherit;
    border-radius: 6px;
    padding: 4px 6px;
    margin: -4px -6px;
    transition: background .12s var(--ease);
}
.cell-user-link:hover { background: var(--bg-hover); }
.cell-user-link .name { color: var(--text); }

.row-action[href]:hover { color: var(--accent); }

/* ============================================================
   Invite panel — QR + share + log
============================================================ */
.invite-grid {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 24px;
    align-items: start;
}
@media (max-width: 720px) { .invite-grid { grid-template-columns: 1fr; } }

.invite-qr {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 14px;
    text-align: center;
}
.invite-qr #qrcode { display: inline-block; }
.invite-qr #qrcode img,
.invite-qr #qrcode canvas { display: block; margin: 0 auto; }
.invite-qr .invite-code {
    margin-top: 10px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12px;
    color: var(--text-muted);
    letter-spacing: .04em;
    word-break: break-all;
}

.invite-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px;
}
.share-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 42px; padding: 0 14px;
    background: #fff;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    font-size: 13.5px; font-weight: 500;
    color: var(--text);
    transition: all .15s var(--ease);
    cursor: pointer;
}
.share-btn:hover { background: var(--bg-soft); border-color: var(--accent); color: var(--accent-text); }
.share-btn .ic { font-size: 16px; }
.share-btn--primary {
    background: var(--accent); color: #fff; border-color: var(--accent);
    box-shadow: 0 1px 2px rgba(10,132,255,.25);
}
.share-btn--primary:hover { background: #006fe6; color: #fff; border-color: #006fe6; }
.share-btn--kakao {
    background: #FEE500;
    color: #191919;
    border-color: #FEE500;
    box-shadow: 0 1px 2px rgba(254,229,0,.35);
}
.share-btn--kakao:hover { background: #FDD700; color: #191919; border-color: #FDD700; }

/* 채널별 컬러 · 버튼 티 나도록 */
.share-btn[data-share-action="web"] {
    background: #0a84ff; color: #fff; border-color: #0a84ff;
    box-shadow: 0 1px 2px rgba(10,132,255,.28);
}
.share-btn[data-share-action="web"]:hover { background: #0069d9; border-color: #0069d9; color: #fff; }

.share-btn[data-share-action="sms"] {
    background: #16a34a; color: #fff; border-color: #16a34a;
    box-shadow: 0 1px 2px rgba(22,163,74,.28);
}
.share-btn[data-share-action="sms"]:hover { background: #15803d; border-color: #15803d; color: #fff; }

.share-btn[data-share-action="email"] {
    background: #4f46e5; color: #fff; border-color: #4f46e5;
    box-shadow: 0 1px 2px rgba(79,70,229,.28);
}
.share-btn[data-share-action="email"]:hover { background: #4338ca; border-color: #4338ca; color: #fff; }

.share-btn[data-share-action="copy"] {
    background: #475569; color: #fff; border-color: #475569;
    box-shadow: 0 1px 2px rgba(71,85,105,.25);
}
.share-btn[data-share-action="copy"]:hover { background: #334155; border-color: #334155; color: #fff; }

.invite-url-row {
    display: flex; gap: 8px; align-items: center; margin-top: 12px;
}
.invite-url-row input {
    flex: 1; height: 36px; padding: 0 12px;
    border: 1px solid var(--border-strong); border-radius: 8px;
    font-size: 12.5px; font-family: ui-monospace, monospace;
    background: var(--bg-soft);
}

.share-status {
    margin-top: 10px;
    font-size: 12.5px;
    min-height: 18px;
    color: var(--text-muted);
    transition: all .2s;
}
.share-status--ok    { color: var(--green); }
.share-status--warn  {
    color: var(--orange);
    background: rgba(255,159,10,.12);
    border: 1px solid rgba(255,159,10,.28);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.5;
}

.invite-recipient {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 12px;
    margin-top: 14px;
}
@media (max-width: 600px) { .invite-recipient { grid-template-columns: 1fr; } }

[data-invite-root].no-web-share .share-btn[data-share-action="web"] {
    display: none;
}

/* Web Contact Picker 버튼 — 지원 환경에서만 자동 표시 */
.contact-picker-row {
    display: flex;
    gap: 6px;
    align-items: stretch;
    max-width: 100%;
    min-width: 0;
}
.contact-picker-row input {
    flex: 1 1 0;
    min-width: 0;
    width: 0;       /* flex가 펼쳐주도록 — 컨테이너 폭에 맞춰 안전하게 줄어듦 */
}
.btn-pick-contact {
    height: 36px;
    padding: 0 10px;
    border: 1px solid #FEE500;
    background: #FEE500;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #191919;
    white-space: nowrap;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 1px 2px rgba(254,229,0,.35);
    transition: background .15s var(--ease), border-color .15s var(--ease),
                transform .12s var(--ease);
    flex-shrink: 0;
}
.btn-pick-contact:hover {
    background: #FDD700;
    border-color: #FDD700;
    color: #191919;
}
.btn-pick-contact:active { transform: scale(.97); }
.btn-pick-contact .ic { font-size: 14px; line-height: 1; }
@media (min-width: 720px) {
    /* PC에서는 sms 링크가 동작하지 않을 가능성이 높음 — 흐리게 */
    [data-invite-root]:not(.is-mobile) .share-btn[data-share-action="sms"] {
        opacity: 0.55;
    }
}


