/* AI 영화·영상 프로젝트 대시보드 — 다크 시네마틱 테마 */
:root {
  --bg: #05070d;
  --panel: rgba(16, 22, 34, 0.72);
  --panel-solid: #0d1320;
  --line: rgba(120, 160, 200, 0.16);
  --line-strong: rgba(120, 190, 220, 0.34);
  --text: #e7eef8;
  --muted: #93a3bb;
  --dim: #66758c;
  --cyan: #22d3ee;
  --cyan-soft: rgba(34, 211, 238, 0.14);
  --amber: #f59e0b;
  --amber-soft: rgba(245, 158, 11, 0.14);
  --violet: #a78bfa;
  --violet-soft: rgba(167, 139, 250, 0.14);
  --green: #34d399;
  --red: #f87171;
  --radius: 18px;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo",
    "Malgun Gothic", "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3, h4 { margin: 0; line-height: 1.3; letter-spacing: -0.01em; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--cyan); }

.aurora {
  position: fixed;
  inset: -20% -10% auto -10%;
  height: 90vh;
  pointer-events: none;
  background:
    radial-gradient(46% 42% at 18% 12%, rgba(34, 211, 238, 0.16), transparent 70%),
    radial-gradient(38% 36% at 82% 6%, rgba(167, 139, 250, 0.14), transparent 72%),
    radial-gradient(42% 36% at 62% 42%, rgba(245, 158, 11, 0.09), transparent 74%);
  filter: blur(10px);
  z-index: 0;
}
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.5;
  background-image: repeating-linear-gradient(
    0deg,
    rgba(255, 255, 255, 0.016) 0 1px,
    transparent 1px 3px
  );
}

