:root {
  --bg: #07080d;
  --card: #141920;
  --text: #eef2fb;
  --muted: #8b96ab;
  --accent: #3d9eff;
  --accent2: #5eb4ff;
  --danger: #c75c6e;
  --ok: #3ecf8e;
  --border: rgba(139, 150, 171, 0.22);
  --grid: #2a3d55;
  --glow: rgba(61, 158, 255, 0.22);
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { background: #07080d; }
body {
  font-family: "DM Sans", "Segoe UI", system-ui, sans-serif;
  background:
    radial-gradient(ellipse 90% 55% at 50% -8%, var(--glow), transparent 58%),
    linear-gradient(145deg, #0c121a 0%, #07080d 50%, #050608 100%);
  color: var(--text);
  min-height: 100vh;
}
body.app-shell::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.4;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 80px 80px;
  mask-image: radial-gradient(ellipse 70% 55% at 50% 18%, #000 18%, transparent 72%);
  -webkit-mask-image: radial-gradient(ellipse 70% 55% at 50% 18%, #000 18%, transparent 72%);
}
body.app-shell::after {
  content: "";
  position: fixed;
  width: min(640px, 80vw);
  height: min(640px, 80vw);
  top: -8rem;
  right: -10rem;
  border-radius: 50%;
  background: rgb(61, 158, 255);
  opacity: 0.12;
  filter: blur(140px);
  pointer-events: none;
  z-index: 0;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.top {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 64px;
  padding: 0 clamp(1rem, 3vw, 1.6rem);
  border-bottom: 1px solid rgba(61, 158, 255, 0.18);
  background: rgba(7, 8, 13, 0.92);
}
.top-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(61, 158, 255, 0.16) 0%, rgba(61, 158, 255, 0.05) 28%, rgba(7, 8, 13, 0.97) 55%, #07080d 100%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.brand,
.top nav {
  position: relative;
  z-index: 1;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: #fff;
  text-decoration: none;
  line-height: 1.05;
}
.brand:hover { opacity: 0.88; text-decoration: none; }
.lockup-mark { width: 28px; height: 28px; flex-shrink: 0; }
.lockup-word { display: flex; flex-direction: column; gap: 0.08rem; }
.lockup-word strong {
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.lockup-word span {
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent2);
  font-weight: 700;
}
.top nav { display: flex; align-items: stretch; gap: 0.15rem; }
.top nav a {
  display: flex;
  align-items: center;
  min-height: 64px;
  padding: 0 0.85rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: #f0f2f6;
  border-bottom: 2px solid transparent;
  text-decoration: none;
}
.top nav a:hover,
.top nav a.is-active {
  color: #fff;
  text-decoration: none;
  border-bottom-color: var(--accent);
}
.wrap { position: relative; z-index: 1; max-width: 1120px; margin: 0 auto; padding: 2.2rem 1.5rem 4rem; }
.page-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-end;
  margin-bottom: 1.8rem;
}
.page-head .btn { margin-top: 0; flex-shrink: 0; }
.kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: ui-monospace, "Cascadia Mono", "Segoe UI Mono", monospace;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(61, 158, 255, 0.35);
  background: rgba(61, 158, 255, 0.08);
  color: #cfe6ff;
  margin: 0 0 0.85rem;
}
.kicker .p { color: var(--accent); }
.page-lede { margin: 0.45rem 0 0; max-width: 36rem; }
h1 { font-size: clamp(1.55rem, 3vw, 2.1rem); letter-spacing: -0.045em; font-weight: 700; margin: 0; }
h2 { font-size: 1.08rem; margin: 0 0 0.8rem; }
h3 { font-size: 0.95rem; }
.muted { color: var(--muted); font-size: 0.9rem; }
.card {
  background: linear-gradient(180deg, rgba(22, 30, 42, 0.92), rgba(12, 16, 22, 0.92));
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.2rem 1.3rem;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.22);
}
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.1rem; }
.company-grid { align-items: stretch; }
.company-card {
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  min-height: 15.5rem;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.company-card:hover {
  transform: translateY(-4px);
  border-color: rgba(61, 158, 255, 0.55);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(61, 158, 255, 0.2);
  text-decoration: none;
}
.company-card h2 { margin: 0; font-size: 1.18rem; letter-spacing: -0.03em; }
.company-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
}
.company-card-go {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent2);
  white-space: nowrap;
  margin-top: 0.28rem;
}
.company-url { margin: 0; }
.company-meta {
  margin: auto 0 0;
  padding-top: 0.55rem;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}
