/* ═══════════════════════════════════════════════════════════════
   Calendar — календарь событий
   Извлечено из checklist_operational.css строки 8729–9455
   ═══════════════════════════════════════════════════════════════ */

/* ===== CALENDAR ===== */
.cal-wrap {
    padding: 24px 32px 32px;
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}
.cal-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-3);
}
.cal-toolbar-left {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}
.cal-toolbar-right {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}
.cal-nav-btn {
    width: 32px; height: 32px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    color: var(--color-text-strong);
    font-size: var(--text-lg);
    line-height: 1;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}
.cal-nav-btn:hover {
    background: var(--color-bg-subtle);
    border-color: var(--color-border-strong);
    color: var(--color-text);
}
.cal-nav-btn:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 1px; }
.cal-today-btn {
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    color: var(--color-text-strong);
    font-size: var(--text-sm);
    font-weight: 600;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease;
}
.cal-today-btn:hover { background: var(--color-bg-subtle); border-color: var(--color-border-strong); }
.cal-today-btn:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 1px; }
.cal-title {
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--color-text);
    margin-left: 8px;
    letter-spacing: -0.01em;
    text-transform: capitalize;
}
.cal-add-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    padding: 8px 12px;
    font-size: var(--text-sm);
    font-weight: 600;
    cursor: pointer;
    transition: background 0.18s ease, transform 0.12s ease, box-shadow 0.18s ease;
}
.cal-add-btn:hover {
    background: var(--color-primary-hover);
    box-shadow: 0 2px 8px rgba(62, 60, 89, 0.18);
}
.cal-add-btn:active { transform: translateY(1px); }
.cal-add-btn:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.cal-add-btn-icon { font-size: var(--text-md); line-height: 1; font-weight: 600; }
.cal-view-toggle {
    display: flex;
    background: var(--color-bg-subtle);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    padding: 2px;
    gap: 2px;
}
.cal-view-btn {
    padding: 8px 12px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}
