/* Студия: тёмная ореховая тема из бренда Расула (brand-tokens v2.1) */
:root {
  --bg: #513C2C;
  --bg-deep: #45301F;
  --bg-deeper: #3A2818;
  --surface: #634A38;
  --text: #FFF7DE;
  --text-2: #E7D8C4;
  --muted: #B4B2BF;
  --accent: #40BCD8;
  --accent-ink: #0C3D48;
  --accent-text: #5FD0E8;
  --accent-soft: rgba(64, 188, 216, .14);
  --rose: #D6A2AD;
  --rose-ink: #4B1528;
  --rose-text: #E4B9C2;
  --warn: #E7B84F;
  --warn-ink: #45301F;
  --danger: #EB9DAD;
  --danger-fill: #C0455B;
  --line: rgba(255, 247, 222, .14);
  --font-display: 'Rubik', sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg-deep);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
}
h1, h2, h3 { font-family: var(--font-display); margin: 0; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 16px; font-weight: 700; }
a { color: var(--accent-text); text-decoration: none; }

.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 190px; flex-shrink: 0;
  background: var(--bg-deeper);
  padding: 20px 12px;
  display: flex; flex-direction: column; gap: 6px;
  position: sticky; top: 0; height: 100vh;
}
.logo {
  font-family: var(--font-display); font-weight: 800; font-size: 22px;
  padding: 0 10px 16px;
}
.sidebar nav { display: flex; flex-direction: column; gap: 4px; }
.sidebar nav a {
  color: var(--text-2); padding: 9px 12px; border-radius: 9px;
  font-size: 14px;
}
.sidebar nav a:hover { background: rgba(255, 247, 222, .06); }
.sidebar nav a.active {
  background: var(--accent); color: var(--accent-ink); font-weight: 600;
}
.sidebar-bottom { margin-top: auto; }

.content { flex: 1; min-width: 0; padding: 24px 28px 60px; }
.page-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 18px; gap: 12px; flex-wrap: wrap;
}

.btn {
  display: inline-block; background: var(--accent); color: var(--accent-ink);
  border: 0; border-radius: 9px; padding: 9px 16px;
  font: 600 14px var(--font-body); cursor: pointer;
}
.btn:hover { background: #7FDCEE; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-ghost {
  display: inline-block; background: transparent; color: var(--text-2);
  border: 1px solid var(--line); border-radius: 9px; padding: 8px 14px;
  font: 500 13px var(--font-body); cursor: pointer;
}
.btn-ghost:hover { border-color: rgba(255, 247, 222, .35); }
.btn-danger { background: var(--danger-fill); color: var(--text); }

.badge {
  display: inline-block; font-size: 11px; font-weight: 600;
  padding: 2px 9px; border-radius: 999px; vertical-align: middle;
}
.badge-raw { background: rgba(180, 178, 191, .25); color: var(--text-2); }
.badge-montaged { background: var(--accent); color: var(--accent-ink); }
.badge-scheduled { background: var(--warn); color: var(--warn-ink); }
.badge-published { background: var(--rose); color: var(--rose-ink); }

