/* ============================================================
   MODU UI — 모두허브 디자인 시스템 (수제 토큰 CSS, Tailwind 대체)
   라이트: :root / 다크: html[data-theme="dark"]
   ============================================================ */

/* ---------- 토큰 ---------- */
:root {
    --bg: #F4F6F8;
    --surface: #FFFFFF;
    --surface-2: #F8FAFB;
    --line: #E4E8EC;
    --ink: #1B2430;
    --ink-2: #5B6673;
    --ink-3: #97A1AC;
    --brand: #5B5BD6;
    --brand-strong: #4A48C4;
    --brand-tint: #EEEEFB;
    --brand-on: #FFFFFF;

    --amber: #B45309;      --amber-bg: #FDF3E3;
    --green: #0E8A5F;      --green-bg: #E6F6EF;
    --red:   #D13438;      --red-bg:   #FCEBEB;
    --blue:  #0B7CB8;      --blue-bg:  #E7F4FB;
    --rose:  #BE3D6B;      --rose-bg:  #FBEAF1;

    --topbar-h: 56px;
    --banner-h: 38px;
    --sidebar-w: 232px;
    --tabbar-h: 58px;

    --r-ctl: 8px;
    --r-card: 12px;
    --r-modal: 16px;

    --shadow-overlay: 0 16px 48px rgba(15, 18, 21, 0.18);
    --scrim: rgba(15, 18, 21, 0.42);
}

html[data-theme="dark"] {
    --bg: #0F1215;
    --surface: #171B21;
    --surface-2: #1D232B;
    --line: #2A313A;
    --ink: #E7EAEE;
    --ink-2: #98A2AE;
    --ink-3: #5C6672;
    --brand: #8385EC;
    --brand-strong: #979AF0;
    --brand-tint: #26263E;
    --brand-on: #0F1215;

    --amber: #F5B04D;      --amber-bg: #3A2E15;
    --green: #4ECB94;      --green-bg: #123124;
    --red:   #F17B7E;      --red-bg:   #3A1B1C;
    --blue:  #5BB8E8;      --blue-bg:  #12293A;
    --rose:  #E27BA4;      --rose-bg:  #3A1E2B;

    --shadow-overlay: 0 16px 48px rgba(0, 0, 0, 0.55);
    --scrim: rgba(0, 0, 0, 0.55);
}