.cal-view-btn:hover:not(.active) { background: white; color: var(--color-text); }
.cal-view-btn.active {
    background: white;
    color: var(--color-text);
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(15,23,42,0.06);
}
.cal-view-btn:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 1px; }
.cal-body {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

/* ---- Month view ---- */
.cal-month-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}
.cal-month-head {
    text-align: center;
    padding: 12px 0;
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg-subtle);
}
.cal-month-head.weekend { color: var(--color-text-muted); }
.cal-month-cell {
    min-height: 116px;
    padding: var(--space-2);
    border-right: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
    vertical-align: top;
    position: relative;
    transition: background 0.15s ease;
}
.cal-month-cell:nth-child(7n) { border-right: none; }
.cal-month-cell:hover:not(.other-month) { background: var(--color-bg-subtle); }
.cal-month-cell.other-month { background: #fafbfc; }
.cal-month-cell.weekend-cell { background: #fcfcfd; }
.cal-month-cell.weekend-cell:hover { background: var(--color-bg-subtle); }
.cal-month-cell.today { background: var(--color-primary-25); }
.cal-month-cell.today:hover { background: var(--color-primary-25); }
.cal-day-num {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--color-text-strong);
    width: 26px; height: 26px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    margin-bottom: 4px;
    transition: background 0.15s ease, color 0.15s ease;
}
.cal-month-cell.today .cal-day-num {
    background: var(--color-primary);
    color: white;
    box-shadow: 0 2px 6px rgba(62, 60, 89, 0.28);
}
.cal-month-cell.other-month .cal-day-num { color: #cbd5e1; font-weight: 500; }
.cal-month-cell.weekend-cell .cal-day-num { color: var(--color-text-secondary); }
.cal-month-cell.holiday-cell { background: #fef7f7; }
.cal-month-cell.holiday-cell:hover { background: #fdeeee; }
.cal-month-cell.holiday-cell .cal-day-num { color: #dc2626; }
.cal-month-cell.holiday-cell.today { background: var(--color-primary-25); }
.cal-month-cell.holiday-cell.today .cal-day-num {
    background: var(--color-primary);
    color: white;
}
.cal-holiday-label {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    max-width: 100%;
    font-size: var(--text-xs);
    font-weight: 600;
    color: #b91c1c;
    padding: 2px 8px 2px 8px;
    border-radius: var(--radius-pill);
    background: #fee2e2;
    margin-bottom: 3px;
    white-space: normal;
    overflow: hidden;
    letter-spacing: 0.01em;
}
.cal-holiday-label::before {
    content: '';
    flex: 0 0 auto;
    width: 5px; height: 5px;
    border-radius: 50%;
    background: #dc2626;
}
.cal-week-head.holiday-col { background: #fef7f7; }
.cal-week-head.holiday-col .cal-week-daynum { color: #dc2626; }
.cal-week-holiday {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    font-size: var(--text-xs);
    font-weight: 600;
    color: #b91c1c;
    margin-top: 4px;
    white-space: normal;
    overflow: hidden;
    max-width: 100%;
}
.cal-week-holiday::before {
    content: '';
    width: 5px; height: 5px;
    border-radius: 50%;
    background: #dc2626;
}
.cal-day-holiday {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    background: linear-gradient(135deg, #fff5f5 0%, #fee2e2 100%);
    color: #991b1b;
    font-size: var(--text-base);
    font-weight: 600;
    padding: 12px 16px;
    border-radius: var(--radius-xl);
    margin-bottom: 16px;
    border: 1px solid #fecaca;
    box-shadow: 0 1px 2px rgba(220, 38, 38, 0.06);
}

/* ---- Year view ---- */
.cal-year-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-4);
    padding: var(--space-4);
    background: var(--color-bg-subtle);
}
.cal-year-month {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: var(--space-3);
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}
.cal-year-month:hover {
    border-color: var(--color-border-strong);
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
    transform: translateY(-1px);
}
.cal-year-month-title {
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--color-text);
    margin: 0 0 8px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    user-select: none;
    transition: color 0.15s ease;
}
.cal-year-month-title:hover { color: var(--color-primary); }
.cal-year-mini-head {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    margin-bottom: 6px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--color-border);
}
.cal-year-mini-dow {
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
    text-align: center;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.cal-year-mini-dow.weekend { color: #cbd5e1; }
.cal-year-mini-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}
.cal-year-mini-day {
    font-size: var(--text-xs);
    font-family: inherit;
    font-weight: 500;
    color: var(--color-text);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    padding: var(--space-0);
    cursor: pointer;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}
.cal-year-mini-day:hover:not(.other-month) { background: var(--color-primary-25); color: var(--color-primary); }
.cal-year-mini-day:active:not(.other-month) { transform: scale(0.92); }
.cal-year-mini-day:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 1px; }
.cal-year-mini-day.other-month { color: #cbd5e1; cursor: default; font-weight: 400; }
.cal-year-mini-day.weekend { color: var(--color-text-muted); }
.cal-year-mini-day.holiday { color: #dc2626; font-weight: 600; }
.cal-year-mini-day.today {
    background: var(--color-primary);
    color: white;
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(62, 60, 89, 0.28);
}
.cal-year-mini-day.today:hover { background: var(--color-primary); color: white; }
.cal-year-mini-day.has-event::after {
    content: '';
    position: absolute;
    bottom: 3px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    background: var(--color-primary);
    border-radius: 50%;
}
.cal-year-mini-day.today.has-event::after { background: white; }
.cal-year-mini-day.holiday.has-event::after { background: #dc2626; }
@media (max-width: 1100px) {
    .cal-year-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 800px) {
    .cal-year-grid { grid-template-columns: repeat(2, 1fr); gap: var(--space-3); }
}
@media (max-width: 480px) {
    .cal-year-grid { grid-template-columns: 1fr; }
}
.cal-event-pill {
    display: block;
    font-size: var(--text-xs);
    font-weight: 500;
    padding: 2px 8px;
    border-radius: var(--radius-xs);
    margin-bottom: 2px;
    white-space: normal;
    overflow: hidden;
    cursor: default;
    opacity: 0.9;
}
.cal-event-more {
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
    padding: 1px 4px;
}

/* ---- Week view ---- */
.cal-week-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}
.cal-week-head {
    padding: 12px 8px 12px;
    text-align: center;
    border-right: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg-subtle);
}
.cal-week-head:last-child { border-right: none; }
.cal-week-head.today-col {
    background: linear-gradient(180deg, var(--color-primary-25) 0%, var(--color-bg-subtle) 100%);
}
.cal-week-head.today-col .cal-week-dayname { color: var(--color-primary); }
.cal-week-head.today-col .cal-week-daynum {
    background: var(--color-primary);
    color: white;
    box-shadow: 0 2px 6px rgba(62, 60, 89, 0.28);
}
.cal-week-dayname {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 6px;
}
.cal-week-daynum {
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--color-text);
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    margin: 0 auto;
    transition: background 0.15s ease, color 0.15s ease;
}
.cal-week-col {
    border-right: 1px solid var(--color-border);
    padding: var(--space-2);
    min-height: 320px;
    vertical-align: top;
    transition: background 0.15s ease;
}
.cal-week-col:last-child { border-right: none; }
.cal-week-col:hover:not(.today-col) { background: var(--color-bg-subtle); }
.cal-week-col.today-col { background: var(--color-primary-25); }
.cal-week-event {
    display: block;
    font-size: var(--text-xs);
    font-weight: 500;
    padding: 4px 8px;
    border-radius: var(--radius-md);
    margin-bottom: 5px;
    line-height: 1.4;
    cursor: default;
    opacity: 0.9;
}
.cal-week-event-phase {
    font-size: var(--text-xs);
    opacity: 0.75;
    margin-top: 2px;
}

/* ---- Day view ---- */
.cal-day-view {
    padding: 20px 24px;
    min-height: 320px;
}
.cal-day-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 72px 20px;
    color: var(--color-text-secondary);
    font-size: var(--text-base);
    font-weight: 500;
    background: var(--color-bg-subtle);
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-xl);
}
.cal-day-event {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: 12px 16px;
    border-radius: var(--radius-xl);
    margin-bottom: 8px;
    border: 1px solid rgba(0,0,0,0.06);
}
.cal-day-event-bar {
    width: 4px;
    border-radius: var(--radius-xs);
    align-self: stretch;
    min-height: 36px;
    flex-shrink: 0;
}
.cal-day-event-name {
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 3px;
}
.cal-day-event-meta {
    font-size: var(--text-xs);
    color: var(--color-gray-400);
}

/* Calendar event delete button */
.cal-event-del {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px; height: 14px;
    border-radius: 50%;
    background: rgba(0,0,0,0.15);
    border: none;
    color: inherit;
    font-size: var(--text-xs);
    cursor: pointer;
    line-height: 1;
    flex-shrink: 0;
    margin-left: 4px;
    vertical-align: middle;
    transition: background 0.15s;
}
.cal-event-del:hover { background: rgba(0,0,0,0.35); }

/* Calendar event modal */
.cal-modal-field {
    margin-bottom: 14px;
}
.cal-modal-label {
    display: block;
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--color-text-secondary);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.cal-modal-input {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    font-size: var(--text-base);
    color: var(--color-text);
    outline: none;
    transition: border-color 0.15s;
    font-family: inherit;
}
.cal-modal-input:focus { border-color: var(--color-primary); }
.cal-user-picker {
    max-height: 168px;
    overflow-y: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: var(--space-2);
    background: var(--color-surface);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}
.cal-user-picker-empty {
    color: var(--color-gray-400);
    font-size: var(--text-sm);
    padding: var(--space-2);
}
.cal-user-option {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: background 0.15s ease;
}
.cal-user-option:hover {
    background: var(--color-bg-tint);
}
.cal-user-option input[type=checkbox] {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    accent-color: var(--color-primary);
    cursor: pointer;
}
.cal-user-option.is-self {
    background: var(--color-primary-25);
}
.cal-user-option.is-self input[type=checkbox] {
    cursor: not-allowed;
}
.cal-user-option-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.cal-user-option-name {
    font-size: var(--text-base);
    color: var(--color-text);
}
.cal-user-option-note {
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
}

/* Color picker */
.cal-color-picker {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
}
.cal-color-swatch {
    width: 28px; height: 28px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s;
    box-sizing: border-box;
}
.cal-color-swatch:hover { transform: scale(1.15); }
.cal-color-swatch.selected { border-color: var(--color-text); transform: scale(1.1); }

/* Announce checkbox row */
.cal-modal-announce-row {
    background: #f0f7ff;
    border: 1px solid var(--color-primary-50);
    border-radius: var(--radius-lg);
    padding: var(--space-3);
    margin-top: 4px;
}
.cal-modal-check-wrap {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
}
.cal-modal-check-wrap input[type=checkbox] {
    width: 16px; height: 16px;
    cursor: pointer;
    accent-color: var(--color-primary);
}
.cal-modal-check-label {
    font-size: var(--text-sm);
    font-weight: 500;
    color: #0040DD;
}

.cal-view-head {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    margin-bottom: 18px;
}
.cal-view-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 4px;
    box-shadow: 0 0 0 4px rgba(148,163,184,0.12);
}
.cal-view-date {
    font-size: var(--text-base);
    color: #4b5563;
}
.cal-view-time {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
}
.cal-view-section {
    padding: 12px 16px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    background: var(--color-gray-50);
}
.cal-view-label {
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-text-secondary);
    margin-bottom: 8px;
}
.cal-view-text {
    font-size: var(--text-base);
    line-height: 1.6;
    color: var(--color-text);
    white-space: pre-wrap;
}
.cal-view-members {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}
.cal-view-member {
    padding: var(--space-2);
    border-radius: var(--radius-pill);
    background: var(--color-primary-25);
    color: var(--color-primary-strong);
    font-size: var(--text-sm);
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
}
.cal-view-member.is-pending {
    background: #fff7e6;
    color: #b26a00;
}
.cal-view-member.is-declined {
    background: #fdecec;
    color: var(--color-danger-text);
}
.cal-view-member-status {
    font-size: var(--text-xs);
    font-weight: 700;
    opacity: 0.8;
}
.cal-view-meta-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-3);
    margin-top: 14px;
}
.cal-view-meta-card {
    padding: var(--space-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    background: var(--color-surface);
}
.cal-view-meta-value {
    font-size: var(--text-base);
    color: var(--color-text);
    line-height: 1.45;
}
.cal-view-delete-btn {
    background: var(--color-danger-50);
    color: var(--color-danger-700);
}
.cal-view-delete-btn:hover {
    background: #fecaca;
}
.cal-event-time {
    flex-shrink: 0;
    margin-right: 6px;
    font-weight: 700;
    opacity: 0.9;
}
.cal-event-pill-clickable,
.cal-week-event-clickable,
.cal-day-event-clickable {
    cursor: pointer;
}

@media (max-width: 768px) {
    .cal-wrap { padding: var(--space-3); }
    .cal-week-daynum { font-size: var(--text-base); width: 28px; height: 28px; }
    .cal-month-cell { min-height: 70px; }
}
