@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── 변수 ── */
:root {
  --bg: #070b18;
  --surface: #0d1226;
  --elevated: #131a35;
  --glass: rgba(255, 255, 255, .05);
  --glass-b: rgba(255, 255, 255, .10);
  --glass-h: rgba(255, 255, 255, .09);
  --acc: #6c63ff;
  --acc-l: #9b95ff;
  --acc2: #ff6584;
  --acc3: #43e8d8;
  --ok: #4ade80;
  --warn: #fbbf24;
  --err: #f87171;
  --t1: #eef0f8;
  --t2: #8892b0;
  --t3: #4a5480;
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --sh-sm: 0 2px 8px rgba(0, 0, 0, .35);
  --sh-md: 0 8px 32px rgba(0, 0, 0, .45);
  --sh-lg: 0 16px 56px rgba(0, 0, 0, .55);
  --glow: 0 0 24px rgba(108, 99, 255, .30);
  --tr: .2s cubic-bezier(.4, 0, .2, 1);
  --nav: 220px;
  --top: 60px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', 'Apple SD Gothic Neo', sans-serif;
  background: var(--bg);
  color: var(--t1);
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
}

input,
textarea,
select {
  font-family: inherit;
  background: var(--glass);
  border: 1px solid var(--glass-b);
  color: var(--t1);
  border-radius: var(--r-sm);
  padding: 8px 12px;
  outline: none;
  transition: border var(--tr), box-shadow var(--tr);
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--acc);
  box-shadow: 0 0 0 3px rgba(108, 99, 255, .2);
}

input::placeholder,
textarea::placeholder {
  color: var(--t3);
}

select option {
  background: var(--elevated);
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  background: radial-gradient(ellipse 80% 60% at 20% 10%, rgba(108, 99, 255, .12) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 80%, rgba(67, 232, 216, .08) 0%, transparent 55%),
    radial-gradient(ellipse 50% 40% at 60% 30%, rgba(255, 101, 132, .06) 0%, transparent 50%),
    var(--bg);
}

/* ── 레이아웃 ── */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ── 사이드바 ── */
.sidebar {
  width: var(--nav);
  background: rgba(13, 18, 38, .9);
  backdrop-filter: blur(20px);
  border-right: 1px solid var(--glass-b);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 20px 18px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--glass-b);
}

.sidebar-logo-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--acc), var(--acc2));
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: var(--glow);
  flex-shrink: 0;
}

.brand {
  font-size: 15px;
  font-weight: 800;
}

.tagline {
  font-size: 10px;
  color: var(--t3);
  margin-top: 2px;
}

.sidebar-nav {
  padding: 14px 10px;
  flex: 1;
}

.sec-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--t3);
  padding: 6px 10px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background var(--tr), color var(--tr);
  color: var(--t2);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 2px;
  user-select: none;
}

.nav-item:hover {
  background: var(--glass);
  color: var(--t1);
}

.nav-item.active {
  background: rgba(108, 99, 255, .15);
  color: var(--acc-l);
  box-shadow: inset 3px 0 0 var(--acc);
}

.nav-item .icon {
  font-size: 17px;
  flex-shrink: 0;
}

.sidebar-bottom {
  padding: 14px 10px;
  border-top: 1px solid var(--glass-b);
}

.today-info {
  padding: 10px 12px;
  background: var(--glass);
  border-radius: var(--r-sm);
  font-size: 12px;
  color: var(--t2);
}

.today-info .d-date {
  font-weight: 700;
  color: var(--t1);
  font-size: 13px;
}

.today-info .d-day {
  color: var(--acc-l);
  font-size: 10px;
  margin-top: 2px;
}

/* ── 메인 ── */
.main-content {
  margin-left: var(--nav);
  flex: 1;
  min-height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--top);
  background: rgba(13, 18, 38, .75);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--glass-b);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title {
  font-size: 17px;
  font-weight: 700;
  flex: 1;
}

.topbar-subtitle {
  font-size: 11px;
  color: var(--t3);
  margin-top: 2px;
}

.page-content {
  padding: 22px;
  flex: 1;
}