/* ---------- 리셋·베이스 ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, 'Segoe UI', sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--ink);
    background: var(--bg);
    word-break: keep-all;
    font-variant-numeric: tabular-nums;
    -webkit-font-smoothing: antialiased;
}

html.theme-anim body,
html.theme-anim body * {
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease !important;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
ul, ol { list-style: none; }
h1, h2, h3, h4 { line-height: 1.4; }

:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

.ico { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ico-sm { width: 14px; height: 14px; }
.ico-lg { width: 22px; height: 22px; }
.num { font-variant-numeric: tabular-nums; }

.kbd {
    display: inline-flex; align-items: center; gap: 2px;
    padding: 1px 6px; border: 1px solid var(--line); border-bottom-width: 2px;
    border-radius: 5px; background: var(--surface-2);
    font-size: 11px; font-weight: 600; color: var(--ink-3); font-family: inherit;
}

/* ---------- 데모 배너 ---------- */
.demo-banner {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
    gap: 4px 12px; padding: 9px 16px; text-align: center;
    background: #16191F; color: #E7EAEE; font-size: 12px;
}
.demo-banner a { color: #A5B4FC; text-decoration: underline; text-underline-offset: 3px; }
.demo-banner a:hover { color: #fff; }

/* ---------- 상단바 ---------- */
.topbar {
    position: sticky; top: 0; z-index: 40;
    display: flex; align-items: center; gap: 12px;
    height: var(--topbar-h); padding: 0 16px;
    background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; flex: none; }
.brand-mark {
    width: 30px; height: 30px; border-radius: 8px; color: var(--brand-on);
    background: var(--brand); display: grid; place-items: center;
}
.brand-mark svg { width: 19px; height: 19px; }
.brand-name { font-size: 16px; font-weight: 800; letter-spacing: -0.02em; }
.brand-tenant {
    font-size: 11px; font-weight: 600; color: var(--ink-2);
    border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px;
    background: var(--surface-2);
}
.gsearch {
    display: flex; align-items: center; gap: 8px;
    flex: 1; max-width: 420px; margin: 0 auto;
    height: 36px; padding: 0 10px 0 12px;
    border: 1px solid var(--line); border-radius: var(--r-ctl);
    background: var(--surface-2); color: var(--ink-3); font-size: 13px;
    transition: border-color 0.15s ease;
}
.gsearch:hover { border-color: var(--brand); }
.gsearch .ico { width: 15px; height: 15px; }
.gsearch-ph { flex: 1; text-align: left; }
.topbar-actions { display: flex; align-items: center; gap: 4px; flex: none; margin-left: auto; }

.icon-btn {
    position: relative; width: 36px; height: 36px; border-radius: var(--r-ctl);
    display: grid; place-items: center; color: var(--ink-2);
    transition: background-color 0.15s ease, color 0.15s ease;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.badge-dot {
    position: absolute; top: 3px; right: 3px; min-width: 16px; height: 16px;
    padding: 0 4px; border-radius: 999px; background: var(--red);
    color: #fff; font-size: 10px; font-weight: 700; line-height: 16px; text-align: center;
}
html[data-theme="dark"] .badge-dot { color: #1D1112; }
.badge-dot.bounce { animation: badgeBounce 0.5s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes badgeBounce { 0% { transform: scale(0.4); } 60% { transform: scale(1.25); } 100% { transform: scale(1); } }
.bell-wiggle { animation: wiggle 0.9s ease; transform-origin: top center; }
@keyframes wiggle {
    0%, 100% { transform: rotate(0); } 20% { transform: rotate(13deg); }
    40% { transform: rotate(-10deg); } 60% { transform: rotate(6deg); } 80% { transform: rotate(-4deg); }
}

.theme-btn .ico-sun, .theme-btn .ico-moon { position: absolute; transition: opacity 0.25s ease, transform 0.25s ease; }
html[data-theme="light"] .theme-btn .ico-moon,
html:not([data-theme="dark"]) .theme-btn .ico-moon { opacity: 0; transform: rotate(70deg) scale(0.5); }
html[data-theme="dark"] .theme-btn .ico-sun { opacity: 0; transform: rotate(-70deg) scale(0.5); }

.profile-btn {
    display: flex; align-items: center; gap: 8px; height: 38px;
    padding: 0 8px 0 4px; border-radius: 999px;
    transition: background-color 0.15s ease;
}
.profile-btn:hover { background: var(--surface-2); }
.profile-name { font-size: 13px; font-weight: 600; }

/* ---------- 아바타 ---------- */
.avatar {
    width: 30px; height: 30px; border-radius: 999px; flex: none;
    display: inline-grid; place-items: center;
    font-size: 12px; font-weight: 700; color: #fff; line-height: 1;
    user-select: none;
}
.avatar.av-sm { width: 24px; height: 24px; font-size: 10px; }
.avatar.av-lg { width: 40px; height: 40px; font-size: 15px; }
.avatar.av-xl { width: 64px; height: 64px; font-size: 24px; }
.avatar-stack { display: inline-flex; align-items: center; }
.avatar-stack .avatar { margin-left: -7px; border: 2px solid var(--surface); }
.avatar-stack .avatar:first-child { margin-left: 0; }
.avatar-stack .avatar.turn { box-shadow: 0 0 0 2px var(--brand); z-index: 1; }
.avatar-wrap { position: relative; display: inline-flex; flex: none; }
.avatar-wrap .st-dot {
    position: absolute; right: -1px; bottom: -1px; width: 10px; height: 10px;
    border-radius: 999px; border: 2px solid var(--surface);
}

.st-dot { display: inline-block; width: 8px; height: 8px; border-radius: 999px; flex: none; }
.st-dot.working { background: var(--green); }
.st-dot.remote { background: var(--blue); }
.st-dot.out { background: var(--amber); }
.st-dot.vacation { background: var(--rose); }
.st-dot.away { background: var(--ink-3); }

/* ---------- 셸 레이아웃 ---------- */
.shell { display: flex; align-items: flex-start; }

.sidebar {
    display: none;
    position: sticky; top: var(--topbar-h);
    width: var(--sidebar-w); flex: none;
    height: calc(100vh - var(--topbar-h));
    padding: 16px 12px;
    background: var(--surface); border-right: 1px solid var(--line);
    flex-direction: column;
}
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a {
    position: relative; display: flex; align-items: center; gap: 10px;
    height: 38px; padding: 0 12px; border-radius: var(--r-ctl);
    font-size: 13.5px; font-weight: 500; color: var(--ink-2);
    transition: background-color 0.15s ease, color 0.15s ease;
}
.side-nav a:hover { background: var(--surface-2); color: var(--ink); }
.side-nav a.active { background: var(--brand-tint); color: var(--brand); font-weight: 700; }
.side-nav a.active::before {
    content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px;
    width: 3px; border-radius: 0 3px 3px 0; background: var(--brand);
}
.nav-badge {
    margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px;
    border-radius: 999px; background: var(--brand); color: var(--brand-on);
    font-size: 11px; font-weight: 700; line-height: 20px; text-align: center;
}
.side-nav a.active .nav-badge { background: var(--brand); }

.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.work-mini {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-ctl);
    background: var(--surface-2); font-size: 12px; color: var(--ink-2);
}
.work-mini-dot { width: 8px; height: 8px; border-radius: 999px; background: var(--ink-3); flex: none; }
.work-mini.on .work-mini-dot { background: var(--green); }
.work-mini.off .work-mini-dot { background: var(--amber); }
.work-mini-label { font-weight: 600; }
.work-mini-time { margin-left: auto; font-weight: 700; color: var(--ink); }

.main {
    flex: 1; min-width: 0;
    padding: 20px 16px calc(var(--tabbar-h) + 32px);
}

.app-foot { padding: 40px 0 8px; text-align: center; font-size: 12px; color: var(--ink-3); }
.app-foot p + p { margin-top: 4px; }
.app-foot a { color: var(--brand); font-weight: 600; }
.app-foot a:hover { text-decoration: underline; }

/* ---------- 모바일 하단 탭 ---------- */
.tabbar {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
    display: grid; grid-template-columns: repeat(5, 1fr);
    background: var(--surface); border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 9px 0 7px; font-size: 10.5px; font-weight: 600; color: var(--ink-3);
}
.tabbar a.active { color: var(--brand); }

@media (min-width: 1024px) {
    .sidebar { display: flex; }
    .tabbar { display: none; }
    .main { padding: 24px 28px 32px; }
    .only-sm { display: none; }
}
@media (max-width: 1023px) {
    .gsearch { display: none; }
    .brand-tenant { display: none; }
    .profile-name { display: none; }
}

/* ---------- 뷰 공통 ---------- */
.view[hidden] { display: none; }
.view { animation: viewIn 0.16s ease both; }
.view-inner { animation: viewIn 0.16s ease both; }
.view.leaving { animation: viewOut 0.08s ease both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes viewOut { from { opacity: 1; } to { opacity: 0; } }

.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; }
.page-title { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.page-sub { font-size: 13px; color: var(--ink-2); }
.page-head .spacer { flex: 1; }

/* ---------- 버튼 ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 36px; padding: 0 14px; border-radius: var(--r-ctl);
    font-size: 13px; font-weight: 600;
    border: 1px solid var(--line); background: var(--surface); color: var(--ink);
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn-brand { background: var(--brand); border-color: var(--brand); color: var(--brand-on); }
.btn-brand:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-danger { background: var(--red-bg); border-color: transparent; color: var(--red); }
.btn-danger:hover { filter: brightness(0.97); }
.btn-ok { background: var(--green-bg); border-color: transparent; color: var(--green); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

.link-more { font-size: 12px; font-weight: 600; color: var(--ink-3); display: inline-flex; align-items: center; gap: 2px; }
.link-more:hover { color: var(--brand); }
.link-more .ico { width: 13px; height: 13px; }

/* ---------- 카드 ---------- */
.card {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--r-card); padding: 20px; min-width: 0;
}
.card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.card-title { font-size: 15px; font-weight: 600; }
.card-head .spacer { flex: 1; }

[data-reveal] { opacity: 0; transform: translateY(14px); }
[data-reveal].in { opacity: 1; transform: none; transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.16, 1, 0.3, 1); }

/* ---------- 상태 배지 ---------- */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    height: 22px; padding: 0 9px; border-radius: 999px;
    font-size: 12px; font-weight: 500; white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 999px; background: currentColor; }
.badge.st-wait     { background: var(--amber-bg); color: var(--amber); }
.badge.st-progress { background: var(--blue-bg);  color: var(--blue); }
.badge.st-approved { background: var(--green-bg); color: var(--green); }
.badge.st-rejected { background: var(--red-bg);   color: var(--red); }
.badge.st-plan     { background: var(--surface-2); color: var(--ink-2); }
.badge.st-brand    { background: var(--brand-tint); color: var(--brand); }
.badge.no-dot::before { display: none; }

.tag {
    display: inline-flex; align-items: center; height: 22px; padding: 0 8px;
    border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line);
    font-size: 12px; color: var(--ink-2); font-weight: 500;
}

.doc-no { font-size: 13px; letter-spacing: 0.03em; color: var(--ink-2); white-space: nowrap; }

/* ---------- 대시보드 ---------- */
.dash-greet { margin-bottom: 16px; }
.dash-greet h1 { font-size: 20px; font-weight: 700; }
.dash-greet p { font-size: 13px; color: var(--ink-2); }

.dash-top { display: grid; gap: 16px; margin-bottom: 16px; }
@media (min-width: 1280px) { .dash-top { grid-template-columns: 5fr 7fr; } }

.kpi-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.kpi { display: flex; flex-direction: column; justify-content: space-between; gap: 8px; }
.kpi-label { font-size: 12px; font-weight: 500; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.kpi-label .ico { width: 15px; height: 15px; color: var(--ink-3); }
.kpi-num { font-size: 26px; font-weight: 700; line-height: 1.2; }
.kpi-num small { font-size: 13px; font-weight: 600; color: var(--ink-3); margin-left: 2px; }
.kpi-delta { font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 3px; }
.kpi-delta.up { color: var(--green); }
.kpi-delta.down { color: var(--red); }
.kpi-delta.flat { color: var(--ink-3); }
.kpi-delta .ico { width: 12px; height: 12px; }

/* 출퇴근 위젯 */
.att-clock { font-size: 34px; font-weight: 700; letter-spacing: 0.01em; line-height: 1.2; }
.att-date { font-size: 13px; color: var(--ink-2); margin-bottom: 14px; }
.att-state { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.att-meta { font-size: 12px; color: var(--ink-2); display: flex; flex-direction: column; gap: 2px; }
.att-meta b { color: var(--ink); font-weight: 700; }
.att-btn { min-width: 120px; height: 42px; font-size: 14px; }
.att-btn.morph { animation: morphPop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes morphPop { 0% { transform: scale(0.85); } 100% { transform: scale(1); } }
.att-summary {
    display: flex; align-items: center; gap: 10px; padding: 12px 14px;
    border-radius: var(--r-ctl); background: var(--green-bg); color: var(--green);
    font-size: 13px; font-weight: 600; margin-bottom: 18px;
}
.weekbar { display: flex; align-items: flex-end; gap: 10px; height: 96px; padding-top: 8px; }
.weekbar .wb { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; position: relative; }
.weekbar .wb-fill {
    width: 100%; max-width: 34px; border-radius: 6px 6px 2px 2px;
    background: var(--brand-tint); position: relative;
    transform-origin: bottom; animation: growY 0.9s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.weekbar .wb.today .wb-fill { background: var(--brand); }
.weekbar .wb-day { font-size: 11px; font-weight: 600; color: var(--ink-3); }
.weekbar .wb.today .wb-day { color: var(--brand); }
.weekbar .wb-tip {
    position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
    background: var(--ink); color: var(--bg); font-size: 11px; font-weight: 600;
    padding: 3px 8px; border-radius: 6px; white-space: nowrap;
    opacity: 0; pointer-events: none; transition: opacity 0.15s ease; z-index: 5;
}
.weekbar .wb:hover .wb-tip, .weekbar .wb:focus-within .wb-tip { opacity: 1; }
@keyframes growY { from { transform: scaleY(0); } }
.weekbar-foot { display: flex; justify-content: space-between; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-2); }
.weekbar-foot b { font-size: 14px; color: var(--ink); }

.dash-cols { display: grid; gap: 16px; }
@media (min-width: 1280px) { .dash-cols { grid-template-columns: 7fr 5fr; align-items: start; } }
.dash-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

/* 대시보드 결재 행 */
.mini-doc { display: flex; align-items: center; gap: 10px; padding: 9px 8px; border-radius: var(--r-ctl); transition: background-color 0.15s ease; cursor: pointer; }
.mini-doc:hover { background: var(--surface-2); }
.mini-doc .mini-doc-body { flex: 1; min-width: 0; }
.mini-doc .mini-doc-title { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-doc .mini-doc-sub { font-size: 12px; color: var(--ink-3); }
.mini-doc-actions { display: flex; gap: 4px; flex: none; }
.mini-doc-actions .icon-btn { width: 30px; height: 30px; }
.mini-doc-actions .ok:hover { background: var(--green-bg); color: var(--green); }
.mini-doc-actions .no:hover { background: var(--red-bg); color: var(--red); }
.row-flash-ok { animation: flashOk 0.35s ease; }
.row-flash-no { animation: flashNo 0.35s ease; }
@keyframes flashOk { 0% { background: var(--green-bg); } 100% { background: transparent; } }
@keyframes flashNo { 0% { background: var(--red-bg); } 100% { background: transparent; } }
.row-out { animation: rowOut 0.3s ease both; }
@keyframes rowOut { to { opacity: 0; transform: translateX(24px); height: 0; padding-top: 0; padding-bottom: 0; overflow: hidden; } }

/* 공지 행 */
.mini-notice { display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: var(--r-ctl); cursor: pointer; }
.mini-notice:hover { background: var(--surface-2); }
.mini-notice .ico { width: 14px; height: 14px; color: var(--ink-3); }
.mini-notice-title { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-notice-title.unread { font-weight: 700; }
.mini-notice-date { font-size: 12px; color: var(--ink-3); flex: none; }
.dot-unread { width: 7px; height: 7px; border-radius: 999px; background: var(--brand); flex: none; transition: transform 0.2s ease, opacity 0.2s ease; }
.dot-unread.gone { transform: scale(0); opacity: 0; }
.badge-new { font-size: 10px; font-weight: 800; color: var(--red); flex: none; letter-spacing: 0.04em; }

/* 오늘 일정 타임라인 */
.tl { position: relative; padding-left: 18px; display: flex; flex-direction: column; gap: 12px; }
.tl::before { content: ""; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 2px; background: var(--line); border-radius: 2px; }
.tl-item { position: relative; }
.tl-item::before {
    content: ""; position: absolute; left: -17.5px; top: 6px; width: 9px; height: 9px;
    border-radius: 999px; background: var(--cat, var(--brand)); border: 2px solid var(--surface);
}
.tl-time { font-size: 12px; font-weight: 700; color: var(--ink-2); }
.tl-title { font-size: 13.5px; font-weight: 600; }
.tl-sub { font-size: 12px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* 팀 피드 */
.feed { display: flex; flex-direction: column; gap: 4px; }
.feed-item { display: flex; gap: 10px; padding: 8px; border-radius: var(--r-ctl); }
.feed-item:hover { background: var(--surface-2); }
.feed-body { min-width: 0; }
.feed-meta { font-size: 12px; color: var(--ink-3); }
.feed-meta b { color: var(--ink); font-weight: 600; font-size: 13px; margin-right: 4px; }
.feed-text { font-size: 13px; color: var(--ink-2); margin: 1px 0 3px; }
.feed-react { font-size: 12px; color: var(--ink-3); display: inline-flex; align-items: center; gap: 4px; }
.feed-react .ico { width: 12px; height: 12px; }

/* 구성원 상태 보드 */
.status-board { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.status-cell {
    display: flex; align-items: center; gap: 8px; padding: 10px 12px;
    border: 1px solid var(--line); border-radius: var(--r-ctl); background: var(--surface-2);
    font-size: 13px; font-weight: 500; color: var(--ink-2);
}
.status-cell b { margin-left: auto; font-size: 15px; color: var(--ink); }

/* ---------- 전자결재 ---------- */
.appr-layout { display: grid; gap: 16px; align-items: start; }
@media (min-width: 1024px) { .appr-layout { grid-template-columns: 190px minmax(0, 1fr); } }
@media (min-width: 1440px) { .appr-layout.with-detail { grid-template-columns: 190px minmax(0, 1fr) 380px; } }

.seg { display: flex; flex-direction: row; gap: 4px; overflow-x: auto; }
@media (min-width: 1024px) { .seg { flex-direction: column; position: sticky; top: calc(var(--topbar-h) + 20px); } }
.seg button {
    display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px;
    border-radius: var(--r-ctl); font-size: 13px; font-weight: 500; color: var(--ink-2);
    white-space: nowrap; text-align: left;
}
.seg button:hover { background: var(--surface-2); color: var(--ink); }
.seg button.active { background: var(--brand-tint); color: var(--brand); font-weight: 700; }
.seg .seg-count { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--ink-3); }
.seg button.active .seg-count { color: var(--brand); }

.doc-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); }
.doc-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 720px; }
.doc-table th {
    text-align: left; font-size: 12px; font-weight: 600; color: var(--ink-3);
    padding: 0 12px; height: 40px; border-bottom: 1px solid var(--line);
    background: var(--surface-2); white-space: nowrap;
}
.doc-table td { padding: 0 12px; height: 44px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.doc-table tbody tr { cursor: pointer; transition: background-color 0.12s ease; }
.doc-table tbody tr:hover { background: var(--surface-2); }
.doc-table tbody tr.selected { background: var(--brand-tint); }
.doc-table tbody tr:last-child td { border-bottom: 0; }
.doc-table .t-title { max-width: 300px; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.doc-table .row-actions { opacity: 0; display: flex; gap: 2px; transition: opacity 0.12s ease; }
.doc-table tr:hover .row-actions, .doc-table tr:focus-within .row-actions { opacity: 1; }
.doc-table .row-actions .icon-btn { width: 28px; height: 28px; }
.doc-table .row-actions .ok:hover { background: var(--green-bg); color: var(--green); }
.doc-table .row-actions .no:hover { background: var(--red-bg); color: var(--red); }
.doc-table input[type="checkbox"] { accent-color: var(--brand); width: 15px; height: 15px; cursor: pointer; }

.appr-detail { min-width: 0; }
@media (max-width: 1439px) {
    .appr-detail {
        position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100%);
        z-index: 60; overflow-y: auto; box-shadow: var(--shadow-overlay);
        border-radius: 0; border: 0; border-left: 1px solid var(--line);
        animation: drawerIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) both;
    }
}
@media (min-width: 1440px) { .appr-detail { position: sticky; top: calc(var(--topbar-h) + 20px); max-height: calc(100vh - var(--topbar-h) - 40px); overflow-y: auto; } }
.detail-scrim { position: fixed; inset: 0; z-index: 55; background: var(--scrim); }
@media (min-width: 1440px) { .detail-scrim { display: none; } }

.stepper { display: flex; flex-direction: column; gap: 0; }
.step { display: flex; gap: 12px; position: relative; padding-bottom: 16px; }
.step:last-child { padding-bottom: 0; }
.step::before { content: ""; position: absolute; left: 14px; top: 32px; bottom: 2px; width: 2px; background: var(--line); }
.step:last-child::before { display: none; }
.step-node {
    width: 29px; height: 29px; border-radius: 999px; flex: none; z-index: 1;
    display: grid; place-items: center; font-size: 12px; font-weight: 700;
    border: 2px solid var(--line); background: var(--surface); color: var(--ink-3);
}
.step.done .step-node { background: var(--green-bg); border-color: var(--green); color: var(--green); }
.step.current .step-node { border-color: var(--brand); color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }
.step-body { font-size: 13px; min-width: 0; padding-top: 3px; }
.step-name { font-weight: 600; }
.step-sub { font-size: 12px; color: var(--ink-3); }

.comment-item { display: flex; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.comment-item:first-child { border-top: 0; }
.comment-meta { font-size: 12px; color: var(--ink-3); }
.comment-meta b { color: var(--ink); font-size: 13px; margin-right: 6px; }
.comment-text { font-size: 13px; color: var(--ink-2); margin-top: 1px; }

.reject-form { margin-top: 10px; padding: 12px; border-radius: var(--r-ctl); background: var(--red-bg); }
.reject-form label { font-size: 12px; font-weight: 700; color: var(--red); display: block; margin-bottom: 6px; }

/* 상신 모달 스테퍼 */
.wizard-steps { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.wizard-steps .ws {
    flex: 1; height: 4px; border-radius: 4px; background: var(--line);
    position: relative; overflow: hidden;
}
.wizard-steps .ws.on::after { content: ""; position: absolute; inset: 0; background: var(--brand); border-radius: 4px; animation: growX 0.3s ease both; }
@keyframes growX { from { transform: scaleX(0); transform-origin: left; } }
.wizard-label { font-size: 12px; color: var(--ink-2); margin-bottom: 14px; }
.wizard-pane { animation: paneIn 0.2s ease both; }
@keyframes paneIn { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }

.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 560px) { .form-grid { grid-template-columns: repeat(4, 1fr); } }
.form-card {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    padding: 14px 8px; border: 1px solid var(--line); border-radius: var(--r-ctl);
    font-size: 12.5px; font-weight: 600; color: var(--ink-2); text-align: center;
    transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}
.form-card:hover { border-color: var(--brand); color: var(--ink); }
.form-card.selected { border-color: var(--brand); background: var(--brand-tint); color: var(--brand); }
.form-card .ico { width: 20px; height: 20px; }

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; }
.field input[type="text"], .field input[type="date"], .field input[type="time"], .field select, .field textarea {
    width: 100%; border: 1px solid var(--line); border-radius: var(--r-ctl);
    background: var(--surface); padding: 8px 10px; font-size: 13.5px; color: var(--ink);
    transition: border-color 0.15s ease;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }
.field textarea { min-height: 90px; resize: vertical; }
.field .err-cap { display: none; font-size: 12px; color: var(--red); margin-top: 4px; }
.field.error .err-cap { display: block; }
.field.error input, .field.error textarea, .field.error select { border-color: var(--red); }
.shake { animation: shake 0.2s ease 2; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

.line-editor { display: flex; flex-direction: column; gap: 6px; }
.line-item {
    display: flex; align-items: center; gap: 8px; padding: 8px 10px;
    border: 1px solid var(--line); border-radius: var(--r-ctl); background: var(--surface-2);
}
.line-item .who { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.line-item .who small { font-weight: 500; color: var(--ink-3); margin-left: 4px; }
.line-item select { border: 1px solid var(--line); border-radius: 6px; background: var(--surface); font-size: 12px; padding: 3px 4px; }
.line-item .icon-btn { width: 26px; height: 26px; }
.ac-wrap { position: relative; }
.ac-list {
    position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 10;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-ctl);
    box-shadow: var(--shadow-overlay); max-height: 200px; overflow-y: auto; padding: 4px;
}
.ac-list button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 8px; border-radius: 6px; font-size: 13px; text-align: left; }
.ac-list button:hover, .ac-list button.hl { background: var(--surface-2); }
.ac-list small { color: var(--ink-3); }

/* ---------- 캘린더 ---------- */
.cal-layout { display: grid; gap: 16px; align-items: start; }
@media (min-width: 1280px) { .cal-layout { grid-template-columns: minmax(0, 1fr) 320px; } }

.cal-nav { display: flex; align-items: center; gap: 8px; }
.cal-nav h2 { font-size: 16px; font-weight: 700; min-width: 110px; text-align: center; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); border-top: 1px solid var(--line); border-left: 1px solid var(--line); border-radius: 0 0 var(--r-card) var(--r-card); overflow: hidden; }
.cal-dow { display: grid; grid-template-columns: repeat(7, 1fr); font-size: 12px; font-weight: 600; color: var(--ink-3); text-align: center; padding: 8px 0 6px; }
.cal-dow span:first-child { color: var(--red); }
.cal-cell {
    min-height: 96px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
    padding: 6px; background: var(--surface); text-align: left; position: relative;
    display: flex; flex-direction: column; gap: 3px; cursor: pointer; min-width: 0;
    transition: background-color 0.12s ease;
}
.cal-cell:hover { background: var(--surface-2); }
.cal-cell.dim { background: var(--surface-2); }
.cal-cell.dim .cal-day { color: var(--ink-3); }
.cal-cell.weekend { background: var(--surface-2); }
.cal-cell.selected { background: var(--brand-tint); }
.cal-day {
    font-size: 12px; font-weight: 600; width: 22px; height: 22px;
    display: grid; place-items: center; border-radius: 999px; flex: none;
}
.cal-cell.sun .cal-day { color: var(--red); }
.cal-cell.today .cal-day { box-shadow: 0 0 0 2px var(--brand); color: var(--brand); font-weight: 800; }
.cal-add-ghost {
    position: absolute; top: 5px; right: 5px; width: 22px; height: 22px;
    display: grid; place-items: center; border-radius: 6px; color: var(--ink-3);
    opacity: 0; transition: opacity 0.12s ease; background: var(--surface);border: 1px solid var(--line);
}
.cal-cell:hover .cal-add-ghost { opacity: 1; }
.cal-chip {
    display: block; width: 100%; text-align: left; font-size: 11px; font-weight: 600;
    padding: 2px 6px; border-radius: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    background: var(--chip-bg, var(--surface-2)); color: var(--chip-fg, var(--ink-2));
    transition: opacity 0.2s ease; border: 0;
}
.cal-chip:hover { filter: brightness(0.96); }
html[data-theme="dark"] .cal-chip:hover { filter: brightness(1.15); }
.cal-more { font-size: 11px; font-weight: 700; color: var(--ink-3); padding: 0 6px; text-align: left; }
.cal-cell .cal-chip.hide, .agenda-item.hide { display: none; }

.chip-filter { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
    display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px;
    border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
    font-size: 12px; font-weight: 600; color: var(--ink-2);
    transition: background-color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}
.chip .st-dot { width: 7px; height: 7px; background: var(--chip-fg, var(--ink-3)); }
.chip[aria-pressed="true"] { background: var(--surface-2); border-color: var(--ink-3); color: var(--ink); }
.chip[aria-pressed="false"] { opacity: 0.45; }

.agenda { display: flex; flex-direction: column; gap: 2px; }
.agenda-item { display: flex; gap: 10px; padding: 9px 8px; border-radius: var(--r-ctl); align-items: flex-start; }
.agenda-item:hover { background: var(--surface-2); }
.agenda-time { font-size: 12px; font-weight: 700; color: var(--ink-2); width: 42px; flex: none; padding-top: 2px; }
.agenda-body { min-width: 0; flex: 1; }
.agenda-title { font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.agenda-sub { font-size: 12px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 2px; }

/* ---------- 조직도 ---------- */
.org-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }
@media (min-width: 768px) { .org-stats { grid-template-columns: repeat(4, 1fr); } }
.org-layout { display: grid; gap: 16px; align-items: start; }
@media (min-width: 1024px) { .org-layout { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); } }

.tree { display: flex; flex-direction: column; gap: 2px; }
.tree-dept > button {
    display: flex; align-items: center; gap: 8px; width: 100%; height: 38px; padding: 0 10px;
    border-radius: var(--r-ctl); font-size: 13.5px; font-weight: 700; text-align: left;
}
.tree-dept > button:hover { background: var(--surface-2); }
.tree-dept .chev { transition: transform 0.2s ease; color: var(--ink-3); }
.tree-dept.open .chev { transform: rotate(90deg); }
.tree-dept .dept-count { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--ink-3); }
.tree-kids { overflow: hidden; padding-left: 14px; border-left: 1px solid var(--line); margin-left: 17px; display: none; }
.tree-dept.open .tree-kids { display: block; }
.tree-person {
    display: flex; align-items: center; gap: 9px; width: 100%; height: 40px; padding: 0 10px;
    border-radius: var(--r-ctl); font-size: 13px; text-align: left;
}
.tree-person:hover { background: var(--surface-2); }
.tree-person.selected { background: var(--brand-tint); }
.tree-person .tp-name { font-weight: 600; }
.tree-person .tp-role { font-size: 12px; color: var(--ink-3); }
.tree-person mark { background: var(--amber-bg); color: var(--amber); border-radius: 3px; padding: 0 1px; }
.tree-person.pulse { animation: hlPulse 0.9s ease 1; }
@keyframes hlPulse { 0% { background: var(--brand-tint); } 100% { background: transparent; } }

.person-card .pc-head { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; }
.pc-name { font-size: 17px; font-weight: 700; }
.pc-role { font-size: 13px; color: var(--ink-2); }
.pc-path { font-size: 12px; color: var(--ink-3); }
.pc-rows { display: flex; flex-direction: column; gap: 9px; font-size: 13px; margin-bottom: 14px; }
.pc-rows > div { display: flex; align-items: center; gap: 8px; color: var(--ink-2); }
.pc-rows .ico { width: 15px; height: 15px; color: var(--ink-3); }
.pc-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.pc-docs { border-top: 1px solid var(--line); padding-top: 12px; margin-bottom: 16px; }
.pc-docs h4 { font-size: 12px; font-weight: 700; color: var(--ink-3); margin-bottom: 6px; }
.pc-doc-link { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: var(--r-ctl); font-size: 13px; font-weight: 500; width: 100%; text-align: left; }
.pc-doc-link:hover { background: var(--surface-2); color: var(--brand); }

/* ---------- 게시판 ---------- */
.board-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 4px; overflow-x: auto; }
.board-tabs button {
    height: 40px; padding: 0 14px; font-size: 13.5px; font-weight: 600; color: var(--ink-3);
    border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.board-tabs button:hover { color: var(--ink); }
.board-tabs button.active { color: var(--brand); border-bottom-color: var(--brand); }
.board-tabs .cnt { font-size: 12px; margin-left: 4px; color: var(--ink-3); font-weight: 700; }

.post-row {
    display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
    padding: 11px 10px; border-bottom: 1px solid var(--line); transition: background-color 0.12s ease;
}
.post-row:hover { background: var(--surface-2); }
.post-row .ico-pin { width: 14px; height: 14px; color: var(--brand); flex: none; }
.post-prefix { font-size: 12px; font-weight: 700; color: var(--brand); flex: none; }
.post-title { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 7px; }
.post-title.unread { font-weight: 700; }
.post-meta { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--ink-3); flex: none; }
.post-meta .pm { display: inline-flex; align-items: center; gap: 3px; }
.post-meta .ico { width: 13px; height: 13px; }
@media (max-width: 640px) { .post-meta .pm-views, .post-meta .pm-author { display: none; } }

