﻿:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --border: #e3e5e8;
  --border-strong: #cdd1d7;
  --text: #1f2330;
  --text-muted: #6b7280;
  --text-light: #9aa1ad;
  --accent: #4a90d9;
  --shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-lg: 0 6px 18px rgba(15, 23, 42, .08);
  --radius: 10px;
  --radius-sm: 6px;
  --group-col-w: 150px;
  --slot-w: 45px;
  --row-h: 78px;
}

.t-ec-app * {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.t-ec-app {
  display: flex;
  flex-direction: column;
  /*min-height: 100vh;*/
  /*max-width: 1500px;*/
  margin: 0 auto;
  padding: 0 24px 24px;
}

.t-ec-app-main {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 20px;
  flex: 1;
  min-height: 0;
}

.t-ec-sidebar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  height: fit-content;
  position: sticky;
  /*top: 18px;*/
}

.t-ec-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.t-ec-sidebar-header h2 {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
}

.t-ec-sidebar-reset {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: all .15s ease;
}

.t-ec-sidebar-reset:hover { background: var(--bg); color: var(--text); }

.t-ec-status-list { list-style: none; display: flex; flex-direction: column; gap: 4px; margin: 0; }

.t-ec-status-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all .15s ease;
  user-select: none;
}

.t-ec-status-item:hover { background: var(--bg); }
.t-ec-status-item.t-ec-is-active { background: #eef4fb; border-color: #c9defa; }
.t-ec-status-item.t-ec-is-empty { opacity: .5; }

.t-ec-status-item-left { display: flex; align-items: center; gap: 10px; }

.t-ec-status-item-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.t-ec-status-item-name { font-size: 13px; font-weight: 500; }

.t-ec-status-item-count {
  background: var(--bg);
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  min-width: 24px;
  text-align: center;
}

.t-ec-status-item.t-ec-is-active .t-ec-status-item-count { background: var(--accent); color: #fff; }

.t-ec-schedule { display: flex; flex-direction: column; gap: 12px; min-width: 0; }

.t-ec-schedule-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.t-ec-schedule-toolbar h2 { font-size: 16px; font-weight: 600; }

.t-ec-schedule-search {
  width: 280px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 13px;
  color: var(--text);
  transition: border-color .15s ease, box-shadow .15s ease;
}

.t-ec-schedule-search:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(74, 144, 217, .15);
}

.t-ec-schedule-scroll {
  overflow: visible;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-height: none;
}

.t-ec-schedule-grid {
  display: grid;
  background-color: var(--surface);
  background-image: linear-gradient(
    to right,
    var(--border) 0,
    var(--border) 1px,
    transparent 1px,
    transparent 100%
  );
  background-size: calc(var(--slot-w-actual, var(--slot-w)) * 2) 100%;
  background-position: var(--group-col-w) 0;
  background-repeat: repeat;
}

.t-ec-grid-head {
  background: #f7f8fa;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
  white-space: nowrap;
  border-bottom: 1px solid var(--border-strong);
  padding: 10px 6px !important;
  display: flex;
  align-items: center;
  justify-content: center;
}

.t-ec-grid-head-group {
  text-align: left;
  justify-content: flex-start;
  padding-left: 14px;
  border-right: 2px solid var(--border-strong);
}

.t-ec-group-cell {
  background: var(--surface);
  border-right: 2px solid var(--border-strong);
  border-bottom: 1px solid var(--border);
  padding: 12px 14px !important;
  width: var(--group-col-w);
  min-width: var(--group-col-w);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.t-ec-group-cell-name {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .02em;
  color: var(--text);
  margin-bottom: 4px;
  line-height: 1.3;
}

.t-ec-group-cell-count {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg);
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  align-self: flex-start;
}

.t-ec-slot-empty {
  background: transparent;
  cursor: pointer;
  /*border-bottom: 1px solid var(--border);*/
  height: var(--row-h);
  min-width: 0;
  min-height: 0;
  touch-action: none;
}
.t-ec-slot-empty:hover { background-color: rgba(74, 144, 217, .08); }

.t-ec-event {
  position: relative;
  padding: 8px 14px !important;
  height: var(--row-h);
  border-radius: 4px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  overflow: hidden;
  border-left: 4px solid currentColor;
  border-bottom: 1px solid var(--border);
  transition: box-shadow .12s ease;
  min-width: 0;
}

.t-ec-event:hover {
  box-shadow: 0 2px 8px rgba(15, 23, 42, .12);
}

.t-ec-event-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 8px;
  cursor: ew-resize;
  z-index: 2;
  background: transparent;
  transition: background .15s ease;
}

