:root {
  --bg: #f4f5f7;
  --card: #fff;
  --text: #1a1d23;
  --muted: #6b7280;
  --accent: #2563eb;
  --accent-dim: #1d4ed8;
  --border: #e5e7eb;
  --ok: #047857;
  --err: #b91c1c;
  --in: #dbeafe;
  --done: #d1fae5;
  /* Typography: 본문·보조·캡션·소제목·제목만 구분 */
  --fs-base: 0.9375rem;
  --fs-sm: 0.875rem;
  --fs-caption: 0.8125rem;
  --fs-h3: 1.0625rem;
  --fs-h2: 1.5rem;
  --fs-h1: 1.625rem;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, "Segoe UI", sans-serif;
  font-size: var(--fs-base);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 1rem 1.25rem 2rem;
}

.container.narrow {
  max-width: 420px;
  padding-top: 3rem;
}

.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
}

.nav {
  max-width: 960px;
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.nav .brand {
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  margin-right: auto;
}

.nav a {
  color: var(--accent);
  text-decoration: none;
}

.nav a:hover {
  text-decoration: underline;
}

.user-label {
  color: var(--muted);
  font-size: var(--fs-sm);
}

.inline-form {
  display: inline;
  margin: 0;
}

.link-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: var(--fs-sm);
  text-decoration: underline;
  padding: 0;
}

h1 {
  font-size: var(--fs-h2);
  margin: 0 0 0.5rem;
}

.subnav, .crumb {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: var(--fs-sm);
}

.subnav a, .crumb a {
  color: var(--accent);
}

.calendar {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  /* 날짜·시각·재택 — 글자 키운 만큼 셀 높이 확보 */
  --cal-cell-height: calc(5.35rem * 2);
  font-size: var(--fs-base);
}

.calendar th,
.calendar td {
  border: 1px solid var(--border);
  text-align: center;
  padding: 0.5rem;
  vertical-align: middle;
}

.calendar td.cal-cell {
  vertical-align: top;
  min-width: 5rem;
  height: var(--cal-cell-height);
  min-height: var(--cal-cell-height);
  max-height: var(--cal-cell-height);
  overflow: hidden;
}

.calendar th {
  background: #f9fafb;
  font-weight: 600;
  font-size: var(--fs-base);
}

.calendar th.cal-wd-sat {
  color: #1d4ed8;
}

.calendar th.cal-wd-sun {
  color: #dc2626;
}