/* ---------------- top bar ---------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  padding: 16px clamp(16px, 4vw, 48px);
  background: rgba(5, 7, 13, 0.82);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 42px; height: 42px;
  border-radius: 14px;
  color: var(--cyan);
  font-size: 20px;
  background: radial-gradient(circle at 30% 25%, rgba(34, 211, 238, 0.28), rgba(13, 19, 32, 0.9));
  border: 1px solid var(--line-strong);
  box-shadow: 0 0 26px rgba(34, 211, 238, 0.18), inset 0 0 18px rgba(34, 211, 238, 0.1);
  flex: none;
}
.brand-kicker {
  font-size: 10.5px;
  letter-spacing: 0.22em;
  color: var(--dim);
  text-transform: uppercase;
}
.brand h1 { font-size: clamp(17px, 2.1vw, 21px); font-weight: 700; }

.topbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------------- buttons ---------------- */
.btn {
  cursor: pointer;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(19, 27, 41, 0.9);
  color: var(--text);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
  white-space: nowrap;
}
.btn:hover { border-color: var(--cyan); background: rgba(34, 211, 238, 0.1); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; }
.btn.primary {
  background: linear-gradient(120deg, #22d3ee, #38bdf8);
  color: #04121a;
  border-color: transparent;
}
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger:hover { border-color: var(--red); background: rgba(248, 113, 113, 0.1); }
.btn.tiny { padding: 5px 10px; font-size: 12px; }
.btn.icon { padding: 6px 10px; }

/* ---------------- layout ---------------- */
.wrap {
  position: relative;
  z-index: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px clamp(16px, 4vw, 48px) 40px;
  display: flex;
  flex-direction: column;
  gap: 34px;
}

/* ---------------- hero ---------------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 232px;
  gap: 26px;
  padding: 26px clamp(18px, 3vw, 32px);
  border-radius: calc(var(--radius) + 6px);
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(34, 211, 238, 0.09), rgba(13, 19, 32, 0.2) 42%, rgba(245, 158, 11, 0.07)),
    var(--panel);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(34, 211, 238, 0.06), transparent);
  transform: translateX(-100%);
  animation: sweep 9s ease-in-out infinite;
  pointer-events: none;
}
@keyframes sweep {
  0%, 70% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
.hero-main { min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--cyan);
}
.hero-eyebrow .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.16);
  animation: pulse 2.4s infinite;
}
@keyframes pulse {
  50% { box-shadow: 0 0 0 9px rgba(34, 211, 238, 0.04); }
}
.hero-title { font-size: clamp(22px, 3.2vw, 34px); font-weight: 800; letter-spacing: -0.02em; }
.hero-title small { display: block; font-size: 12px; font-weight: 500; letter-spacing: 0.14em; color: var(--dim); text-transform: uppercase; margin-top: 6px; }
.hero-desc { color: var(--muted); font-size: 13.5px; max-width: 62ch; }
.hero-next {
  margin-top: 4px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px dashed rgba(34, 211, 238, 0.35);
  background: rgba(34, 211, 238, 0.06);
  font-size: 13.5px;
}
.hero-next strong { color: #f8fafc; }
.hero-next .tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.16);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.3);
}
.hero-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding-left: 18px;
  border-left: 1px solid var(--line);
}
.ring {
  --p: 0;
  width: 132px; height: 132px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--cyan) calc(var(--p) * 1%), rgba(120, 160, 200, 0.12) 0);
  position: relative;
}
.ring::before {
  content: "";
  position: absolute;
  inset: 9px;
  border-radius: 50%;
  background: #070b13;
  border: 1px solid var(--line);
}
.ring-inner { position: relative; text-align: center; }
.ring-value { font-size: 30px; font-weight: 800; letter-spacing: -0.03em; }
.ring-value span { font-size: 14px; color: var(--muted); font-weight: 600; }
.ring-label { font-size: 11px; color: var(--dim); letter-spacing: 0.08em; }
.hero-side .side-note { font-size: 11.5px; color: var(--dim); text-align: center; }

/* ---------------- filter bar ---------------- */
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  cursor: pointer;
  border: 1px solid var(--line);
  background: rgba(16, 22, 34, 0.6);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all 0.15s ease;
}
.chip:hover { color: var(--text); border-color: var(--line-strong); }
.chip[aria-pressed="true"] {
  color: #061018;
  background: linear-gradient(120deg, #67e8f9, #22d3ee);
  border-color: transparent;
  font-weight: 700;
}
.chip .count {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
}
.chip[aria-pressed="true"] .count { background: rgba(4, 18, 26, 0.18); }

/* ---------------- project cards ---------------- */
.projects { display: flex; flex-direction: column; gap: 20px; }
.project {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.28);
  overflow: hidden;
}
.project.is-active { border-color: rgba(34, 211, 238, 0.42); box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.12), 0 20px 55px rgba(0, 0, 0, 0.4); }
.project.is-hold { border-color: rgba(148, 163, 184, 0.22); }

