:root {
  --bg: #f3f6fb;
  --card: #ffffff;
  --line: #dbe3ef;
  --line-strong: #c7d2e2;
  --text: #172033;
  --muted: #68758b;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eaf1ff;
  --accent: #7c3aed;
  --accent-dark: #6d28d9;
  --accent-soft: #f1eafe;
  --evening: #0f766e;
  --evening-soft: #e6fffb;
  --holiday: #ea580c;
  --holiday-soft: #fff1e8;
  --danger: #dc2626;
  --danger-soft: #feecec;
  --success: #15803d;
  --shadow: 0 12px 30px rgba(24, 39, 75, 0.07);
  --radius: 16px;
}

* { box-sizing: border-box; }
html { min-width: 320px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Pretendard, "Noto Sans KR", "Malgun Gothic", Arial, sans-serif;
  font-size: 14px;
  word-break: keep-all;
}
button, input, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.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;
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 30px;
  background:
    radial-gradient(circle at 20% 20%, rgba(37, 99, 235, .14), transparent 32%),
    radial-gradient(circle at 80% 75%, rgba(124, 58, 237, .12), transparent 36%),
    #f7f9fd;
}
.login-card {
  width: min(460px, 100%);
  padding: 44px;
  background: rgba(255, 255, 255, .96);
  border: 1px solid rgba(203, 213, 225, .9);
  border-radius: 28px;
  box-shadow: 0 28px 70px rgba(30, 51, 90, .13);
  text-align: center;
}
.brand-mark {
  width: 68px;
  height: 68px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  border-radius: 22px;
  color: white;
  background: linear-gradient(145deg, #2563eb, #7c3aed);
  box-shadow: 0 12px 22px rgba(37, 99, 235, .24);
  font-size: 28px;
  font-weight: 900;
}
.brand-mark.small {
  width: 42px;
  height: 42px;
  margin: 0;
  border-radius: 13px;
  font-size: 18px;
}
.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .16em;
}
.login-card h1 { margin: 0; font-size: 30px; letter-spacing: -.04em; }
.login-copy { margin: 16px auto 28px; color: var(--muted); line-height: 1.75; }
.login-footnote { margin: 18px 0 0; color: #94a3b8; font-size: 12px; }
.google-g {
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: white;
  color: #4285f4;
  font-weight: 900;
}
.setup-notice {
  margin-top: 18px;
  padding: 13px 14px;
  display: grid;
  gap: 4px;
  border: 1px solid #fdba74;
  border-radius: 12px;
  background: #fff7ed;
  color: #9a3412;
  text-align: left;
  font-size: 12px;
  line-height: 1.5;
}

.topbar {
  min-height: 68px;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255,255,255,.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}
.topbar-brand, .account-area { display: flex; align-items: center; gap: 12px; }
.topbar-brand strong { display: block; font-size: 16px; }
.topbar-brand span, .account-text span { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.account-text { min-width: 0; }
.account-text strong { display: block; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: #e2e8f0; }
.admin-badge { padding: 5px 8px; border-radius: 999px; background: var(--primary-soft); color: var(--primary-dark); font-size: 11px; font-weight: 800; }

.main { width: min(100%, 1600px); margin: 0 auto; padding: 30px 28px 50px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.page-heading h1 { margin: 0; font-size: 28px; letter-spacing: -.04em; }
.page-heading p:not(.eyebrow) { margin: 9px 0 0; color: var(--muted); line-height: 1.6; }
.heading-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }

.toolbar { min-height: 72px; padding: 12px 14px; display: flex; align-items: end; gap: 10px; margin-bottom: 18px; }
.toolbar-spacer { flex: 1; }
.range-separator { align-self: center; margin-top: 18px; color: var(--muted); font-weight: 800; }
.field { display: grid; gap: 7px; min-width: 0; }
.field > span { color: #4b5870; font-size: 12px; font-weight: 700; }
.field b { color: var(--danger); }
.field input, .field select, .inline-form input {
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  outline: none;
  color: var(--text);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .inline-form input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.field input:disabled { background: #f1f5f9; color: #94a3b8; }
.field.compact { width: 154px; }
.search-field { width: min(310px, 28vw); }

.btn {
  min-height: 40px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 750;
  white-space: nowrap;
  transition: .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled { cursor: not-allowed; opacity: .55; transform: none; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-accent { background: var(--accent); color: white; }
.btn-accent:hover { background: var(--accent-dark); }
.btn-secondary { background: white; border-color: var(--line-strong); color: #344158; }
.btn-secondary:hover, .btn-ghost:hover { background: #f5f7fb; }
.btn-ghost { background: transparent; border-color: transparent; color: #4b5870; }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-large { width: 100%; min-height: 52px; border-radius: 13px; font-size: 15px; }
.btn-mini { min-height: 28px; padding: 0 8px; border-radius: 7px; font-size: 11px; }

.person-summary { margin-bottom: 18px; overflow: hidden; }
.summary-dot { background: var(--success); }
.person-summary-wrap { width: 100%; overflow: hidden; }
.person-summary-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  font-size: 13px;
}
.person-summary-table th,
.person-summary-table td {
  padding: 14px 12px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: center;
  overflow-wrap: anywhere;
}
.person-summary-table th:last-child,
.person-summary-table td:last-child { border-right: 0; }
.person-summary-table thead th {
  background: #f8fafc;
  color: #3d4a61;
  font-size: 12px;
  font-weight: 800;
}
.person-summary-table tbody th {
  width: 18%;
  background: #fbfdff;
  font-size: 14px;
  font-weight: 850;
}
.person-summary-table tbody td:nth-child(2) { background: var(--primary-soft); }
.person-summary-table tbody td:nth-child(3) { background: linear-gradient(90deg, var(--evening-soft), var(--holiday-soft)); }
.person-summary-table tbody td:nth-child(4) { background: var(--accent-soft); }
.person-summary-table tbody strong { font-size: 16px; letter-spacing: -.02em; }
.person-summary-table tbody tr:last-child th,
.person-summary-table tbody tr:last-child td { border-bottom: 0; }

.board-wrap { min-width: 0; }
.board-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.data-panel { min-width: 0; overflow: hidden; }
.panel-heading { min-height: 62px; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; gap: 15px; border-bottom: 1px solid var(--line); }
.panel-heading > div { display: flex; align-items: center; gap: 8px; }
.panel-heading h2 { margin: 0; font-size: 16px; }
.panel-heading small { color: var(--muted); text-align: right; }
.panel-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.shoot-dot { background: var(--primary); }
.leave-dot { background: var(--accent); }

.table-scroller { overflow-x: auto; max-height: 620px; }
.leave-scroller { max-height: 420px; }
.data-table {
  width: 100%;
  min-width: 0;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  font-size: 12px;
}
.data-table th, .data-table td {
  padding: 8px 7px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  overflow-wrap: anywhere;
}
.data-table th:last-child, .data-table td:last-child { border-right: 0; }
.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f8fafc;
  color: #3d4a61;
  font-weight: 800;
  text-align: center;
  white-space: nowrap;
}
.data-table tbody tr:hover td { background: #fafcff; }
.data-table tbody td { background: #fff; }
.data-table tbody tr.row-evening td { background: #f3fffd; }
.data-table tbody tr.row-holiday td { background: #fffaf6; }
.data-table tbody tr.row-evening:hover td { background: #ecfdf9; }
.data-table tbody tr.row-holiday:hover td { background: #fff5ed; }
.data-table tfoot td {
  position: sticky;
  bottom: 0;
  z-index: 1;
  background: #f7f9fc;
  font-weight: 900;
  text-align: center;
}
.date-col, .data-table .date-cell { width: 132px; }
.type-col, .data-table .type-cell { width: 86px; text-align: center; }
.event-col { width: 18%; }
.activity-col, .data-table .activity-cell { width: 72px; text-align: center; }
.person-col, .data-table .person-cell { width: 56px; text-align: center; font-variant-numeric: tabular-nums; }
.note-col { width: 12%; }
.reason-col { width: 28%; }
.action-col, .data-table .action-cell { width: 66px; text-align: center; }
.name-col { width: 92px; }
.duration-col { width: 80px; }
.event-cell { font-weight: 700; }
.note-cell { color: #526078; }
.date-main { white-space: nowrap; font-weight: 700; }
.day-badge {
  display: inline-block;
  margin-left: 4px;
  padding: 2px 4px;
  border-radius: 4px;
  background: #f1f5f9;
  color: #64748b;
  font-size: 9px;
}
.holiday-text {
  display: block;
  margin-top: 4px;
  color: var(--holiday);
  font-size: 10px;
  line-height: 1.3;
}
.type-badge {
  display: inline-flex;
  justify-content: center;
  min-width: 62px;
  padding: 5px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
}
.type-badge.weekday { background: var(--primary-soft); color: var(--primary-dark); }
.type-badge.evening { background: var(--evening-soft); color: var(--evening); }
.type-badge.holiday { background: var(--holiday-soft); color: var(--holiday); }
.row-actions { display: flex; justify-content: center; gap: 4px; }
.icon-action { width: 25px; height: 25px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: white; color: #526078; font-size: 12px; }
.icon-action:hover { background: #eff4ff; color: var(--primary); }
.icon-action.delete:hover { background: var(--danger-soft); color: var(--danger); }
.zero { color: #c0c8d4; }
.empty-state { padding: 46px 20px; color: var(--muted); text-align: center; }

.access-denied { padding: 34px; text-align: center; }
.access-denied h2 { margin: 0 0 8px; }
.access-denied p { color: var(--muted); }
.access-denied strong { display: inline-block; margin-top: 10px; padding: 7px 11px; background: #f1f5f9; border-radius: 8px; }

.modal { width: min(760px, calc(100vw - 28px)); max-height: calc(100vh - 28px); padding: 0; border: 0; border-radius: 20px; background: transparent; overflow: visible; }
.manage-modal { width: min(1080px, calc(100vw - 28px)); }
.modal::backdrop { background: rgba(15, 23, 42, .54); backdrop-filter: blur(4px); }
.modal-card { max-height: calc(100vh - 28px); overflow: auto; padding: 26px; background: white; border-radius: 20px; box-shadow: 0 24px 80px rgba(0,0,0,.24); }
.modal-card.narrow { width: min(620px, 100%); margin: auto; }
.modal-card.manage-card { width: 100%; }
.modal-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.modal-heading h2 { margin: 0; font-size: 23px; }
.icon-btn { width: 36px; height: 36px; border: 0; border-radius: 10px; background: #f2f5f9; color: #526078; font-size: 24px; line-height: 1; }
.form-grid { display: grid; gap: 15px; }
.form-grid.two-col { grid-template-columns: 1fr 1fr; }
.form-grid .full { grid-column: 1 / -1; }

.date-status {
  min-height: 64px;
  padding: 11px 13px;
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #f8fafc;
  color: #526078;
  line-height: 1.45;
}
.date-status strong { color: var(--text); }
.date-status.holiday { border-color: #fdba74; background: var(--holiday-soft); color: #9a3412; }
.date-status.evening { border-color: #99f6e4; background: var(--evening-soft); color: var(--evening); }

.work-option-box {
  margin-top: 18px;
  padding: 15px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 11px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #f8fafc;
}
.check-option {
  min-width: 0;
  padding: 10px 11px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  cursor: pointer;
}
.check-option input { width: 17px; height: 17px; margin: 2px 0 0; accent-color: var(--primary); }
.check-option span { min-width: 0; }
.check-option strong { display: block; font-size: 13px; }
.check-option small { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.45; }
.custom-holiday-name { grid-column: 1 / -1; }

.assignment-block { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
.assignment-heading { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.assignment-heading h3 { margin: 0; font-size: 15px; }
.assignment-heading span { color: var(--muted); font-size: 11px; }
.assignment-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.assignment-item { display: grid; grid-template-columns: minmax(0, 1fr) 74px; align-items: center; gap: 8px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; }
.assignment-item label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.assignment-item input { width: 100%; height: 34px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: 8px; text-align: right; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; }

.manage-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.manage-section { min-width: 0; }
.holiday-manage-section { grid-column: 1 / -1; padding-top: 20px; border-top: 1px solid var(--line); }
.section-heading h3 { margin: 0; }
.section-heading p { margin: 6px 0 14px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.inline-form { display: grid; grid-template-columns: 110px 1fr auto; gap: 7px; margin-bottom: 12px; }
.inline-form.staff-form { grid-template-columns: 1fr auto; }
.inline-form.holiday-form { grid-template-columns: 170px 1fr auto; }
.manage-list { display: grid; gap: 7px; max-height: 320px; overflow: auto; }
.holiday-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.manage-item { min-height: 50px; padding: 8px 10px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid var(--line); border-radius: 10px; }
.manage-item-main { min-width: 0; }
.manage-item strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.manage-item span { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.manage-item-actions { display: flex; gap: 5px; }
.status-dot { width: 8px; height: 8px; display: inline-block; margin-right: 5px; border-radius: 50%; background: #22c55e; }
.status-dot.off { background: #94a3b8; }

.toast { min-width: 240px; max-width: min(440px, calc(100vw - 32px)); padding: 12px 16px; position: fixed; left: 50%; bottom: 24px; z-index: 100; transform: translate(-50%, 30px); border-radius: 11px; background: #172033; color: white; box-shadow: 0 16px 40px rgba(0,0,0,.22); opacity: 0; pointer-events: none; transition: .2s ease; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: #991b1b; }

@media (max-width: 1000px) {
  .toolbar { align-items: stretch; flex-wrap: wrap; }
  .toolbar-spacer { display: none; }
  .search-field { flex: 1; width: auto; min-width: 230px; }
  .toolbar .btn { align-self: end; }
  .assignment-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .topbar { padding: 12px 16px; align-items: flex-start; }
  .topbar-brand span, .account-text { display: none; }
  .main { padding: 22px 14px 40px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .page-heading h1 { font-size: 24px; }
  .heading-actions { width: 100%; }
  .heading-actions .btn { flex: 1; }
  .field.compact { width: calc(50% - 16px); }
  .range-separator { width: 12px; text-align: center; }
  .search-field { width: 100%; flex-basis: 100%; }
  .toolbar .btn { flex: 1; }
  .form-grid.two-col { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  .work-option-box { grid-template-columns: 1fr; }
  .custom-holiday-name { grid-column: auto; }
  .assignment-grid { grid-template-columns: 1fr 1fr; }
  .manage-grid { grid-template-columns: 1fr; }
  .holiday-manage-section { grid-column: auto; }
  .inline-form, .inline-form.holiday-form { grid-template-columns: 1fr; }
  .holiday-list { grid-template-columns: 1fr; }
  .login-card { padding: 34px 24px; }
  .data-table { min-width: 820px; }
}
@media (max-width: 560px) {
  .person-summary-table { font-size: 11px; }
  .person-summary-table th, .person-summary-table td { padding: 10px 5px; }
  .person-summary-table thead th { font-size: 10px; }
  .person-summary-table tbody th { font-size: 12px; }
  .person-summary-table tbody strong { font-size: 12px; }
}
@media (max-width: 460px) {
  .field.compact { width: calc(50% - 16px); }
  .assignment-grid { grid-template-columns: 1fr; }
}

@page {
  size: A4 landscape;
  margin: 9mm;
}

@media print {
  :root { --shadow: none; }
  html, body { width: 100%; }
  body { background: white; font-size: 11px; }
  .topbar, .toolbar, .heading-actions, .action-col, .action-cell, .toast { display: none !important; }
  .main { width: 100%; max-width: none; padding: 0; }
  .page-heading { margin-bottom: 10px; }
  .page-heading h1 { font-size: 22px; }
  .page-heading p { display: none; }
  .person-summary { margin-bottom: 9px; box-shadow: none; break-inside: avoid; }
  .person-summary-table { font-size: 12px; }
  .person-summary-table th, .person-summary-table td { padding: 7px 6px; }
  .person-summary-table tbody strong { font-size: 13px; }
  .data-panel { margin-bottom: 12px; box-shadow: none; break-inside: auto; }
  .panel-heading { min-height: 44px; padding: 0 10px; }
  .panel-heading h2 { font-size: 15px; }
  .table-scroller { max-height: none; overflow: visible; }
  .data-table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
    font-size: 15px;
    line-height: 1.3;
  }
  .data-table th, .data-table td {
    padding: 6px 4px;
    overflow-wrap: break-word;
    word-break: keep-all;
  }
  .data-table thead th, .data-table tfoot td { position: static; }
  .shoot-table .date-col, .shoot-table .date-cell { width: 13%; }
  .shoot-table .type-col, .shoot-table .type-cell { width: 9%; }
  .shoot-table .event-col, .shoot-table .event-cell { width: 14%; }
  .shoot-table .activity-col, .shoot-table .activity-cell { width: 7%; }
  .shoot-table .person-col, .shoot-table .person-cell { width: 6%; }
  .shoot-table .note-col, .shoot-table .note-cell { width: 9%; }
  .leave-table .date-col, .leave-table .date-cell { width: 15%; }
  .leave-table .name-col { width: 12%; }
  .leave-table .duration-col { width: 10%; }
  .leave-table .reason-col { width: 36%; }
  .leave-table .note-col, .leave-table .note-cell { width: 27%; }
  .day-badge { font-size: 13px; }
  .holiday-text { font-size: 13px; }
  .type-badge { min-width: 0; padding: 3px 4px; font-size: 13px; white-space: normal; }
}