.conn-row {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0;
  margin: 0.15rem 0 0;
}
.conn-row li {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 0.28rem 0.62rem 0.28rem 0.45rem;
  border: 1px solid var(--border);
  color: var(--muted);
}
.conn-row li.on {
  border-color: rgba(62, 207, 142, 0.45);
  color: #9ad8b8;
  background: rgba(62, 207, 142, 0.08);
}
.conn-row li.off { opacity: 0.55; }
.conn-row svg { width: 14px; height: 14px; flex-shrink: 0; }
.empty-card { max-width: 28rem; }
.empty-card .btn { margin-top: 0.9rem; }
.page-head + .conn-row { margin: 0 0 1.5rem; }
.split { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 1rem; }
.split:has(> :only-child) { grid-template-columns: 1fr; }
@media (max-width: 860px) {
  .split { grid-template-columns: 1fr; display: block; }
  .page-head { flex-wrap: wrap; align-items: flex-start; }
  .top { flex-wrap: wrap; }
  .top nav { width: 100%; overflow-x: auto; }
  .top nav a { min-height: 48px; }
}
.field-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}
.field-head label { margin-bottom: 0.35rem; }
.char-count { font-size: 0.78rem; font-variant-numeric: tabular-nums; }
.char-count.warn { color: var(--danger); }
label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0.9rem 0 0.35rem;
}
input, textarea, select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: var(--bg);
  border: 1px solid rgba(139, 144, 154, 0.35);
  border-radius: 6px;
  color: var(--text);
  font: inherit;
}
textarea { resize: vertical; }
input:focus, textarea:focus { outline: none; border-color: var(--accent); }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 0;
  padding: 0.68rem 1.15rem;
  background: linear-gradient(180deg, #5eb4ff, var(--accent));
  color: #041018;
  border: 1px solid transparent;
  border-radius: 10px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(61, 158, 255, 0.28);
  text-decoration: none;
}
.btn:hover { filter: brightness(1.08); text-decoration: none; transform: translateY(-1px); }
.btn.ghost {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  color: #fff;
  box-shadow: none;
}
.btn.ghost:hover { border-color: var(--accent); background: rgba(61, 158, 255, 0.08); }
.btn.danger { background: var(--danger); color: #fff; box-shadow: none; }
form > .btn,
form > button.btn { margin-top: 1rem; }
.row-actions .btn { margin-top: 0; }
.row-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 1.15rem;
}
.page-head .row-actions { margin-top: 0; }
.auto-only { display: flex; }
#post-form:has(input[name="kind"][value="text"]:checked) .auto-only { display: none; }
#post-form:has(input[name="copy_mode"][value="manual"]:checked):has(input[name="kind"][value="short"]:checked) .auto-only,
#post-form:has(input[name="copy_mode"][value="manual"]:checked):has(input[name="kind"][value="long"]:checked) .auto-only,
#post-form:has(input[name="copy_mode"][value="manual"]:checked):has(input[name="kind"][value="both"]:checked) .auto-only {
  display: none;
}
.check-row { display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; margin: 0.4rem 0 0.25rem; }
.check-row label { text-transform: none; letter-spacing: 0; font-size: 0.92rem; color: var(--text); display: flex; align-items: center; gap: 0.4rem; margin: 0; }
.check-row input { width: auto; }
.social-only,
.photo-only,
.text-only,
.both-only { display: none; }
#post-form:has(input[name="kind"][value="photo"]:checked) .social-only,
#post-form:has(input[name="kind"][value="text"]:checked) .social-only { display: block; }
#post-form:has(input[name="kind"][value="photo"]:checked) .photo-only { display: block; }
#post-form:has(input[name="kind"][value="text"]:checked) .text-only { display: block; }
#post-form:has(input[name="kind"][value="text"]:checked) .photo-only { display: none; }
#post-form:has(input[name="kind"][value="photo"]:checked) .video-only,
#post-form:has(input[name="kind"][value="text"]:checked) .video-only { display: none; }
#post-form:has(input[name="kind"][value="photo"]:checked) .cbi-cms,
#post-form:has(input[name="kind"][value="text"]:checked) .cbi-cms { display: none; }
#post-form:has(input[name="kind"][value="both"]:checked) .both-only { display: block; }
#post-form:has(input[name="kind"][value="both"]:checked) .single-only { display: none; }
.fb-image-only,
.ig-image-only { display: none; }
#post-form:has(input[name="kind"][value="photo"]:checked):has(input[name="want_facebook"]:checked) .fb-image-only { display: block; }
#post-form:has(input[name="kind"][value="photo"]:checked):has(input[name="want_linkedin"]:checked) .fb-image-only { display: block; }
#post-form:has(input[name="kind"][value="photo"]:checked):has(input[name="want_instagram"]:checked) .ig-image-only { display: block; }
.pills { list-style: none; display: flex; gap: 0.45rem; flex-wrap: wrap; padding: 0; margin: 0 0 1rem; }
.pills li { font-size: 0.78rem; border-radius: 999px; padding: 0.2rem 0.65rem; border: 1px solid var(--border); }
.pills .on { border-color: var(--ok); color: var(--ok); }
.pills .off { color: var(--muted); }
.flash { border-radius: 8px; padding: 0.7rem 0.9rem; margin-bottom: 1rem; font-size: 0.9rem; }
.flash.error, .flash.danger { background: rgba(199, 92, 110, 0.12); color: var(--danger); border: 1px solid rgba(199, 92, 110, 0.25); }
.flash.ok, .flash.message { background: rgba(61, 158, 255, 0.12); border: 1px solid rgba(61, 158, 255, 0.25); }
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-wrap { width: 100%; max-width: 360px; padding: 1.5rem; }
.logo { font-weight: 600; color: var(--accent); margin-bottom: 1.5rem; text-align: center; }
.crumb { color: var(--muted); font-size: 0.85rem; }
.post-list { list-style: none; padding: 0; margin: 0; }
.post-list li { padding: 0.45rem 0; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; gap: 0.6rem; }
.cal { width: 100%; table-layout: fixed; border-collapse: collapse; background: var(--card); border-radius: 12px; overflow: hidden; }
.cal th, .cal td { border: 1px solid var(--border); vertical-align: top; padding: 0.35rem; width: 14.28%; }
.cal th { color: var(--muted); font-size: 0.78rem; font-weight: 600; }
.cal td { height: 188px; }
.cal td.empty { background: #0a0b0e; }
.cal td.today { outline: 1px solid var(--accent); outline-offset: -1px; }
.cal-cell { height: 176px; display: flex; flex-direction: column; min-width: 0; }
.cal-cell-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem;
  flex-shrink: 0;
  margin-bottom: 0.25rem;
  width: 100%;
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-align: left;
}
.cal-cell-head:hover .day-num { color: var(--accent); }
.day-num { font-weight: 700; color: var(--text); line-height: 1; }
.cal-day-view {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  z-index: 85;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.2rem;
}
.cal-day-view[hidden] { display: none; }
.cal-day-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: min(760px, 100%);
  max-height: 90vh;
  overflow: auto;
  padding: 1.1rem 1.2rem 1.3rem;
}
.cal-day-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 0.85rem;
}
.cal-day-head h2 { margin: 0; }
.cal-day-head .btn { margin-top: 0; }
.cal-day-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.cal-day-list .cal-post {
  font-size: 0.92rem;
  padding: 0.7rem 0.8rem;
}
.cal-day-list .cal-title {
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  margin-top: 0.2rem;
}
.cal-day-empty { margin: 0.4rem 0 0.8rem; }
.cal-count {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  padding: 0.08rem 0.4rem;
  font-variant-numeric: tabular-nums;
}
.cal-cell-posts {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  padding-right: 0.1rem;
}
.cal-cell-posts::-webkit-scrollbar { width: 6px; }
.cal-cell-posts::-webkit-scrollbar-thumb {
  background: rgba(139, 144, 154, 0.35);
  border-radius: 999px;
}
.cal-post {
  display: block;
  font-size: 0.68rem;
  background: rgba(61, 158, 255, 0.12);
  border-radius: 5px;
  padding: 0.22rem 0.32rem;
  color: var(--text);
  line-height: 1.2;
  min-width: 0;
}
.cal-post:hover { text-decoration: none; filter: brightness(1.12); }
.cal-post-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.3rem;
}
.cal-when { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-title {
  display: block;
  font-weight: 600;
  margin-top: 0.05rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-dots { display: flex; gap: 3px; flex-shrink: 0; }
.cal-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  display: inline-block;
}
.cal-dot.ch-live, .cal-dot.ch-unlisted { background: var(--ok); }
.cal-dot.ch-scheduled { background: var(--accent); }
.cal-dot.ch-queued, .cal-dot.ch-pending { background: var(--muted); }
.cal-dot.ch-failed { background: var(--danger); }
.cal-dot.ch-cancelled { background: var(--muted); opacity: 0.45; }
.cal-post.status-live, .cal-post.status-unlisted { background: rgba(62, 207, 142, 0.18); }
.cal-post.status-failed { background: rgba(199, 92, 110, 0.18); }
.cal-post.status-cancelled { background: rgba(255, 255, 255, 0.04); opacity: 0.7; }
.log { list-style: none; padding: 0; max-height: 280px; overflow: auto; font-size: 0.82rem; }
.log li { padding: 0.25rem 0; border-bottom: 1px solid var(--border); }
code { font-size: 0.85em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.2rem 0; }
.radio-row { display: flex; gap: 0.5rem; align-items: center; margin: 0.4rem 0; text-transform: none; letter-spacing: 0; color: var(--text); font-size: 0.92rem; }
.radio-row input { width: auto; }
.setup-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin-top: 0.4rem; }
@media (max-width: 700px) { .setup-row { grid-template-columns: 1fr; } }
.setup-card {
  display: block;
  margin: 0;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 400;
  cursor: pointer;
}
.setup-card strong { display: block; margin: 0.2rem 0 0.35rem; font-size: 0.98rem; }
.setup-card span { display: block; color: var(--muted); font-size: 0.82rem; line-height: 1.4; font-weight: 400; }
.setup-card:has(input:checked) { border-color: var(--accent); background: rgba(61, 158, 255, 0.08); }
.setup-card input { width: auto; margin-right: 0.35rem; }
.both-only { display: none; }
#post-form:has(input[name="kind"][value="both"]:checked) .both-only { display: block; }
#post-form:has(input[name="kind"][value="both"]:checked) .single-only { display: none; }
.nine-sixteen-only { display: block; }
#post-form:has(input[name="kind"][value="short"]:checked) .nine-sixteen-only,
#post-form:has(input[name="kind"][value="both"]:checked) .nine-sixteen-only,
#post-form:has(input[name="kind"][value="long"]:checked) .nine-sixteen-only { display: block; }
.cbi-cms { display: block; }
.interval-box input { max-width: 8rem; }
.site-box {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem 1rem 1rem;
  margin: 0.85rem 0;
  background: rgba(255,255,255,0.02);
}
.site-box h3 {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  text-transform: none;
  letter-spacing: 0;
}
.site-box label {
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.82rem;
}
.file-row {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  flex-wrap: wrap;
  margin: 0.2rem 0 0.35rem;
}
.file-row input[type="text"] {
  flex: 1;
  min-width: 12rem;
  margin: 0;
}
.file-row .btn {
  margin-top: 0;
  flex-shrink: 0;
  white-space: nowrap;
}
.shorts-box {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem 1rem 1rem;
  margin: 0.85rem 0;
  background: rgba(61, 158, 255, 0.06);
}
.shorts-box h3 {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  text-transform: none;
  letter-spacing: 0;
}
.shorts-box.empty-shorts {
  border-color: rgba(199, 92, 110, 0.45);
}
.shorts-loaded li span { word-break: break-all; }
.post-list.shorts-loaded li {
  display: block;
  align-items: stretch;
}
.short-item-main {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  align-items: flex-start;
}
.short-item input[type="text"] { margin-top: 0.15rem; }
.title-tools {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin: 0.35rem 0 0.15rem;
}
.title-tools .btn { margin-top: 0; }
.title-options {
  display: grid;
  gap: 0.4rem;
  margin: 0.45rem 0 0.2rem;
}
.title-options[hidden] { display: none; }
.title-option {
  display: block;
  width: 100%;
  text-align: left;
  margin: 0;
  padding: 0.55rem 0.75rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.title-option:hover { border-color: var(--accent); filter: none; }
.title-option.on { border-color: var(--accent); background: rgba(61, 158, 255, 0.08); }
.title-option small {
  display: block;
  margin-top: 0.2rem;
  color: var(--muted);
  font-weight: 400;
  font-size: 0.78rem;
}
.link-row {
  display: grid;
  grid-template-columns: minmax(7rem, 0.7fr) minmax(12rem, 1.4fr) auto;
  gap: 0.45rem;
  align-items: center;
  margin: 0.35rem 0;
}
.link-row input { margin: 0; }
.link-row .btn { margin-top: 0; }
.link-stack-box .btn.ghost { margin-top: 0.35rem; }

.publish-lock {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  cursor: wait;
}
.publish-lock[hidden] { display: none; }
.publish-lock-card {
  max-width: 28rem;
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.6rem 1.5rem 1.4rem;
  text-align: center;
}
.publish-lock-card p { margin: 0.45rem 0 0; }
#publish-lock-title { font-size: 1.15rem; font-weight: 600; }
.publish-lock-spin {
  width: 2rem;
  height: 2rem;
  margin: 0 auto 0.85rem;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: publish-spin 0.8s linear infinite;
}
@keyframes publish-spin {
  to { transform: rotate(360deg); }
}

.yt-url-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1rem;
  align-items: flex-end;
}
.yt-url-filters > div { min-width: 10rem; }
.yt-url-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.yt-url-actions .btn { margin-top: 0; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.data-table th,
.data-table td {
  text-align: left;
  padding: 0.45rem 0.55rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.data-table th { color: var(--muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; }
.data-table td:nth-child(4) { word-break: break-all; }
.yt-url-rows { list-style: none; padding: 0; margin: 0; }
.yt-url-rows li {
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--border);
}
.yt-url-rows li:last-child { border-bottom: 0; }
.yt-url-meta { display: flex; flex-direction: column; gap: 0.15rem; margin-bottom: 0.35rem; }
.yt-url-line { font-family: ui-monospace, Consolas, monospace; font-size: 0.85rem; }

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
  margin-top: 0.85rem;
  align-items: start;
}
.media-card {
  position: relative;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  color: inherit;
  text-align: left;
  padding: 0;
}
.media-card.is-selected {
  outline: 1px solid var(--accent);
  outline-offset: -1px;
}
.media-card-check {
  position: absolute;
  top: 0.4rem;
  left: 0.4rem;
  z-index: 2;
  width: 1.05rem;
  height: 1.05rem;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}
.library-bulk {
  margin-top: 0.7rem;
  align-items: center;
}
.library-bulk .btn { margin-top: 0; }
#library_sel_status { margin-left: 0.2rem; }
.media-card img,
.media-card-empty {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  display: block;
  background: #0a0b0e;
  cursor: zoom-in;
}
.media-card.long img { aspect-ratio: 16 / 9; }
.media-card.short img { aspect-ratio: 9 / 16; }
.media-card-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.75rem;
  cursor: default;
}
.media-card figcaption {
  padding: 0.4rem 0.5rem 0.55rem;
  font-size: 0.72rem;
  color: var(--muted);
  word-break: break-all;
}
.media-card strong {
  display: block;
  color: var(--text);
  font-size: 0.75rem;
  margin-bottom: 0.15rem;
}
.media-card .btn { margin-top: 0.4rem; padding: 0.28rem 0.5rem; font-size: 0.75rem; }
.media-card-actions {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-top: 0.2rem;
}
.media-viewer {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.2rem;
}
.media-viewer[hidden] { display: none; }
.media-viewer-card {
  width: min(1100px, 96vw);
  max-height: 94vh;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.media-viewer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
}
.media-viewer-head p {
  margin: 0;
  color: var(--text);
  font-size: 0.9rem;
  word-break: break-all;
}
.media-viewer-head .btn { margin-top: 0; }
.media-viewer img {
  width: 100%;
  max-height: 78vh;
  object-fit: contain;
  border-radius: 8px;
  background: #0a0b0e;
}
.media-viewer-actions { margin-top: 0; }
.media-viewer-actions .btn { margin-top: 0; }
.media-picker {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.2rem;
}
.media-picker[hidden] { display: none; }
.media-picker-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: min(920px, 100%);
  max-height: 88vh;
  overflow: auto;
  padding: 1.1rem 1.2rem 1.3rem;
}
.media-picker-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
}
.media-picker-head h2 { margin: 0; }
.media-picker-head .btn { margin-top: 0; }
.media-picker .media-card img { cursor: pointer; }
.media-picker-filters {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 0.7rem;
}
.media-picker-filters button {
  margin-top: 0;
  padding: 0.35rem 0.7rem;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 999px;
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}
.media-picker-filters button.on {
  border-color: var(--accent);
  color: var(--accent);
}
.library-groups {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem 1.1rem;
  align-items: center;
  max-height: none;
  overflow: visible;
}
.library-source-label {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--muted);
  font-size: 0.82rem;
}
.library-source-select {
  margin-top: 0;
  min-width: 12rem;
  max-width: min(22rem, 100%);
}
.media-card-group {
  display: block;
  color: var(--text);
  font-style: normal;
  font-weight: 600;
  font-size: 0.72rem;
  margin: 0.12rem 0 0.08rem;
}
#library_search,
#media-picker-search {
  max-width: 16rem;
  margin-top: 0;
}
#library-pager,
#media-picker-pager {
  margin-top: 0.75rem;
  align-items: center;
}
#library-pager .btn,
#media-picker-pager .btn {
  margin-top: 0;
}
#library-pager .btn[disabled],
#media-picker-pager .btn[disabled] {
  opacity: 0.4;
  cursor: default;
}