.post-detail-head { border-bottom: 1px solid var(--line); padding-bottom: 14px; margin-bottom: 16px; }
.post-detail-title { font-size: 18px; font-weight: 700; margin: 6px 0; }
.post-detail-meta { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--ink-2); flex-wrap: wrap; }
.post-body { font-size: 14px; color: var(--ink); line-height: 1.75; }
.post-body p + p { margin-top: 12px; }
.attach-row {
    display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
    padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--r-ctl);
    font-size: 13px; margin-top: 8px; background: var(--surface-2);
}
.attach-row:hover { border-color: var(--brand); }
.attach-row .size { margin-left: auto; font-size: 12px; color: var(--ink-3); }
.like-btn { transition: color 0.15s ease; }
.like-btn.on { color: var(--rose); border-color: var(--rose); }
.like-btn.on .ico { fill: currentColor; }

.comment-input { display: flex; gap: 10px; margin-top: 14px; }
.comment-input input {
    flex: 1; border: 1px solid var(--line); border-radius: var(--r-ctl);
    background: var(--surface); padding: 8px 12px; font-size: 13.5px; color: var(--ink);
}
.comment-input input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }
.slide-in { animation: slideIn 0.25s ease both; }
@keyframes slideIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ---------- 오버레이 공통 ---------- */
.overlay { position: fixed; inset: 0; z-index: 70; }
.overlay[hidden] { display: none; }
.scrim { position: absolute; inset: 0; background: var(--scrim); animation: fadeIn 0.18s ease both; }
@keyframes fadeIn { from { opacity: 0; } }

