/* =========================================================
   Marketian Workspace — Fluent Design System stylesheet
   직원 포털(base.html)과 관리 대시보드(manage/base.html)가
   공유하는 단일 스타일시트입니다. (인라인 CSS 통합본)
   ========================================================= */

:root {
  /* Fluent brand ramp (communication blue) */
  --brand: #0f6cbd;
  --brand-hover: #115ea3;
  --brand-pressed: #0c3b5e;
  --brand-soft: #ebf3fc;
  --brand-soft-line: #b4d6fa;

  /* Neutrals */
  --bg: #f5f5f5;
  --surface: #ffffff;
  --surface-2: #fafafa;
  --line: #e0e0e0;
  --line-strong: #d1d1d1;
  --text: #242424;
  --muted: #616161;

  /* Semantic */
  --danger: #b10e1c;
  --danger-soft: #fdf3f4;
  --danger-line: #eeacb2;
  --warning: #835b00;
  --warning-soft: #fff9ef;
  --warning-line: #fdcfb4;
  --success: #0e700e;
  --success-soft: #f1faf1;
  --success-line: #9fd89f;

  /* Legacy aliases (기존 템플릿 호환) */
  --primary: var(--brand);
  --primary-dark: var(--brand-hover);
  --primary-soft: var(--brand-soft);
  --blue: var(--brand);
  --red: var(--danger);
  --green: var(--success);
  --amber: var(--warning);
  --nav: #fafafa;
  --nav-muted: #616161;

  /* Elevation (Fluent shadow ramp) */
  --shadow-2: 0 1px 2px rgba(0, 0, 0, .14), 0 0 2px rgba(0, 0, 0, .12);
  --shadow-8: 0 4px 8px rgba(0, 0, 0, .14), 0 0 2px rgba(0, 0, 0, .12);
  --shadow-16: 0 8px 16px rgba(0, 0, 0, .14), 0 0 2px rgba(0, 0, 0, .12);
  --shadow-28: 0 14px 28px rgba(0, 0, 0, .24), 0 0 8px rgba(0, 0, 0, .2);

  /* Radius (Fluent) */
  --radius-s: 4px;
  --radius-m: 6px;
  --radius-l: 8px;
  --radius-xl: 12px;
}

* { box-sizing: border-box; }

.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;
}

html { height: 100%; }

body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: none; }
h1, h2 { margin: 0; line-height: 1.25; font-weight: 600; }
h1 { font-size: 24px; }
h2 { font-size: 18px; }
.muted { color: var(--muted); }
.link { color: var(--brand); font-weight: 600; }
.link:hover { color: var(--brand-hover); text-decoration: underline; }
.nowrap { white-space: nowrap; }
.shell { max-width: 920px; margin: 0 auto; padding: 48px 20px; }

/* ---------------------------------------------------------
   App shell (직원 포털 + 관리 공용 레이아웃)
   --------------------------------------------------------- */
.app-layout,
.layout {
  display: grid;
  grid-template-columns: 256px minmax(0, 1fr);
  height: 100vh;
  min-height: 0;
  overflow: hidden;
}

.mobile-nav-backdrop { display: none; }

.sidebar {
  background: var(--nav);
  color: var(--text);
  border-right: 1px solid var(--line);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  height: 100vh;
  min-height: 0;
  overflow: hidden;
}
.sidebar-mobile-head { display: none; }

.brand { display: grid; gap: 3px; padding: 10px 10px 14px; }
.brand strong { font-size: 17px; font-weight: 700; color: var(--text); letter-spacing: -.01em; }
.brand span { color: var(--muted); font-size: 12px; }

.side-nav,
.nav { display: grid; gap: 4px; }
.side-nav a,
.nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: var(--radius-m);
  color: var(--muted);
  font-weight: 600;
  transition: background .12s ease, color .12s ease;
}
.side-nav a:hover,
.nav a:hover { background: #f0f0f0; color: var(--text); }
.side-nav a.active,
.nav a.active { background: var(--brand-soft); color: var(--brand-hover); }
.side-nav a.active::before,
.nav a.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 18px;
  border-radius: 999px;
  background: var(--brand);
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 8px;
  padding: 12px 10px 4px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}