/* ── 탭 패널 ── */
.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* ── 카드 ── */
.card {
  background: var(--glass);
  border: 1px solid var(--glass-b);
  border-radius: var(--r-lg);
  padding: 20px 22px;
  transition: border-color var(--tr), box-shadow var(--tr);
}

.card:hover {
  border-color: rgba(108, 99, 255, .3);
  box-shadow: var(--sh-md);
}

.card-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--t2);
  text-transform: uppercase;
  letter-spacing: .8px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--acc), var(--acc2));
  box-shadow: 0 0 6px var(--acc);
}

/* ── 언어 선택 ── */
.lang-opt {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  color: var(--t3);
  background: var(--glass);
  border: 1px solid var(--glass-b);
  transition: all var(--tr);
}

.lang-opt:hover {
  border-color: var(--acc);
  color: var(--t1);
}

.lang-opt.active {
  background: var(--acc);
  color: #fff;
  border-color: var(--acc);
}

/* ── 그리드 ── */
.g2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.g3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.g4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.span2 {
  grid-column: span 2;
}

.span3 {
  grid-column: span 3;
}

/* ── 명언 ── */
.quote-banner {
  background: linear-gradient(135deg, rgba(108, 99, 255, .18), rgba(255, 101, 132, .12));
  border: 1px solid rgba(108, 99, 255, .25);
  border-radius: var(--r-xl);
  padding: 24px 28px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}

.quote-banner::before {
  content: '"';
  position: absolute;
  top: -10px;
  left: 16px;
  font-size: 100px;
  line-height: 1;
  color: rgba(108, 99, 255, .15);
  font-family: Georgia, serif;
  pointer-events: none;
}

.quote-text {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.6;
  color: var(--t1);
  position: relative;
  z-index: 1;
}

.quote-author {
  margin-top: 8px;
  font-size: 12px;
  color: var(--acc-l);
  font-weight: 500;
  position: relative;
  z-index: 1;
}

/* ── 기간 탭 ── */
.period-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 18px;
  background: var(--glass);
  border-radius: var(--r-sm);
  padding: 4px;
  width: fit-content;
}

.period-tab {
  padding: 6px 18px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--t2);
  transition: all var(--tr);
}

.period-tab.active {
  background: var(--acc);
  color: #fff;
  box-shadow: var(--glow);
}

.period-tab:hover:not(.active) {
  background: var(--glass-h);
  color: var(--t1);
}

/* ── 지표 카드 ── */
.metric-card {
  background: var(--glass);
  border: 1px solid var(--glass-b);
  border-radius: var(--r-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: transform var(--tr), box-shadow var(--tr);
}

.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--sh-md);
}

.metric-label {
  font-size: 11px;
  color: var(--t3);
  font-weight: 600;
  letter-spacing: .5px;
  text-transform: uppercase;
}

.metric-value {
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
}

.metric-sub {
  font-size: 11px;
  color: var(--t2);
}

.metric-card.c1 .metric-value {
  color: var(--acc-l);
}

.metric-card.c2 .metric-value {
  color: var(--acc2);
}

.metric-card.c3 .metric-value {
  color: var(--acc3);
}

.metric-card.c4 .metric-value {
  color: var(--ok);
}

/* ── 진척도 ── */
.prog-wrap {
  margin-top: 6px;
}

.prog-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--t2);
  margin-bottom: 5px;
}

.prog-track {
  height: 7px;
  background: rgba(255, 255, 255, .07);
  border-radius: 99px;
  overflow: hidden;
}

.prog-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--acc), var(--acc2));
  transition: width .6s cubic-bezier(.4, 0, .2, 1);
}

.prog-fill.ok {
  background: linear-gradient(90deg, var(--ok), var(--acc3));
}

.prog-fill.warn {
  background: linear-gradient(90deg, var(--warn), var(--acc2));
}

