*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #ffffff;
  --sidebar-bg: #f7f6f3;
  --sidebar-hover: #ededeb;
  --sidebar-active: #e9e9e7;
  --text: #37352f;
  --text-secondary: #9b9a97;
  --text-light: #b7b4ae;
  --border: #e9e8e4;
  --border-light: #f1f0ed;
  --accent: #224FBC;
  --accent-light: #dde4f7;
  --success: #0f7b6c;
  --success-bg: #ddedea;
  --danger: #e03e3e;
  --danger-bg: #fbe4e4;
  --warning: #dfab01;
  --warning-bg: #fbf3db;
  --sidebar-width: 240px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

/* === LAYOUT === */
.layout {
  display: flex;
  min-height: 100vh;
}

/* === SIDEBAR === */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-header {
  padding: 12px 12px 4px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.sidebar-nav {
  padding: 4px 8px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 4px;
  font-size: 14px;
  color: var(--text);
  text-decoration: none;
  transition: background 80ms ease;
  cursor: pointer;
  width: 100%;
  border: none;
  background: none;
  font-family: inherit;
  text-align: left;
}

.nav-item:hover { background: var(--sidebar-hover); }
.nav-item.active { background: var(--sidebar-active); font-weight: 500; }

.nav-icon {
  font-size: 15px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 8px;
}

.sidebar-footer {
  padding: 8px;
  border-top: 1px solid var(--border);
}

/* === MAIN CONTENT === */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 40px 48px;
}

/* === PAGE HEADER === */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.page-header h1 {
  font-size: 1.875rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* === BUTTONS === */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
  font-weight: 500;
  text-decoration: none;
  transition: background 80ms ease;
  white-space: nowrap;
}

.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: #1a3d96; }

.btn-secondary {
  background: var(--sidebar-hover);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--sidebar-active); }

.btn-danger { background: var(--danger-bg); color: var(--danger); }
.btn-danger:hover { background: #f5c6c6; }

.btn-sm { padding: 3px 8px; font-size: 12px; }

.btn-google {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  background: white;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background 80ms, box-shadow 80ms;
}
.btn-google:hover {
  background: var(--sidebar-bg);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* === CARDS === */
.card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 20px;
}

.summary-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 24px;
  max-width: 400px;
}

.card-success { border-left: 3px solid var(--success); }
.card-danger { border-left: 3px solid var(--danger); }

.card-number {
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  margin-bottom: 4px;
}

.card-label {
  font-size: 12px;
  color: var(--text-secondary);
}

/* === TABLE === */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th {
  padding: 8px 12px;
  text-align: left;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}

.table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
}

.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--sidebar-bg); }

/* 대시보드 제출현황 테이블 컬럼 너비 */
#status-table { table-layout: fixed; }
#status-table th:nth-child(1),
#status-table td:nth-child(1) { width: 80px; }
#status-table th:nth-child(2),
#status-table td:nth-child(2) { width: 160px; }
#status-table th:nth-child(3),
#status-table td:nth-child(3) { width: 140px; white-space: normal; word-break: break-word; overflow: hidden; }
#status-table th:nth-child(4),
#status-table td:nth-child(4) { width: 72px; text-align: center; }
#status-table th:nth-child(5),
#status-table td:nth-child(5) { width: 200px; }
#status-table th:nth-child(6),
#status-table td:nth-child(6) { width: 72px; text-align: center; }
#status-table th:nth-child(7),
#status-table td:nth-child(7) { width: 200px; }
#status-table th:nth-child(8),
#status-table td:nth-child(8) { width: 140px; white-space: nowrap; }

/* 파일명 셀: 넘치면 말줄임 */
#status-table td:nth-child(5),
#status-table td:nth-child(7) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 0;
}

/* === BADGES === */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 12px;
  font-weight: 500;
}

.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-secondary { background: var(--sidebar-hover); color: var(--text-secondary); }