.t-ec-event-handle-left  { left: 0; }
.t-ec-event-handle-right { right: 0; }

.t-ec-event-handle:hover,
.t-ec-event-handle.t-ec-is-dragging {
  background: rgba(0, 0, 0, .15);
}

.t-ec-event.t-ec-is-resizing {
  box-shadow: 0 0 0 2px var(--accent), 0 2px 8px rgba(15, 23, 42, .18);
  z-index: 3;
}

.t-ec-event-time {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 2px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.t-ec-event-title {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.t-ec-event-info {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.t-ec-event:not([style*="background"]) {
  background: #f0f0f0;
  color: #666;
}

.t-ec-event.t-ec-is-compact .t-ec-event-info,
.t-ec-event.t-ec-is-compact .t-ec-event-title { white-space: nowrap; }
.t-ec-event.t-ec-is-tiny .t-ec-event-info { display: none; }
.t-ec-event.t-ec-is-tiny .t-ec-event-time { display: none; }

.t-ec-event.t-ec-is-continued-left {
  border-left: none;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}
.t-ec-event.t-ec-is-continued-left::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  border-style: solid;
  border-width: 6px 0 6px 6px;
  border-color: transparent transparent transparent rgba(0,0,0,.15);
}

.t-ec-event.t-ec-is-continued-right {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
.t-ec-event.t-ec-is-continued-right::after {
  content: '';
  position: absolute;
  right: 0; top: 50%;
  transform: translateY(-50%);
  border-style: solid;
  border-width: 6px 6px 6px 0;
  border-color: transparent rgba(0,0,0,.15) transparent transparent;
}

.t-ec-empty-row td {
  text-align: center;
  color: var(--text-muted);
  padding: 40px;
  font-size: 14px;
}

.t-ec-tech-break {
  height: var(--row-h);
  background-color: #f0f0f2;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8'%3E%3Cpath d='M-1,1 l2,-2 M0,8 l8,-8 M7,9 l2,-2' stroke='%23b0b0b8' stroke-width='1'/%3E%3C/svg%3E");
  background-repeat: repeat;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  position: relative;
  box-sizing: border-box;
}
.t-ec-tech-break:hover { background-color: #e8e8ec; }
.t-ec-tech-break-label {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  opacity: 0.7;
  pointer-events: none;
}

.t-ec-event.t-ec-is-preparatory {
  opacity: 0.85;
  z-index: 1;
  border-left-style: dashed;
  border-left-width: 3px;
}

.t-ec-selection-overlay {
  background: rgba(74, 144, 217, .15);
  border: 2px solid rgba(74, 144, 217, .45);
  border-radius: 4px;
  z-index: 5;
  min-height: 0;
  height: var(--row-h);
  box-sizing: border-box;
}

.t-ec-ctx-menu {
  position: fixed;
  z-index: 1000;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 16px rgba(15, 23, 42, .15), 0 1px 3px rgba(15, 23, 42, .1);
  padding: 4px;
  min-width: 160px;
}

.t-ec-ctx-menu-item {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background .12s ease;
}

.t-ec-ctx-menu-item:hover {
  background: rgba(74, 144, 217, .1);
}

.t-ec-event.t-ec-is-stage {
  border-left-style: solid;
  border-left-width: 4px;
  opacity: 0.9;
}
.t-ec-event.t-ec-is-stage::after {
  content: '';
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  background: currentColor;
  border-radius: 50%;
  opacity: 0.4;
}

.t-ec-group-cell.t-ec-is-additional {
  background: #f8f5ff;
  border-right-color: #d6c4f0;
}
.t-ec-group-cell.t-ec-is-additional .t-ec-group-cell-name::after {
  content: ' (доп.)';
  font-weight: 400;
  color: var(--text-muted);
}

@media (max-width: 980px) {
  .t-ec-app { padding: 0 14px 14px; }
  .t-ec-app-main { grid-template-columns: 1fr; }
  .t-ec-sidebar { position: static; }
  .t-ec-schedule-search { width: 100%; }
  .t-ec-schedule-toolbar { flex-direction: column; align-items: stretch; }
}

@media (max-width: 540px) {
  .t-ec-app-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  :root { --group-col-w: 110px; --slot-w: 50px; }
}