/* ── 버튼 ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 600;
  transition: all var(--tr);
}

.btn-primary {
  background: linear-gradient(135deg, var(--acc), #5551e8);
  color: #fff;
  box-shadow: var(--glow);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 28px rgba(108, 99, 255, .5);
}

.btn-secondary {
  background: var(--glass);
  border: 1px solid var(--glass-b);
  color: var(--t1);
}

.btn-secondary:hover {
  background: var(--glass-h);
}

.btn-danger {
  background: rgba(248, 113, 113, .1);
  border: 1px solid rgba(248, 113, 113, .3);
  color: var(--err);
}

.btn-danger:hover {
  background: rgba(248, 113, 113, .2);
}

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

.btn-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--r-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--glass);
  border: 1px solid var(--glass-b);
  font-size: 15px;
  transition: all var(--tr);
}

.btn-icon:hover {
  background: var(--glass-h);
  border-color: var(--acc);
}

/* ── 체크리스트 ── */
.task-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  transition: background var(--tr);
  cursor: pointer;
}

.task-item:hover {
  background: var(--glass);
}

.task-check {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 2px solid var(--glass-b);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--tr);
  flex-shrink: 0;
  color: transparent;
  font-size: 11px;
}

.task-item.done .task-check {
  background: linear-gradient(135deg, var(--acc), var(--acc2));
  border-color: transparent;
  color: #fff;
}

.task-item.done .task-text {
  text-decoration: line-through;
  color: var(--t3);
}

.task-text {
  font-size: 13px;
  flex: 1;
}

/* ── D-Day ── */
.dday-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.dday-card {
  background: linear-gradient(135deg, rgba(108, 99, 255, .15), rgba(255, 101, 132, .10));
  border: 1px solid rgba(108, 99, 255, .25);
  border-radius: var(--r-lg);
  padding: 16px 20px;
  min-width: 140px;
  position: relative;
}

.dday-days {
  font-size: 32px;
  font-weight: 900;
  color: var(--acc-l);
  line-height: 1;
}

.dday-label {
  font-size: 12px;
  font-weight: 600;
  margin-top: 5px;
}

.dday-date {
  font-size: 10px;
  color: var(--t3);
  margin-top: 3px;
}

.dday-delete {
  position: absolute;
  top: 7px;
  right: 7px;
  font-size: 12px;
  color: var(--t3);
  cursor: pointer;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--tr);
}

.dday-delete:hover {
  background: rgba(248, 113, 113, .15);
  color: var(--err);
}

/* ── 습관 그리드 (대시보드) ── */
.habit-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .08);
  cursor: pointer;
  transition: all var(--tr);
  display: inline-block;
}

.habit-dot.done {
  background: var(--ok);
  box-shadow: 0 0 6px rgba(74, 222, 128, .5);
}

/* ── 수면 요약 카드 ── */
.sleep-summary-card {
  background: linear-gradient(135deg, rgba(67, 232, 216, .08), rgba(108, 99, 255, .10));
  border: 1px solid rgba(67, 232, 216, .2);
  border-radius: var(--r-lg);
  padding: 18px;
}

.sleep-summary-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--acc3);
  margin-bottom: 12px;
}

/* ── 일정관리: 접이식 패널 ── */
.sched-pinned {
  background: rgba(13, 18, 38, .8);
  border: 1px solid var(--glass-b);
  border-radius: var(--r-lg);
  padding: 6px 12px;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pinned-section {
  border-bottom: 1px solid rgba(255, 255, 255, .04);
}

.pinned-section:last-child {
  border-bottom: none;
}

.pinned-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  color: var(--t2);
  border-radius: var(--r-sm);
  transition: background var(--tr);
}

.pinned-header:hover {
  background: rgba(108, 99, 255, .08);
}

.pinned-arrow {
  font-size: 18px;
  font-weight: 700;
  color: var(--t3);
  transition: transform .2s;
}

.pinned-section.collapsed .pinned-arrow {
  transform: rotate(-90deg);
}

.pinned-body {
  padding: 4px 6px 8px;
}

.pinned-section.collapsed .pinned-body {
  display: none;
}

/* failed task */
.task-item.failed .task-check {
  background: rgba(248, 113, 113, .2);
  border-color: var(--err);
  color: var(--err);
}

.task-item.failed .task-text {
  text-decoration: line-through;
  color: var(--err);
  opacity: .6;
}

