/* 팀 포털 공통 스타일 */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --border: #dfe2e7;
  --text: #1f2328;
  --text-muted: #6b7280;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --error-bg: #fdecec;
  --error-text: #a12626;
  --success-bg: #e7f6ec;
  --success-text: #1e6b3a;
  --info-bg: #e8f0fd;
  --info-text: #1e4b9a;
  --radius: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Malgun Gothic", "맑은 고딕", "Apple SD Gothic Neo", sans-serif;
  font-size: 15px;
  line-height: 1.6;
}

a { color: var(--primary); }

/* 로그인 전 화면 */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px 24px;
}
.auth-brand { text-align: center; margin-bottom: 20px; }
.auth-title { font-size: 22px; font-weight: 600; }
.auth-sub { font-size: 13px; color: var(--text-muted); }
.auth-heading { font-size: 17px; font-weight: 600; margin: 0 0 4px; }

.hint { font-size: 13px; color: var(--text-muted); margin: 0 0 16px; }

/* 폼 */
.form label { display: block; font-size: 13px; color: var(--text-muted); margin: 12px 0 4px; }
.form input[type="text"],
.form input[type="password"] {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
}
.form select {
  width: 100%;
  height: 40px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font: inherit;
}
.form input[type="color"] { width: 64px; height: 36px; padding: 2px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.form input:focus, .form select:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: var(--primary); }
.form select:disabled { background: var(--bg); color: var(--text-muted); }
.form-secondary { margin-top: 10px; }
.field-hint { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.form .btn { margin-top: 20px; }

/* 버튼 */
.btn {
  display: inline-block;
  height: 40px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  line-height: 38px;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-block { display: block; width: 100%; }
.btn-danger { border-color: var(--error-text); color: var(--error-text); }
.btn-danger:hover { background: var(--error-bg); }

/* 로그인 후 화면 상단 메뉴 */
.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 24px;
  padding: 10px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar a { color: var(--text-muted); text-decoration: none; }
.topbar a:hover, .topbar a.active { color: var(--primary); }
.topbar-nav { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 18px; }
.topbar-nav a.nav-home { font-weight: 700; font-size: 17px; color: var(--text); }
.topbar-nav a.nav-home.active, .topbar-nav a.nav-home:hover { color: var(--primary); }
.topbar-user { display: flex; align-items: center; gap: 14px; margin-left: auto; font-size: 14px; }
.topbar-name { font-weight: 500; }
.inline-form { display: inline; margin: 0; }
.link-button { border: 0; background: none; padding: 0; font: inherit; color: var(--text-muted); cursor: pointer; }
.link-button:hover { color: var(--primary); }

/* 본문은 창 너비에 맞게 꽉 채운다 (양옆 여백만 화면 크기에 따라 16~40px) */
.container { padding: 24px clamp(16px, 3vw, 40px); }
.page-title { font-size: 20px; font-weight: 600; margin: 0 0 16px; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}
.card-narrow { max-width: 420px; }
.card-title { font-size: 16px; font-weight: 600; margin: 0 0 12px; }

/* 목록 + 입력 폼 2단 배치 (좁은 화면에서는 세로로) */
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1024px) { .split { grid-template-columns: minmax(0, 1fr); } }

/* 관리 화면 탭 */
.tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.tabs a { padding: 8px 14px; color: var(--text-muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--primary); }
.tabs a.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 500; }
.row-excluded td:nth-child(2) { text-decoration: line-through; }

/* 제목 + 필터 */
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-bottom: 16px; }
.page-head .page-title { margin: 0; }
.filters { display: flex; align-items: center; gap: 8px; margin-left: auto; font-size: 14px; color: var(--text-muted); }
.filters select { height: 36px; padding: 0 8px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); font: inherit; }

/* 요약 숫자 카드 */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.stat-label { font-size: 13px; color: var(--text-muted); }
.stat-value { font-size: 24px; font-weight: 600; }
.stat-form { display: flex; gap: 6px; margin-top: 6px; }
.stat-form input { width: 72px; min-width: 0; height: 32px; padding: 0 8px; border: 1px solid var(--border); border-radius: var(--radius); font: inherit; }
.text-primary { color: var(--primary); }
.text-negative { color: var(--error-text); }
.btn-small { height: 32px; line-height: 30px; padding: 0 10px; font-size: 13px; }