.cal-cell.today {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.cal-cell.other-month {
  background: #fafafa;
  color: var(--muted);
}

.cal-cell.status-in {
  background: var(--in);
}

.cal-cell.status-done {
  background: var(--done);
}

/* 셀 전체 클릭 영역 */
.cal-day-hit {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  height: 100%;
  min-height: 100%;
  text-decoration: none;
  color: inherit;
  box-sizing: border-box;
  outline: none;
}

.cal-day-hit:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.cal-day-num {
  display: block;
  font-weight: 700;
  font-size: 1.125rem;
  line-height: 1.2;
}

.cal-cell:not(.other-month):not(.cal-wd-sat):not(.cal-wd-sun) .cal-day-hit:hover .cal-day-num {
  color: var(--accent);
}

/* 토요일·일요일 (weekday(): 월=0 … 토=5, 일=6) */
.cal-cell.cal-wd-sat:not(.other-month) .cal-day-num {
  color: #1d4ed8;
}

.cal-cell.cal-wd-sat:not(.other-month) .cal-day-hit:hover .cal-day-num {
  color: #1e3a8a;
}

.cal-cell.cal-wd-sun:not(.other-month) .cal-day-num {
  color: #dc2626;
}

.cal-cell.cal-wd-sun:not(.other-month) .cal-day-hit:hover .cal-day-num {
  color: #991b1b;
}

.cal-cell.cal-wd-sat:not(.other-month) .cal-times {
  color: #2563eb;
}

.cal-cell.cal-wd-sun:not(.other-month) .cal-times {
  color: #dc2626;
}

.cal-cell.other-month.cal-wd-sat .muted {
  color: #3b82f6;
  opacity: 0.7;
}

.cal-cell.other-month.cal-wd-sun .muted {
  color: #ef4444;
  opacity: 0.7;
}

.cal-times {
  margin-top: 0.25rem;
  font-size: var(--fs-base);
  line-height: 1.35;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  font-variant-numeric: tabular-nums;
}

.cal-t-in,
.cal-t-out {
  display: block;
  white-space: nowrap;
}

.cal-remote-badge {
  display: block;
  margin-top: 0.2rem;
  align-self: center;
  padding: 0.12rem 0.4rem;
  max-width: 100%;
  font-size: var(--fs-sm);
  font-weight: 700;
  line-height: 1.2;
  color: #5b21b6;
  background: #ede9fe;
  border-radius: 4px;
  border: 1px solid #c4b5fd;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.legend {
  margin-top: 0.75rem;
  font-size: var(--fs-base);
  color: var(--muted);
}

.leg {
  margin-right: 1rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

.leg.status-in {
  background: var(--in);
}

.leg.status-done {
  background: var(--done);
}

.leg.leg-remote {
  background: #ede9fe;
  color: #5b21b6;
  border: 1px solid #c4b5fd;
}

.card {
  background: var(--card);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.card h2 {
  font-size: var(--fs-h3);
  margin: 0 0 0.75rem;
}

.kv {
  display: grid;
  grid-template-columns: 8rem 1fr;
  gap: 0.35rem 0.75rem;
  margin: 0 0 1rem;
}

.kv dt {
  margin: 0;
  color: var(--muted);
  font-size: var(--fs-caption);
}

.kv dd {
  margin: 0;
}

.btn-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
}

.btn-row form {
  margin: 0;
  display: inline-block;
  width: auto;
}

.btn-row button {
  width: auto;
}

button, .button {
  font: inherit;
  cursor: pointer;
  border-radius: 6px;
  padding: 0.45rem 1rem;
  border: 1px solid transparent;
}

button.primary, .button.primary {
  background: var(--accent);
  color: #fff;
}

button.primary:hover:not(:disabled) {
  background: var(--accent-dim);
}

button.secondary, .button.secondary {
  background: #fff;
  border-color: var(--border);
  color: var(--text);
  text-decoration: none;
  display: inline-block;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.stack-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.stack-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-weight: 500;
}

.stack-form input,
.stack-form textarea {
  font: inherit;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.checkbox-field {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  cursor: pointer;
}

.checkbox-field input {
  width: auto;
  margin: 0;
  accent-color: var(--accent);
}

.form-actions-inline {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: center;
}

.btn-fit {
  width: auto;
  min-width: 0;
  flex: 0 0 auto;
  box-sizing: border-box;
}

.hint {
  color: var(--muted);
  font-size: var(--fs-sm);
  margin: 0;
}

.readonly-block .pre-text {
  white-space: pre-wrap;
  margin: 0 0 1rem;
  font-family: inherit;
  font-size: var(--fs-base);
}

.msg {
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: var(--fs-base);
}

.msg.ok {
  background: #ecfdf5;
  color: var(--ok);
}

.msg.err {
  background: #fef2f2;
  color: var(--err);
}

/* —— 일별 상세(근태 등록) —— */
.container--day {
  max-width: 720px;
}

.day-page {
  padding-bottom: 2rem;
}

.day-header {
  margin-bottom: 1.35rem;
}

.day-back {
  margin: 0 0 0.35rem;
}

.day-back a {
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.day-back a:hover {
  color: var(--accent);
}

.day-title {
  font-size: var(--fs-h1);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 0.35rem;
  line-height: 1.25;
  color: var(--text);
}

.day-meta {
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.day-alerts {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.1rem;
}

.day-msg {
  margin: 0;
}

.day-card {
  background: var(--card);
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.04),
    0 4px 16px rgba(0, 0, 0, 0.04);
  padding: 1.15rem 1.25rem 1.25rem;
  margin-bottom: 1.15rem;
}

.day-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border);
}

.day-card-title {
  margin: 0;
  font-size: var(--fs-h3);
  font-weight: 700;
  color: var(--text);
}

.day-badge-today {
  flex-shrink: 0;
  font-size: var(--fs-caption);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: linear-gradient(180deg, #dbeafe 0%, #bfdbfe 100%);
  color: #1e40af;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  border: 1px solid #93c5fd;
}

.day-kv {
  display: grid;
  grid-template-columns: minmax(6.5rem, 9rem) 1fr;
  gap: 0;
  margin: 0 0 0.85rem;
}

.day-kv dt,
.day-kv dd {
  padding: 0.55rem 0;
  border-bottom: 1px solid #f1f5f9;
  margin: 0;
}

.day-kv dt:last-of-type,
.day-kv dd:last-of-type {
  border-bottom: none;
}

.day-kv dt {
  font-size: var(--fs-caption);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  align-self: start;
  padding-right: 0.75rem;
}

.day-kv dd {
  font-size: var(--fs-base);
  line-height: 1.45;
  color: var(--text);
}

.day-value-mono {
  font-variant-numeric: tabular-nums;
}

.day-value-loc {
  word-break: break-word;
}

.day-value-empty {
  color: #cbd5e1;
}

.day-clock-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

.day-inline-form {
  margin: 0;
}

.day-btn-clock {
  min-height: 2.7rem;
  padding: 0.55rem 1.35rem;
  border-radius: 10px;
  font-weight: 600;
  font-size: var(--fs-base);
  transition:
    transform 0.08s ease,
    box-shadow 0.15s ease,
    background 0.15s ease,
    border-color 0.15s ease;
}

.day-btn-clock--in:not(:disabled):hover {
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.day-btn-clock--out:not(:disabled):hover {
  border-color: #cbd5e1;
  background: #f9fafb;
}

.day-btn-clock:active:not(:disabled) {
  transform: scale(0.98);
}

.day-hint-readonly {
  margin: 0;
  padding: 0.75rem 0.9rem;
  background: #f8fafc;
  border-radius: 10px;
  border: 1px dashed #e2e8f0;
  font-size: var(--fs-sm);
  color: var(--muted);
  line-height: 1.5;
}

.day-stack-form {
  gap: 1rem;
}

.day-stack-form .day-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin: 0;
}

.day-label-text {
  font-size: var(--fs-caption);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.day-textarea {
  font: inherit;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fafbfc;
  color: var(--text);
  line-height: 1.5;
  resize: vertical;
  min-height: 2.5rem;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease;
}

.day-textarea:hover {
  border-color: #d1d5db;
}

.day-textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--card);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

.day-checkbox {
  margin-top: 0.15rem;
  padding: 0.65rem 0.85rem;
  background: #f8fafc;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.day-form-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  margin-top: 0.35rem;
  padding-top: 0.25rem;
}

.day-form-footer--readonly {
  justify-content: flex-start;
  margin-top: 0.85rem;
  padding-top: 0;
}

.day-btn-submit,
.day-btn-close {
  min-height: 2.55rem;
  padding: 0.5rem 1.35rem;
  border-radius: 10px;
  font-weight: 600;
}

.day-readonly {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.day-readonly-block {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.day-readonly-block--inline {
  flex-direction: row;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.day-readonly-block--inline .day-label-text {
  margin: 0;
}

.day-readonly-body {
  margin: 0;
  padding: 0.65rem 0.85rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font-size: var(--fs-base);
  line-height: 1.5;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

.day-readonly-body--tag {
  display: inline-block;
  padding: 0.35rem 0.75rem;
  font-weight: 600;
  font-size: var(--fs-sm);
  border-radius: 8px;
}

.day-readonly-body--tag-yes {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.day-readonly-body--tag-no {
  background: #f9fafb;
  color: var(--muted);
  border: 1px solid var(--border);
}

.row-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: flex-end;
  justify-content: center;
  margin-bottom: 1rem;
}

.row-form label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: var(--fs-sm);
}

.row-form input[type="date"] {
  font: inherit;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
}

/* —— 근태 출력(리포트) —— */
.container--report {
  max-width: 1120px;
}

.only-print {
  display: none;
}

.report-page {
  padding-bottom: 2rem;
}

.report-header {
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.report-title {
  font-size: var(--fs-h1);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 0.5rem;
  color: var(--text);
  line-height: 1.3;
}

.report-title-user {
  font-weight: 700;
  margin-right: 0.35rem;
}

.report-title-id {
  font-weight: 600;
  color: var(--muted);
}

/* 인쇄 시에만 표시(화면에서는 시작일·종료일 필드와 중복 방지) */
.report-period-print {
  margin: 0.35rem 0 0;
  font-size: var(--fs-sm);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.report-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  margin-bottom: 1.25rem;
  padding: 1rem 1.15rem;
  background: var(--card);
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.04);
  font-size: var(--fs-caption);
}

.report-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 1rem;
  margin: 0;
}

.report-filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
}

.report-filter {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0;
}

.report-filter-name {
  font-size: var(--fs-caption);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.report-input {
  font: inherit;
  padding: 0.4rem 0.55rem;
  min-width: 10.25rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fafbfc;
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.report-input:hover {
  border-color: #d1d5db;
}

.report-input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--card);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

.report-btn-query {
  align-self: flex-end;
  padding: 0.4rem 0.95rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: inherit;
}

.report-export {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.report-export .button,
.report-export button {
  border-radius: 8px;
  font-weight: 600;
  font-size: inherit;
  padding: 0.4rem 0.85rem;
}

.report-table-shell {
  background: var(--card);
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 6px 20px rgba(0, 0, 0, 0.05);
  overflow: hidden;
}

.report-table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.report-table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  font-size: var(--fs-base);
  line-height: 1.45;
}

.report-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  font-weight: 600;
  font-size: var(--fs-caption);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #475569;
  border-bottom: 2px solid #e2e8f0;
  padding: 0.65rem 0.85rem;
  white-space: nowrap;
}

/* 근무 시작·종료: HH:mm 폭에 맞추고 헤더는 두 줄로 */
.report-table thead th.col-time {
  white-space: normal;
  text-align: center;
  width: 3.35rem;
  max-width: 3.35rem;
  padding: 0.45rem 0.2rem;
  line-height: 1.2;
  letter-spacing: 0;
  word-break: keep-all;
}

.report-table tbody td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: top;
  color: var(--text);
}

.report-table tbody tr:last-child td {
  border-bottom: none;
}

.report-table tbody tr:nth-child(even) {
  background: #fafbfc;
}

.report-table tbody tr:hover {
  background: #eff6ff;
}

.report-table .col-date {
  width: 9.5rem;
  font-weight: 500;
  white-space: nowrap;
}

.report-table .col-time {
  width: 3.35rem;
  max-width: 3.35rem;
  white-space: nowrap;
  text-align: center;
  box-sizing: border-box;
}

.report-table tbody td.col-time {
  padding-left: 0.3rem;
  padding-right: 0.3rem;
}

.report-table .col-remote {
  width: 3.25rem;
  max-width: 3.5rem;
  text-align: center;
  white-space: nowrap;
}

.report-table thead th.col-remote {
  width: 3.25rem;
  max-width: 3.5rem;
  padding: 0.45rem 0.2rem;
  white-space: normal;
  line-height: 1.2;
  letter-spacing: 0;
  text-align: center;
  word-break: keep-all;
}

.report-table .col-text {
  min-width: 12rem;
}

.report-table .col-ip {
  width: 8.5rem;
}

.report-table .col-loc {
  min-width: 10rem;
}

.report-table .tabular {
  font-variant-numeric: tabular-nums;
}

.report-table .wrap {
  max-width: 18rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.report-empty {
  text-align: center;
  padding: 2.5rem 1.5rem;
  background: var(--card);
  border-radius: 12px;
  border: 1px dashed #cbd5e1;
  color: var(--muted);
}

.report-empty-title {
  margin: 0 0 0.5rem;
  font-size: var(--fs-h3);
  font-weight: 600;
  color: var(--text);
}

.report-empty-hint {
  margin: 0;
  font-size: var(--fs-sm);
  line-height: 1.55;
  max-width: 28rem;
  margin-left: auto;
  margin-right: auto;
}

.report-empty-print {
  padding: 1.5rem 0;
  text-align: center;
  color: var(--muted);
  font-size: var(--fs-sm);
}

.print-actions {
  margin: 0.5rem 0 1rem;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
}

@media print {
  body {
    background: #fff;
  }

  .site-header,
  .no-print,
  .row-form button,
  .subnav,
  .crumb {
    display: none !important;
  }

  .only-print {
    display: block !important;
  }

  .container {
    max-width: none;
    padding: 0;
  }

  .report-page {
    padding-bottom: 0;
  }

  .report-header {
    border-bottom: 1px solid #ccc;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
  }

  .report-title {
    font-size: 14pt;
  }

  .report-table-shell {
    border: none;
    box-shadow: none;
    border-radius: 0;
  }

  .report-table-scroll {
    overflow: visible;
  }

  .report-table {
    font-size: 10pt;
    min-width: 0;
  }

  .report-table thead th {
    position: static;
    background: #f3f4f6;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .report-table tbody tr:nth-child(even),
  .report-table tbody tr:hover {
    background: transparent;
  }

  .report-table tbody td {
    border-bottom: 1px solid #ddd;
  }

  .report-table .wrap {
    max-width: none;
  }
}

.muted {
  color: var(--muted);
}
