:root {
  --ink: #0a0f1e;
  --ink2: #111827;
  --surface: #141c2e;
  --card: #1a2338;
  --card2: #1f2c42;
  --line: rgba(255,255,255,.07);
  --line2: rgba(255,255,255,.12);
  --text: #e8edf8;
  --muted: #6b7fa3;
  --muted2: #8b9fc0;
  --gold: #f59e0b;
  --gold2: #fbbf24;
  --gold-dim: rgba(245,158,11,.15);
  --blue: #3b82f6;
  --blue2: #60a5fa;
  --blue-dim: rgba(59,130,246,.15);
  --teal: #14b8a6;
  --teal-dim: rgba(20,184,166,.15);
  --rose: #f43f5e;
  --rose-dim: rgba(244,63,94,.12);
  --green: #10b981;
  --green-dim: rgba(16,185,129,.13);
  --radius: 18px;
  --radius-sm: 12px;
}

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

body {
  font-family: 'Sora', sans-serif;
  background: var(--ink);
  color: var(--text);
  min-height: 100vh;
  background-image:
    radial-gradient(ellipse 80% 40% at 10% 0%, rgba(59,130,246,.12) 0%, transparent 60%),
    radial-gradient(ellipse 60% 30% at 90% 5%, rgba(245,158,11,.08) 0%, transparent 50%);
}

.mono { font-family: 'JetBrains Mono', monospace; }

/* ── LAYOUT ─────────────────────────────────── */
.wrap { max-width: 1560px; margin: 0 auto; padding: 24px 20px 48px; }

.app-grid {
  display: grid;
  grid-template-columns: 360px minmax(0,1fr);
  gap: 20px;
  margin-top: 20px;
}
@media(max-width:1100px){ .app-grid { grid-template-columns: 1fr; } }

/* ── CARDS ──────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--line2);
  border-radius: var(--radius);
  padding: 24px;
}
.card-sm { border-radius: var(--radius-sm); padding: 16px; }

/* ── HEADER ─────────────────────────────────── */
header {
  background: linear-gradient(135deg, #1a2338 0%, #1d2d4a 50%, #1a2338 100%);
  border: 1px solid var(--line2);
  border-radius: 24px;
  padding: 28px 32px;
  position: relative;
  overflow: hidden;
}
header::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 260px; height: 260px;
  background: radial-gradient(circle, rgba(245,158,11,.12), transparent 70%);
  pointer-events: none;
}
header::after {
  content: '';
  position: absolute;
  bottom: -40px; left: 20%;
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(59,130,246,.10), transparent 70%);
  pointer-events: none;
}
.header-inner { display: flex; flex-wrap: wrap; gap: 24px; align-items: center; justify-content: space-between; position: relative; }
.header-kpis { display: flex; gap: 12px; flex-wrap: wrap; }
.kpi-pill {
  background: rgba(255,255,255,.06);
  border: 1px solid var(--line2);
  border-radius: 14px;
  padding: 12px 18px;
  min-width: 100px;
  backdrop-filter: blur(8px);
}
.kpi-label { font-size: 10px; text-transform: uppercase; letter-spacing: .18em; color: var(--muted2); }
.kpi-val { font-size: 22px; font-weight: 700; margin-top: 4px; letter-spacing: -.02em; }
.kpi-val.gold { color: var(--gold2); }
.kpi-val.blue { color: var(--blue2); }

/* ── YEAR NAV ───────────────────────────────── */
.year-nav {
  display: flex; align-items: center; gap: 12px;
  background: rgba(255,255,255,.05);
  border: 1px solid var(--line2);
  border-radius: 999px;
  padding: 6px 6px 6px 16px;
}
.year-display { font-size: 20px; font-weight: 600; min-width: 52px; text-align: center; }
.btn-icon {
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255,255,255,.08); border: 1px solid var(--line2);
  color: var(--text); cursor: pointer; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, transform .1s;
}
.btn-icon:hover:not(:disabled) { background: rgba(255,255,255,.15); transform: scale(1.05); }
.btn-icon:disabled { opacity: .3; cursor: not-allowed; }

/* ── SIDEBAR ─────────────────────────────────── */
.sidebar { display: flex; flex-direction: column; gap: 16px; }

.section-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: .2em;
  color: var(--muted); margin-bottom: 12px;
}