/* 드로어 */
.drawer {
    position: absolute; top: 0; right: 0; bottom: 0; width: min(400px, 92vw);
    background: var(--surface); border-left: 1px solid var(--line);
    box-shadow: var(--shadow-overlay); display: flex; flex-direction: column;
    animation: drawerIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes drawerIn { from { transform: translateX(60px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { font-size: 15px; font-weight: 700; }
.drawer-head-actions { display: flex; align-items: center; gap: 4px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 10px 12px 20px; }
.notif-group { font-size: 11px; font-weight: 700; color: var(--ink-3); letter-spacing: 0.05em; margin: 12px 6px 6px; }
.notif-item { display: flex; gap: 10px; width: 100%; text-align: left; padding: 10px; border-radius: var(--r-ctl); align-items: flex-start; }
.notif-item:hover { background: var(--surface-2); }
.notif-item.unread { background: var(--brand-tint); }
.notif-item.unread:hover { filter: brightness(0.98); }
.notif-ico { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; flex: none; background: var(--surface-2); color: var(--ink-2); }
.notif-ico .ico { width: 15px; height: 15px; }
.notif-ico.t-approval { background: var(--green-bg); color: var(--green); }
.notif-ico.t-calendar { background: var(--blue-bg); color: var(--blue); }
.notif-ico.t-board { background: var(--amber-bg); color: var(--amber); }
.notif-ico.t-system { background: var(--surface-2); color: var(--ink-2); }
.notif-text { font-size: 13px; min-width: 0; }
.notif-time { font-size: 11.5px; color: var(--ink-3); margin-top: 1px; }

/* 커맨드 팔레트 */
.palette {
    position: absolute; top: 12vh; left: 50%; transform: translateX(-50%);
    width: min(600px, calc(100vw - 32px));
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-modal);
    box-shadow: var(--shadow-overlay); overflow: hidden;
    animation: palIn 0.18s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes palIn { from { opacity: 0; transform: translateX(-50%) translateY(-10px) scale(0.98); } to { opacity: 1; transform: translateX(-50%); } }
.palette-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.palette-head .ico { color: var(--ink-3); }
.palette-head input { flex: 1; border: 0; background: none; font-size: 15px; color: var(--ink); }
.palette-head input:focus { outline: none; }
.palette-list { max-height: 46vh; overflow-y: auto; padding: 8px; }
.pal-group { font-size: 11px; font-weight: 700; color: var(--ink-3); letter-spacing: 0.05em; margin: 8px 8px 4px; }
.pal-item {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 9px 10px; border-radius: var(--r-ctl); font-size: 13.5px; text-align: left;
}
.pal-item .ico { width: 15px; height: 15px; color: var(--ink-3); }
.pal-item small { color: var(--ink-3); font-size: 12px; margin-left: auto; flex: none; }
.pal-item .pal-title { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pal-item.hl { background: var(--brand-tint); }
.pal-item.hl .pal-title { color: var(--brand); font-weight: 600; }

/* 모달 */
.modal {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: min(640px, calc(100vw - 32px)); max-height: min(86vh, 820px);
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-modal);
    box-shadow: var(--shadow-overlay); display: flex; flex-direction: column; overflow: hidden;
    animation: modalIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes modalIn { from { opacity: 0; transform: translate(-50%, -47%) scale(0.97); } to { opacity: 1; transform: translate(-50%, -50%); } }
.modal-head { display: flex; align-items: center; gap: 8px; padding: 16px 20px 12px; }
.modal-head h2 { font-size: 16px; font-weight: 700; flex: 1; }
.modal-body { padding: 4px 20px 16px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 16px; border-top: 1px solid var(--line); }

/* 팝오버 */
.popover {
    position: fixed; z-index: 80; width: 280px;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card);
    box-shadow: var(--shadow-overlay); padding: 14px;
    animation: popIn 0.2s cubic-bezier(0.34, 1.4, 0.64, 1) both;
}
@keyframes popIn { from { opacity: 0; transform: scale(0.92) translateY(4px); } to { opacity: 1; transform: none; } }
.popover[hidden] { display: none; }
.pop-title { font-size: 14px; font-weight: 700; margin-bottom: 2px; padding-right: 24px; }
.pop-rows { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--ink-2); margin: 8px 0 12px; }
.pop-rows > div { display: flex; align-items: center; gap: 7px; }
.pop-rows .ico { width: 14px; height: 14px; color: var(--ink-3); }
.pop-close { position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; }

/* 프로필 드롭다운 */
.menu {
    position: fixed; z-index: 80; width: 250px;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card);
    box-shadow: var(--shadow-overlay); padding: 8px;
    animation: popIn 0.16s ease both;
}
.menu[hidden] { display: none; }
.menu-me { display: flex; align-items: center; gap: 10px; padding: 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu-me-name { font-size: 14px; font-weight: 700; }
.menu-me-sub { font-size: 12px; color: var(--ink-3); }
.menu-label { font-size: 11px; font-weight: 700; color: var(--ink-3); margin: 8px 10px 4px; letter-spacing: 0.04em; }
.menu-item {
    display: flex; align-items: center; gap: 9px; width: 100%;
    padding: 8px 10px; border-radius: var(--r-ctl); font-size: 13px; text-align: left; color: var(--ink);
}
.menu-item:hover { background: var(--surface-2); }
.menu-item .ico { width: 15px; height: 15px; color: var(--ink-3); }
.menu-item.on { background: var(--brand-tint); color: var(--brand); font-weight: 600; }
.menu-item.on .ico { color: var(--brand); }

/* ---------- 토스트 ---------- */
.toast-stack {
    position: fixed; right: 16px; bottom: calc(var(--tabbar-h) + 16px); z-index: 90;
    display: flex; flex-direction: column; gap: 8px; align-items: flex-end;
    pointer-events: none;
}
@media (min-width: 1024px) { .toast-stack { bottom: 20px; } }
.toast {
    display: flex; align-items: flex-start; gap: 9px; max-width: min(360px, calc(100vw - 32px));
    padding: 11px 14px; border-radius: var(--r-card);
    background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-overlay);
    font-size: 13px; font-weight: 500; pointer-events: auto;
    animation: toastIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.toast.hide { animation: toastOut 0.2s ease both; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px); } }
.toast .ico { width: 16px; height: 16px; margin-top: 2px; }
.toast-success .ico { color: var(--green); }
.toast-info .ico { color: var(--blue); }
.toast-demo .ico { color: var(--amber); }

/* ---------- 스켈레톤 ---------- */
.skel-wrap { display: flex; flex-direction: column; gap: 16px; }
.skel {
    position: relative; overflow: hidden; background: var(--surface);
    border: 1px solid var(--line); border-radius: var(--r-card);
}
.skel::after {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent, var(--surface-2), transparent);
    animation: shimmer 1.1s linear infinite;
}
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.skel-line { height: 14px; border-radius: 6px; border: 0; background: var(--surface-2); }
.skel-card { height: 140px; }
.skel-row { height: 44px; }

