/* ───────── Tokens ───────── */
:root {
  color-scheme: light;
  --bg: #f3f4f6;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --sunken: #f1f2f5;
  --hover: #eef0f3;
  --ink: #15181e;
  --ink-2: #3b414b;
  --muted: #7b828d;
  --faint: #b7bcc4;
  --line: #e5e7eb;
  --line-soft: #eff1f4;
  --weekend: #fafbfc;

  --primary: #15181e;
  --primary-hover: #2c313a;
  --primary-ink: #ffffff;
  --accent: #3366ff;
  --accent-soft: color-mix(in srgb, var(--accent) 10%, var(--surface));
  --sat: #3366ff;
  --sun: #e5484d;
  --danger: #dc3d43;

  --office: #3366ff;
  --home: #12a594;
  --trip: #f08a24;
  --off: #8b919b;
  --leave: #e5484d;
  --etc: #7c5cd6;

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.03);
  --shadow-lg: 0 18px 44px rgba(16, 24, 40, 0.16);
  --backdrop: rgba(16, 20, 28, 0.4);
  --radius: 16px;
  --radius-sm: 10px;
  --font: "Pretendard", "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0e1013;
    --surface: #17191e;
    --surface-2: #1c1f25;
    --sunken: #121418;
    --hover: #23272e;
    --ink: #eceef1;
    --ink-2: #c3c8d0;
    --muted: #8c939e;
    --faint: #4d535d;
    --line: #2a2e36;
    --line-soft: #22262d;
    --weekend: #15171b;
    --primary: #eceef1;
    --primary-hover: #d5d9df;
    --primary-ink: #111317;
    --accent: #6b8cff;
    --sat: #7b98ff;
    --sun: #ff6b70;
    --danger: #ff6b70;
    --office: #6b8cff;
    --home: #2ec4b0;
    --trip: #f5a050;
    --off: #8f96a1;
    --leave: #ff6b70;
    --etc: #a48bf0;
    --shadow-sm: none;
    --shadow: 0 0 0 1px rgba(255, 255, 255, 0.02);
    --shadow-lg: 0 18px 44px rgba(0, 0, 0, 0.55);
    --backdrop: rgba(0, 0, 0, 0.6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1013;
  --surface: #17191e;
  --surface-2: #1c1f25;
  --sunken: #121418;
  --hover: #23272e;
  --ink: #eceef1;
  --ink-2: #c3c8d0;
  --muted: #8c939e;
  --faint: #4d535d;
  --line: #2a2e36;
  --line-soft: #22262d;
  --weekend: #15171b;
  --primary: #eceef1;
  --primary-hover: #d5d9df;
  --primary-ink: #111317;
  --accent: #6b8cff;
  --sat: #7b98ff;
  --sun: #ff6b70;
  --danger: #ff6b70;
  --office: #6b8cff;
  --home: #2ec4b0;
  --trip: #f5a050;
  --off: #8f96a1;
  --leave: #ff6b70;
  --etc: #a48bf0;
  --shadow-sm: none;
  --shadow: 0 0 0 1px rgba(255, 255, 255, 0.02);
  --shadow-lg: 0 18px 44px rgba(0, 0, 0, 0.55);
  --backdrop: rgba(0, 0, 0, 0.6);
}