/* ── INPUTS ─────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; color: var(--muted2); font-weight: 500; }
.field input, .field select {
  background: var(--ink2); border: 1px solid rgba(255,255,255,.1);
  color: var(--text); border-radius: var(--radius-sm);
  padding: 10px 14px; font-size: 14px; font-family: inherit;
  transition: border-color .2s, box-shadow .2s;
  width: 100%;
}
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}
.field input::placeholder { color: var(--muted); }
.input-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ── BUTTONS ─────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: var(--radius-sm); padding: 11px 18px;
  font-size: 13px; font-weight: 600; font-family: inherit;
  cursor: pointer; transition: all .15s; border: 1px solid transparent;
  white-space: nowrap;
}
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: #2563eb; transform: translateY(-1px); box-shadow: 0 8px 20px rgba(59,130,246,.35); }
.btn-gold { background: var(--gold); color: #1a0f00; }
.btn-gold:hover { background: var(--gold2); transform: translateY(-1px); box-shadow: 0 8px 20px rgba(245,158,11,.35); }
.btn-ghost { background: rgba(255,255,255,.06); border-color: var(--line2); color: var(--text); }
.btn-ghost:hover { background: rgba(255,255,255,.11); }
.btn-danger { background: var(--rose-dim); border-color: rgba(244,63,94,.25); color: #fb7185; }
.btn-danger:hover { background: rgba(244,63,94,.2); }
.btn-success { background: var(--green-dim); border-color: rgba(16,185,129,.25); color: #34d399; }
.btn-success:hover { background: rgba(16,185,129,.2); }
.btn-full { width: 100%; }
.btn-sm { padding: 7px 12px; font-size: 12px; border-radius: 9px; }

/* ── PROGRESS BAR ───────────────────────────── */
.progress-wrap { margin-top: 6px; }
.progress-track {
  background: rgba(255,255,255,.07); border-radius: 999px; height: 8px; overflow: hidden;
}
.progress-fill {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--blue), var(--teal));
  transition: width .4s cubic-bezier(.4,0,.2,1);
}
.progress-fill.warn { background: linear-gradient(90deg, var(--gold), #ef4444); }
.progress-label { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted2); margin-bottom: 6px; }

/* ── HOLIDAY LIST ───────────────────────────── */
.holiday-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 14px;
  background: var(--card2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); margin-bottom: 6px;
}
.holiday-item .name { font-size: 13px; font-weight: 500; }
.holiday-item .date { font-size: 11px; color: var(--muted); margin-top: 2px; font-family: 'JetBrains Mono'; }

/* ── CALENDAR AREA ──────────────────────────── */
.cal-header {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px; margin-bottom: 20px;
}
.cal-nav { display: flex; gap: 8px; align-items: center; }
.month-label { font-size: 14px; font-weight: 500; color: var(--muted2); min-width: 110px; text-align: center; }

.cal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media(max-width:900px){ .cal-grid { grid-template-columns: 1fr; } }

/* ── MONTH CARD ─────────────────────────────── */
.month-card {
  background: var(--card2);
  border: 1px solid var(--line2);
  border-radius: var(--radius);
  padding: 18px;
  animation: fadeSlide .22s ease;
}
@keyframes fadeSlide { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.month-name {
  font-size: 16px; font-weight: 600; margin-bottom: 14px;
  display: flex; justify-content: space-between; align-items: center;
}
.month-name span { font-size: 11px; color: var(--muted); font-weight: 400; font-family: 'JetBrains Mono'; }

.day-headers {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 4px; margin-bottom: 6px;
}
.day-header {
  text-align: center; font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .1em; color: var(--muted);
  padding: 4px 0;
}
.day-header.weekend { color: rgba(244,63,94,.5); }

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

/* ── DAY CELL ───────────────────────────────── */
.day {
  aspect-ratio: 1;
  border-radius: 10px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  font-size: 13px; font-weight: 500;
  cursor: pointer; position: relative;
  border: 1px solid transparent;
  transition: background .12s, transform .1s, border-color .12s;
  user-select: none;
  overflow: hidden;
}
.day:hover:not(.disabled):not(.outside):not(.holiday-day):not(.weekend-day) {
  background: var(--blue-dim);
  border-color: rgba(59,130,246,.3);
  transform: scale(1.08);
  z-index: 2;
}
.day.outside { opacity: .15; pointer-events: none; font-size: 11px; }
.day.weekend-day { color: rgba(244,63,94,.45); cursor: default; }
.day.weekend-day:hover { background: none; transform: none; }
.day.today {
  border-color: rgba(59,130,246,.5);
  background: rgba(59,130,246,.08);
  color: var(--blue2);
  font-weight: 700;
}
.day.today::after {
  content: '';
  position: absolute;
  bottom: 4px; left: 50%;
  transform: translateX(-50%);
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--blue2);
}
.day.selected {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue2);
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(59,130,246,.4);
  transform: scale(1.05);
}
.day.holiday-day {
  background: var(--gold-dim);
  border-color: rgba(245,158,11,.3);
  color: var(--gold2);
  cursor: not-allowed;
  font-size: 11px;
  padding: 2px;
  text-align: center;
  line-height: 1.2;
}
.day.holiday-day .hname {
  font-size: 8px; display: block; color: rgba(245,158,11,.7);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 100%; padding: 0 2px;
}
.day.disabled { opacity: .25; cursor: not-allowed; }