.sidebar-user { display: grid; gap: 2px; overflow-wrap: anywhere; }
.sidebar-user strong { color: var(--text); }

.app-main,
.main {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.app-topbar,
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  padding: 12px 28px;
  background: rgba(255, 255, 255, .86);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
  z-index: 5;
}
.topbar-title-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.title-block { display: grid; gap: 2px; }
.title-block h1 { margin: 0; font-size: 20px; font-weight: 700; line-height: 1.25; }
.title-block span { color: var(--muted); font-size: 12.5px; }
.top-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.top-actions form { margin: 0; }

.content {
  min-height: 0;
  overflow: auto;
  padding: 24px 28px 44px;
  display: grid;
  align-content: start;
  gap: 16px;
}

/* ---------------------------------------------------------
   Buttons (Fluent)
   --------------------------------------------------------- */
.button, button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  padding: 7px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-s);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background .1s ease, border-color .1s ease, box-shadow .1s ease;
}
.button:hover, button:hover { background: var(--surface-2); border-color: var(--line-strong); }
.button:active, button:active { background: #f0f0f0; }
.button:focus-visible, button:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible,
a:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}
.button.primary, button.primary {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
  box-shadow: var(--shadow-2);
}
.button.primary:hover, button.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.button.primary:active, button.primary:active { background: var(--brand-pressed); }
.button.danger, button.danger { color: var(--danger); }
.button.danger:hover, button.danger:hover { background: var(--danger-soft); border-color: var(--danger-line); }
.button:disabled, button:disabled { opacity: .6; cursor: wait; box-shadow: none; }
.button.full, button.full { width: 100%; }
.button.disabled {
  color: var(--muted);
  background: var(--surface-2);
  border-color: var(--line);
  cursor: default;
}
.button.is-loading, button.is-loading { position: relative; }
.button.is-loading::before, button.is-loading::before {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, .45);
  border-top-color: #fff;
  border-radius: 999px;
  animation: spin .75s linear infinite;
}

.icon-button {
  width: 32px;
  min-height: 32px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-s);
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  font-weight: 500;
}
.icon-button:hover { background: #f0f0f0; color: var(--text); }

.menu-toggle {
  display: none;
  width: 38px;
  min-height: 38px;
  padding: 0;
  flex: 0 0 auto;
  border-color: var(--line);
  background: #fff;
}
.menu-toggle span:not(.sr-only),
.menu-toggle span:not(.sr-only)::before,
.menu-toggle span:not(.sr-only)::after {
  display: block;
  width: 16px;
  height: 2px;
  border-radius: 999px;
  background: var(--text);
  content: "";
}
.menu-toggle span:not(.sr-only) { position: relative; }
.menu-toggle span:not(.sr-only)::before,
.menu-toggle span:not(.sr-only)::after { position: absolute; left: 0; }
.menu-toggle span:not(.sr-only)::before { top: -5px; }
.menu-toggle span:not(.sr-only)::after { top: 5px; }

/* ---------------------------------------------------------
   Cards / sections / panels
   --------------------------------------------------------- */
.panel,
.section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-2);
  overflow: hidden;
}
.panel-head,
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.panel-head { padding: 16px 20px; }
.section-head h2 { margin: 0; font-size: 15px; font-weight: 700; line-height: 1.3; }
.section-body { padding: 16px 18px; }
.form-section { max-width: 560px; }

.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid-1 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.split { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr); gap: 14px; }

.metric {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-2);
  padding: 16px;
  display: grid;
  gap: 8px;
  min-height: 104px;
  transition: box-shadow .12s ease;
}
.metric:hover { box-shadow: var(--shadow-8); }
.metric span { color: var(--muted); font-size: 12px; font-weight: 600; }
.metric strong { font-size: 26px; font-weight: 700; line-height: 1.05; letter-spacing: -.01em; }
.metric small { color: var(--muted); }

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

