/* ============================================================
   Panel-Dashboard · Calendar view · Real Flow AI · v3 (preview)
   - Reusa tokens dual de _styles.css (dark + light)
   - Vistas: week / month / year / list + modal
   ============================================================ */

/* ===== TOOLBAR ===== */
.cal-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 14px 18px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.cal-week-label {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-strong);
  min-width: 220px;
  letter-spacing: -0.01em;
}

.cal-nav { display: flex; gap: 4px; }

.cal-nav-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.cal-nav-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

.cal-nav-btn.today {
  background: var(--orange);
  border-color: var(--orange);
  color: white;
}
.cal-nav-btn.today:hover {
  background: var(--orange-bright);
  border-color: var(--orange-bright);
}

.cal-spacer { flex: 1; }

.cal-filter {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 10px;
  border-radius: var(--radius);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  min-width: 180px;
  transition: border-color var(--transition-fast);
}

.cal-filter:focus {
  border-color: var(--orange);
  outline: none;
  box-shadow: 0 0 0 3px var(--orange-bg);
}

.cal-view-toggle {
  display: flex;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 2px;
}

.cal-view-toggle button {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  border-radius: var(--radius);
  transition: all var(--transition-fast);
}

.cal-view-toggle button.on {
  background: var(--bg-panel);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.cal-view-toggle button:hover:not(.on) { color: var(--text); }

.btn-add {
  background: var(--orange);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background var(--transition-fast), transform var(--transition-fast);
  box-shadow: 0 2px 4px rgba(249, 115, 22, 0.25);
}

.btn-add:hover {
  background: var(--orange-bright);
  transform: translateY(-1px);
}

/* ===== STATS BAR ===== */
.cal-stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

@media (max-width: 900px) { .cal-stats { grid-template-columns: repeat(2, 1fr); } }

.cal-stat {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.cal-stat:hover { transform: translateY(-1px); box-shadow: var(--shadow); }

.cal-stat-num {
  font-size: 24px;
  font-weight: 700;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  color: var(--text-strong);
  letter-spacing: -0.02em;
}

.cal-stat-num.g { color: var(--green); }
.cal-stat-num.r { color: var(--coral); }
.cal-stat-num.y { color: var(--amber); }
.cal-stat-num.p { color: var(--purple); }

.cal-stat-lbl {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
  font-weight: 500;
}

/* ===== WEEK GRID ===== */
.cal-week {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.cal-grid {
  display: grid;
  grid-template-columns: 56px repeat(7, 1fr);
  grid-template-rows: 56px repeat(20, 28px);
  position: relative;
  font-size: 12px;
}

.cal-grid > .cal-corner {
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
}

.cal-grid > .cal-day-head {
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  padding: 8px 6px;
  text-align: center;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 56px;
}

.cal-grid > .cal-day-head:last-child { border-right: none; }

.cal-grid > .cal-day-head.today {
  background: var(--orange-bg);
  color: var(--orange);
  border-bottom-color: var(--orange-border);
}

.cal-day-name {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.cal-day-num {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-strong);
  margin-top: 1px;
  letter-spacing: -0.02em;
}

.cal-day-head.today .cal-day-num { color: var(--orange); }

/* Time column */
.cal-time-cell {
  background: var(--bg-subtle);
  color: var(--text-dim);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px;
  padding: 2px 6px 0 0;
  text-align: right;
  border-right: 1px solid var(--border);
  border-top: 1px dashed var(--border-soft);
}

.cal-time-cell.half { border-top: none; color: transparent; }

/* Day cells */
.cal-cell {
  border-right: 1px solid var(--border-soft);
  border-top: 1px dashed var(--border-soft);
  background: var(--bg-panel);
  cursor: pointer;
  transition: background 80ms ease;
}

.cal-cell.half { border-top: none; }
.cal-cell:hover { background: var(--bg-hover); }
.cal-cell.last-col { border-right: none; }

.cal-cell.today { background: var(--orange-bg); }
.cal-cell.today:hover { background: var(--orange-bg); filter: brightness(1.1); }

/* Now indicator */
.cal-now-line {
  position: absolute;
  height: 2px;
  background: var(--coral);
  z-index: 1;
  pointer-events: none;
  opacity: 0.9;
  border-radius: 1px;
}
.cal-now-line::before {
  content: '';
  position: absolute;
  left: 0; top: -3px;
  width: 8px; height: 8px;
  background: var(--coral);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--coral);
}

/* ===== APPOINTMENTS ===== */
.cal-appt {
  margin: 1px 2px;
  padding: 4px 7px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  line-height: 1.25;
  cursor: pointer;
  overflow: hidden;
  z-index: 2;
  position: relative;
  border-left: 3px solid;
  background: var(--bg-elevated);
  transition: filter var(--transition-fast), transform 80ms ease, box-shadow var(--transition-fast);
}

.cal-appt:hover {
  filter: brightness(1.1);
  transform: translateX(1px);
  box-shadow: var(--shadow-sm);
}

.cal-appt-time {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 600;
}

.cal-appt-title {
  color: var(--text-strong);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cal-appt-sub {
  color: var(--text-muted);
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cal-appt.pending   { background: var(--amber-bg); border-left-color: var(--amber); }
.cal-appt.confirmed { background: var(--green-bg); border-left-color: var(--green); }
.cal-appt.completed { background: var(--bg-elevated); border-left-color: var(--text-dim); opacity: 0.7; }
.cal-appt.cancelled { background: var(--coral-bg); border-left-color: var(--coral); text-decoration: line-through; opacity: 0.6; }
.cal-appt.no_show   { background: var(--coral-bg); border-left-color: var(--coral); }

/* Blocked slots */
.cal-blocked {
  background: repeating-linear-gradient(
    45deg,
    var(--bg-deep),
    var(--bg-deep) 6px,
    var(--bg-elevated) 6px,
    var(--bg-elevated) 12px
  );
  margin: 1px 2px;
  padding: 4px 7px;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--text-dim);
  font-size: 10px;
  color: var(--text-muted);
  z-index: 1;
  cursor: default;
  overflow: hidden;
}

.cal-blocked-label { color: var(--text-dim); font-style: italic; }

/* ===== LIST VIEW ===== */
.cal-list {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.cal-list-day-header {
  background: var(--bg-subtle);
  padding: 10px 18px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 700;
  border-bottom: 1px solid var(--border);
}

.cal-list-day-header.today { color: var(--orange); }

.cal-list-row {
  display: grid;
  grid-template-columns: 80px 1fr 200px 140px 100px;
  gap: 16px;
  padding: 14px 18px;
  align-items: center;
  border-bottom: 1px solid var(--border-soft);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.cal-list-row:hover { background: var(--bg-hover); }
.cal-list-row:last-child { border-bottom: none; }

.cal-list-row.crit { border-left: 3px solid var(--coral); }
.cal-list-row.cancelled { opacity: 0.5; }

.cal-list-time {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-strong);
}

.cal-list-customer {
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cal-list-customer .phone {
  color: var(--text-dim);
  font-size: 12px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  margin-left: 6px;
}

.cal-list-service { font-size: 13px; color: var(--text-muted); }
.cal-list-assignee { font-size: 13px; color: var(--text-muted); }

.cal-list-status-tag {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.cal-list-status-tag.pending   { background: var(--amber-bg); color: var(--amber); border: 1px solid var(--amber-border); }
.cal-list-status-tag.confirmed { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-border); }
.cal-list-status-tag.completed { background: var(--bg-elevated); color: var(--text-muted); border: 1px solid var(--border); }
.cal-list-status-tag.cancelled { background: var(--coral-bg); color: var(--coral); border: 1px solid var(--coral-border); }
.cal-list-status-tag.no_show   { background: var(--coral-bg); color: var(--coral); border: 1px solid var(--coral-border); }

@media (max-width: 768px) {
  .cal-list-row {
    grid-template-columns: 60px 1fr 100px;
    gap: 8px;
  }
  .cal-list-service, .cal-list-assignee { display: none; }
}

/* ===== MODAL ===== */
.cal-modal-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(6, 10, 16, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
  animation: backdropIn 200ms ease;
}

[data-theme="light"] .cal-modal-backdrop {
  background: rgba(15, 23, 42, 0.4);
}

@keyframes backdropIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.cal-modal-backdrop.hidden { display: none; }

.cal-modal {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalIn {
  from { transform: scale(0.96) translateY(8px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}

.cal-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.cal-modal-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-strong);
  margin: 0;
  letter-spacing: -0.01em;
}

.cal-modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  width: 30px;
  height: 30px;
  border-radius: var(--radius);
  transition: all var(--transition-fast);
}

.cal-modal-close:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.cal-form-row {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

.cal-form-row.dual {
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.cal-form-row label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.cal-form-row input,
.cal-form-row select,
.cal-form-row textarea {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 12px;
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.cal-form-row input:focus,
.cal-form-row select:focus,
.cal-form-row textarea:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px var(--orange-bg);
}

.cal-form-row textarea { min-height: 70px; resize: vertical; }

.cal-modal-status-strip {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.cal-status-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.cal-status-btn:hover { color: var(--text); border-color: var(--border-strong); }

.cal-status-btn.on.pending   { background: var(--amber-bg); color: var(--amber); border-color: var(--amber); }
.cal-status-btn.on.confirmed { background: var(--green-bg); color: var(--green); border-color: var(--green); }
.cal-status-btn.on.completed { background: var(--bg-elevated); color: var(--text); border-color: var(--text-muted); }
.cal-status-btn.on.cancelled { background: var(--coral-bg); color: var(--coral); border-color: var(--coral); }
.cal-status-btn.on.no_show   { background: var(--coral-bg); color: var(--coral); border-color: var(--coral); }

.cal-modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.cal-modal-footer-right { display: flex; gap: 8px; }

.btn-secondary {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition-fast);
}

.btn-secondary:hover { background: var(--bg-hover); border-color: var(--border-strong); }

.btn-primary {
  background: var(--orange);
  color: white;
  border: 1px solid var(--orange);
  padding: 9px 20px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition-fast);
  box-shadow: 0 2px 4px rgba(249, 115, 22, 0.2);
}

.btn-primary:hover {
  background: var(--orange-bright);
  border-color: var(--orange-bright);
  transform: translateY(-1px);
}

.btn-danger {
  background: transparent;
  color: var(--coral);
  border: 1px solid var(--coral-border);
  padding: 9px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition-fast);
}

.btn-danger:hover { background: var(--coral-bg); border-color: var(--coral); }

.cal-modal-info {
  background: var(--bg-elevated);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.cal-modal-info strong { color: var(--text); font-weight: 600; }
.cal-modal-info .src-bot { color: var(--purple); }
.cal-modal-info .src-manual { color: var(--cyan); }

.cal-modal-error {
  background: var(--coral-bg);
  border: 1px solid var(--coral-border);
  color: var(--coral);
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 12px;
  font-weight: 500;
}

.cal-modal-error.hidden { display: none; }

/* ===== Empty state ===== */
.cal-empty {
  text-align: center;
  padding: 64px 16px;
  color: var(--text-muted);
}

.cal-empty .emoji {
  font-size: 36px;
  display: block;
  margin-bottom: 10px;
  opacity: 0.6;
}

/* ===== OUT-OF-HOURS BAND ===== */
.cal-out-of-hours {
  background: var(--amber-bg);
  border: 1px solid var(--amber-border);
  border-left: 3px solid var(--amber);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 12px;
}

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

.cal-ooh-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--amber);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.cal-ooh-count {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-panel);
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  border: 1px solid var(--border);
}

.cal-ooh-chips { display: flex; flex-wrap: wrap; gap: 6px; }

.cal-ooh-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-left: 3px solid var(--amber);
  color: var(--text);
  padding: 6px 10px;
  border-radius: var(--radius);
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  transition: background var(--transition-fast), transform 80ms ease;
}

.cal-ooh-chip:hover {
  background: var(--bg-hover);
  transform: translateY(-1px);
}

.cal-ooh-chip.confirmed { border-left-color: var(--green); }
.cal-ooh-chip.completed { border-left-color: var(--text-dim); opacity: 0.7; }
.cal-ooh-chip.cancelled { border-left-color: var(--coral); text-decoration: line-through; opacity: 0.6; }
.cal-ooh-chip.no_show   { border-left-color: var(--coral); }

.cal-ooh-day {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.cal-ooh-time {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  color: var(--amber);
  font-weight: 600;
}

.cal-ooh-customer { color: var(--text); font-weight: 500; }

/* ===== MONTH VIEW ===== */
.cal-month {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.cal-month-head {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
}

.cal-month-head-cell {
  padding: 12px 6px;
  text-align: center;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 700;
  border-right: 1px solid var(--border);
}

.cal-month-head-cell:last-child { border-right: none; }

.cal-month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: minmax(96px, 1fr);
}

.cal-month-cell {
  border-right: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
  padding: 7px 9px;
  cursor: pointer;
  transition: background var(--transition-fast);
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 96px;
  position: relative;
  overflow: hidden;
}

.cal-month-cell:hover { background: var(--bg-hover); }

.cal-month-cell.outside { opacity: 0.35; }

.cal-month-cell.today {
  background: var(--orange-bg);
}

.cal-month-cell.today:hover { filter: brightness(1.06); }

.cal-month-cell-num {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-strong);
  font-feature-settings: "tnum";
  letter-spacing: -0.01em;
}

.cal-month-cell.today .cal-month-cell-num { color: var(--orange); }
.cal-month-cell.outside .cal-month-cell-num {
  color: var(--text-dim);
  font-weight: 400;
}

.cal-month-cell-count {
  font-size: 10px;
  color: var(--text-muted);
  margin-left: auto;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  background: var(--bg-elevated);
  font-weight: 600;
  border: 1px solid var(--border);
}

.cal-month-cell-count.has {
  color: var(--orange);
  background: var(--orange-bg);
  border-color: var(--orange-border);
}

.cal-month-cell-num-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cal-month-cell-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.cal-month-mini-appt {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  border-left: 2px solid;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: var(--bg-elevated);
  font-weight: 500;
}

.cal-month-mini-appt.pending   { background: var(--amber-bg); border-left-color: var(--amber); color: var(--amber); }
.cal-month-mini-appt.confirmed { background: var(--green-bg); border-left-color: var(--green); color: var(--green); }
.cal-month-mini-appt.completed { background: var(--bg-elevated); border-left-color: var(--text-dim); color: var(--text-muted); }
.cal-month-mini-appt.cancelled { background: var(--coral-bg); border-left-color: var(--coral); color: var(--coral); text-decoration: line-through; }
.cal-month-mini-appt.no_show   { background: var(--coral-bg); border-left-color: var(--coral); color: var(--coral); }

.cal-month-more {
  font-size: 10px;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 1px;
  font-weight: 500;
}

@media (max-width: 768px) {
  .cal-month-grid { grid-auto-rows: minmax(60px, 1fr); }
  .cal-month-cell { min-height: 60px; padding: 4px 5px; }
  .cal-month-mini-appt, .cal-month-more { display: none; }
}

/* ===== YEAR VIEW ===== */
.cal-year {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

@media (max-width: 1024px) { .cal-year { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 768px)  { .cal-year { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px)  { .cal-year { grid-template-columns: 1fr; } }

.cal-year-month {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.cal-year-month:hover { transform: translateY(-1px); box-shadow: var(--shadow); }

.cal-year-month-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-strong);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  transition: color var(--transition-fast);
}

.cal-year-month-name:hover { color: var(--orange); }
.cal-year-month-name.current { color: var(--orange); }

.cal-year-month-total {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  font-feature-settings: "tnum";
}

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

.cal-year-mini-head {
  font-size: 9px;
  color: var(--text-dim);
  text-align: center;
  padding: 1px 0;
  font-weight: 600;
  text-transform: uppercase;
}

.cal-year-mini-cell {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  font-size: 9px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform var(--transition-fast), border-color var(--transition-fast);
  border: 1px solid transparent;
  font-weight: 500;
}

.cal-year-mini-cell.outside {
  background: transparent;
  color: transparent;
  cursor: default;
}

.cal-year-mini-cell:hover:not(.outside) {
  transform: scale(1.18);
  z-index: 2;
  border-color: var(--text-muted);
}

.cal-year-mini-cell.today {
  border-color: var(--orange);
  font-weight: 700;
  color: var(--orange);
}

.cal-year-mini-cell.lvl-0 { background: var(--bg-elevated); color: var(--text-dim); }
.cal-year-mini-cell.lvl-1 { background: rgba(249, 115, 22, 0.18); color: var(--text-muted); }
.cal-year-mini-cell.lvl-2 { background: rgba(249, 115, 22, 0.40); color: var(--text); }
.cal-year-mini-cell.lvl-3 { background: rgba(249, 115, 22, 0.65); color: white; }
.cal-year-mini-cell.lvl-4 { background: var(--orange); color: white; font-weight: 700; }

[data-theme="light"] .cal-year-mini-cell.lvl-0 { background: var(--bg-deep); }

.cal-year-legend {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  padding: 10px 14px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 11px;
  color: var(--text-muted);
  box-shadow: var(--shadow-sm);
  font-weight: 500;
}

.cal-year-legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: var(--radius-sm);
  display: inline-block;
}