/* ── LEGEND ─────────────────────────────────── */
.legend { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted2); }
.legend-dot {
  width: 10px; height: 10px; border-radius: 4px;
  flex-shrink: 0;
}

/* ── SELECTED DATES PILLS ───────────────────── */
.dates-cloud { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.date-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--blue-dim);
  border: 1px solid rgba(59,130,246,.25);
  color: var(--blue2);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 12px; font-weight: 500;
  font-family: 'JetBrains Mono';
  cursor: pointer;
  transition: background .12s;
}
.date-pill:hover { background: rgba(59,130,246,.25); }
.date-pill .remove { color: rgba(96,165,250,.5); font-size: 13px; line-height: 1; }

/* ── LOG TABLE ──────────────────────────────── */
.log-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.log-table th {
  text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: .16em;
  color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line2);
  white-space: nowrap; font-weight: 500;
}
.log-table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.log-table tr:last-child td { border-bottom: none; }
.log-table tr:hover td { background: rgba(255,255,255,.02); }
.log-badge {
  display: inline-flex; align-items: center;
  background: var(--green-dim); border: 1px solid rgba(16,185,129,.25);
  color: #34d399; border-radius: 6px; padding: 2px 8px;
  font-size: 11px; font-weight: 600; font-family: 'JetBrains Mono';
}

/* ── SUMMARY CARD ───────────────────────────── */
.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media(max-width:600px){ .summary-grid { grid-template-columns: 1fr 1fr; } }
.summary-item {
  background: var(--card2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 12px 14px;
}
.summary-item .s-label { font-size: 10px; text-transform: uppercase; letter-spacing: .16em; color: var(--muted); }
.summary-item .s-val { font-size: 16px; font-weight: 600; margin-top: 4px; }

/* ── DIVIDER ─────────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--line); margin: 16px 0; }

/* ── TOAST ──────────────────────────────────── */
.toast-wrap {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 1000; pointer-events: none;
}
.toast {
  background: var(--card2); border: 1px solid var(--line2);
  border-radius: 14px; padding: 12px 18px;
  font-size: 13px; font-weight: 500; color: var(--text);
  box-shadow: 0 16px 40px rgba(0,0,0,.5);
  opacity: 0; transform: translateY(12px) scale(.97);
  transition: opacity .22s, transform .22s;
  max-width: 320px;
  pointer-events: auto;
}
.toast.show { opacity: 1; transform: translateY(0) scale(1); }
.toast.success { border-color: rgba(16,185,129,.3); }
.toast.error { border-color: rgba(244,63,94,.3); }
.toast.warning { border-color: rgba(245,158,11,.3); }
.toast-icon { margin-right: 8px; }

/* ── EMPTY STATE ─────────────────────────────── */
.empty {
  text-align: center; padding: 32px 16px; color: var(--muted);
  font-size: 13px;
}
.empty-icon { font-size: 28px; margin-bottom: 8px; opacity: .4; }

/* ── SCROLLBAR ──────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 3px; }

/* ── BADGE PILL ─────────────────────────────── */
.badge {
  display: inline-block; border-radius: 6px; padding: 2px 8px;
  font-size: 11px; font-weight: 600;
}
.badge-blue { background: var(--blue-dim); color: var(--blue2); border: 1px solid rgba(59,130,246,.2); }
.badge-gold { background: var(--gold-dim); color: var(--gold2); border: 1px solid rgba(245,158,11,.2); }
.badge-rose { background: var(--rose-dim); color: #fb7185; border: 1px solid rgba(244,63,94,.2); }