/* 연차 등록 폼 */
.date-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.form input[type="date"] { width: 100%; min-width: 0; height: 40px; padding: 0 8px; border: 1px solid var(--border); border-radius: var(--radius); font: inherit; }
.form input[readonly] { background: var(--bg); color: var(--text-muted); }
.preview { min-height: 20px; margin-top: 10px; font-size: 13px; color: var(--text-muted); }
.preview-warn { color: #9a6700; }
.preview-error { color: var(--error-text); }
.row-actions { display: flex; gap: 12px; }
.link-danger { color: var(--error-text); }

/* 대시보드 */
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.card-head .card-title { margin: 0; }
.notice { border-left: 4px solid var(--primary); }
.notice-body { white-space: normal; word-break: break-word; margin-bottom: 6px; }
.form textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); font: inherit; resize: vertical; }
.form textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: var(--primary); }
.btn-row { display: flex; gap: 8px; margin-top: 10px; }
.btn-row .btn { margin-top: 0; }
.stat-link { display: block; color: inherit; text-decoration: none; }
.stat-link:hover { border-color: var(--primary); }
.person-list { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 14px; margin-top: 4px; }
.person { display: inline-flex; align-items: center; gap: 4px; }
.person-type { color: var(--text-muted); font-size: 12px; }
.split-even { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.day-list { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.day-list li { display: flex; align-items: baseline; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.day-list li:last-child { border-bottom: 0; }
.day-list .person-list { margin-top: 0; }
.day-date { min-width: 76px; color: var(--text-muted); white-space: nowrap; }
.day-list .is-past { opacity: 0.5; }
.day-list .is-today .day-date { color: var(--primary); font-weight: 600; }
.day-divider { font-size: 12px; color: var(--text-muted); padding-top: 12px !important; }
.dday { margin-left: auto; color: var(--text-muted); font-size: 13px; white-space: nowrap; }

/* 주간보고 */
.week-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-bottom: 16px; }
.week-title { min-width: 150px; text-align: center; }
.week-label { font-size: 17px; font-weight: 600; }
.badge-ok { background: var(--success-bg); color: var(--success-text); }
.badge-warn { background: #fff4d6; color: #7f6000; }
.report-items { display: grid; gap: 12px; margin-bottom: 12px; }
.report-item { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.report-item-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-bottom: 10px; }
.report-item-head select { min-width: 0; width: min(420px, 100%); height: 38px; padding: 0 8px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); font: inherit; font-weight: 600; }
.ri-tools { display: flex; gap: 14px; margin-left: auto; font-size: 14px; }
.report-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.report-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--text-muted); }
.report-grid textarea { width: 100%; min-height: 96px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); font: inherit; font-size: 14px; line-height: 1.5; color: var(--text); resize: vertical; }
.report-grid textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: var(--primary); }
.report-grid .ri-issue textarea { background: #fff9f0; color: #7f6000; }
.ri-files { margin-top: 10px; font-size: 14px; }
.file-list { list-style: none; margin: 0 0 4px; padding: 0; }
.file-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 2px 0; word-break: break-all; }
.file-row progress { width: 160px; }
.ri-upload { color: var(--primary); }
.btn-dashed { border-style: dashed; width: 100%; color: var(--primary); }
.report-actions { display: flex; justify-content: flex-end; gap: 8px; margin: 16px 0 8px; }
@media (max-width: 860px) {
  .report-grid { grid-template-columns: minmax(0, 1fr); }
  .ri-tools { margin-left: 0; }
}

/* 연차 달력 */
.cal-nav { display: flex; align-items: center; gap: 6px; }
.cal-month { font-size: 16px; font-weight: 600; min-width: 96px; text-align: center; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-left: auto; font-size: 13px; }
.cal-legend label { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.cal-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.cal {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.cal-head { padding: 6px; text-align: center; font-size: 13px; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.cal-day {
  min-height: 96px;
  padding: 4px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  min-width: 0;
}
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day[data-date] { cursor: pointer; }
.cal-day[data-date]:hover { background: #fafbfc; }
.cal-day.is-off { background: var(--bg); }
.cal-day.is-other .cal-date { opacity: 0.4; }
.cal-day.is-today { box-shadow: inset 0 0 0 2px var(--primary); }
.cal-date { font-size: 13px; color: var(--text-muted); margin-bottom: 2px; word-break: keep-all; overflow-wrap: anywhere; }
.cal-day.is-today .cal-date { color: var(--primary); font-weight: 600; }
.cal-day.is-red .cal-date, .cal-head.is-sun { color: var(--error-text); }
.cal-holiday { font-size: 11px; margin-left: 2px; }
.cal-ev {
  display: block;
  margin-top: 2px;
  padding: 1px 5px;
  border-left: 3px solid var(--c);
  border-radius: 3px;
  background: color-mix(in srgb, var(--c) 18%, #fff);
  color: var(--text);
  text-decoration: none;
  /* 칸이 좁으면 자르지 않고 줄바꿈해서 이름이 다 보이게 */
  word-break: keep-all;
  overflow-wrap: anywhere;
  line-height: 1.35;
}
a.cal-ev:hover { background: color-mix(in srgb, var(--c) 30%, #fff); }
.cal-ev-etc { background: transparent; border: 1px dashed var(--c); border-left-width: 3px; border-left-style: solid; }
.cal-ev-half { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--c) 18%, #fff) 0 6px, #fff 6px 9px); }
.cal-ev[hidden] { display: none; }
@media (max-width: 640px) {
  .cal-day { min-height: 64px; padding: 2px; font-size: 11px; }
  .cal-ev { padding: 0 2px; border-left-width: 2px; }
  .cal-ev-type { display: none; }   /* 좁은 화면에서는 이름만, 종류는 무늬로 구분 */
  .cal-legend { margin-left: 0; width: 100%; }
}

/* 표 */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
.table th { font-weight: 500; color: var(--text-muted); font-size: 13px; }
.row-muted td { color: var(--text-muted); }
.row-selected td { background: var(--info-bg); }

.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; vertical-align: 0; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; background: var(--bg); color: var(--text-muted); }
.badge-admin { background: var(--info-bg); color: var(--info-text); }

@media (max-width: 640px) {
  .topbar { padding: 10px 16px; }
  .topbar-user { margin-left: 0; width: 100%; }
}

/* 알림 */
.alert { padding: 10px 12px; border-radius: var(--radius); font-size: 14px; margin-bottom: 12px; }
.alert-error { background: var(--error-bg); color: var(--error-text); }
.alert-success { background: var(--success-bg); color: var(--success-text); }
.alert-info { background: var(--info-bg); color: var(--info-text); }

/* 좁은 화면에서는 표 글자를 줄바꿈해 가로 스크롤 없이 버튼까지 보이게 (표 기본 규칙보다 뒤에 둔다) */
@media (max-width: 640px) {
  .table th, .table td { white-space: normal; padding: 8px 6px; }
  .row-actions { flex-direction: column; gap: 4px; }
}
