:root {
  --ink: #f3f6f2;
  --mute: rgba(243,246,242,.5);
  --line: rgba(255,255,255,.1);
  --accent: #e8c47a;
  --bg: #0b151c;
  --panel: #111e26;
  --sidebar-w: 250px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: Sora, system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  min-height: 100dvh;
}

/* —— Shell —— */
.shell { width: 100%; max-width: 600px; margin: 0 auto; padding: 40px 20px; }

/* —— Workspace Layout (v71 Style) —— */
.workspace {
  display: flex;
  height: 100dvh;
  max-width: none;
  padding: 0;
  overflow: hidden;
}

.sidebar {
  width: var(--sidebar-w);
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-top { padding: 30px 20px; border-bottom: 1px solid var(--line); }
.kicker { font-size: .65rem; text-transform: uppercase; color: var(--accent); font-weight: 800; letter-spacing: .1em; }
.session-status { font-size: .7rem; color: var(--mute); display: block; margin-top: 4px; }

.nav-menu { flex: 1; padding: 20px 10px; display: flex; flex-direction: column; gap: 4px; }
.nav-btn {
  background: transparent; border: 0; color: var(--mute);
  padding: 12px 15px; border-radius: 10px; text-align: left;
  font: 600 .9rem Sora; cursor: pointer; display: flex; align-items: center; gap: 12px;
}
.nav-btn:hover:not(:disabled) { background: rgba(255,255,255,.03); color: var(--ink); }
.nav-btn.is-on { background: rgba(232, 196, 122, .15); color: var(--accent); font-weight: 700; }
.nav-btn.is-on .nav-icon { filter: drop-shadow(0 0 5px var(--accent)); }
.nav-btn:disabled { opacity: .2; cursor: not-allowed; }

.sidebar-bottom { padding: 20px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }

.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  position: relative;
  scroll-behavior: smooth;
}

.pane-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px;
}

/* —— High Fidelity Cards —— */
.card {
  background: rgba(255,255,255,.03);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 30px;
  margin-bottom: 30px;
  box-shadow: 0 10px 40px rgba(0,0,0,.3);
}

.card-nested {
  background: rgba(0,0,0,.2);
  border: 1px solid rgba(255,255,255,.05);
  padding: 20px;
  border-radius: 16px;
}
h2 { font-family: Fraunces, serif; font-size: 1.4rem; margin-bottom: 20px; }
h3 { font-family: Fraunces, serif; font-size: 1.1rem; margin-bottom: 15px; color: var(--mute); }

/* —— Controls —— */
input, select {
  background: rgba(0,0,0,.2); border: 1px solid var(--line);
  color: var(--ink); padding: 10px 12px; border-radius: 8px; font-family: inherit; width: 100%; margin-bottom: 15px;
}
label span { display: block; font-size: .75rem; color: var(--mute); text-transform: uppercase; margin-bottom: 5px; }