.cards {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}
.card {
  background: var(--surface); border-radius: 14px; overflow: hidden;
}
.card .frame {
  position: relative; aspect-ratio: 9 / 12; background: var(--bg-deeper);
}
.card .frame img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.card .frame .dur {
  position: absolute; right: 8px; bottom: 8px;
  background: rgba(0, 0, 0, .55); color: var(--text);
  font-size: 11px; padding: 2px 7px; border-radius: 6px;
}
.card .frame .badge { position: absolute; left: 8px; top: 8px; }
.card .meta { padding: 10px 12px 12px; }
.card .meta .title { font-weight: 600; font-size: 14px; margin: 0; }
.card .meta .sub {
  color: var(--muted); font-size: 12px; margin: 3px 0 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card .actions {
  display: flex; gap: 6px; padding: 0 12px 12px; flex-wrap: wrap;
}
.card .actions .btn, .card .actions .btn-ghost {
  padding: 6px 10px; font-size: 12px;
}

.upload-zone {
  border: 1.5px dashed rgba(95, 208, 232, .5); background: var(--accent-soft);
  border-radius: 14px; padding: 22px; text-align: center;
  color: var(--accent-text); cursor: pointer; margin-bottom: 20px;
  font-size: 14px;
}
.upload-zone.drag { background: rgba(64, 188, 216, .25); }
.progress {
  height: 8px; border-radius: 6px; background: var(--bg-deeper);
  overflow: hidden; margin-top: 10px; display: none;
}
.progress i {
  display: block; height: 100%; width: 0; background: var(--accent);
  transition: width .2s;
}

.notice {
  background: var(--surface); border-radius: 12px; padding: 12px 16px;
  margin-bottom: 16px; font-size: 13px; color: var(--text-2);
}
.notice.error { border-left: 3px solid var(--danger-fill); border-radius: 0 12px 12px 0; }

/* календарь */
.cal-table { width: 100%; border-collapse: separate; border-spacing: 4px; table-layout: fixed; }
.cal-table th {
  font: 500 12px var(--font-body); color: var(--muted); padding: 4px 2px;
}
.cal-table th.today { color: var(--text); background: var(--accent-soft); border-radius: 8px; }
.cal-table td.rowlabel {
  font-size: 13px; color: var(--text-2); width: 84px; padding-right: 6px;
}
.cal-cell {
  background: var(--bg); border-radius: 9px; min-height: 74px;
  vertical-align: top; padding: 4px;
}
.cal-cell.dragover { outline: 2px dashed var(--accent-text); }
.chip {
  background: var(--accent); color: var(--accent-ink); border-radius: 7px;
  padding: 5px 7px; margin-bottom: 4px; cursor: grab; font-size: 12px;
}
.chip .t { font-weight: 600; line-height: 1.2; display: block;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip .s { font-size: 11px; opacity: .8; }
.chip.published { background: var(--rose); color: var(--rose-ink); }
.chip.reminded { background: var(--warn); color: var(--warn-ink); }
.tray { margin-top: 20px; }
.tray-items { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.tray-item {
  background: var(--surface); border-radius: 10px; padding: 8px 12px;
  display: flex; align-items: center; gap: 10px; cursor: grab;
}
.tray-item img { width: 30px; height: 46px; object-fit: cover; border-radius: 5px; background: var(--bg-deeper); }
.tray-item .t { font-size: 13px; font-weight: 600; }
.tray-item .s { font-size: 12px; color: var(--muted); }

/* монтаж */
.montage-grid { display: flex; gap: 24px; flex-wrap: wrap; }
.opt-group { margin-bottom: 18px; }
.opt-group .label { color: var(--muted); font-size: 12px; margin-bottom: 7px; }
.seg { display: flex; gap: 7px; flex-wrap: wrap; }
.seg input { display: none; }
.seg label {
  color: var(--text-2); font-size: 13px; padding: 8px 14px;
  border: 1px solid var(--line); border-radius: 9px; cursor: pointer;
}
.seg input:checked + label {
  background: var(--accent); color: var(--accent-ink);
  border-color: var(--accent); font-weight: 600;
}
select, input[type=text], input[type=time], input[type=password], textarea {
  background: var(--bg); color: var(--text); border: 1px solid var(--line);
  border-radius: 9px; padding: 9px 12px; font: 400 14px var(--font-body);
  width: 100%;
}
select:focus, input:focus, textarea:focus { outline: 1.5px solid var(--accent); }

/* вход */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--bg-deep);
}
.login-box {
  width: 320px; background: var(--bg-deeper); border-radius: 16px;
  padding: 28px;
}
.login-box h1 { margin-bottom: 4px; }
.login-box p { color: var(--muted); font-size: 13px; margin: 0 0 18px; }
.login-box .btn { width: 100%; margin-top: 12px; }
.login-error { color: var(--danger); font-size: 13px; margin-top: 10px; }

/* диалог плашки календаря */
dialog {
  background: var(--bg-deeper); color: var(--text); border: 1px solid var(--line);
  border-radius: 14px; padding: 20px; width: 340px; max-width: 92vw;
}
dialog::backdrop { background: rgba(0, 0, 0, .5); }
dialog .row { margin-bottom: 12px; }
dialog .row .label { color: var(--muted); font-size: 12px; margin-bottom: 5px; }
dialog .dlg-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }

/* предпросмотр «как в рилзе»: пропорции безопасной зоны из движка монтажа
   (кадр 1080x1920: сверху 222px, снизу от 1542px, справа внизу от 891px) */
.reels-dlg { width: auto; }
.reels-frame {
  position: relative; width: min(300px, 78vw); aspect-ratio: 9 / 16;
  background: #000; border-radius: 14px; overflow: hidden; margin: 0 auto;
}
.reels-frame video {
  width: 100%; height: 100%; object-fit: cover; display: block; cursor: pointer;
}
.reels-ui { position: absolute; inset: 0; pointer-events: none; }
.ru-top {
  position: absolute; top: 0; left: 0; right: 0; height: 11.6%;
  background: rgba(0, 0, 0, .45);
}
.ru-bottom {
  position: absolute; bottom: 0; left: 0; right: 0; height: 19.7%;
  background: rgba(0, 0, 0, .45); padding: 8px 10px;
}
.ru-avatar {
  display: inline-block; width: 22px; height: 22px; border-radius: 50%;
  background: rgba(255, 255, 255, .55); vertical-align: middle;
}
.ru-line {
  display: block; height: 7px; border-radius: 4px;
  background: rgba(255, 255, 255, .4); margin-top: 7px;
}
.ru-line.w60 { width: 60%; }
.ru-line.w80 { width: 80%; }
.ru-rail {
  position: absolute; right: 0; bottom: 19.7%; width: 17.5%; height: 42%;
  background: rgba(0, 0, 0, .35);
  display: flex; flex-direction: column; align-items: center;
  justify-content: flex-end; gap: 14px; padding-bottom: 12px;
}
.ru-ic {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .65);
}
.reels-hint {
  color: var(--muted); font-size: 12px; margin-top: 10px; max-width: 300px;
}
.reels-hint label { color: var(--text-2); }

@media (max-width: 760px) {
  .layout { flex-direction: column; }
  .sidebar {
    width: auto; height: auto; position: static; flex-direction: row;
    align-items: center; padding: 10px 12px;
  }
  .logo { padding: 0 10px 0 4px; font-size: 18px; }
  .sidebar nav { flex-direction: row; overflow-x: auto; }
  .sidebar nav a { padding: 7px 10px; font-size: 13px; white-space: nowrap; }
  .sidebar-bottom { display: none; }
  .content { padding: 16px 12px 60px; }
  .cal-scroll { overflow-x: auto; }
  .cal-table { min-width: 760px; }
}
