:root{
  --ms-band-col: 74px;
  --ms-mode-col: 52px;
  --ms-half-col: minmax(26px, 1fr);
  --ms-date-h: 34px;
  --ms-header-h: 36px;
  --ms-row-h: 32px;
  --ms-grid-border: #d9dee8;
  --ms-grid-line: #e7ebf3;
  --ms-bg: #f5f7fb;
}

.msched{font-family:system-ui,-apple-system,"Segoe UI",Roboto,Arial,sans-serif;color:#0f172a}
.msched *{box-sizing:border-box}
.msched .ms-card{background:#fff;border:0;box-shadow:0 .125rem .5rem rgba(0,0,0,.06);border-radius:.75rem}
.msched .ms-toolbar{display:flex;gap:12px;flex-wrap:wrap;align-items:end;padding:14px 16px}
.msched .ms-field{display:flex;flex-direction:column;gap:6px;min-width:220px}
.msched .ms-field label{font-size:13px;color:#475569}
.msched input[type="text"], .msched select{
  border:1px solid #cbd5e1;border-radius:.5rem;padding:.5rem .7rem;font-size:14px;background:#fff
}
.msched button{
  border:1px solid #cbd5e1;background:#fff;border-radius:.5rem;padding:.5rem .75rem;font-size:14px;cursor:pointer
}
.msched button.ms-primary{background:#2563eb;border-color:#2563eb;color:#fff}
.msched button.ms-danger{background:#fff;border-color:#dc2626;color:#b91c1c}
.msched .ms-meta{display:flex;justify-content:space-between;gap:12px;align-items:center;margin-bottom:8px;color:#64748b;font-size:12px}
.msched .ms-main{padding:10px 12px}
.msched .ms-schedule-wrap{overflow-x:auto}
.msched .ms-schedule-area{min-width:1480px;position:relative}
.msched .ms-grid, .msched .ms-slot-layer{
  display:grid;
  grid-template-columns: var(--ms-band-col) var(--ms-mode-col) repeat(48, var(--ms-half-col));
  grid-template-rows: var(--ms-date-h) var(--ms-header-h) repeat(36, var(--ms-row-h));
}
.msched .ms-grid{position:relative;border:1px solid var(--ms-grid-border);background:#fff;isolation:isolate}
.msched .ms-slot-layer{position:absolute;inset:0;pointer-events:none;z-index:5}
.msched .ms-cell{
  min-height: var(--ms-row-h);
  border-right:1px solid var(--ms-grid-line);
  border-bottom:1px solid var(--ms-grid-line);
  display:flex;align-items:center;justify-content:center;text-align:center;
  padding:4px;font-size:12px;line-height:1.1;background:#fff;user-select:none
}
.msched .ms-head{background:#eef3fb;font-weight:600;position:sticky;z-index:4}
.msched .ms-date-head{min-height:var(--ms-date-h);top:0;z-index:8}
.msched .ms-time-head{min-height:var(--ms-header-h);top:var(--ms-date-h);z-index:7}
.msched .ms-band-cell{background:#f7f9fc;font-weight:700;position:sticky;left:0;z-index:3}
.msched .ms-mode-cell{background:#fbfcfe;font-weight:600;position:sticky;left:var(--ms-band-col);z-index:3}
.msched .ms-head.ms-band-cell,.msched .ms-head.ms-mode-cell{z-index:9}
.msched .ms-corner-blank{background:#f3f6fb}
.msched .ms-date-strip-cell{padding:0;background:#f3f6fb;overflow:hidden}
.msched .ms-date-strip{display:grid;height:100%;width:100%;align-items:stretch}
.msched .ms-date-switch{
  cursor:pointer;display:flex;flex-direction:column;justify-content:center;align-items:center;gap:2px;
  transition:background-color .12s ease, box-shadow .12s ease;font-size:11px;padding:3px 2px;border-right:1px solid var(--ms-grid-line)
}
.msched .ms-date-switch:last-child{border-right:0}
.msched .ms-date-switch:hover{background:#e8f0fc}
.msched .ms-date-switch.ms-active{background:#dbeafe;box-shadow:inset 0 -2px 0 #0d6efd;color:#0b3b80}
.msched .ms-date-switch.ms-weekend{background:#fff4f4}
.msched .ms-date-switch.ms-weekend.ms-active{background:#ffe4e4;box-shadow:inset 0 -2px 0 #dc3545;color:#842029}
.msched .ms-date-switch small{font-size:10px;opacity:.8}
.msched .ms-half-even{border-right:1px dashed #edf1f7}
.msched .ms-hour-start{border-left:1px solid #d2d9e6}
.msched .ms-time-cell{cursor:pointer;transition:background-color .12s ease}
.msched .ms-time-cell:hover{background:#f4f8ff}
.msched .ms-slot{
  margin:3px;border-radius:6px;padding:3px 18px 3px 18px;font-size:10px;line-height:1.1;color:#0b2239;
  border:1px solid rgba(0,0,0,.08);overflow:hidden;box-shadow:0 1px 2px rgba(0,0,0,.06);
  pointer-events:auto;min-width:0;display:flex;flex-direction:column;justify-content:center;position:relative;cursor:default;touch-action:none
}
.msched .ms-slot.ms-editable{cursor:grab}
.msched .ms-slot.ms-dragging,.msched .ms-slot.ms-resizing{
  opacity:.92;box-shadow:0 0 0 2px rgba(13,110,253,.25), 0 6px 16px rgba(0,0,0,.14);z-index:20
}
.msched .ms-slot strong,.msched .ms-slot small{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;pointer-events:none}
.msched .ms-slot strong{font-size:10px}
.msched .ms-slot small{opacity:.82}

.msched .ms-slot-ph{
  background:#e7f0ff;       /* мягкий голубой */
  border:1px solid #b6d0ff;
  color:#2f5fb3;            /* приглушённый синий */
}

.msched .ms-slot-cw{
  background:#e6f6ea;       /* мягкий зелёный */
  border:1px solid #b7e0c1;
  color:#2e7d4f;            /* спокойный зелёный */
}

.msched .ms-slot-digi{
  background:#fdeaea;       /* мягкий красный */
  border:1px solid #f5bcbc;
  color:#b33a3a;            /* приглушённый красный */
}
.msched .ms-slot-current{box-shadow:0 0 0 2px rgba(255,99,71,.35), 0 1px 2px rgba(0,0,0,.08)}
.msched .ms-slot-handle{position:absolute;top:0;bottom:0;width:12px;background:rgba(0,0,0,.04);cursor:ew-resize}
.msched .ms-slot-handle:hover{background:rgba(0,0,0,.10)}
.msched .ms-slot-handle-left{left:0;border-right:1px solid rgba(0,0,0,.08)}
.msched .ms-slot-handle-right{right:0;border-left:1px solid rgba(0,0,0,.08)}
.msched .ms-slot-edit-btn{
  position:absolute;top:2px;right:2px;width:14px;height:14px;border:0;padding:0;border-radius:50%;
  background:rgba(255,255,255,.9);color:#334155;font-size:10px;line-height:14px;text-align:center;cursor:pointer;
  box-shadow:0 0 0 1px rgba(0,0,0,.08)
}
.msched .ms-slot-edit-btn:hover{background:#fff;color:#0d6efd}
.msched .ms-slot-empty-note{color:#9aa4b2;background:transparent;border:0;box-shadow:none;pointer-events:none;justify-content:center}
.msched .ms-event-box{margin-top:12px;padding:12px 16px}
.msched .ms-event-box pre{margin:0;background:#f8fafc;border:1px solid #e2e8f0;border-radius:.5rem;padding:10px;white-space:pre-wrap}
.msched .ms-modal-backdrop{position:fixed;inset:0;background:rgba(15,23,42,.35);display:none;align-items:center;justify-content:center;z-index:9999;padding:16px}
.msched .ms-modal-backdrop.ms-open{display:flex}
.msched .ms-modal{background:#fff;border-radius:.75rem;box-shadow:0 20px 50px rgba(0,0,0,.2);width:100%;max-width:360px;overflow:hidden}
.msched .ms-modal-header,.msched .ms-modal-footer{padding:10px 14px;border-bottom:1px solid #e2e8f0}
.msched .ms-modal-footer{border-top:1px solid #e2e8f0;border-bottom:0;display:flex;gap:8px;justify-content:flex-end}
.msched .ms-modal-body{padding:14px}
.msched .ms-modal-title{font-size:15px;font-weight:700}
.msched .ms-close{border:0;background:transparent;font-size:18px;line-height:1;cursor:pointer}
.msched .ms-row{display:flex;justify-content:space-between;align-items:center;gap:10px}
.msched .ms-small{font-size:12px;color:#64748b}
@media (max-width: 900px){
  .msched .ms-toolbar{padding:12px}
  .msched .ms-field{min-width:180px}
}


.msched .ms-band-cell.ms-hover-band,
.msched .ms-mode-cell.ms-hover-mode{
  box-shadow: inset 0 0 0 2px #6c757d;
  background-image: linear-gradient(rgba(255,255,255,0.18), rgba(255,255,255,0.18));
}

.ms-date-switch{
  position: relative;
}

.ms-date-check{
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 12px;
  line-height: 1;
  font-weight: 700;
  color: #198754;
}