.pinned-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.pinned-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--t3);
  letter-spacing: .5px;
  text-transform: uppercase;
  min-width: 60px;
  flex-shrink: 0;
}

/* ── 습관 팔레트 (일정관리) ── */
.habit-palette {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.habit-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 99px;
  border: 1.5px solid var(--chip-color, #6c63ff);
  background: color-mix(in srgb, var(--chip-color, #6c63ff) 12%, transparent);
  color: var(--chip-color, #6c63ff);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--tr);
  user-select: none;
}

.habit-chip:hover {
  transform: scale(1.05);
}

.habit-chip.active {
  background: color-mix(in srgb, var(--chip-color, #6c63ff) 30%, transparent);
  box-shadow: 0 0 10px var(--chip-color, var(--acc));
}

/* ── 수면 위젯 (일정관리 상단) ── */
.sleep-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.sleep-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.sleep-field label {
  font-size: 10px;
  color: var(--t3);
  font-weight: 600;
}

.sleep-field input[type="time"] {
  width: 120px;
  font-size: 13px;
}

.sleep-dur-badge {
  font-size: 20px;
  font-weight: 800;
  color: var(--acc3);
}

/* ── 타임박스 ── */
.schedule-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.date-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.date-nav-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  background: var(--glass);
  border: 1px solid var(--glass-b);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  color: var(--t1);
  cursor: pointer;
  transition: all var(--tr);
}

.date-nav-btn:hover {
  background: var(--glass-h);
  border-color: var(--acc);
}

.date-display {
  font-size: 14px;
  font-weight: 700;
  min-width: 200px;
  text-align: center;
}

.timebox-wrap {
  overflow-y: auto;
  border-radius: var(--r-lg);
  border: 1px solid var(--glass-b);
  max-height: calc(100vh - 310px);
}

.timebox-wrap::-webkit-scrollbar {
  width: 5px;
}

.timebox-wrap::-webkit-scrollbar-track {
  background: transparent;
}

.timebox-wrap::-webkit-scrollbar-thumb {
  background: var(--glass-b);
  border-radius: 99px;
}

.timebox-table {
  width: 100%;
  border-collapse: collapse;
}

.timebox-table th {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--elevated);
  padding: 8px 14px;
  font-size: 11px;
  font-weight: 700;
  color: var(--t3);
  text-align: left;
  letter-spacing: .5px;
  border-bottom: 1px solid var(--glass-b);
}

.timebox-row {
  cursor: pointer;
  transition: background var(--tr);
}

.timebox-row:hover td {
  background: rgba(108, 99, 255, .08);
}

.timebox-row.hour-start td {
  border-top: 1px solid rgba(255, 255, 255, .10);
}

.timebox-row td {
  padding: 5px 8px;
  font-size: 11px;
  border-bottom: 1px solid rgba(255, 255, 255, .02);
  height: 22px;
}

.time-cell {
  color: var(--t3);
  font-weight: 400;
  font-size: 9px;
  white-space: nowrap;
  width: 48px;
  padding: 4px 6px !important;
  text-align: right;
  opacity: 0.5;
}

.time-cell.time-m {
  opacity: 0.55;
  font-size: 9px;
  color: var(--t3);
}

.time-cell.time-h {
  color: var(--t1);
  font-size: 11px;
  font-weight: 800;
  opacity: 1;
}

/* 정시 행은 진하게 */
.timebox-row.hour-start .time-cell {
  color: var(--t1);
  font-size: 11px;
  font-weight: 800;
  opacity: 1;
}

.timebox-row.selected td {
  background: rgba(108, 99, 255, .15);
}

.timebox-row.resize-preview td {
  background: rgba(108, 99, 255, .22) !important;
}

.timebox-row.paint-preview td {
  background: rgba(249, 115, 22, .15) !important;
}

/* ── 슬롯 블록 ── */
.slot-block {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  min-height: 20px;
  overflow: hidden;
}

.slot-label-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.slot-color-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.resize-handle {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: ns-resize;
  font-size: 10px;
  opacity: .5;
  border-radius: 3px;
  transition: opacity var(--tr), background var(--tr);
  user-select: none;
}

.resize-handle:hover {
  opacity: 1;
  background: rgba(255, 255, 255, .15);
}

/* ── 사이드 패널 (일정관리) ── */
.sched-layout {
  display: flex;
  gap: 14px;
}

.sched-sidebar {
  width: 240px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sched-sidebar-card {
  background: var(--glass);
  border: 1px solid var(--glass-b);
  border-radius: var(--r-lg);
  padding: 16px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  margin-bottom: 5px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── 캘린더 ── */
.cal-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.cal-view-tabs {
  display: flex;
  gap: 3px;
  background: var(--glass);
  border-radius: var(--r-sm);
  padding: 3px;
}

.cal-view-tab {
  padding: 5px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: var(--t2);
  transition: all var(--tr);
}

.cal-view-tab.active {
  background: var(--acc);
  color: #fff;
}

.cal-nav-btn {
  width: 30px;
  height: 30px;
  border-radius: var(--r-sm);
  background: var(--glass);
  border: 1px solid var(--glass-b);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  transition: all var(--tr);
}

.cal-nav-btn:hover {
  border-color: var(--acc);
}

.cal-period-label {
  font-size: 15px;
  font-weight: 700;
  min-width: 140px;
  text-align: center;
}

.cal-layout {
  display: flex;
  gap: 16px;
}

.cal-main {
  flex: 1;
}

.cal-panel {
  width: 260px;
  flex-shrink: 0;
}

/* 월간 그리드 */
.month-grid {
  background: var(--glass);
  border: 1px solid var(--glass-b);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.month-grid-head {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.month-grid-head span {
  padding: 10px 6px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--t3);
  letter-spacing: .5px;
  border-bottom: 1px solid var(--glass-b);
}

.month-grid-head span:first-child {
  color: #f87171;
}

.month-grid-head span:last-child {
  color: #60a5fa;
}

.month-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.cal-day {
  min-height: 80px;
  padding: 6px;
  border-right: 1px solid rgba(255, 255, 255, .04);
  border-bottom: 1px solid rgba(255, 255, 255, .04);
  cursor: pointer;
  transition: background var(--tr);
  position: relative;
}

.cal-day:hover {
  background: rgba(108, 99, 255, .08);
}

.cal-day.today {
  background: rgba(108, 99, 255, .12);
}

.cal-day.other-month {
  opacity: .35;
}

.cal-day.selected {
  background: rgba(108, 99, 255, .2);
}

.cal-day-num {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 4px;
}

.cal-day.sun .cal-day-num {
  color: #f87171;
}

.cal-day.sat .cal-day-num {
  color: #60a5fa;
}

.cal-day.today .cal-day-num {
  background: var(--acc);
  color: #fff;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
}

.cal-event-pill {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 99px;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
}

/* 연간 그리드 */
.year-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.mini-month {
  background: var(--glass);
  border: 1px solid var(--glass-b);
  border-radius: var(--r-md);
  padding: 12px;
  cursor: pointer;
  transition: all var(--tr);
}

.mini-month:hover {
  border-color: rgba(108, 99, 255, .4);
  transform: translateY(-1px);
}

.mini-month-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--acc-l);
  margin-bottom: 8px;
}

.mini-month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.mini-day {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 2px;
  background: rgba(255, 255, 255, .04);
  position: relative;
}

.mini-day.has-event {
  background: var(--acc);
  opacity: .7;
}

.mini-day.today-mini {
  background: var(--acc2);
  opacity: 1;
  border-radius: 50%;
}

/* 이벤트 패널 */
.event-panel-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 12px;
}

.event-item {
  background: var(--glass);
  border-radius: var(--r-sm);
  padding: 8px 12px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  transition: background var(--tr);
}

.event-item:hover {
  background: var(--glass-h);
}

.event-color-bar {
  width: 3px;
  height: 28px;
  border-radius: 99px;
  flex-shrink: 0;
}

.event-title {
  font-size: 13px;
  font-weight: 600;
  flex: 1;
}

.event-time {
  font-size: 11px;
  color: var(--t2);
}

.event-recur {
  font-size: 10px;
  color: var(--warn);
  background: rgba(251, 191, 36, .1);
  padding: 1px 6px;
  border-radius: 99px;
}

.event-del {
  font-size: 12px;
  color: var(--t3);
  cursor: pointer;
  padding: 2px 5px;
  border-radius: 3px;
  transition: all var(--tr);
}

.event-del:hover {
  color: var(--err);
  background: rgba(248, 113, 113, .1);
}

/* ── 모달 ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(7, 11, 24, .75);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  animation: fadeIn .15s ease;
}

.modal-overlay.open {
  display: flex;
}

@keyframes fadeIn {
  from {
    opacity: 0
  }

  to {
    opacity: 1
  }
}

.modal-box {
  background: var(--elevated);
  border: 1px solid var(--glass-b);
  border-radius: var(--r-xl);
  padding: 26px;
  width: 400px;
  max-width: 92vw;
  box-shadow: var(--sh-lg);
  animation: slideUp .2s cubic-bezier(.4, 0, .2, 1);
  position: relative;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(14px)
  }

  to {
    opacity: 1;
    transform: translateY(0)
  }
}

.modal-title {
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 18px;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--glass);
  color: var(--t2);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--tr);
}

.modal-close:hover {
  background: var(--glass-h);
  color: var(--t1);
}

.modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
}

.form-group {
  margin-bottom: 14px;
}

.form-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--t2);
  letter-spacing: .5px;
  margin-bottom: 5px;
  display: block;
}

.form-control {
  width: 100%;
}

.color-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.color-swatch {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
  transition: transform var(--tr);
  border: 2px solid transparent;
}

.color-swatch:hover {
  transform: scale(1.15);
}

.color-swatch.selected {
  border-color: #fff;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, .3);
}

/* ── 토스트 ── */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
}

.toast {
  background: var(--elevated);
  border: 1px solid var(--glass-b);
  border-radius: var(--r-md);
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--sh-md);
  animation: slideInRight .25s cubic-bezier(.4, 0, .2, 1);
  pointer-events: all;
}

.toast.success {
  border-left: 3px solid var(--ok);
}

.toast.error {
  border-left: 3px solid var(--err);
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(18px)
  }

  to {
    opacity: 1;
    transform: translateX(0)
  }
}

/* ── 스크롤바 ── */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--glass-b);
  border-radius: 99px;
}