.btn {
  font: 700 .85rem Sora; padding: 10px 20px; border-radius: 10px; cursor: pointer;
  border: 1px solid transparent; transition: all .2s; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn.primary { background: var(--accent); color: #000; }
.btn.ghost { background: rgba(255,255,255,.05); border-color: var(--line); color: var(--ink); }
.btn.ghost:hover { background: rgba(255,255,255,.1); }
.btn-sm { padding: 6px 12px; font-size: .75rem; }
.btn-xs { padding: 4px 8px; font-size: .7rem; }

.tv-matrix {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.tv-card {
  aspect-ratio: 16/10;
  background: rgba(0,0,0,.3);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 15px;
  cursor: pointer;
  transition: all .3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.tv-card:hover {
  border-color: var(--accent);
  transform: translateY(-5px);
  box-shadow: 0 15px 30px rgba(0,0,0,.5);
}

.tv-card.is-active {
  border-color: var(--accent);
  background: rgba(232, 196, 122, .08);
  box-shadow: 0 0 0 1px var(--accent);
}

.tv-card-head { display: flex; justify-content: space-between; align-items: center; }
.tv-status { width: 8px; height: 8px; border-radius: 50%; background: #4caf50; box-shadow: 0 0 10px #4caf50; }
.tv-label { font: 700 .9rem Sora; display: block; margin-top: 10px; }
.tv-code { font: 400 .7rem monospace; opacity: .4; }

.tv-mock-small {
  flex: 1;
  margin: 10px 0;
  background: #000;
  border-radius: 6px;
  border: 4px solid #1a1a1a;
  display: grid;
  overflow: hidden;
  gap: 1px;
}

/* —— Studio Overlay —— */
.studio-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0, 5, 10, 0.95);
  backdrop-filter: blur(20px);
  display: flex; align-items: center; justify-content: center;
  padding: 30px;
  animation: studioIn .4s cubic-bezier(0.4, 0, 0.2, 1) both;
}
@keyframes studioIn { from { opacity: 0; transform: scale(1.05); } to { opacity: 1; transform: scale(1); } }

.studio-content {
  width: 100%; max-width: 1400px; height: 100%;
  display: flex; flex-direction: column; gap: 20px;
}
.studio-header { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 1px solid var(--line); padding-bottom: 20px; }
.studio-body { flex: 1; display: grid; grid-template-columns: 200px 1fr 320px; gap: 30px; overflow: hidden; }

.studio-left { border-right: 1px solid var(--line); padding-right: 20px; }
.layout-grid { display: grid; gap: 12px; margin-top: 15px; }
.layout-btn {
  background: rgba(255,255,255,.03); border: 1px solid var(--line);
  padding: 12px; border-radius: 12px; cursor: pointer; color: var(--mute);
  transition: all .2s;
}
.layout-btn:hover { border-color: var(--accent); background: rgba(255,255,255,.06); }
.layout-btn.is-on { border-color: var(--accent); background: rgba(232, 196, 122, .1); color: var(--accent); }
.layout-btn span { font-size: .75rem; font-weight: 600; margin-top: 8px; display: block; }

.mock-small { height: 50px; background: #000; border-radius: 4px; display: grid; gap: 1px; border: 2px solid #222; }
.mock-small.split { grid-template-columns: 1fr 1fr; }
.mock-small.quad { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }

.studio-center { display: flex; flex-direction: column; align-items: center; justify-content: center; }
.tv-mockup {
  width: 100%; max-width: 700px; aspect-ratio: 16/9;
  background: #000; border: 12px solid #1a1a1a; border-radius: 16px;
  box-shadow: 0 40px 100px rgba(0,0,0,.6);
  display: grid; overflow: hidden; gap: 2px;
}

.studio-right { background: rgba(0,0,0,.2); border-radius: 20px; border: 1px solid var(--line); display: flex; flex-direction: column; overflow: hidden; }
.tool-tabs { display: flex; background: rgba(255,255,255,.05); border-bottom: 1px solid var(--line); }
.tool-tab-btn {
  flex: 1; padding: 15px; background: transparent; border: 0;
  color: var(--mute); font: 700 .75rem Sora; cursor: pointer;
  border-bottom: 2px solid transparent; transition: all .2s;
}
.tool-tab-btn.is-on { color: var(--accent); border-bottom-color: var(--accent); background: rgba(255,255,255,.02); }

.tool-panes { flex: 1; overflow-y: auto; padding: 20px; }
.tool-pane { display: none; }
.tool-pane.is-on { display: block; }

.studio-playlist { display: grid; gap: 8px; }
.playlist-row {
  display: flex; align-items: center; gap: 12px; padding: 10px;
  background: rgba(255,255,255,.03); border-radius: 10px; border: 1px solid transparent;
}
.playlist-row:hover { background: rgba(255,255,255,.06); }
.playlist-row.is-picked { border-color: var(--accent); background: rgba(232, 196, 122, .05); }

.effect-grid-studio { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 8px; }
.label { font-size: .7rem; text-transform: uppercase; color: var(--mute); font-weight: 800; letter-spacing: .1em; margin-bottom: 10px; }
.layout-communityAds .mock-pane:first-child { background: rgba(50,150,255,.15); }
.layout-adsQuad .mock-pane { background: rgba(232, 196, 122, .1); }
.layout-adsSplit2 .mock-pane { background: rgba(255,255,255,.1); }
.layout-staticMenu .mock-pane { background: rgba(255, 100, 0, .1); }

.biz-list, .ad-list { display: grid; gap: 10px; }
.biz-item, .ad-item {
  background: rgba(0,0,0,.2); border: 1px solid var(--line);
  padding: 12px; border-radius: 12px; display: flex; align-items: center; justify-content: space-between;
}
.ad-card { background: rgba(0,0,0,.2); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.ad-thumb { aspect-ratio: 16/9; background: #000; overflow: hidden; }
.ad-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ad-info { padding: 12px; }

/* —— Utilities —— */
.row { display: flex; gap: 10px; align-items: center; }
.status { font-size: .8rem; color: var(--accent); margin-top: 8px; font-weight: 600; }
.help { font-size: .8rem; color: var(--mute); line-height: 1.5; margin-bottom: 10px; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 800px) {
  .workspace { flex-direction: column; overflow: visible; height: auto; }
  .sidebar { width: 100%; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav-menu { flex-direction: row; overflow-x: auto; padding: 10px; }
  .workspace-layout { grid-template-columns: 1fr; }
}