/* ---------- empty state ---------- */
.empty {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    padding: 40px 16px; text-align: center; color: var(--ink-3);
}
.empty .ico { width: 30px; height: 30px; stroke-width: 1.6; }
.empty p { font-size: 13px; font-weight: 500; }

/* ---------- 유틸 ---------- */
.muted { color: var(--ink-3); }
.muted-2 { color: var(--ink-2); }
.fs12 { font-size: 12px; }
.fs13 { font-size: 13px; }
.fw6 { font-weight: 600; }
.fw7 { font-weight: 700; }
.flex { display: flex; }
.aic { align-items: center; }
.gap4 { gap: 4px; } .gap6 { gap: 6px; } .gap8 { gap: 8px; } .gap10 { gap: 10px; } .gap12 { gap: 12px; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; }
.mb8 { margin-bottom: 8px; } .mb12 { margin-bottom: 12px; } .mb16 { margin-bottom: 16px; }
.spacer { flex: 1; }
.divider { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ellip { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; }

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    .view, .view-inner, .view.leaving, [data-reveal], [data-reveal].in,
    .drawer, .palette, .modal, .popover, .menu, .toast, .toast.hide,
    .wizard-pane, .slide-in, .row-out { animation: none !important; transition: none !important; }
    [data-reveal] { opacity: 1; transform: none; }
    .skel::after { animation: none; }
    .weekbar .wb-fill, .wizard-steps .ws.on::after { animation: none; }
    .bell-wiggle, .badge-dot.bounce, .shake, .att-btn.morph, .tree-person.pulse,
    .row-flash-ok, .row-flash-no { animation: none !important; }
    html.theme-anim body, html.theme-anim body * { transition: none !important; }
}