.mini-list, .history-list { display: grid; gap: 8px; }
.mini-row, .history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  background: #fff;
  transition: background .1s ease, border-color .1s ease;
}
.mini-row:hover, .history-row:hover { background: var(--surface-2); border-color: var(--line-strong); }
.mini-row span:first-child, .history-row span:first-child { display: grid; gap: 2px; min-width: 0; }
.mini-row strong, .history-row strong { font-size: 13px; }
.mini-row small, .history-row small { color: var(--muted); overflow-wrap: anywhere; }

.history-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.history-head h2 { font-size: 15px; }
.history-head a { color: var(--brand); font-size: 12px; font-weight: 700; }

/* ---------------------------------------------------------
   Messages / status badges
   --------------------------------------------------------- */
.messages { display: grid; gap: 8px; }
.message {
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: var(--radius-m);
  background: #fff;
}
.message.success { border-color: var(--success-line); border-left-color: var(--success); background: var(--success-soft); color: var(--success); }
.message.warning { border-color: var(--warning-line); border-left-color: var(--warning); background: var(--warning-soft); color: var(--warning); }
.message.error { border-color: var(--danger-line); border-left-color: var(--danger); background: var(--danger-soft); color: var(--danger); }

.status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 22px;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
}
.status.pending { color: #825b00; background: var(--warning-soft); border-color: var(--warning-line); }
.status.approved { color: var(--success); background: var(--success-soft); border-color: var(--success-line); }
.status.rejected, .status.failed { color: var(--danger); background: var(--danger-soft); border-color: var(--danger-line); }
.status.cancelled { color: var(--muted); background: #f0f0f0; }

/* ---------------------------------------------------------
   Tables
   --------------------------------------------------------- */
table { width: 100%; border-collapse: collapse; }
th, td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}
td { vertical-align: top; }
th {
  color: var(--muted);
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .08s ease; }
tbody tr:hover td { background: var(--brand-soft); }

/* ---------------------------------------------------------
   Forms
   --------------------------------------------------------- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 20px;
}
.form-grid .full { grid-column: 1 / -1; }
.field { display: grid; gap: 6px; }
.field.full { grid-column: 1 / -1; }
label { display: grid; gap: 6px; color: var(--text); font-weight: 600; font-size: 12.5px; }
input, select, textarea {
  width: 100%;
  min-height: 36px;
  padding: 7px 11px;
  border: 1px solid var(--line-strong);
  border-bottom-color: #8a8a8a;
  border-radius: var(--radius-s);
  background: #fff;
  color: var(--text);
  font: inherit;
  transition: border-color .1s ease, box-shadow .1s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  border-bottom-color: var(--brand);
  box-shadow: 0 0 0 1px var(--brand) inset;
}
input[readonly] { background: var(--surface-2); color: var(--muted); }
input[type="checkbox"] { width: 18px; min-height: 18px; justify-self: start; accent-color: var(--brand); }
textarea { resize: vertical; }
details summary { cursor: pointer; width: fit-content; }
.errors, .errorlist, .field-errors { margin: 4px 0 0; padding-left: 18px; color: var(--danger); font-size: 13px; }
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}

/* ---------------------------------------------------------
   Filters (관리 목록)
   --------------------------------------------------------- */
.filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) repeat(3, minmax(140px, 190px));
  gap: 8px;
  align-items: end;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.filters.compact { grid-template-columns: minmax(220px, 1fr) minmax(160px, 220px); }
.filters input, .filters select { background: #fff; }
.filter-status {
  align-self: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  min-height: 18px;
}
.ajax-region { transition: opacity .15s ease; }
.ajax-region.is-loading { opacity: .55; }

.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}

