* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
:root {
    --bg: #f5f7fb; --bg2: #ffffff; --fg: #0f172a; --fg2: #475569;
    --muted: #94a3b8; --border: #e2e8f0;
    --primary: #2563eb; --primary-hover: #1d4ed8;
    --danger: #dc2626; --success: #16a34a; --warning: #f59e0b;
    --weekend: #ef4444; --holiday: #ec4899;
    --shadow: 0 1px 3px rgba(15,23,42,.06), 0 4px 14px rgba(15,23,42,.06);
    --radius: 12px; --radius-sm: 8px;
    --header-h: 60px; --sidebar-w: 260px;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
}
body.dark {
    --bg: #0f172a; --bg2: #1e293b; --fg: #f1f5f9; --fg2: #cbd5e1;
    --muted: #64748b; --border: #334155;
    --shadow: 0 1px 3px rgba(0,0,0,.4), 0 4px 14px rgba(0,0,0,.4);
}
html, body { height: 100%; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg); color: var(--fg);
    overflow-x: hidden;
    transition: background .2s, color .2s;
    font-size: 15px; line-height: 1.5;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); text-decoration: none; }

#loader { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--bg); z-index: 9999; }
.spinner { width: 40px; height: 40px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
    padding-top: calc(20px + var(--safe-top));
    padding-bottom: calc(20px + var(--safe-bottom));
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 50%, #7c3aed 100%); }
.login-card { background: var(--bg2); padding: 40px 32px; border-radius: 20px; width: 100%; max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,.3); animation: pop .3s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(20px) scale(.98); } }
.login-card h1 { font-size: 22px; margin-bottom: 8px; text-align: center; }
.login-card .sub { color: var(--muted); text-align: center; margin-bottom: 28px; font-size: 14px; }
.login-card .logo { font-size: 52px; text-align: center; margin-bottom: 16px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 500; color: var(--fg2); margin-bottom: 6px; }
.field input, .field select, .field textarea {
    width: 100%; padding: 11px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--bg2); color: var(--fg); outline: none; transition: border-color .15s, box-shadow .15s;
    min-height: 44px;
}
.field input:focus, .field select:focus, .field textarea:focus {
    border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}
.field input:disabled { background: var(--bg); color: var(--muted); cursor: not-allowed; }
.field textarea { min-height: 80px; resize: vertical; }

.field select {
    appearance: none; -webkit-appearance: none; -moz-appearance: none;
    background-color: var(--bg2);
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 38px;
    cursor: pointer;
}
body.dark .field select {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
}
.field select option { background: var(--bg2); color: var(--fg); }
body.dark .field select option { background: #1e293b; color: #f1f5f9; }

/* Цветовой ввод */
.color-input {
    display: inline-block;
    width: 44px; height: 44px;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    cursor: pointer; padding: 2px;
    background: var(--bg2);
    vertical-align: middle;
}

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 11px 18px; border-radius: var(--radius-sm); border: none; cursor: pointer;
    font-weight: 500; transition: all .15s; font-size: 14px; min-height: 44px;
    white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }
.btn-secondary { background: var(--bg); color: var(--fg); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost { background: transparent; color: var(--fg2); }
.btn-ghost:hover { background: var(--border); }
.btn-block { width: 100%; }
.btn-icon { padding: 8px; width: 38px; height: 38px; border-radius: 50%; min-height: auto; }
.btn-sm { padding: 7px 12px; font-size: 13px; min-height: 34px; }

/* Ряд кнопок — не растягиваются */
.btn-row {
    display: flex; gap: 10px; flex-wrap: wrap;
    align-items: center;
    margin-top: 12px;
}
.btn-row .btn { flex: 0 0 auto; }

.app-shell { min-height: 100vh; display: grid; grid-template-rows: auto 1fr; }

.topbar {
    background: var(--bg2); border-bottom: 1px solid var(--border);
    display: flex; align-items: center; padding: 0 12px; gap: 10px;
    position: sticky; top: 0; z-index: 100; box-shadow: var(--shadow);
    min-height: var(--header-h);
    padding-top: var(--safe-top);
    padding-left: calc(12px + var(--safe-left));
    padding-right: calc(12px + var(--safe-right));
    height: auto;
}
.topbar .brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 16px; min-width: 0; }
.topbar .brand .logo-ico { width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
    background: linear-gradient(135deg, #2563eb, #7c3aed); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 18px; }
.topbar .spacer { flex: 1; }
.topbar .user-chip { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 20px;
    cursor: pointer; transition: background .15s; flex-shrink: 0; }
.topbar .user-chip:hover { background: var(--bg); }
.topbar .avatar { width: 32px; height: 32px; border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #7c3aed); color: #fff;
    display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px; }
.icon-btn { background: transparent; border: none; width: 40px; height: 40px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; cursor: pointer;
    position: relative; transition: background .15s; color: var(--fg2); flex-shrink: 0; }
.icon-btn:hover { background: var(--bg); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn .badge { position: absolute; top: 4px; right: 4px; background: var(--danger); color: #fff;
    font-size: 10px; font-weight: 700; padding: 2px 5px; border-radius: 10px; min-width: 16px; text-align: center; }
.burger { display: none; }

.main-area { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: calc(100vh - var(--header-h)); }
.sidebar { background: var(--bg2); border-right: 1px solid var(--border); padding: 16px 12px;
    display: flex; flex-direction: column; gap: 4px;
    position: sticky; top: var(--header-h);
    height: calc(100vh - var(--header-h) - var(--safe-top));
    overflow-y: auto; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: var(--radius-sm);
    cursor: pointer; color: var(--fg2); transition: all .15s; font-size: 14px; font-weight: 500; }
.nav-item:hover { background: var(--bg); color: var(--fg); }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-item svg { width: 20px; height: 20px; flex-shrink: 0; }
.sidebar .nav-divider { height: 1px; background: var(--border); margin: 8px 4px; }

.content { padding: 20px 24px; overflow-x: hidden; padding-bottom: calc(20px + var(--safe-bottom)); }

.btn-new-event { position: fixed; width: 60px; height: 60px; border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #7c3aed); color: #fff; border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center; box-shadow: 0 8px 24px rgba(37,99,235,.4);
    z-index: 90; transition: transform .2s;
    bottom: calc(24px + var(--safe-bottom));
    right: calc(24px + var(--safe-right)); }
.btn-new-event svg { width: 26px; height: 26px; }
.btn-new-event:hover { transform: scale(1.08); }

.view { display: none; animation: fadeIn .2s; }
.view.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } }

.cal-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.cal-toolbar h2 { font-size: 20px; font-weight: 600; min-width: 220px; }
.cal-nav { display: flex; gap: 6px; }

.cal-view-switch {
    display: inline-flex; background: var(--bg2); border: 1px solid var(--border);
    border-radius: var(--radius-sm); overflow: hidden;
}
.cal-view-switch button {
    padding: 8px 16px; background: transparent; border: none; cursor: pointer;
    color: var(--fg2); font-size: 13px; font-weight: 600; transition: all .15s;
    min-width: 70px; display: inline-flex; align-items: center; justify-content: center;
}
.cal-view-switch button:hover { background: var(--bg); color: var(--fg); }
.cal-view-switch button.active { background: var(--primary); color: #fff; }

.calendar-grid { background: var(--bg2); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.month-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.month-head { padding: 12px; text-align: center; font-weight: 600; color: var(--fg2); font-size: 12px;
    background: var(--bg); text-transform: uppercase; letter-spacing: .5px; }
.month-head.is-weekend-head { color: var(--weekend); }

.month-day { min-height: 110px; padding: 8px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
    cursor: pointer; transition: background .15s; position: relative; }
.month-day:hover { background: var(--bg); }
.month-day.other-month { opacity: .4; }
.month-day.today { background: rgba(37,99,235,.06); }
.month-day.today .day-num { background: var(--primary); color: #fff; }
.month-day .day-num { display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 26px; border-radius: 50%; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.month-day .ev-mini { font-size: 11px; padding: 2px 6px; border-radius: 4px; margin-bottom: 3px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #fff; font-weight: 500; cursor: pointer; }
.month-day .ev-more { font-size: 11px; color: var(--muted); padding-left: 4px; }

/* Выходные и праздники */
.month-day.is-weekend { background: rgba(239,68,68,.04); }
.month-day.is-weekend .day-num { color: var(--weekend); }
.month-day.is-holiday { background: rgba(236,72,153,.06); }
.month-day.is-holiday .day-num { color: var(--holiday); }
.month-day .day-label {
    font-size: 10px; color: var(--holiday); font-weight: 600;
    margin-top: -4px; margin-bottom: 4px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.month-day.is-weekend .day-label { color: var(--weekend); }

.week-grid { display: grid; grid-template-columns: 70px repeat(7, 1fr); }
.week-head { padding: 10px 6px; text-align: center; background: var(--bg); border-bottom: 1px solid var(--border); font-size: 12px; }
.week-head .wd { text-transform: uppercase; letter-spacing: .5px; color: var(--fg2); font-weight: 600; font-size: 11px; }
.week-head .dd { font-size: 20px; font-weight: 600; margin-top: 2px; }
.week-head.today .dd { color: var(--primary); }
.week-head.is-weekend .dd { color: var(--weekend); }
.week-head.is-holiday .dd { color: var(--holiday); }

.week-scroll { max-height: calc(100vh - 240px); overflow-y: auto; }
.week-row { display: grid; grid-template-columns: 70px repeat(7, 1fr); border-bottom: 1px solid var(--border); }
.week-hour { padding: 4px 8px; font-size: 11px; color: var(--muted); text-align: right; border-right: 1px solid var(--border); }
.week-cell { min-height: 48px; border-right: 1px solid var(--border); position: relative; cursor: pointer; padding: 2px; }
.week-cell:hover { background: var(--bg); }
.week-cell.is-weekend { background: rgba(239,68,68,.04); }
.week-cell.is-holiday { background: rgba(236,72,153,.06); }
.week-ev { font-size: 11px; padding: 2px 5px; border-radius: 4px; margin-bottom: 2px; color: #fff;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; font-weight: 500; }
.week-ev-time { font-size: 10px; opacity: .9; margin-right: 3px; }

.day-view .day-header { background: var(--bg2); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow); }
.day-view .day-header h3 { font-size: 22px; margin-bottom: 4px; }
.day-view .day-header .sub { color: var(--muted); font-size: 14px; }
.day-view .day-header.is-weekend h3 { color: var(--weekend); }
.day-view .day-header.is-holiday h3 { color: var(--holiday); }
.day-events { display: flex; flex-direction: column; gap: 10px; }
.day-event { background: var(--bg2); border-radius: var(--radius); padding: 14px 18px; box-shadow: var(--shadow);
    display: flex; gap: 16px; align-items: flex-start; cursor: pointer; border-left: 4px solid var(--primary);
    transition: transform .15s; }
.day-event:hover { transform: translateX(3px); }
.day-event .time { min-width: 60px; font-weight: 600; font-size: 14px; }
.day-event .time .end { font-size: 12px; color: var(--muted); font-weight: 400; }
.day-event .info { flex: 1; min-width: 0; }
.day-event .info h4 { font-size: 15px; margin-bottom: 3px; word-break: break-word; }
.day-event .info .meta { font-size: 12px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; }
.day-event .status-dot { width: 8px; height: 8px; border-radius: 50%; align-self: center; }

.modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.55); backdrop-filter: blur(4px);
    z-index: 500; display: flex; align-items: center; justify-content: center; padding: 16px;
    padding-top: calc(16px + var(--safe-top));
    padding-bottom: calc(16px + var(--safe-bottom));
    animation: fadeIn .15s; }
.modal { background: var(--bg2); border-radius: 16px; width: 100%; max-width: 640px; max-height: 92vh;
    overflow-y: auto; box-shadow: 0 24px 64px rgba(0,0,0,.35); animation: pop .25s ease-out; }
.modal-header { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center;
    justify-content: space-between; position: sticky; top: 0; background: var(--bg2); z-index: 10; border-radius: 16px 16px 0 0; }
.modal-header h3 { font-size: 17px; font-weight: 600; }
.modal-body { padding: 20px 22px; }

.modal-footer {
    padding: 16px 22px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    align-items: center;
    position: sticky;
    bottom: 0;
    background: var(--bg2);
    border-radius: 0 0 16px 16px;
    flex-wrap: wrap;
}
.modal-footer .btn { flex: 0 0 auto; }
.modal-footer .btn.btn-danger { margin-right: auto; }
.modal-footer .btn.btn-secondary,
.modal-footer .btn.btn-primary { min-width: 110px; }

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

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.chip {
    padding: 8px 14px; border-radius: 20px; font-size: 13px; cursor: pointer;
    border: 1px solid var(--border); background: var(--bg2); color: var(--fg);
    transition: all .15s; font-weight: 500; line-height: 1.2;
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 34px; user-select: none;
}
.chip:hover { border-color: var(--primary); background: var(--bg); }
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.attach-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--bg);
    border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 6px; }
.attach-item .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-item .rm { color: var(--danger); cursor: pointer; }

.notif-panel { position: fixed; top: calc(var(--header-h) + var(--safe-top) + 8px);
    right: 12px; width: 380px; max-width: calc(100vw - 24px);
    max-height: calc(100vh - var(--header-h) - var(--safe-top) - 24px);
    background: var(--bg2); border-radius: var(--radius);
    box-shadow: var(--shadow); z-index: 300; overflow: hidden; display: flex; flex-direction: column;
    animation: pop .2s ease-out; }
.notif-list { overflow-y: auto; flex: 1; }
.notif-item { padding: 14px 18px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background .15s; }
.notif-item:hover { background: var(--bg); }
.notif-item.unread { background: rgba(37,99,235,.05); border-left: 3px solid var(--primary); }
.notif-item h5 { font-size: 14px; margin-bottom: 3px; font-weight: 600; }
.notif-item p { font-size: 13px; color: var(--fg2); }
.notif-item .time { font-size: 11px; color: var(--muted); margin-top: 4px; }

#toast-container { position: fixed; top: calc(var(--header-h) + var(--safe-top) + 12px); right: 12px; z-index: 9999;
    display: flex; flex-direction: column; gap: 8px; pointer-events: none; max-width: calc(100vw - 24px); }
.toast { padding: 12px 18px; background: var(--bg2); border-radius: var(--radius-sm);
    box-shadow: var(--shadow); border-left: 4px solid var(--primary); font-size: 14px;
    animation: slideIn .2s; pointer-events: auto; max-width: 340px; }
.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--danger); }
.toast.warn { border-color: var(--warning); }
@keyframes slideIn { from { opacity: 0; transform: translateX(40px); } }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card { background: var(--bg2); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.stat-card .label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.stat-card .value { font-size: 28px; font-weight: 700; margin-top: 6px; }

.help-section { background: var(--bg2); border-radius: var(--radius); padding: 22px 26px; box-shadow: var(--shadow); margin-bottom: 16px; }
.help-section h3 { font-size: 17px; margin-bottom: 12px; }
.help-section h4 { font-size: 15px; margin: 14px 0 8px; }
.help-section p, .help-section li { font-size: 14px; color: var(--fg2); margin-bottom: 6px; }
.help-section ol, .help-section ul { padding-left: 22px; }
.help-section code { background: var(--bg); padding: 2px 6px; border-radius: 4px; font-size: 13px; font-family: monospace; }

.settings-grid { display: grid; gap: 16px; }
.settings-block { background: var(--bg2); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.settings-block h3 { font-size: 16px; margin-bottom: 16px; }
.settings-block h4 { font-size: 14px; margin-bottom: 10px; }
.settings-block p.hint { font-size: 13px; color: var(--fg2); margin-bottom: 12px; line-height: 1.5; }

.switch {
    display: inline-flex; align-items: center; gap: 12px;
    cursor: pointer; user-select: none; font-size: 14px; color: var(--fg);
    padding: 4px 0; line-height: 1.4;
}
.switch input { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.switch .track {
    width: 44px; height: 24px; background: var(--border); border-radius: 12px;
    position: relative; transition: background .2s; flex-shrink: 0;
    display: inline-block;
}
.switch .thumb {
    position: absolute; top: 2px; left: 2px; width: 20px; height: 20px;
    background: #fff; border-radius: 50%; transition: transform .2s;
    box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track .thumb { transform: translateX(20px); }
.switch > span:last-child { font-size: 14px; color: var(--fg); }

.search-bar { display: flex; align-items: center; gap: 8px; background: var(--bg2); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 8px 12px; max-width: 320px; min-height: 40px; }
.search-bar input { border: none; background: transparent; outline: none; flex: 1; }
.search-bar svg { color: var(--muted); flex-shrink: 0; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }

.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .ico { font-size: 48px; margin-bottom: 12px; opacity: .5; }

/* Типы событий */
.types-list { display: flex; flex-direction: column; gap: 8px; }
.type-row {
    display: grid; grid-template-columns: 28px 1fr auto; gap: 12px; align-items: center;
    padding: 12px 14px; background: var(--bg2); border-radius: var(--radius-sm);
    border-left: 4px solid var(--primary); box-shadow: var(--shadow);
}
.type-row .swatch {
    width: 22px; height: 22px; border-radius: 6px; flex-shrink: 0;
}
.type-row .name { font-weight: 600; font-size: 14px; }
.type-row .code { font-size: 11px; color: var(--muted); font-family: monospace; }
.type-row .actions { display: flex; gap: 6px; }
.type-row .actions button {
    background: transparent; border: none; cursor: pointer; padding: 6px;
    color: var(--fg2); border-radius: 6px; display: flex; align-items: center; justify-content: center;
}
.type-row .actions button:hover { background: var(--bg); color: var(--fg); }
.type-row .actions button.danger:hover { color: var(--danger); }

/* Праздники */
.holiday-row {
    display: grid; grid-template-columns: 130px 1fr auto; gap: 12px; align-items: center;
    padding: 10px 14px; background: var(--bg2); border-radius: var(--radius-sm);
    border-left: 4px solid var(--holiday); box-shadow: var(--shadow);
    margin-bottom: 6px;
}
.holiday-row .date { font-weight: 600; font-size: 13px; color: var(--holiday); }
.holiday-row .title { font-size: 14px; }
.holiday-row .kind { font-size: 11px; color: var(--muted); text-transform: uppercase; }
.holiday-row .actions { display: flex; gap: 6px; }
.holiday-row .actions button {
    background: transparent; border: none; cursor: pointer; padding: 6px;
    color: var(--fg2); border-radius: 6px; display: flex; align-items: center; justify-content: center;
}
.holiday-row .actions button:hover { background: var(--bg); color: var(--fg); }
.holiday-row .actions button.danger:hover { color: var(--danger); }

@media (max-width: 900px) {
    .main-area { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed;
        top: calc(var(--header-h) + var(--safe-top));
        left: 0; width: 280px; max-width: 85vw;
        transform: translateX(-100%); transition: transform .25s;
        z-index: 200;
        height: calc(100vh - var(--header-h) - var(--safe-top));
        box-shadow: var(--shadow);
    }
    .sidebar.open { transform: translateX(0); }
    .burger { display: flex; }
    .content { padding: 14px; padding-bottom: calc(80px + var(--safe-bottom)); }
    .cal-toolbar h2 { font-size: 16px; min-width: auto; }
    .cal-toolbar { gap: 8px; }
    .cal-view-switch button { padding: 8px 12px; min-width: 60px; font-size: 12px; }
    .month-day { min-height: 72px; padding: 5px; }
    .month-day .day-num { width: 22px; height: 22px; font-size: 12px; }
    .month-day .ev-mini { font-size: 10px; padding: 1px 4px; }
    .month-day .day-label { font-size: 9px; }
    .week-grid { grid-template-columns: 44px repeat(7, 1fr); font-size: 10px; }
    .week-head { padding: 6px 2px; }
    .week-head .dd { font-size: 14px; }
    .week-hour { padding: 3px 4px; font-size: 10px; }
    .week-cell { min-height: 40px; }
    .week-ev { font-size: 10px; padding: 1px 4px; }
    .form-row, .form-row-3 { grid-template-columns: 1fr; }

    .modal-footer {
        padding: 12px 16px;
        gap: 8px;
    }
    .modal-footer .btn {
        flex: 0 0 auto;
        min-width: 90px;
        padding: 10px 14px;
    }
    .modal-footer .btn.btn-danger { margin-right: auto; }
    .modal-footer .btn.btn-secondary,
    .modal-footer .btn.btn-primary { min-width: 100px; }

    .notif-panel {
        top: calc(var(--header-h) + var(--safe-top) + 8px);
        left: 8px; right: 8px; width: auto; max-width: none;
    }
    .topbar .brand .text { display: none; }
    .btn-new-event {
        bottom: calc(18px + var(--safe-bottom));
        right: calc(18px + var(--safe-right));
        width: 54px; height: 54px;
    }
    .btn-new-event svg { width: 22px; height: 22px; }
    .day-event { padding: 12px; gap: 12px; }
    .day-event .time { min-width: 48px; font-size: 13px; }

    .type-row { grid-template-columns: 24px 1fr auto; gap: 8px; }
    .holiday-row { grid-template-columns: 1fr auto; gap: 8px; }
    .holiday-row .date { grid-column: 1 / -1; }
}

@media (max-width: 480px) {
    body { font-size: 14px; }
    .login-card { padding: 28px 22px; }
    .content { padding: 10px; }
    .month-day { min-height: 60px; }
    .topbar { gap: 6px; padding-left: calc(8px + var(--safe-left)); padding-right: calc(8px + var(--safe-right)); }
    .topbar .brand .logo-ico { width: 30px; height: 30px; font-size: 16px; }
    .icon-btn { width: 36px; height: 36px; }
    .icon-btn svg { width: 18px; height: 18px; }
    .modal-footer { padding: 10px 12px; gap: 6px; }
    .modal-footer .btn { padding: 9px 12px; font-size: 13px; min-width: 80px; }
    .modal-footer .btn.btn-secondary,
    .modal-footer .btn.btn-primary { min-width: 90px; }
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

@media print { .topbar, .sidebar, .btn-new-event, .cal-toolbar { display: none !important; } }