.p-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px clamp(16px, 2.4vw, 24px);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.p-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.p-title { font-size: 19px; font-weight: 750; letter-spacing: -0.015em; }
.p-en { font-size: 11.5px; color: var(--dim); letter-spacing: 0.12em; text-transform: uppercase; }
.p-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  white-space: nowrap;
}
.p-badge.active { color: #a5f3fc; background: var(--cyan-soft); border-color: rgba(34, 211, 238, 0.4); }
.p-badge.waiting { color: #fcd34d; background: var(--amber-soft); border-color: rgba(245, 158, 11, 0.34); }
.p-badge.hold { color: #cbd5e1; background: rgba(148, 163, 184, 0.12); border-color: rgba(148, 163, 184, 0.3); }
.p-badge.done { color: #6ee7b7; background: rgba(52, 211, 153, 0.12); border-color: rgba(52, 211, 153, 0.34); }
.p-meta { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--muted); }
.p-meta span { display: inline-flex; align-items: center; gap: 5px; }
.p-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.p-progress { display: flex; align-items: center; gap: 10px; min-width: 150px; }
.bar { flex: 1; height: 6px; border-radius: 999px; background: rgba(120, 160, 200, 0.14); overflow: hidden; min-width: 70px; }
.bar > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #22d3ee, #34d399); }
.bar.hold > i { background: linear-gradient(90deg, #94a3b8, #cbd5e1); }
.p-progress small { font-size: 11.5px; color: var(--muted); white-space: nowrap; }

.p-body { padding: 18px clamp(16px, 2.4vw, 24px) 22px; display: flex; flex-direction: column; gap: 18px; }

.p-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.fact {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(8, 12, 20, 0.5);
}
.fact b { display: block; font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--dim); font-weight: 600; margin-bottom: 4px; }
.fact span { font-size: 13px; color: #dbe6f4; }

.p-notes { display: flex; flex-direction: column; gap: 6px; }
.p-notes li { font-size: 13px; color: var(--muted); margin-left: 18px; }
.p-notes li::marker { color: var(--cyan); }

/* timeline */
.timeline { display: flex; flex-direction: column; gap: 8px; }
.timeline-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 11.5px; color: var(--dim); letter-spacing: 0.1em; text-transform: uppercase; }
.tl-track {
  display: flex;
  gap: 4px;
  padding: 6px;
  border-radius: 12px;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.05) 0 1px, transparent 1px 22px),
    rgba(6, 10, 17, 0.8);
  border: 1px solid var(--line);
  overflow-x: auto;
}
.tl-seg {
  cursor: pointer;
  flex: 1 0 92px;
  border: 1px solid rgba(34, 211, 238, 0.25);
  border-radius: 9px;
  background: rgba(34, 211, 238, 0.08);
  padding: 8px 10px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: all 0.15s ease;
}
.tl-seg:hover { border-color: var(--cyan); background: rgba(34, 211, 238, 0.16); }
.tl-seg b { font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-seg small { font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tl-seg.is-done { border-color: rgba(52, 211, 153, 0.4); background: rgba(52, 211, 153, 0.12); }
.tl-seg.is-done small::after { content: " · ✅"; }

/* scenes */
.scenes { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }
.scene {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.022), rgba(8, 12, 20, 0.6));
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  scroll-margin-top: 90px;
}
.scene.is-done { border-color: rgba(52, 211, 153, 0.34); }
.scene-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.scene-no {
  font-size: 10.5px;
  letter-spacing: 0.12em;
  font-weight: 700;
  color: var(--cyan);
  border: 1px solid rgba(34, 211, 238, 0.3);
  background: rgba(34, 211, 238, 0.08);
  padding: 2px 7px;
  border-radius: 6px;
}
.tc {
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(120, 160, 200, 0.1);
}
.scene-head .spacer { flex: 1; }
.status-btn {
  cursor: pointer;
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(245, 158, 11, 0.35);
  background: var(--amber-soft);
  color: #fcd34d;
  white-space: nowrap;
}
.status-btn.is-done { border-color: rgba(52, 211, 153, 0.45); background: rgba(52, 211, 153, 0.14); color: #6ee7b7; }
.scene h4 { font-size: 15.5px; font-weight: 700; }
.scene-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.scene-tags span {
  font-size: 11.5px;
  color: #b9c7da;
  background: rgba(120, 160, 200, 0.1);
  border: 1px solid var(--line);
  padding: 2px 8px;
  border-radius: 999px;
}
.line-text {
  font-size: 13px;
  color: #eef4ff;
  padding: 8px 10px;
  border-left: 2px solid var(--amber);
  background: rgba(245, 158, 11, 0.07);
  border-radius: 0 8px 8px 0;
}
.line-text small { display: block; color: var(--dim); font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 2px; }
.prompt-block { display: flex; flex-direction: column; gap: 6px; }
.prompt-block label { font-size: 10.5px; letter-spacing: 0.12em; color: var(--dim); text-transform: uppercase; }
textarea.prompt {
  width: 100%;
  min-height: 98px;
  resize: vertical;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #060a11;
  color: #cfe0f2;
  padding: 9px 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px;
  line-height: 1.5;
}
textarea.prompt:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.12); }
.prompt-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.saved { font-size: 11px; color: var(--green); opacity: 0; transition: opacity 0.25s ease; }
.saved.show { opacity: 1; }
.scene .memo-input {
  border-radius: 9px;
  border: 1px dashed var(--line);
  background: rgba(6, 10, 17, 0.6);
  padding: 7px 9px;
  font-size: 12.5px;
  width: 100%;
}
.scene .memo-input:focus { outline: none; border-color: var(--amber); }
.mini-link {
  background: none; border: none; cursor: pointer;
  color: var(--dim); font-size: 11px; padding: 0; text-decoration: underline;
}
.mini-link:hover { color: var(--red); }
.empty-scenes {
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  padding: 18px;
  text-align: center;
  color: var(--dim);
  font-size: 13px;
}

/* ---------------- 기획안 ---------------- */
.plan-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 2px; }
.plan-tab {
  cursor: pointer;
  border: 1px solid var(--line-strong);
  background: rgba(8, 12, 20, 0.6);
  color: var(--muted);
  border-radius: 10px;
  padding: 8px 13px;
  font-size: 12.5px;
  font-weight: 600;
  transition: all 0.15s ease;
}
.plan-tab:hover { color: var(--text); border-color: var(--amber); }
.plan-tab[aria-selected="true"] {
  color: #1a1206;
  background: linear-gradient(120deg, #fcd34d, #f59e0b);
  border-color: transparent;
  font-weight: 750;
}
.plan-section:empty { display: none; }
.plan-doc {
  border: 1px solid rgba(245, 158, 11, 0.26);
  border-radius: calc(var(--radius) + 4px);
  background:
    linear-gradient(160deg, rgba(245, 158, 11, 0.07), rgba(13, 19, 32, 0.4) 40%, rgba(34, 211, 238, 0.05)),
    var(--panel);
  padding: 24px clamp(18px, 3vw, 30px);
  display: flex;
  flex-direction: column;
  gap: 18px;
  box-shadow: var(--shadow);
}
.plan-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.plan-kicker { font-size: 10.5px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--amber); margin-bottom: 6px; }
.plan-title { font-size: clamp(20px, 2.6vw, 27px); font-weight: 800; letter-spacing: -0.02em; }
.plan-date {
  text-align: right;
  border: 1px solid rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.1);
  border-radius: 12px;
  padding: 8px 14px;
  flex: none;
}
.plan-date span { display: block; font-size: 10px; letter-spacing: 0.18em; color: var(--dim); text-transform: uppercase; }
.plan-date b { font-size: 17px; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; color: #fcd34d; }
.plan-overview { font-size: 13.5px; color: #cfdcec; max-width: 92ch; }
.plan-logline {
  border-left: 3px solid var(--cyan);
  background: rgba(34, 211, 238, 0.06);
  border-radius: 0 12px 12px 0;
  padding: 12px 16px;
}
.plan-logline span { font-size: 10px; letter-spacing: 0.22em; color: var(--cyan); }
.plan-logline p { margin-top: 4px; font-size: 14px; color: #eef4ff; line-height: 1.6; }
.acts { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; }
.act {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(8, 12, 20, 0.55);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.act header { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.act-no {
  font-size: 11px; font-weight: 800; letter-spacing: 0.06em;
  color: #04121a; background: linear-gradient(120deg, #67e8f9, #22d3ee);
  padding: 2px 8px; border-radius: 6px;
}
.act h3 { font-size: 15px; font-weight: 750; }
.act-state { margin-left: auto; font-size: 10.5px; color: var(--muted); border: 1px solid var(--line-strong); padding: 1px 7px; border-radius: 999px; white-space: nowrap; }
.act-meta { display: flex; gap: 10px; flex-wrap: wrap; font-size: 11.5px; color: var(--dim); }
.act ol { margin: 0; padding-left: 16px; display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: #c3d1e3; }
.act li::marker { color: var(--amber); }
.plan-strategy { border-top: 1px dashed var(--line-strong); padding-top: 14px; }
.plan-strategy h3 { font-size: 14px; margin-bottom: 5px; }
.plan-strategy p { font-size: 13px; color: var(--muted); }

.scene.flash { animation: flash 1.2s ease; }
@keyframes flash {
  0%, 100% { box-shadow: none; }
  25% { box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.35); }
}

.hero-spec {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  font-size: 12px;
  color: #a5f3fc;
  background: rgba(34, 211, 238, 0.08);
  border: 1px solid rgba(34, 211, 238, 0.28);
  border-radius: 8px;
  padding: 4px 10px;
}
.spec-badge {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fde68a;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 6px;
  padding: 2px 7px;
  white-space: nowrap;
}
.plan-spec {
  font-size: 12px;
  color: #fde68a;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.24);
  border-radius: 8px;
  padding: 6px 11px;
  align-self: flex-start;
}

/* ---------------- episodes ---------------- */
.episodes { display: flex; flex-direction: column; gap: 8px; }
.episodes-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 11.5px; color: var(--dim); letter-spacing: 0.1em; text-transform: uppercase; }
.ep-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.ep {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(8, 12, 20, 0.6);
  padding: 9px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 74px;
}
.ep.is-current { border-color: rgba(34, 211, 238, 0.45); background: rgba(34, 211, 238, 0.07); }
.ep-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ep-top b { font-size: 12px; font-weight: 800; color: #e7eef8; }
.ep-stage { font-size: 10px; color: var(--muted); border: 1px solid var(--line-strong); border-radius: 999px; padding: 0 6px; }
.ep-now { font-size: 9.5px; font-weight: 800; color: #04121a; background: var(--cyan); border-radius: 999px; padding: 0 6px; }
.ep p { font-size: 11.5px; color: #b9c7da; line-height: 1.45; }

/* ---------------- devices ---------------- */
.section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.section-head h2 { font-size: 19px; font-weight: 750; }
.section-sub { font-size: 13px; color: var(--muted); margin-top: 4px; max-width: 78ch; }
.device-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.device {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  overflow: hidden;
}
.device::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--accent, var(--cyan));
}
.device[data-device="iphone"] { --accent: var(--cyan); }
.device[data-device="office"] { --accent: var(--amber); }
.device[data-device="home"] { --accent: var(--violet); }
.device-top { display: flex; align-items: center; gap: 10px; }
.device-emoji { font-size: 24px; line-height: 1; }
.device-name { font-size: 16px; font-weight: 750; }
.device-state { margin-left: auto; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--muted); }
.device-state.active { color: #a5f3fc; border-color: rgba(34, 211, 238, 0.4); background: var(--cyan-soft); }
.device-state.waiting { color: #fcd34d; border-color: rgba(245, 158, 11, 0.34); background: var(--amber-soft); }
.device-state.hold { color: #cbd5e1; }
.device-state.done { color: #6ee7b7; border-color: rgba(52, 211, 153, 0.34); background: rgba(52, 211, 153, 0.12); }

.field { display: flex; flex-direction: column; gap: 4px; }
.field > span { font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim); }
.field input, .field select, .field textarea {
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(6, 10, 17, 0.7);
  padding: 7px 9px;
  font-size: 13px;
  width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent, var(--cyan)); }
.field textarea { resize: vertical; min-height: 56px; font-size: 12.5px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.credit-line { display: flex; align-items: baseline; gap: 8px; }
.credit-note {
  font-size: 11.5px;
  color: var(--dim);
  background: rgba(120, 160, 200, 0.08);
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 5px 9px;
}
.device-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 2px; }
.device-foot .saved { font-size: 11px; }

/* ---------------- howto ---------------- */
.howto {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px clamp(16px, 2.4vw, 24px);
  background: rgba(12, 18, 29, 0.55);
}
.howto h2 { font-size: 16px; margin-bottom: 10px; }
.howto ol { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 7px; font-size: 13px; color: var(--muted); }
.howto strong { color: var(--text); }
.howto em { color: var(--cyan); font-style: normal; }

/* ---------------- footer ---------------- */
.foot {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--line);
  padding: 18px clamp(16px, 4vw, 48px) 34px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11.5px;
  color: var(--dim);
  max-width: 1280px;
  margin: 0 auto;
}

/* ---------------- dialog ---------------- */
.dialog {
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: #0b111c;
  color: var(--text);
  padding: 0;
  width: min(520px, calc(100vw - 28px));
  box-shadow: var(--shadow);
}
.dialog::backdrop { background: rgba(2, 5, 10, 0.72); backdrop-filter: blur(4px); }
.dialog form { padding: 20px; display: flex; flex-direction: column; gap: 11px; }
.dialog h3 { font-size: 17px; }
.dialog-sub { font-size: 12px; color: var(--dim); }
.dialog label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.dialog input, .dialog select, .dialog textarea {
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(6, 10, 17, 0.8);
  padding: 8px 10px;
  font-size: 13.5px;
}
.dialog input:focus, .dialog select:focus, .dialog textarea:focus { outline: none; border-color: var(--cyan); }
.dialog .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }

/* ---------------- toast ---------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  background: rgba(10, 16, 26, 0.96);
  border: 1px solid var(--line-strong);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  transition: all 0.22s ease;
  z-index: 60;
  max-width: calc(100vw - 32px);
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { border-color: rgba(248, 113, 113, 0.5); color: #fecaca; }

/* ---------------- responsive ---------------- */
@media (max-width: 1024px) {
  .device-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .acts { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  body { font-size: 14px; }
  .topbar { padding: 12px 16px; gap: 10px; }
  .brand-mark { width: 36px; height: 36px; border-radius: 11px; font-size: 17px; }
  .brand-kicker { font-size: 9px; letter-spacing: 0.16em; }
  .brand h1 { font-size: 15.5px; }
  .topbar-actions { width: 100%; }
  .topbar-actions .btn { flex: 1; text-align: center; padding: 7px 8px; font-size: 11.5px; }
  .wrap { padding: 18px 16px 28px; gap: 26px; }
  .hero { grid-template-columns: 1fr; padding: 18px; gap: 16px; }
  .hero-side { flex-direction: row; align-items: center; justify-content: flex-start; gap: 14px; padding: 14px 0 0; border-left: none; border-top: 1px solid var(--line); }
  .ring { width: 84px; height: 84px; flex: none; }
  .ring::before { inset: 7px; }
  .ring-value { font-size: 21px; }
  .ring-value span { font-size: 11px; }
  .ring-label { font-size: 9.5px; }
  .hero-side .side-note { text-align: left; font-size: 11px; }
  .hero-title { font-size: 22px; }
  .p-head { padding: 14px; }
  .p-title { font-size: 17px; }
  .p-body { padding: 14px; gap: 14px; }
  .scenes { grid-template-columns: 1fr; }
  .filter-bar { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
  .filter-bar::-webkit-scrollbar { display: none; }
  .chip { flex: none; padding: 6px 11px; font-size: 12px; }
  .device-grid { grid-template-columns: 1fr; }
  .ep-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ep { min-height: 0; }
  .plan-head { flex-direction: column-reverse; align-items: stretch; }
  .plan-date { align-self: flex-start; text-align: left; }
  .plan-doc { padding: 18px 14px; }
  .p-facts { grid-template-columns: 1fr; }
  .p-tools { width: 100%; justify-content: space-between; }
  .p-progress { flex: 1; }
  .tl-seg { flex: 0 0 96px; }
  .toast { bottom: 16px; font-size: 12px; }
}