.bar-list { display: grid; gap: 12px; }
.bar-row { display: grid; gap: 6px; }
.bar-meta { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 13px; }
.bar-track { height: 8px; background: #ebebeb; border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; width: var(--value); background: var(--brand); border-radius: 999px; }

.json-box {
  max-height: 260px;
  overflow: auto;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  background: #1b1a19;
  color: #edebe9;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ---------------------------------------------------------
   Login / request shells
   --------------------------------------------------------- */
.login-shell {
  height: 100vh;
  overflow: auto;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(1200px 500px at 85% -10%, var(--brand-soft), transparent 60%),
    var(--bg);
}
.login-card {
  width: min(440px, 100%);
  display: grid;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-16);
  overflow: hidden;
}
.login-head { padding: 26px 26px 16px; border-bottom: 1px solid var(--line); }
.login-head h1 { margin: 0 0 6px; font-size: 24px; font-weight: 700; }
.login-head p { margin: 0; color: var(--muted); line-height: 1.55; }
.auth-card { padding: 20px 26px 26px; display: grid; gap: 14px; }

.ms-mark {
  display: grid;
  grid-template-columns: repeat(2, 9px);
  grid-template-rows: repeat(2, 9px);
  gap: 2px;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
}
.ms-mark span:nth-child(1) { background: #f25022; }
.ms-mark span:nth-child(2) { background: #7fba00; }
.ms-mark span:nth-child(3) { background: #00a4ef; }
.ms-mark span:nth-child(4) { background: #ffb900; }

.request-shell { max-width: 560px; margin: 0 auto; padding: 54px 20px; }
.request-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-8);
  overflow: hidden;
}
.request-head { display: grid; gap: 8px; padding: 24px 24px 10px; }
.request-head h1 { font-size: 26px; font-weight: 700; }
.request-form { display: grid; gap: 14px; padding: 18px 24px 24px; }
.request-form.compact { padding: 18px 20px 20px; }

.reveal-field {
  display: grid;
  gap: 6px;
  overflow: hidden;
  max-height: 140px;
  opacity: 1;
  transform: translateY(0);
  transition: max-height .22s ease, opacity .18s ease, transform .18s ease, margin .18s ease;
}
.reveal-field.is-hidden {
  max-height: 0;
  opacity: 0;
  transform: translateY(-4px);
  margin-top: -14px;
  pointer-events: none;
}
.request-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.submit-progress {
  position: relative;
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--brand-soft);
}
.submit-progress[hidden] { display: none; }
.submit-progress span {
  position: absolute;
  inset: 0 auto 0 0;
  width: 38%;
  border-radius: inherit;
  background: var(--brand);
  animation: loading-bar 1s ease-in-out infinite;
}
.request-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.request-history {
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  padding: 16px 24px 20px;
  display: grid;
  gap: 10px;
}

/* ---------------------------------------------------------
   Modal
   --------------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, .4);
}
.modal-backdrop.is-open { display: flex; }
.modal-panel {
  width: min(560px, 100%);
  max-height: min(760px, calc(100dvh - 48px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-28);
  overflow: hidden;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.modal-head div { display: grid; gap: 3px; }
.modal-head h2 { font-size: 17px; font-weight: 700; }
.modal-panel .request-form { overflow: auto; }

/* ---------------------------------------------------------
   Calendar
   --------------------------------------------------------- */
.calendar-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.dashboard-page {
  --calendar-min-height: clamp(560px, calc(100dvh - 330px), 760px);
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(var(--calendar-min-height), 1fr);
  gap: 16px;
}
.calendar-page {
  min-width: 0;
  min-height: var(--calendar-min-height, 0);
  height: calc(100dvh - 136px);
  display: grid;
}
.dashboard-calendar-page { height: 100%; min-height: 0; max-height: none; }
.calendar-layout {
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 14px;
  align-items: stretch;
}
.calendar-section {
  min-width: 0;
  min-height: 0;
  overflow: visible;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}
.today-panel { min-width: 0; min-height: 0; max-height: 100%; overflow: auto; }
.calendar-controls { display: flex; gap: 8px; flex-wrap: wrap; }
.calendar-scroll {
  min-width: 0;
  max-width: 100%;
  min-height: 0;
  overflow: visible;
  -webkit-overflow-scrolling: touch;
}
.calendar-grid {
  --calendar-week-count: 6;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-template-rows: 32px repeat(var(--calendar-week-count), minmax(76px, 1fr));
  grid-auto-rows: auto;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
  background: var(--line);
}
.calendar-weekday, .calendar-day {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.calendar-weekday {
  min-height: 0;
  padding: 7px 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}
.calendar-day {
  position: relative;
  min-height: 0;
  min-width: 0;
  padding: 6px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 4px;
  overflow: visible;
}
.calendar-day-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 4px;
  min-width: 0;
  min-height: 24px;
}
.calendar-day:hover,
.calendar-day:focus-within { z-index: 12; }
.calendar-day.outside { background: var(--surface-2); color: var(--muted); }
.calendar-date {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-weight: 600;
  font-size: 12px;
}
.calendar-day.today .calendar-date { background: var(--brand); color: #fff; font-weight: 700; }
.calendar-events {
  display: grid;
  align-content: start;
  gap: 5px;
  min-width: 0;
  min-height: 0;
  overflow: visible;
}
.calendar-event {
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 20px;
  padding: 2px 6px;
  border: 1px solid var(--brand-soft-line);
  border-left: 3px solid var(--brand);
  border-radius: var(--radius-s);
  background: var(--brand-soft);
  color: var(--text);
  font-size: 12px;
  line-height: 1.15;
  overflow: hidden;
}
.calendar-event strong { flex: 1 1 auto; min-width: 0; font-weight: 600; }
.calendar-event span { flex: 0 0 auto; max-width: 42%; color: var(--muted); }
.calendar-event strong,
.calendar-event span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.calendar-more-wrap { position: relative; z-index: 4; flex: 0 0 auto; max-width: 100%; }
.calendar-more {
  min-height: 20px;
  padding: 2px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #fff;
  color: var(--brand-hover);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  box-shadow: var(--shadow-2);
  white-space: nowrap;
}
.calendar-more:hover,
.calendar-more:focus-visible {
  border-color: var(--brand);
  outline: 2px solid var(--brand-soft-line);
  outline-offset: 1px;
}
.calendar-popover {
  position: fixed;
  z-index: 80;
  top: 0;
  left: 0;
  width: min(280px, calc(100vw - 48px));
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  background: #fff;
  box-shadow: var(--shadow-16);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-3px);
  transition: opacity .14s ease, transform .14s ease, visibility .14s ease;
}
.calendar-more-wrap:hover .calendar-popover,
.calendar-more-wrap:focus-within .calendar-popover,
.calendar-more-wrap.is-open .calendar-popover {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}
.calendar-popover-title { display: block; margin-bottom: 7px; font-size: 12px; line-height: 1.3; }
.calendar-popover-list { display: grid; gap: 6px; max-height: 240px; overflow: auto; }
.calendar-popover-row {
  display: grid;
  grid-template-columns: minmax(44px, auto) minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding-top: 6px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  line-height: 1.35;
}
.calendar-popover-row strong { white-space: nowrap; }
.calendar-popover-row span { color: var(--muted); overflow-wrap: anywhere; }

/* ---------------------------------------------------------
   Detail grid / misc
   --------------------------------------------------------- */
.detail-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; }
.detail-item {
  padding: 16px 18px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.detail-item:nth-child(3n) { border-right: 0; }
.detail-item strong { display: block; color: var(--muted); font-size: 12px; font-weight: 600; margin-bottom: 4px; }
.empty { padding: 32px 20px; color: var(--muted); text-align: center; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes loading-bar {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(270%); }
}

/* ---------------------------------------------------------
   Responsive — 직원 포털 (모바일 드로어)
   --------------------------------------------------------- */
@media (max-width: 760px) {
  body.nav-open { overflow: hidden; }
  .app-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }
  .mobile-nav-backdrop {
    position: fixed;
    inset: 0;
    z-index: 45;
    display: block;
    background: rgba(0, 0, 0, .4);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .18s ease, visibility .18s ease;
  }
  body.nav-open .mobile-nav-backdrop {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }
  .app-layout .sidebar {
    position: fixed;
    z-index: 50;
    inset: 0 auto 0 0;
    width: min(300px, 84vw);
    height: 100dvh;
    gap: 14px;
    padding: 14px 12px 18px;
    box-shadow: var(--shadow-28);
    transform: translateX(-105%);
    transition: transform .22s ease;
  }
  body.nav-open .app-layout .sidebar { transform: translateX(0); }
  .sidebar-mobile-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 2px 4px 6px;
  }
  .sidebar-mobile-head strong { font-size: 14px; }
  .side-nav { grid-template-columns: 1fr; }
  .side-nav a { justify-content: flex-start; }
  .app-layout .sidebar-footer { display: grid; }
  .app-topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 12px 14px;
  }
  .topbar-title-row { width: 100%; }
  .menu-toggle { display: inline-flex; }
  .title-block { min-width: 0; }
  .title-block h1 { font-size: 19px; }
  .content { padding: 16px 14px 32px; }
  .panel-head { align-items: flex-start; flex-direction: column; }
  .form-grid, .detail-grid, .grid-3, .grid-2, .quick-actions { grid-template-columns: 1fr; }
  .dashboard-page {
    --calendar-min-height: min(560px, calc(100dvh - 154px));
    height: auto;
    display: grid;
    grid-template-rows: auto auto;
  }
  .calendar-layout { grid-template-columns: 1fr; }
  .calendar-page,
  .dashboard-calendar-page { height: auto; max-height: none; }
  .calendar-section { min-height: var(--calendar-min-height); }
  .today-panel { max-height: none; }
  .calendar-grid {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    grid-template-rows: 32px repeat(var(--calendar-week-count), minmax(0, 1fr));
  }
  .calendar-toolbar { align-items: flex-start; flex-direction: column; }
  .calendar-day { padding: 4px; gap: 3px; }
  .calendar-day-head { min-height: 20px; }
  .calendar-date { width: 20px; height: 20px; font-size: 11px; }
  .calendar-events { gap: 3px; }
  .calendar-event { min-height: 18px; padding: 1px 4px; gap: 3px; font-size: 11px; }
  .calendar-event span { display: none; }
  .calendar-more { min-height: 18px; padding: 1px 5px; font-size: 10px; }
  .calendar-popover {
    width: calc(100vw - 24px);
    max-height: min(360px, 64dvh);
    border-radius: var(--radius-l);
  }
  .calendar-popover-list { max-height: calc(min(360px, 64dvh) - 46px); }
  .calendar-popover-row { grid-template-columns: 1fr; gap: 2px; }
  .detail-item { border-right: 0; }
  table { display: block; overflow-x: auto; white-space: nowrap; }
  .shell { padding: 24px 14px; }
  .request-shell { padding: 24px 14px; }
  .request-actions { grid-template-columns: 1fr; }
  .history-row { align-items: flex-start; flex-direction: column; }
  .mini-row { align-items: flex-start; flex-direction: column; }
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal-panel {
    width: 100%;
    max-height: 92dvh;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  }
}

/* ---------------------------------------------------------
   Responsive — 관리 대시보드
   --------------------------------------------------------- */
@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }
  .layout .sidebar { height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav { grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); }
  .nav a { justify-content: center; }
  .nav a.active::before { display: none; }
  .layout .sidebar-footer { display: none; }
  .grid-4, .grid-3, .grid-2, .grid-1, .split, .form-grid { grid-template-columns: 1fr; }
  .filters { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; flex-direction: column; }
  table { display: block; overflow-x: auto; white-space: nowrap; }
}