/* tinted chip helpers: set --c, get --c-bg / --c-ink */
.ev, .panel-item, .kind-tag, .type-pill, .lv-ev,
.c0, .c1, .c2, .c3, .c4, .c5, .c6, .c7 {
  --c-bg: color-mix(in srgb, var(--c, var(--off)) 13%, var(--surface));
  --c-ink: color-mix(in srgb, var(--c, var(--off)) 72%, var(--ink));
}
.사무실 { --c: var(--office); }
.재택 { --c: var(--home); }
.출장 { --c: var(--trip); }
.휴무 { --c: var(--off); }
.연차 { --c: var(--leave); }
.기타, .기타휴가 { --c: var(--etc); }
.c0 { --c: #3366ff; }
.c1 { --c: #12a594; }
.c2 { --c: #f08a24; }
.c3 { --c: #e2468f; }
.c4 { --c: #7c5cd6; }
.c5 { --c: #d4a017; }
.c6 { --c: #0d9ad8; }
.c7 { --c: #a0703f; }

/* ───────── Base ───────── */
* { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
  letter-spacing: -0.01em;
}
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.muted { color: var(--muted); }
.pad { padding: 24px; }
.multi-text { white-space: pre-wrap; word-break: break-word; }

.app {
  display: grid;
  grid-template-columns: 228px 1fr;
  height: 100vh;
  overflow: hidden;
}

/* ───────── Sidebar ───────── */
.sidebar {
  padding: 20px 12px 14px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 22px;
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; }
.brand-logo { width: 40px; height: 40px; border-radius: 11px; object-fit: cover; flex-shrink: 0; }
.brand strong { display: block; font-size: 0.98rem; font-weight: 700; letter-spacing: -0.02em; }
.brand small { color: var(--muted); font-size: 0.74rem; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-btn {
  display: flex; align-items: center; gap: 10px;
  border: 0; background: transparent; color: var(--ink-2);
  text-align: left; padding: 9px 10px; border-radius: var(--radius-sm);
  cursor: pointer; font-weight: 500;
  transition: background 0.12s, color 0.12s;
}
.nav-btn::before {
  content: ""; width: 18px; height: 18px; flex-shrink: 0;
  background: currentColor; opacity: 0.7;
  -webkit-mask: var(--icon) center / contain no-repeat;
          mask: var(--icon) center / contain no-repeat;
}
.nav-btn[data-view="month"] { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='3'/%3E%3Cpath d='M3 10h18M8 3v4M16 3v4'/%3E%3C/svg%3E"); }
.nav-btn[data-view="leave"] { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3a9 9 0 0 1 9 9H3a9 9 0 0 1 9-9zM12 12v7a2 2 0 0 0 4 0'/%3E%3C/svg%3E"); }
.nav-btn[data-view="members"] { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='9' cy='8' r='4'/%3E%3Cpath d='M2 21a7 7 0 0 1 14 0M16 4a4 4 0 0 1 0 8M22 21a7 7 0 0 0-4-6.3'/%3E%3C/svg%3E"); }
.nav-btn[data-view="boss"] { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='7' height='9' rx='1.5'/%3E%3Crect x='14' y='3' width='7' height='5' rx='1.5'/%3E%3Crect x='14' y='12' width='7' height='9' rx='1.5'/%3E%3Crect x='3' y='16' width='7' height='5' rx='1.5'/%3E%3C/svg%3E"); }
.nav-btn:hover { background: var(--hover); color: var(--ink); }
.nav-btn.active { background: var(--hover); color: var(--ink); font-weight: 700; }
.nav-btn.active::before { opacity: 1; }

.side-block { display: grid; gap: 6px; }
.side-label { font-size: 0.72rem; font-weight: 600; color: var(--muted); padding: 0 10px 2px; }
.side-people { display: grid; gap: 2px; }
.side-person {
  display: flex; align-items: center; gap: 10px;
  border: 0; background: transparent; color: var(--ink-2);
  border-radius: var(--radius-sm); padding: 6px 10px;
  text-align: left; font-weight: 500; cursor: pointer;
  transition: background 0.12s;
}
.side-person::before {
  content: attr(data-initial);
  display: grid; place-items: center;
  width: 26px; height: 26px; border-radius: 50%;
  font-size: 0.74rem; font-weight: 700;
  background: var(--c-bg); color: var(--c-ink);
  flex-shrink: 0;
}
.side-person:hover { background: var(--hover); }
.side-person.active { background: var(--hover); color: var(--ink); font-weight: 700; }
.side-person.active::before { background: var(--c); color: #fff; }
.side-people .muted { padding: 0 10px; margin: 0; font-size: 0.85rem; }

.sidebar-foot {
  margin-top: auto;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 0.76rem; color: var(--muted);
  padding: 12px 8px 0 10px;
  border-top: 1px solid var(--line-soft);
}
#metaLine { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.theme-toggle {
  flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: var(--surface);
  border-radius: 999px; padding: 4px 10px 4px 8px;
  font-size: 0.74rem; font-weight: 600; color: var(--ink-2);
  cursor: pointer; white-space: nowrap;
}
.theme-toggle::before {
  content: ""; width: 14px; height: 14px; background: currentColor;
  -webkit-mask: var(--ticon) center / contain no-repeat;
          mask: var(--ticon) center / contain no-repeat;
}
.theme-toggle[data-mode="light"] { --ticon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z'/%3E%3C/svg%3E"); }
.theme-toggle[data-mode="dark"] { --ticon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='4' fill='black'/%3E%3Cpath d='M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4'/%3E%3C/svg%3E"); }
.theme-toggle:hover { background: var(--hover); }

/* ───────── Main ───────── */
.main {
  padding: 22px 26px 24px;
  height: 100vh; overflow: hidden;
  display: flex; flex-direction: column; min-width: 0;
}
.view { display: none; animation: fade 0.18s ease; }
.view.active { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: auto; }
#view-month.active, #view-leave.active { overflow: hidden; }
@keyframes fade { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

.page-head {
  display: flex; justify-content: space-between; gap: 12px; align-items: center;
  margin-bottom: 18px; flex-wrap: wrap; flex-shrink: 0;
}
.page-head h1 { margin: 0; font-size: 1.6rem; font-weight: 800; letter-spacing: -0.035em; }
.page-head h1 small,
.leave-cal-title small {
  font-size: 0.55em; font-weight: 600; color: var(--muted);
  letter-spacing: -0.01em; margin-left: 6px;
}
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 0.88rem; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.month-head h1 { font-size: 2rem; }

/* segmented nav */
.seg {
  display: inline-flex; align-items: center;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; padding: 3px; box-shadow: var(--shadow-sm);
}
.seg-btn {
  border: 0; background: transparent; cursor: pointer;
  height: 30px; min-width: 32px; padding: 0 10px;
  border-radius: 9px; font-weight: 600; font-size: 0.86rem; color: var(--ink-2);
}
.seg-btn[aria-label] { font-size: 1.15rem; color: var(--muted); padding: 0 8px; }
.seg-btn:hover { background: var(--hover); color: var(--ink); }

/* ───────── Buttons ───────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: var(--radius-sm); padding: 8px 14px;
  font-weight: 600; cursor: pointer; box-shadow: var(--shadow-sm);
  transition: background 0.12s, border-color 0.12s;
  white-space: nowrap;
}
.btn:hover { background: var(--hover); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.primary:hover { background: var(--primary-hover); }
.btn.ghost { background: var(--surface); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: color-mix(in srgb, var(--danger) 10%, var(--surface)); }
.btn.small { padding: 4px 10px; font-size: 0.8rem; border-radius: 8px; box-shadow: none; }
.icon-btn {
  width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--muted); font-size: 1.15rem; cursor: pointer;
  display: grid; place-items: center; padding: 0 0 2px;
}
.icon-btn:hover { background: var(--hover); color: var(--ink); }

/* ───────── Month calendar ───────── */
.cal-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  flex: 1; min-height: 0;
}
.month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-template-rows: auto;
  grid-auto-rows: minmax(84px, 1fr);
  min-height: 0; height: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.month-grid > .pad { grid-column: 1 / -1; align-self: center; text-align: center; }
.m-head, .lc-head {
  text-align: left;
  font-size: 0.72rem; font-weight: 600; color: var(--muted);
  padding: 12px 12px 8px;
}
.m-head:nth-child(6), .lc-head:nth-child(6) { color: var(--sat); }
.m-head:nth-child(7), .lc-head:nth-child(7) { color: var(--sun); }

.m-cell, .lc-cell {
  min-height: 0;
  padding: 6px 6px 6px;
  display: flex; flex-direction: column;
  overflow: hidden;
  border-top: 1px solid var(--line-soft);
  border-left: 1px solid var(--line-soft);
  position: relative;
}
.m-cell:nth-child(7n + 1), .lc-cell:nth-child(7n + 1) { border-left: 0; }
.m-cell:nth-child(7n + 6), .m-cell:nth-child(7n),
.lc-cell:nth-child(7n + 6), .lc-cell:nth-child(7n) { background: var(--weekend); }
.m-cell { cursor: pointer; transition: background 0.1s; }
.m-cell:hover { background: var(--surface-2); }

.m-num, .lc-num {
  display: inline-grid; place-items: center;
  min-width: 26px; height: 26px; padding: 0 5px;
  border-radius: 13px;
  font-weight: 600; font-size: 0.84rem;
  margin-bottom: 4px; align-self: flex-start;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  transition: background 0.1s, color 0.1s;
}
.m-cell:nth-child(7n + 6) .m-num, .lc-cell:nth-child(7n + 6) .lc-num { color: var(--sat); }
.m-cell:nth-child(7n) .m-num, .lc-cell:nth-child(7n) .lc-num { color: var(--sun); }
.m-cell.out .m-num, .lc-cell.out .lc-num { color: var(--faint); }
.m-cell.out .m-list, .lc-cell.out .lc-list { opacity: 0.45; }
.lc-cell.past:not(.today) .lc-num { opacity: 0.45; }
.lc-cell.past:not(.today) .lv-ev { opacity: 0.55; }
.lc-cell.past:not(.today) .lv-ev:hover { opacity: 1; }

.m-cell.focus { background: var(--accent-soft); }
.m-cell.focus .m-num { box-shadow: inset 0 0 0 1.5px var(--accent); color: var(--accent); }
.m-cell.today .m-num, .lc-cell.today .lc-num {
  background: var(--accent); color: #fff !important; box-shadow: none; opacity: 1;
}

.m-list, .lc-list {
  display: grid; gap: 3px; flex: 1;
  align-content: start; min-width: 0;
  overflow-x: hidden; overflow-y: auto; scrollbar-width: none;
}

/* event chips */
.ev {
  position: relative;
  display: block;
  border-radius: 5px;
  padding: 3px 6px 3px 8px;
  font-size: 0.72rem; font-weight: 500; line-height: 1.4;
  min-width: 0; max-width: 100%;
  background: var(--c-bg); color: var(--c-ink);
  box-shadow: inset 2px 0 0 var(--c);
}
.ev-text {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.m-list:has(.ev:nth-child(2)) .ev-text { -webkit-line-clamp: 2; }
.m-list:has(.ev:nth-child(3)) .ev-text { -webkit-line-clamp: 1; }
.ev-x {
  position: absolute; top: 1px; right: 1px;
  width: 18px; height: 18px; border-radius: 4px;
  border: 0; background: var(--c-bg); color: inherit;
  opacity: 0; cursor: pointer;
  font-size: 0.9rem; line-height: 1; padding: 0;
  transition: opacity 0.1s;
}
.ev:hover .ev-x { opacity: 0.6; }
.ev-x:hover { opacity: 1 !important; }
.m-more { display: none; }

/* ───────── Day panel ───────── */
.day-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  min-height: 0; overflow: hidden;
}
.day-panel-hd {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 18px 18px 14px;
}
.dp-date {
  display: flex; align-items: center; gap: 12px;
  border: 0; background: transparent; padding: 4px 8px 4px 4px; margin: -4px;
  border-radius: 12px; cursor: pointer; text-align: left;
}
.dp-date:hover { background: var(--hover); }
.dp-date b { font-size: 2.4rem; font-weight: 800; line-height: 1; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.dp-date span { display: grid; gap: 2px; }
.dp-date em { font-style: normal; font-weight: 700; font-size: 0.98rem; display: flex; align-items: center; gap: 6px; }
.dp-date i {
  font-style: normal; font-size: 0.68rem; font-weight: 700;
  background: var(--accent); color: #fff; padding: 2px 6px; border-radius: 6px;
}
.dp-date small { font-size: 0.8rem; color: var(--muted); font-weight: 500; }
.dp-nav { display: flex; gap: 4px; }

.day-panel-list {
  display: flex; flex-direction: column; gap: 8px;
  flex: 1; padding: 4px 14px 14px; overflow-y: auto;
}
.day-empty {
  margin: auto; text-align: center; font-size: 0.9rem; font-weight: 600; line-height: 1.6;
}
.day-empty small { font-weight: 500; font-size: 0.8rem; color: var(--faint); }
.panel-item {
  padding: 12px 14px 14px 16px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  position: relative;
  overflow: hidden;
}
.panel-item::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0;
  width: 4px; background: var(--c);
}
.pi-head { display: flex; align-items: center; gap: 8px; min-height: 24px; }
.pi-place { font-size: 0.78rem; color: var(--muted); font-weight: 500; }
.pi-place::before { content: "· "; }
.panel-item-actions { display: flex; gap: 2px; margin-left: auto; opacity: 0.6; transition: opacity 0.12s; }
.panel-item:hover .panel-item-actions { opacity: 1; }
.pi-btn {
  border: 0; background: transparent; cursor: pointer;
  font-size: 0.76rem; font-weight: 600; color: var(--muted);
  padding: 3px 7px; border-radius: 6px;
}
.pi-btn:hover { background: var(--hover); color: var(--ink); }
.pi-btn.danger:hover { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, var(--surface)); }
.pi-body {
  margin-top: 8px;
  font-size: 0.92rem; font-weight: 500; line-height: 1.6;
  color: var(--ink);
  word-break: keep-all; overflow-wrap: anywhere;
}
.pi-body p { margin: 0; }
.pi-body p + p { margin-top: 2px; }
.memo-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; counter-reset: memo; }
.memo-list li {
  position: relative;
  padding-left: 24px;
}
.memo-list li::before {
  position: absolute; left: 0; top: 0.2em;
  width: 18px; height: 18px; border-radius: 5px;
  display: grid; place-items: center;
  font-size: 0.7rem; font-weight: 700; line-height: 1;
  background: var(--c-bg); color: var(--c-ink);
}
ol.memo-list li { counter-increment: memo; }
ol.memo-list li::before { content: counter(memo); }
ul.memo-list li::before { content: ""; width: 6px; height: 6px; top: 0.62em; left: 6px; border-radius: 50%; background: var(--c); }
.pi-note {
  margin-top: 8px; padding-top: 8px;
  border-top: 1px dashed var(--line);
  font-size: 0.8rem; color: var(--muted); line-height: 1.5;
}

/* composer (quick add) */
.composer {
  border-top: 1px solid var(--line);
  padding: 12px 14px 14px;
  display: grid; gap: 10px;
  background: var(--surface-2);
}
.composer-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.quick-who {
  font-weight: 700; font-size: 0.82rem; white-space: nowrap;
  color: var(--ink-2); flex-shrink: 0;
}
.type-pills { display: flex; gap: 4px; flex-wrap: wrap; }
.type-pill {
  border: 1px solid var(--line); background: var(--surface);
  border-radius: 999px; padding: 4px 10px;
  font-size: 0.78rem; font-weight: 600; color: var(--muted);
  cursor: pointer; display: inline-flex; align-items: center; gap: 5px;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.type-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--c); }
.type-pill:hover { color: var(--ink); }
.type-pill.active { background: var(--c-bg); color: var(--c-ink); border-color: color-mix(in srgb, var(--c) 40%, transparent); }
.composer-row { display: flex; gap: 8px; align-items: flex-end; }
#quickTitle {
  flex: 1; min-width: 0;
  border: 1px solid var(--line); background: var(--surface);
  border-radius: 12px; padding: 9px 12px;
  resize: none; height: auto; min-height: 40px; max-height: 180px;
  line-height: 1.45; field-sizing: content;
  transition: border-color 0.12s, box-shadow 0.12s;
}
#quickTitle:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
#quickSave { height: 40px; padding: 0 16px; border-radius: 12px; }

/* kind tags & name chips */
.kind-tag {
  display: inline-flex; align-items: center;
  padding: 2px 7px; border-radius: 6px;
  font-size: 0.72rem; font-weight: 700;
  background: var(--c-bg); color: var(--c-ink);
}
.name-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.88rem; font-weight: 700; color: var(--ink);
}
.name-chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--faint)); }

/* date chip / field (dialogs) */
.date-field {
  width: 100%; text-align: left;
  border: 1px solid var(--line); background: var(--surface);
  border-radius: var(--radius-sm); padding: 9px 12px;
  font-weight: 500; cursor: pointer; color: var(--ink);
}
.date-field:hover { border-color: var(--faint); }
.date-field.empty { color: var(--muted); }

/* ───────── Leave ───────── */
.leave-toolbar { margin-bottom: 14px; flex-shrink: 0; }
.filter-bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.filter-bar select {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237b828d' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") right 10px center / 12px no-repeat;
  border-radius: var(--radius-sm);
  padding: 7px 30px 7px 12px;
  font-size: 0.86rem; font-weight: 500;
  min-width: 110px; cursor: pointer; box-shadow: var(--shadow-sm);
}

.leave-summary {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px; margin-bottom: 16px; flex-shrink: 0;
}
.leave-empty { margin: 0; padding: 8px 4px; }
.leave-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  text-align: left; cursor: pointer;
  transition: border-color 0.12s, box-shadow 0.12s;
  position: relative; overflow: hidden;
}
.leave-card::after {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--c);
}
.leave-card:hover { border-color: var(--faint); }
.leave-card.active { border-color: var(--c); box-shadow: 0 0 0 1px var(--c); }
.leave-card .lc-name { margin-bottom: 10px; }
.leave-card .lc-remain { display: flex; align-items: baseline; gap: 4px; }
.leave-card .lc-remain b { font-size: 1.75rem; font-weight: 800; line-height: 1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.leave-card .lc-remain span { font-size: 0.8rem; color: var(--muted); font-weight: 600; }
.leave-card .lc-stats { margin-top: 8px; font-size: 0.78rem; color: var(--muted); }

.leave-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
  grid-template-rows: minmax(0, 1fr);
  gap: 18px; flex: 1; min-height: 0; overflow: hidden;
}
.leave-panel { min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }

/* leave calendar */
.leave-cal-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  flex: 1; min-height: 0;
  display: flex; flex-direction: column; overflow: hidden;
}
.leave-cal-head {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 14px 14px 4px 18px; flex-shrink: 0;
}
.leave-cal-title { font-weight: 800; font-size: 1.3rem; letter-spacing: -0.03em; }
.leave-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-template-rows: auto;
  grid-auto-rows: minmax(0, 1fr);
  flex: 1; min-height: 0;
}
.lv-ev {
  display: flex; align-items: center; min-width: 0;
  border-radius: 6px; overflow: hidden;
  background: var(--c-bg);
}
.lv-main {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 5px;
  border: 0; background: transparent;
  padding: 3px 4px 3px 6px;
  font-size: 0.75rem; cursor: pointer; text-align: left;
  color: var(--c-ink);
}
.lv-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--c); flex-shrink: 0; }
.lv-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lv-tag { flex-shrink: 0; font-size: 0.68rem; font-weight: 700; opacity: 0.75; }
.lv-del {
  border: 0; background: transparent; color: var(--c-ink);
  opacity: 0; cursor: pointer; font-size: 0.9rem; line-height: 1;
  padding: 0 6px; flex-shrink: 0;
}
.lv-ev:hover .lv-del { opacity: 0.55; }
.lv-del:hover { opacity: 1 !important; }

/* leave list (tabs) */
.leave-side {
  display: flex; flex-direction: column;
  min-width: 0; min-height: 0; overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.leave-tabs {
  display: flex; gap: 4px;
  margin: 12px 12px 4px;
  padding: 3px;
  background: var(--sunken);
  border-radius: 12px;
  flex-shrink: 0;
}
.leave-tab {
  flex: 1; border: 0; background: transparent; cursor: pointer;
  padding: 7px 10px; border-radius: 9px;
  font-weight: 600; font-size: 0.86rem; color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.leave-tab:hover { color: var(--ink); }
.leave-tab.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.count-pill {
  display: inline-grid; place-items: center;
  min-width: 20px; height: 18px; padding: 0 6px;
  border-radius: 999px; background: var(--hover); color: var(--muted);
  font-size: 0.72rem; font-weight: 700; font-variant-numeric: tabular-nums;
}
.leave-tab.active .count-pill { background: var(--primary); color: var(--primary-ink); }
.leave-list {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: 6px 8px 10px;
  display: flex; flex-direction: column; gap: 2px;
}
.leave-list[hidden] { display: none; }
.leave-none { margin: auto; padding: 32px 0; text-align: center; font-size: 0.88rem; }
.leave-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 8px; border-radius: 12px;
  transition: background 0.12s;
}
.leave-item:hover { background: var(--surface-2); }
.li-date {
  width: 48px; flex-shrink: 0;
  display: grid; justify-items: center; gap: 1px;
  padding: 6px 0; border-radius: 10px;
  background: var(--sunken);
}
.li-date b { font-size: 1.15rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.li-date span { font-size: 0.66rem; color: var(--muted); font-weight: 600; white-space: nowrap; }
.li-main { flex: 1; min-width: 0; display: grid; gap: 4px; }
.li-top { display: flex; align-items: center; gap: 8px; }
.li-dday {
  font-size: 0.7rem; font-weight: 700; color: var(--accent);
  background: var(--accent-soft); padding: 1px 6px; border-radius: 6px;
}
.li-sub {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px;
  font-size: 0.78rem; color: var(--muted);
}
.li-del {
  border: 0; background: transparent; color: var(--muted);
  width: 28px; height: 28px; border-radius: 8px;
  font-size: 1.1rem; cursor: pointer; opacity: 0; flex-shrink: 0;
  transition: opacity 0.12s, background 0.12s, color 0.12s;
}
.leave-item:hover .li-del { opacity: 1; }
.li-del:hover { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); color: var(--danger); }
#leaveBodyPast .leave-item { opacity: 0.75; }
#leaveBodyPast .leave-item:hover { opacity: 1; }

/* year switch */
.year-switch {
  position: relative; display: inline-flex; align-items: center; gap: 2px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; padding: 3px; box-shadow: var(--shadow-sm);
}
.year-nav { width: 30px; height: 30px; padding: 0; border: 0; box-shadow: none; background: transparent; font-size: 1.1rem; color: var(--muted); border-radius: 9px; }
.year-label {
  font-weight: 700; min-width: 70px; height: 30px; text-align: center;
  padding: 0 8px; border: 0; background: transparent;
  border-radius: 9px; cursor: pointer; font-variant-numeric: tabular-nums;
}
.year-label:hover { background: var(--hover); }
.year-menu {
  position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  z-index: 20; width: 160px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: 6px; display: grid; gap: 2px;
}
.year-menu[hidden] { display: none; }
.year-opt { border: 0; background: transparent; border-radius: 8px; padding: 8px 12px; font-weight: 600; text-align: center; cursor: pointer; }
.year-opt:hover { background: var(--hover); }
.year-opt.active { background: var(--primary); color: var(--primary-ink); }

/* ───────── Tables (members) ───────── */
.table-wrap {
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td {
  border-bottom: 1px solid var(--line-soft);
  padding: 12px 16px; text-align: left; font-size: 0.9rem; vertical-align: middle;
}
.data-table td:last-child { text-align: right; white-space: nowrap; }
.data-table td:last-child .btn + .btn { margin-left: 4px; }
.data-table th {
  background: var(--surface-2); font-weight: 600; color: var(--muted); font-size: 0.76rem;
  position: sticky; top: 0; z-index: 1;
}
.data-table tbody tr:hover td { background: var(--surface-2); }
.data-table tr:last-child td { border-bottom: 0; }
.data-table td.muted { text-align: center; padding: 20px; }
#view-members .table-wrap { max-width: 760px; }
.inactive-block { margin-top: 28px; max-width: 760px; }
.inactive-hd { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 6px; }
.inactive-hd h2 { margin: 0; font-size: 1.05rem; font-weight: 700; }
.pad-sm { padding: 0 2px 10px; font-size: 0.85rem; }

/* ───────── Date popover ───────── */
.cal-popover {
  position: fixed; z-index: 1000; width: 296px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 12px;
}
.cal-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-title { font-weight: 700; font-size: 0.98rem; border: 0; background: transparent; cursor: pointer; padding: 6px 10px; border-radius: 8px; }
.cal-title:hover { background: var(--hover); }
.cal-top .cal-nav {
  width: 30px; height: 30px; min-width: 0; padding: 0;
  border: 0; box-shadow: none; background: transparent; font-size: 1rem; color: var(--muted);
}
.cal-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; min-height: 180px; }
.cal-pick { border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-sm); padding: 12px 8px; font-weight: 600; cursor: pointer; }
.cal-pick:hover { background: var(--hover); }
.cal-pick.sel { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.cal-dows { display: grid; grid-template-columns: repeat(7, 1fr); margin-bottom: 4px; text-align: center; font-size: 0.72rem; font-weight: 600; color: var(--muted); }
.cal-dows span:nth-child(6) { color: var(--sat); }
.cal-dows span:nth-child(7) { color: var(--sun); }
.cal-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-day { border: 0; background: transparent; border-radius: 50%; aspect-ratio: 1; font-weight: 500; font-size: 0.86rem; cursor: pointer; font-variant-numeric: tabular-nums; }
.cal-day:hover { background: var(--hover); }
.cal-day.out { color: var(--faint); }
.cal-day.today { color: var(--accent); font-weight: 700; box-shadow: inset 0 0 0 1.5px var(--accent); }
.cal-day.sel { background: var(--primary); color: var(--primary-ink); box-shadow: none; }
.cal-foot { display: flex; justify-content: space-between; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line-soft); }
.cal-foot .btn { padding: 6px 12px; font-size: 0.84rem; }

/* ───────── Dialog ───────── */
dialog {
  border: 1px solid var(--line); border-radius: 20px; padding: 0;
  width: min(420px, 92vw);
  background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow-lg);
  overflow: visible; position: fixed;
}
dialog[open] { animation: pop 0.16s ease; }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(0.98); } to { opacity: 1; transform: none; } }
dialog::backdrop { background: var(--backdrop); backdrop-filter: blur(3px); }
dialog .cal-popover { z-index: 30; }
.dialog-form { padding: 24px; display: grid; gap: 14px; overflow: visible; position: relative; }
.dialog-form h3 { margin: 0 0 4px; font-size: 1.2rem; font-weight: 800; letter-spacing: -0.02em; }
.dialog-form label { display: grid; gap: 6px; font-size: 0.8rem; font-weight: 600; color: var(--ink-2); }
.dialog-form input, .dialog-form select, #editEventTitle {
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 9px 12px; font-weight: 500; font-size: 0.92rem;
  background: var(--surface); width: 100%;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.dialog-form input:focus, .dialog-form select:focus, #editEventTitle:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