/* === INFO BAR / ALERT === */
.info-bar {
  display: flex;
  gap: 24px;
  padding: 10px 14px;
  background: var(--sidebar-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 20px;
}

.alert {
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 20px;
}

.alert-warning {
  background: var(--warning-bg);
  border: 1px solid #f0d060;
  color: #7d6003;
}

.alert a { color: var(--accent); text-decoration: none; }
.alert a:hover { text-decoration: underline; }

/* === FLASH === */
.flash {
  padding: 10px 48px;
  font-size: 13px;
}

.flash-error { background: var(--danger-bg); color: var(--danger); }
.flash-success { background: var(--success-bg); color: var(--success); }

/* === FORMS === */
.form-group { margin-bottom: 16px; }

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.form-group input,
.form-group select,
.reminder-date-input {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: white;
  transition: border-color 80ms;
}

.form-group input:focus,
.form-group select:focus,
.reminder-date-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-light);
}

.form-group small { font-size: 12px; color: var(--text-secondary); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.form-actions {
  display: flex;
  gap: 8px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
}

.reminder-date-input { margin-bottom: 6px; }

/* === MODAL === */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 15, 15, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal.hidden { display: none; }

.modal-content {
  background: white;
  border-radius: 8px;
  padding: 28px;
  width: 480px;
  max-width: 90vw;
  box-shadow: rgba(15,15,15,0.1) 0px 0px 0px 1px, rgba(15,15,15,0.2) 0px 8px 40px;
}

.modal-content h2 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 20px;
}

/* === MONTHLY CONFIG === */
.config-layout {
  display: grid;
  grid-template-columns: 460px 1fr;
  gap: 32px;
}


.month-nav-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 20px;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.month-nav-btn:hover { background: var(--sidebar-hover); }

/* === CALENDAR === */
.cal-card { padding: 20px; }

.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.cal-month-label {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
}

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.cal-weekdays .sunday { color: var(--danger); }
.cal-weekdays .saturday { color: var(--accent); }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-bottom: 4px;
}

.cal-day {
  height: 72px;
  padding: 6px 4px 4px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
  transition: background 80ms;
}

.cal-day:hover { background: var(--sidebar-hover); }
.cal-day.empty { cursor: default; pointer-events: none; }

.cal-day-num {
  font-size: 14px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  margin-bottom: 3px;
}

.cal-day.today .cal-day-num {
  background: var(--accent);
  color: white;
  font-weight: 600;
}

.cal-day.sunday .cal-day-num { color: var(--danger); }
.cal-day.saturday .cal-day-num { color: var(--accent); }
.cal-day.today .cal-day-num { color: white; }

.cal-day-dots {
  display: flex;
  gap: 3px;
  min-height: 8px;
}

.cal-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.deadline-dot { background: var(--danger); }
.reminder-dot { background: var(--accent); }
.meeting-dot { background: var(--success); }

.cal-mode-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.cal-mode-btns { display: flex; gap: 6px; }

.cal-mode-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: white;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 80ms;
}

.cal-mode-btn.active-deadline {
  border-color: var(--danger);
  color: var(--danger);
  background: var(--danger-bg);
}

.cal-mode-btn.active-reminder {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

.cal-mode-btn.active-meeting {
  border-color: var(--success);
  color: var(--success);
  background: var(--success-bg);
}

.cal-info {
  margin-top: 12px;
  padding: 10px 14px;
  background: var(--sidebar-bg);
  border-radius: 6px;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--text-secondary);
}

.config-list h2 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 12px;
}

.config-item {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 16px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: background 80ms;
}

.config-item:hover { background: var(--sidebar-bg); }

.config-month {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

/* === FILTER BAR === */
.filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.filter-bar select {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: white;
}

/* === PAGINATION === */
.pagination {
  display: flex;
  gap: 4px;
  margin-top: 16px;
  justify-content: center;
}

/* === MISC === */
.text-center { text-align: center; }
.text-danger { color: var(--danger); }

select#month-selector {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: white;
}

code {
  background: var(--sidebar-bg);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 12px;
  font-family: 'SFMono-Regular', Consolas, monospace;
  color: var(--danger);
}

/* === LOGIN PAGE === */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--sidebar-bg);
}

.login-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 48px;
  text-align: center;
  max-width: 360px;
  width: 90%;
}

.login-card h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.login-card p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 28px;
}