/* ── 유틸 ── */
.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-8 {
  gap: 8px;
}

.gap-12 {
  gap: 12px;
}

.mt-8 {
  margin-top: 8px;
}

.mt-12 {
  margin-top: 12px;
}

.mt-16 {
  margin-top: 16px;
}

.mt-20 {
  margin-top: 20px;
}

.mb-8 {
  margin-bottom: 8px;
}

.mb-12 {
  margin-bottom: 12px;
}

.mb-16 {
  margin-bottom: 16px;
}

.text-sm {
  font-size: 13px;
}

.text-xs {
  font-size: 11px;
}

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

.text-secondary {
  color: var(--t2);
}

.text-accent {
  color: var(--acc-l);
}

.font-bold {
  font-weight: 700;
}

.w-full {
  width: 100%;
}

.hidden {
  display: none !important;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
}

.badge-acc {
  background: rgba(108, 99, 255, .18);
  color: var(--acc-l);
}

.badge-ok {
  background: rgba(74, 222, 128, .15);
  color: var(--ok);
}

.badge-warn {
  background: rgba(251, 191, 36, .15);
  color: var(--warn);
}

/* ── 반응형 ── */
@media (max-width:900px) {
  .g4 {
    grid-template-columns: repeat(2, 1fr);
  }

  .g3 {
    grid-template-columns: repeat(2, 1fr);
  }

  .year-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width:760px) {
  :root {
    --nav: 0px;
  }

  .sidebar {
    display: none;
  }

  .main-content {
    margin-left: 0;
  }

  .g2,
  .g3,
  .g4 {
    grid-template-columns: 1fr;
  }

  .cal-layout {
    flex-direction: column;
  }

  .sched-layout {
    flex-direction: column;
  }

  .sched-sidebar {
    width: 100%;
  }
}