#editEventTitle { resize: vertical; min-height: 96px; line-height: 1.5; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.dialog-actions-split { justify-content: space-between; align-items: center; }
.dialog-actions-right { display: flex; gap: 8px; }

/* ───────── Toast ───────── */
#toast {
  position: fixed; left: 50%; bottom: 24px;
  transform: translateX(-50%) translateY(8px);
  background: var(--primary); color: var(--primary-ink);
  padding: 10px 18px; border-radius: 999px;
  opacity: 0; pointer-events: none; transition: 0.2s ease;
  z-index: 2000; font-weight: 600; font-size: 0.9rem; box-shadow: var(--shadow-lg);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.error { background: var(--danger); color: #fff; }

/* ───────── Account (sidebar foot) ───────── */
.sidebar-foot { flex-direction: column; align-items: stretch; gap: 10px; }
.me { display: flex; align-items: center; gap: 10px; min-width: 0; }
.me-avatar {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center;
  font-size: 0.8rem; font-weight: 700;
  background: var(--c, var(--ink)); color: #fff;
}
.me-avatar.admin { background: var(--primary); color: var(--primary-ink); }
.me-text { display: grid; min-width: 0; }
.me-text strong { font-size: 0.88rem; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-actions { display: flex; align-items: center; gap: 0; }
.me-actions .link-btn { padding: 4px 5px; white-space: nowrap; }
.me-actions .theme-toggle { margin-right: auto; }
.link-btn {
  border: 0; background: transparent; cursor: pointer;
  font-size: 0.74rem; font-weight: 600; color: var(--muted);
  padding: 4px 6px; border-radius: 6px;
}
.link-btn:hover { background: var(--hover); color: var(--ink); }
.side-person.me::after {
  content: "나"; margin-left: auto;
  font-size: 0.66rem; font-weight: 700; color: var(--muted);
  border: 1px solid var(--line); border-radius: 6px; padding: 0 5px;
}
.readonly-note {
  border-top: 1px solid var(--line);
  padding: 14px; text-align: center;
  font-size: 0.8rem; font-weight: 600; color: var(--muted);
  background: var(--surface-2);
}
.readonly-note[hidden] { display: none; }
.pin-missing {
  margin-left: 6px; font-size: 0.7rem; font-weight: 700;
  color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, var(--surface));
  padding: 2px 6px; border-radius: 6px; vertical-align: 1px;
}
.field-hint { font-size: 0.74rem; font-weight: 500; color: var(--muted); }
[hidden] { display: none !important; }

/* ───────── Login screen ───────── */
.locked .app { visibility: hidden; }
.auth {
  position: fixed; inset: 0; z-index: 1500;
  display: grid; place-items: center;
  padding: 24px 16px;
  background: var(--bg);
  overflow-y: auto;
}
.auth-card {
  width: min(440px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  padding: 28px;
  display: grid; gap: 22px;
}
.auth-brand { display: flex; align-items: center; gap: 12px; }
.auth-brand img { width: 44px; height: 44px; border-radius: 12px; }
.auth-brand strong { display: block; font-size: 1.05rem; font-weight: 800; }
.auth-brand small { color: var(--muted); font-size: 0.76rem; }
.auth-form { display: grid; gap: 12px; }
.auth-form h2 { margin: 0; font-size: 1.4rem; font-weight: 800; letter-spacing: -0.03em; }
.auth-form p { margin: 0 0 4px; font-size: 0.86rem; line-height: 1.55; }
.auth-form input {
  width: 100%; border: 1px solid var(--line); background: var(--surface);
  border-radius: 12px; padding: 12px 14px;
  font-size: 1.05rem; font-weight: 600; letter-spacing: 0.2em;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.auth-form input::placeholder { letter-spacing: 0; font-weight: 500; font-size: 0.92rem; color: var(--faint); }
.auth-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.auth-submit { width: 100%; height: 46px; border-radius: 12px; font-size: 0.95rem; }
.auth-people {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(116px, 1fr));
  gap: 8px;
}
.auth-person {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); background: var(--surface);
  border-radius: 12px; padding: 8px 10px;
  font-weight: 600; font-size: 0.88rem; cursor: pointer; text-align: left;
  transition: border-color 0.12s, background 0.12s;
  flex-wrap: wrap;
}
.auth-person:hover { background: var(--hover); }
.auth-person.active { border-color: var(--c, var(--ink)); box-shadow: 0 0 0 1px var(--c, var(--ink)); }
.auth-person:disabled { opacity: 0.45; cursor: not-allowed; }
.auth-person small { width: 100%; font-size: 0.68rem; color: var(--muted); padding-left: 36px; margin-top: -6px; }
.auth-avatar {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center;
  font-size: 0.78rem; font-weight: 700;
  background: var(--c-bg, var(--hover)); color: var(--c-ink, var(--ink));
}
.auth-person.active .auth-avatar { background: var(--c, var(--primary)); color: #fff; }
.auth-person.admin .auth-avatar { background: var(--hover); color: var(--ink); }
.auth-person.admin.active { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.auth-person.admin.active .auth-avatar { background: var(--primary); color: var(--primary-ink); }
.auth-pin { display: grid; gap: 8px; margin-top: 6px; }
.auth-pin-label { font-size: 0.8rem; font-weight: 700; color: var(--ink-2); }
.auth-form .auth-hint {
  margin: 0; padding: 10px 12px; border-radius: 10px;
  background: var(--accent-soft); color: var(--ink-2);
  font-size: 0.82rem; font-weight: 500;
}
.auth-error { margin: -8px 0 0; min-height: 1em; font-size: 0.84rem; font-weight: 600; color: var(--danger); }
.auth-error:empty { display: none; }

/* ───────── Responsive ───────── */
@media (max-width: 1180px) {
  .cal-split { grid-template-columns: minmax(0, 1fr) 300px; }
  .leave-layout { grid-template-columns: minmax(0, 1fr) 300px; }
}
@media (max-width: 1000px) {
  .app, .main { height: auto; min-height: 100vh; overflow: visible; }
  .view.active, #view-month.active, #view-leave.active { overflow: visible; }
  .cal-split { grid-template-columns: 1fr; }
  .month-grid { height: auto; grid-auto-rows: minmax(84px, auto); }
  .day-panel { min-height: 260px; }
  .leave-layout { grid-template-columns: 1fr; grid-template-rows: auto; overflow: visible; }
  .leave-cal-grid { grid-auto-rows: minmax(72px, auto); }
  .leave-side { max-height: 520px; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: sticky; top: 0; z-index: 10;
    gap: 10px; padding: 10px 16px;
    border-right: 0; border-bottom: 1px solid var(--line); overflow: visible;
  }
  .brand small, .side-label { display: none; }
  .brand-logo { width: 32px; height: 32px; border-radius: 8px; }
  .nav { flex-direction: row; }
  .nav-btn { padding: 7px 10px; }
  .side-people { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
  .side-person { flex-shrink: 0; padding: 4px 10px 4px 4px; }
  .sidebar-foot {
    position: absolute; top: 12px; right: 12px;
    flex-direction: row; align-items: center; gap: 4px;
    margin: 0; padding: 0; border: 0;
  }
  .me-text, #btnChangePin { display: none; }
  .me-avatar { width: 28px; height: 28px; }
  .theme-toggle { font-size: 0; gap: 0; padding: 6px; }
  .main { padding: 14px 16px 24px; }
  .month-head h1 { font-size: 1.6rem; }
  .m-head, .lc-head { text-align: center; padding: 8px 2px 6px; }
  .m-cell, .lc-cell { padding: 4px 2px; align-items: center; }
  .m-num, .lc-num { align-self: center; }
  .m-list, .lc-list { width: 100%; }
  .ev::before, .ev-x { display: none; }

  /* 휴대폰 달력: 칸에는 한 줄 표시 2개 + 남은 개수, 내용은 아래 목록에서 */
  .month-grid { grid-auto-rows: minmax(64px, auto); }
  .m-head, .lc-head { font-size: 0.72rem; }
  .m-cell, .lc-cell { padding: 3px 2px 4px; gap: 2px; }
  .m-num, .lc-num { min-width: 22px; height: 22px; font-size: 0.76rem; margin-bottom: 1px; }
  .m-list, .lc-list { gap: 2px; overflow: hidden; }
  .m-list .ev:nth-child(n + 3) { display: none; }
  .ev {
    padding: 1px 3px; border-radius: 3px;
    font-size: 0.66rem; line-height: 1.35;
    box-shadow: inset 2px 0 0 var(--c);
  }
  .ev-text, .m-list:has(.ev:nth-child(2)) .ev-text, .m-list:has(.ev:nth-child(3)) .ev-text {
    display: block; white-space: nowrap; overflow: hidden; text-overflow: clip;
  }
  .ev-text br { display: none; }
  .m-more {
    display: block; text-align: center;
    font-size: 0.6rem; font-weight: 700; color: var(--muted);
  }
  .day-panel { scroll-margin-top: 140px; }

  /* 휴대폰 휴가 달력 */
  .leave-cal-grid { grid-auto-rows: minmax(60px, auto); }
  .lv-main { padding: 1px 2px 1px 3px; gap: 2px; font-size: 0.66rem; }
  .lv-dot { display: none; }
  .lv-name { text-overflow: clip; }
  .lv-tag { font-size: 0.55rem; }
  .lv-del { display: none; }
}

/* 일정 ↔ 재고 전환 (준 캘린더) */
.brand { flex-wrap: wrap; }
.app-switch {
  flex-basis: 100%;
  display: grid; grid-template-columns: 1fr 1fr; gap: 2px;
  margin-top: 12px; padding: 3px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px;
}
.app-switch[hidden] { display: none; }
.app-switch a {
  text-align: center; padding: 6px 0; border-radius: 7px;
  font-size: 0.82rem; font-weight: 600; color: var(--muted); text-decoration: none;
}
.app-switch a:hover { color: var(--ink); }
.app-switch a.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
@media (max-width: 760px) {
  .brand { flex-wrap: nowrap; }
  .brand:has(.app-switch:not([hidden])) > div:not(.app-switch) { display: none; }
  .app-switch { flex-basis: auto; width: 116px; margin-top: 0; }
  .app-switch a { padding: 5px 0; }
}

/* ───────── 휴대폰 조작 안정화 ───────── */
/* 팝업(창)이 열려 있으면 뒤 화면이 같이 움직이지 않게 */
html:has(dialog[open]) { overflow: hidden; }
dialog { overscroll-behavior: contain; }
@media (max-width: 760px) {
  /* 아이폰은 16px보다 작은 입력칸을 누르면 화면을 확대해 버려서 16px로 고정 */
  input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
  select, textarea { font-size: 16px !important; }
}

/* ───────── 대표님 현황판 (보기 전용) ───────── */
/* 대표님 모드: 메뉴를 숨기고 현황판만 */
body.boss-mode .sidebar { display: none; }
body.boss-mode .app { grid-template-columns: minmax(0, 1fr); }
body.boss-mode .main { padding: 0; height: auto; min-height: 100vh; overflow: visible; }
body.boss-mode, body.boss-mode .app { height: auto; overflow: visible; }

#view-boss {
  --bz-fs: 17px;
  --bz-card: var(--surface);
  --bz-hair: color-mix(in srgb, var(--ink) 8%, transparent);
  --bz-sub: color-mix(in srgb, var(--ink) 62%, var(--bg));
  --bz-shadow: 0 1px 2px rgba(15, 20, 30, 0.04), 0 6px 20px rgba(15, 20, 30, 0.05);
  font-size: var(--bz-fs);
  max-width: 640px; width: 100%; margin: 0 auto;
  padding: 0 18px 48px;
  color: var(--ink);
  letter-spacing: -0.01em;
}
#view-boss.bz-big { --bz-fs: 20px; }
#view-boss.active { display: block; overflow: visible; }

/* 머리글 */
.bz-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 28px 2px 18px; }
.bz-hello { display: grid; gap: 4px; min-width: 0; }
.bz-date { font-size: 0.88em; font-weight: 600; color: var(--bz-sub); }
.bz-hello strong { font-size: 1.55em; font-weight: 800; letter-spacing: -0.035em; line-height: 1.15; }
.bz-size {
  flex-shrink: 0; width: 2.6em; height: 2.6em; border-radius: 50%;
  border: 0; background: var(--bz-card); box-shadow: var(--bz-shadow);
  color: var(--ink); font: inherit; font-weight: 800; font-size: 0.95em; cursor: pointer;
  display: inline-flex; align-items: baseline; justify-content: center; gap: 1px; line-height: 2.6em;
}
.bz-size span { font-size: 1.3em; }
.bz-size[aria-pressed="true"] { background: var(--ink); color: var(--bg); }

/* 분할 탭 */
.bz-seg {
  position: sticky; top: 0; z-index: 5;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px;
  padding: 4px; margin: 0 0 18px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--ink) 7%, var(--bg));
  backdrop-filter: blur(12px);
}
.bz-tab {
  font: inherit; font-size: 1em; font-weight: 700;
  min-height: 2.6em; border: 0; border-radius: 11px;
  background: transparent; color: var(--bz-sub); cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.bz-tab.active { background: var(--bz-card); color: var(--ink); box-shadow: 0 1px 3px rgba(15, 20, 30, 0.12); }
.bz-pane[hidden] { display: none; }

/* 카드 묶음 (아이폰 설정 화면 같은 목록) */
.bz-group { background: var(--bz-card); border-radius: 18px; box-shadow: var(--bz-shadow); overflow: hidden; }
.bz-empty { margin: 0; padding: 1.4em 1.2em; color: var(--bz-sub); font-weight: 600; text-align: center; }

/* 오늘 요약 */
.bz-stats {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  background: var(--bz-card); border-radius: 18px; box-shadow: var(--bz-shadow);
  margin-bottom: 14px; padding: 14px 4px;
}
.bz-stat { display: grid; justify-items: center; gap: 4px; padding: 0 6px; border-left: 1px solid var(--bz-hair); }
.bz-stat:first-child { border-left: 0; }
.bz-stat b { font-size: 1.6em; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.bz-stat span { display: inline-flex; align-items: center; gap: 5px; font-size: 0.8em; font-weight: 600; color: var(--bz-sub); white-space: nowrap; }
.bz-stat i, .bz-status i { width: 0.5em; height: 0.5em; border-radius: 50%; background: var(--c, var(--off)); flex-shrink: 0; }
.bz-stat i.none, .bz-status.none i { --c: var(--off); opacity: 0.6; }

/* 직원 한 줄 */
.bz-person { display: flex; gap: 12px; padding: 14px 16px; }
.bz-person + .bz-person { border-top: 1px solid var(--bz-hair); }
.bz-person.is-empty .bz-pname { color: var(--bz-sub); }
.bz-av {
  flex-shrink: 0; width: 2.2em; height: 2.2em; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 0.9em; font-weight: 800;
  background: var(--c-bg); color: var(--c-ink);
}
.bz-pbody { flex: 1; min-width: 0; display: grid; gap: 4px; align-content: center; min-height: 2em; }
.bz-pline { display: flex; align-items: center; gap: 6px 12px; flex-wrap: wrap; }
.bz-pname { font-size: 1.05em; font-weight: 700; margin-right: auto; }
.bz-status { display: inline-flex; align-items: center; gap: 6px; font-size: 0.88em; font-weight: 700; color: var(--c-ink, var(--ink)); }
.bz-status {
  --c-ink: color-mix(in srgb, var(--c, var(--off)) 78%, var(--ink));
}
.bz-status.none { color: var(--bz-sub); font-weight: 600; }
.bz-notes { margin: 2px 0 0; padding: 0; list-style: none; display: grid; gap: 3px; }
.bz-notes li {
  position: relative; padding-left: 0.85em;
  font-size: 0.94em; line-height: 1.5; color: var(--ink-2);
  word-break: keep-all; overflow-wrap: anywhere;
}
.bz-notes li::before { content: ""; position: absolute; left: 0; top: 0.72em; width: 0.3em; height: 0.3em; border-radius: 50%; background: var(--bz-sub); opacity: 0.6; }

/* 탭 2개 */
.bz-seg.two { grid-template-columns: repeat(2, 1fr); }
.bz-icon {
  width: 2.4em; height: 2.4em; border-radius: 50%; border: 0;
  background: color-mix(in srgb, var(--ink) 5%, var(--bz-card));
  color: var(--ink); font: inherit; font-size: 1.05em; font-weight: 700; cursor: pointer;
}

/* 한 달 달력 */
.bz-calcard {
  background: var(--bz-card); border-radius: 20px; box-shadow: var(--bz-shadow);
  padding: 14px 10px 12px; margin-bottom: 20px;
}
.bz-calhd { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 10px; }
.bz-calhd strong { font-size: 1.12em; font-weight: 800; letter-spacing: -0.02em; }
.bz-cal7 { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); row-gap: 2px; }
.bz-chead { text-align: center; font-size: 0.74em; font-weight: 700; color: var(--bz-sub); padding: 2px 0 6px; }
.bz-chead.sat { color: var(--sat); }
.bz-chead.sun { color: var(--sun); }
.bz-cell {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  min-width: 0; min-height: 3.1em; padding: 3px 0 4px;
  border: 0; border-radius: 12px; background: transparent;
  color: var(--ink); font: inherit; cursor: pointer;
}
.bz-cell.sat .bz-cnum { color: var(--sat); }
.bz-cell.sun .bz-cnum { color: var(--sun); }
.bz-cell.out { opacity: 0.32; }
.bz-cnum {
  width: 1.95em; height: 1.95em; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 0.95em; font-weight: 700; font-variant-numeric: tabular-nums;
}
.bz-cell.is-today .bz-cnum { box-shadow: inset 0 0 0 2px var(--accent); color: var(--accent); }
.bz-cell.sel .bz-cnum { background: var(--ink); color: var(--bg) !important; box-shadow: none; }
.bz-cell.sel.is-today .bz-cnum { background: var(--accent); color: #fff !important; }
.bz-cdots { display: flex; gap: 3px; min-height: 6px; }
.bz-cdots i, .bz-legend i { width: 6px; height: 6px; border-radius: 50%; background: var(--c, var(--off)); }
.bz-legend {
  display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 14px;
  margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--bz-hair);
  font-size: 0.76em; font-weight: 600; color: var(--bz-sub);
}
.bz-legend span { display: inline-flex; align-items: center; gap: 5px; }

/* 휴가 달력: 칸에 이름 */
.bz-cal7.leave .bz-cell { min-height: 3.9em; }
.bz-cnames { display: grid; gap: 2px; width: 100%; padding: 0 2px; }
.bz-cname {
  display: block; font-size: 0.66em; font-weight: 700; line-height: 1.5;
  border-radius: 5px; padding: 0 2px; text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: clip;
  background: color-mix(in srgb, var(--leave) 14%, var(--bz-card));
  color: color-mix(in srgb, var(--leave) 80%, var(--ink));
}
.bz-cmore { font-size: 0.6em; font-weight: 800; color: var(--bz-sub); text-align: center; }

/* 고른 날 제목 */
.bz-dayhd { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 0 4px 10px; }
.bz-dayhd .bz-dayname { margin: 0; font-size: 1.05em; font-weight: 800; color: var(--ink); }

/* 휴가: 다가오는 휴가 */
.bz-leaverow { display: flex; align-items: center; gap: 14px; padding: 14px 16px; }
.bz-leaverow + .bz-leaverow { border-top: 1px solid var(--bz-hair); }
.bz-cal {
  flex-shrink: 0; width: 3.4em; padding: 6px 0;
  border-radius: 12px; background: color-mix(in srgb, var(--ink) 5%, var(--bz-card));
  display: grid; justify-items: center; line-height: 1.1;
}
.bz-cal b { font-size: 1.3em; font-weight: 800; font-variant-numeric: tabular-nums; }
.bz-cal span { font-size: 0.74em; font-weight: 700; color: var(--bz-sub); }
.bz-cal.sun span { color: var(--sun); }
.bz-cal.sat span { color: var(--sat); }
.bz-reason { font-size: 0.88em; color: var(--bz-sub); word-break: keep-all; }
.bz-dday {
  flex-shrink: 0; font-size: 0.82em; font-weight: 800;
  padding: 4px 10px; border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 6%, var(--bz-card)); color: var(--bz-sub);
  font-variant-numeric: tabular-nums;
}
.bz-dday.near { background: color-mix(in srgb, var(--leave) 14%, var(--bz-card)); color: color-mix(in srgb, var(--leave) 80%, var(--ink)); }

.bz-link {
  font: inherit; font-size: 0.85em; font-weight: 700;
  background: none; border: 0; padding: 0.4em 0.2em;
  color: var(--accent); cursor: pointer;
}
.bz-foot { display: flex; justify-content: center; gap: 28px; margin-top: 36px; }
.bz-foot .bz-link { color: var(--bz-sub); }

/* 어두운 화면: 그림자 대신 얇은 테두리 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) #view-boss .bz-group,
  :root:not([data-theme="light"]) #view-boss .bz-stats,
  :root:not([data-theme="light"]) #view-boss .bz-calcard { box-shadow: none; border: 1px solid var(--line); }
}
:root[data-theme="dark"] #view-boss .bz-group,
:root[data-theme="dark"] #view-boss .bz-stats,
:root[data-theme="dark"] #view-boss .bz-calcard { box-shadow: none; border: 1px solid var(--line); }
