:root {
  --ink: #32363c;
  --muted: #606469;
  --paper: #f4f4f4;
  --panel: #ffffff;
  --accent: #3683dc;
  --accent-deep: #1b7ac7;
  --accent-soft: #e8f2fc;
  --brand: #00a353;
  --line: #e3e5e8;
  --ok: #00875a;
  --warn: #b7791f;
  --bad: #c0392b;
  --sidebar: #32363c;
  --sidebar-2: #2b2b2b;
  --nav-hover: #3f444c;
  --surface-soft: #f4f4f4;
  --radius: 4px;
  --radius-sm: 3px;
  --shadow-sm: 0 1px 2px rgba(50, 54, 60, 0.06);
  --shadow-md: 0 8px 24px rgba(50, 54, 60, 0.10);
  --font: "SF Pro Text", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, "Source Sans 3", system-ui, sans-serif;
  --font-display: "SF Pro Display", "SF Pro Text", -apple-system, BlinkMacSystemFont, Inter, "Source Sans 3", system-ui, sans-serif;
  --topnav-h: 50px;
  --topnav-bg: rgba(27, 27, 27, 0.72);
  --sidebar-w: 64px;
  --sidebar-w-open: 248px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: -0.011em;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -40px;
  z-index: 200;
  background: var(--accent);
  color: #fff;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
}
.skip-link:focus {
  top: 8px;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-topnav {
  height: var(--topnav-h);
  flex: 0 0 var(--topnav-h);
  background: var(--topnav-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px 0 8px;
  position: sticky;
  top: 0;
  z-index: 80;
}
.app-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: .95rem;
  letter-spacing: .02em;
  padding: 0 8px;
  min-height: 44px;
  flex: 0 0 auto;
}
.app-brand:hover { color: #fff; }
.app-brand-text { white-space: nowrap; }
.brand-hex {
  width: 22px;
  height: 24px;
  flex: 0 0 auto;
  background: var(--brand);
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}
.brand-hex-lg {
  width: 36px;
  height: 40px;
}
.app-search {
  flex: 1 1 auto;
  max-width: 640px;
  position: relative;
  margin: 0 auto;
}
.app-search i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #9aa0a6;
  font-size: .85rem;
}
.app-search input {
  width: 100%;
  height: 34px;
  border: 0;
  border-radius: 3px;
  background: #3a3a3a;
  color: #fff;
  padding: 0 12px 0 34px;
  font-size: .88rem;
}
.app-search input::placeholder { color: #9aa0a6; }
.app-search input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  background: #444;
}
.app-topnav-end {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex: 0 0 auto;
}
.btn-create {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 14px;
  background: var(--accent);
  border: 1px solid var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: .88rem;
  border-radius: 3px;
  text-decoration: none;
  cursor: pointer;
  transition: background .2s ease-out;
}
.btn-create:hover {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
  color: #fff;
}
.btn-create:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}
.btn-create-lg {
  min-height: 40px;
  padding: 0 18px;
}
.app-userchip {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  padding: 4px 8px 4px 4px;
  min-height: 44px;
  border: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 4px;
  max-width: min(42vw, 220px);
}
.app-userchip:hover,
.app-userchip.show {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.app-userchip::after { display: none; }
.app-userchip-caret {
  font-size: .65rem;
  opacity: .75;
  flex: 0 0 auto;
}
.app-user-menu { position: relative; z-index: 90; }
.app-user-dropdown {
  min-width: 260px;
  padding: 0;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  z-index: 100;
}
.app-user-dropdown-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px 10px;
}
.user-avatar-lg {
  width: 40px;
  height: 40px;
  font-size: 1rem;
}
.app-user-dropdown-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.app-user-dropdown-meta strong {
  font-size: .92rem;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-user-dropdown-meta span {
  font-size: .78rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-user-dropdown-health {
  margin: 0 12px 12px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  font-size: .82rem;
}
.app-user-dropdown-health .ok { color: #1a7f4b; }
.app-user-dropdown-health .bad { color: #c0392b; }
.app-user-signout {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  padding: 10px 16px 12px;
}
.app-user-signout i { width: 1rem; text-align: center; color: var(--muted); }
.app-create-label { white-space: nowrap; }
.app-menu-toggle {
  display: none;
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
}

.app-body-row {
  display: flex;
  align-items: stretch;
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
}
.nav-scrim {
  display: none;
}

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--sidebar);
  color: #e6e6e6;
  padding: 12px 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: var(--topnav-h);
  height: calc(100vh - var(--topnav-h));
  overflow: hidden;
  z-index: 40;
  transition: width .22s ease-out, flex-basis .22s ease-out, box-shadow .22s ease-out;
}
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-right: 2px;
}
.sidebar .logo {
  display: none;
}
.nav-label {
  white-space: nowrap;
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity .18s ease-out, transform .18s ease-out;
}
.app-shell.is-nav-pinned .sidebar,
.app-shell.is-nav-open .sidebar {
  width: var(--sidebar-w-open);
  flex-basis: var(--sidebar-w-open);
}
.app-shell.is-nav-pinned .nav-label,
.app-shell.is-nav-open .nav-label,
.app-shell.is-nav-pinned .nav-section,
.app-shell.is-nav-open .nav-section,
.sidebar:hover .nav-label,
.sidebar:focus-within .nav-label {
  opacity: 1;
  transform: none;
}

.sidebar .logo {
  display: none;
}

.app-shell:not(.is-nav-pinned):not(.is-nav-open) .nav-section {
  opacity: 0;
}
@media (hover: hover) and (min-width: 961px) {
  .app-shell:not(.is-nav-pinned) .sidebar:hover .nav-section,
  .app-shell:not(.is-nav-pinned) .sidebar:focus-within .nav-section {
    opacity: 1;
  }
}
.nav-section {
  margin: 8px 8px 6px;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #8d9399;
  white-space: nowrap;
  overflow: hidden;
  height: 16px;
}

.nav-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: #c5c8cc;
  text-align: left;
  padding: 10px 12px;
  border-radius: 3px;
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background .18s ease-out, color .18s ease-out;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  position: relative;
}
.nav-btn i {
  width: 1.15rem;
  flex: 0 0 1.15rem;
  text-align: center;
  opacity: .95;
}
.nav-btn:hover { background: var(--nav-hover); color: #fff; }
.nav-btn.active {
  background: #3a3f47;
  color: #fff;
}
.nav-btn.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}
.app-shell.is-nav-pinned .nav-btn-sub,
.app-shell.is-nav-open .nav-btn-sub,
.sidebar:hover .nav-btn-sub,
.sidebar:focus-within .nav-btn-sub {
  padding-left: 28px;
}
.nav-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sidebar-foot {
  margin-top: auto;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 8px;
}
.app-userchip .user-avatar,
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: .85rem;
  flex: 0 0 auto;
}
.app-userchip-name {
  font-size: .85rem;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar .key-box {
  margin-top: auto;
  padding: 12px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 4px;
  background: rgba(0,0,0,.2);
}
.sidebar .key-box label {
  display: block;
  font-size: .7rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #8fa0b0;
  margin-bottom: 6px;
}
.sidebar .key-box input {
  width: 100%;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
  color: #fff;
  border-radius: 3px;
  padding: 8px 10px;
  font-size: .78rem;
  font-family: ui-monospace, Consolas, monospace;
}
.sidebar .health {
  margin-top: 4px;
  margin-bottom: 8px;
  font-size: .75rem;
  color: #9aa0a6;
  white-space: nowrap;
  overflow: hidden;
}
.sidebar .health .ok { color: #6ddeb0; }
.sidebar .health .bad { color: #ff8f8f; }
.sidebar .logout-btn {
  width: 100%;
  padding: 8px 10px;
  font-size: .85rem;
  color: #c5c8cc;
}
.sidebar-pin {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 8px 12px;
  border: 0;
  background: transparent;
  color: #c5c8cc;
  cursor: pointer;
  border-radius: 3px;
  font-size: .85rem;
  font-weight: 500;
}
.sidebar-pin i { width: 1.15rem; text-align: center; }
.sidebar-pin:hover { background: var(--nav-hover); color: #fff; }
.sidebar-pin:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.sidebar-pin[aria-pressed="true"] {
  color: #fff;
}
.app-shell:not(.is-nav-pinned):not(.is-nav-open) .sidebar-pin .nav-label {
  opacity: 0;
}
@media (hover: hover) and (min-width: 961px) {
  .app-shell:not(.is-nav-pinned) .sidebar:hover,
  .app-shell:not(.is-nav-pinned) .sidebar:focus-within {
    width: var(--sidebar-w-open);
    flex-basis: var(--sidebar-w-open);
    box-shadow: 12px 0 28px rgba(0, 0, 0, .28);
    z-index: 50;
  }
}

.main {
  padding: 28px 32px 56px;
  overflow: auto;
  flex: 1 1 auto;
  min-width: 0;
  background: var(--paper);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 26px;
}
.topbar h1 {
  margin: 0;
  font-family: var(--font);
  font-size: 1.7rem;
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.15;
}
.topbar p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: .94rem;
  max-width: 52ch;
  line-height: 1.5;
}

.panel {
  display: none;
  animation: fade .25s ease;
}
.panel.active { display: block; }

@keyframes fade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.card h2 {
  margin: 0 0 14px;
  font-size: .78rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}

.row-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.row-grid.three { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 960px) {
  .app-menu-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .app-brand-text { display: none; }
  .app-userchip-name { display: none; }
  .app-userchip-caret { display: none; }
  .app-create-label { display: none; }
  .btn-create { padding: 0 10px; min-width: 34px; justify-content: center; }
  .app-search { max-width: none; flex: 1 1 auto; min-width: 0; }
  .sidebar {
    position: fixed;
    left: 0;
    top: var(--topnav-h);
    bottom: 0;
    height: auto;
    transform: translateX(-110%);
    width: min(86vw, var(--sidebar-w-open));
    flex-basis: auto;
    z-index: 70;
    box-shadow: 12px 0 28px rgba(0,0,0,.28);
  }
  .app-shell.is-nav-open .sidebar {
    transform: none;
    width: min(86vw, var(--sidebar-w-open));
    flex-basis: auto;
  }
  .app-shell.is-nav-open .nav-label,
  .app-shell.is-nav-open .nav-section { opacity: 1; transform: none; }
  .sidebar-pin { display: none; }
  .nav-scrim {
    display: none;
    position: fixed;
    inset: var(--topnav-h) 0 0 0;
    border: 0;
    background: rgba(0, 0, 0, .45);
    z-index: 65;
    cursor: pointer;
  }
  .app-shell.is-nav-open .nav-scrim { display: block; }
  .row-grid, .row-grid.three { grid-template-columns: 1fr; }
  .main { padding: 18px; }
}

label.field {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--ink);
}
.form-control, .form-select, textarea.form-control {
  border-radius: var(--radius-sm);
  border-color: var(--line);
  font-size: .92rem;
  background: #fff;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.form-control:focus, .form-select:focus, textarea.form-control:focus {
  border-color: rgba(54, 131, 220, .55);
  box-shadow: 0 0 0 .2rem rgba(54, 131, 220, .18);
}
.mb-3 { margin-bottom: 1rem !important; }

.btn,
.btn-accent,
.btn-ink,
.btn-ghost,
.nav-btn,
summary.bui-legend {
  cursor: pointer;
}
.btn-accent,
.btn-ink,
.btn-ghost {
  transition: background .22s ease, border-color .22s ease, color .22s ease, box-shadow .22s ease, transform .22s ease;
}
.btn-accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
  border-radius: var(--radius-sm);
  padding: .58rem 1.05rem;
  letter-spacing: -0.01em;
}
.btn-accent:hover {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
  color: #fff;
  box-shadow: 0 4px 12px rgba(54, 131, 220, .28);
}
.btn-ink {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
  font-weight: 600;
  border-radius: var(--radius-sm);
  padding: .58rem 1.05rem;
}
.btn-ink:hover { background: #0a1511; color: #fff; }
.btn-ghost {
  background: rgba(255,255,255,.7);
  border: 1px solid var(--line);
  color: var(--ink);
  font-weight: 500;
  border-radius: var(--radius-sm);
  padding: .58rem 1.05rem;
}
.btn-ghost:hover { background: #fff; border-color: rgba(12, 107, 79, .25); }
.btn-accent:focus-visible,
.btn-ink:focus-visible,
.btn-ghost:focus-visible,
.nav-btn:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible,
summary.bui-legend:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

.table-wrap { overflow: auto; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}
table.data th, table.data td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
table.data th {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}
table.data tr:hover td { background: rgba(18,32,46,.02); }

.badge-soft {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 700;
  background: rgba(18,32,46,.08);
}
.badge-soft.queued { background: rgba(183,121,31,.15); color: var(--warn); }
.badge-soft.processing { background: rgba(18,64,120,.12); color: #1a4f86; }
.badge-soft.completed { background: rgba(31,122,76,.14); color: var(--ok); }
.badge-soft.failed { background: rgba(163,50,50,.14); color: var(--bad); }

.toast-area {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 360px;
}
.toast-item {
  background: var(--ink);
  color: #fff;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: .88rem;
  box-shadow: 0 12px 30px rgba(0,0,0,.2);
  animation: fade .2s ease;
}
.toast-item.error { background: var(--bad); }

.preview-box {
  border: 1px dashed var(--line);
  border-radius: 12px;
  min-height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(18,32,46,.03);
  overflow: hidden;
}
.preview-box img {
  max-width: 100%;
  max-height: 240px;
  object-fit: contain;
}
.muted { color: var(--muted); font-size: .88rem; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.progress {
  height: 8px;
  border-radius: 999px;
  background: rgba(18,32,46,.08);
  overflow: hidden;
}
.progress > span {
  display: block;
  height: 100%;
  background: var(--accent);
  width: 0;
  transition: width .3s ease;
}
.mono { font-family: ui-monospace, Consolas, monospace; font-size: .84rem; }
.empty {
  padding: 28px;
  text-align: center;
  color: var(--muted);
}

a.nav-btn {
  display: flex;
  text-decoration: none;
}
a.nav-btn:hover { color: #fff; }

.hub-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
@media (max-width: 1100px) {
  .hub-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .hub-grid { grid-template-columns: 1fr; }
}
.hub-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 22px 22px 20px;
  transition: border-color .2s ease-out, box-shadow .22s ease-out;
  min-height: 220px;
  position: relative;
  overflow: hidden;
}
.hub-card::after { display: none; }
.hub-card:hover {
  transform: none;
  border-color: #cfd3d7;
  color: inherit;
  box-shadow: var(--shadow-sm);
}
.hub-card.accent {
  background: #fff;
  border-color: var(--line);
}
.hub-step {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 14px;
}
.hub-step b {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: .7rem;
  letter-spacing: 0;
}
.hub-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--surface-soft);
  color: var(--accent-deep);
  margin-bottom: 16px;
  font-size: 1.1rem;
  border: 1px solid var(--line);
}
.hub-card.accent .hub-icon {
  background: #fff;
  border-color: var(--line);
}
.hub-card h2 {
  margin: 0 0 8px;
  font-size: 1.22rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.hub-card p {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.55;
  font-size: .92rem;
  flex: 1;
}
.hub-cta {
  font-weight: 600;
  color: var(--accent-deep);
  font-size: .9rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.hub-card:hover .hub-cta i {
  transform: translateX(3px);
}
.hub-cta i {
  transition: transform .2s ease;
  font-size: .8rem;
}

.cm-empty {
  text-align: center;
  padding: 72px 24px 40px;
}
.cm-empty-icon {
  width: 96px;
  height: 96px;
  margin: 0 auto 28px;
  border: 1px solid var(--line);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #fff;
}
.cm-empty h1 {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #32363c;
}
.cm-empty-lede {
  margin: 8px 0 0;
  font-size: 1.05rem;
  color: #606469;
}
.cm-empty-copy {
  margin: 16px auto 28px;
  max-width: 46ch;
  color: #888;
  line-height: 1.55;
  font-size: .95rem;
}
.cm-help-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 32px;
  max-width: 1080px;
  margin: 24px auto 0;
  padding: 8px 8px 32px;
  border-top: 1px solid var(--line);
}
.cm-help-col h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .95rem;
  font-weight: 700;
  margin: 20px 0 12px;
  color: var(--ink);
}
.cm-help-col h2 i { color: var(--muted); font-size: .9rem; }
.cm-help-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.cm-help-col li { margin: 0 0 8px; }
.cm-help-col a {
  color: var(--accent);
  text-decoration: none;
  font-size: .9rem;
}
.cm-help-col a:hover { text-decoration: underline; }
.cm-quick-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cm-quick-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #fff;
  color: var(--ink);
  font-size: .88rem;
  font-weight: 600;
  text-decoration: none;
  min-height: 44px;
}
.cm-quick-list a:hover {
  border-color: #cfd3d7;
  text-decoration: none;
  color: var(--ink);
}
.cm-quick-list a i { color: var(--muted); font-size: .75rem; }
.cm-help-note {
  font-size: .88rem;
  color: var(--muted);
  line-height: 1.5;
  margin: 0 0 12px;
}
.cm-help-more {
  font-size: .88rem;
  font-weight: 600;
}
.cm-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.cm-stat {
  --stat-accent: var(--accent);
  --stat-soft: var(--accent-soft);
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 108px;
  padding: 16px 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  overflow: hidden;
  transition: border-color .2s ease-out, box-shadow .2s ease-out, transform .2s ease-out;
}
.cm-stat::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--stat-accent);
}
.cm-stat-total { --stat-accent: var(--accent); --stat-soft: var(--accent-soft); }
.cm-stat-pending { --stat-accent: var(--warn); --stat-soft: #fff6e5; }
.cm-stat-rejected { --stat-accent: var(--bad); --stat-soft: #fdecea; }
.cm-stat-icon {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--stat-soft);
  color: var(--stat-accent);
  font-size: 1.05rem;
}
.cm-stat-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cm-stat-label {
  display: block;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--muted);
}
.cm-stat strong {
  font-family: var(--font-display);
  font-size: 1.85rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -.03em;
  color: var(--ink);
  word-break: break-word;
}
.cm-stat-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: .78rem;
  font-weight: 600;
  color: var(--stat-accent);
}
.cm-stat-cta i {
  font-size: .7rem;
  transition: transform .2s ease-out;
}
a.cm-stat:hover,
a.cm-stat:focus-visible {
  border-color: var(--stat-accent);
  box-shadow: var(--shadow-md);
  color: inherit;
  text-decoration: none;
  transform: translateY(-2px);
}
a.cm-stat:hover .cm-stat-cta i,
a.cm-stat:focus-visible .cm-stat-cta i {
  transform: translateX(3px);
}
a.cm-stat:focus-visible {
  outline: 2px solid var(--stat-accent);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  .cm-stat,
  .cm-stat-cta i { transition: none; }
  a.cm-stat:hover,
  a.cm-stat:focus-visible { transform: none; }
}
@media (max-width: 900px) {
  .cm-help-grid,
  .cm-stat-grid { grid-template-columns: 1fr; }
}

.layer-card .layer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.layer-card .layer-head span {
  font-size: .78rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}
.style-subhead {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 4px;
}
.text-style-grid .form-control-color {
  min-height: 38px;
  padding: .2rem;
}
#tplListTable tr.is-editing {
  outline: 2px solid rgba(227, 91, 45, 0.35);
  background: rgba(227, 91, 45, 0.06);
}

.custom-video-panel {
  position: sticky;
  top: 16px;
  width: 100%;
  max-width: 100%;
}
.custom-preview {
  --cv-w: 16;
  --cv-h: 9;
  --cv-max-h: min(70vh, 640px);
  position: relative;
  width: min(100%, calc(var(--cv-max-h) * var(--cv-w) / var(--cv-h)));
  max-width: 100%;
  max-height: var(--cv-max-h);
  aspect-ratio: var(--cv-w) / var(--cv-h);
  margin-inline: auto;
  background: #111;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.custom-preview .cv-bg-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  z-index: 0;
  display: none;
  pointer-events: none;
  user-select: none;
}
.custom-preview .cv-bg-layer.is-active {
  display: block;
}
.api-doc-block {
  background: rgba(0,0,0,.04);
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 10px;
  padding: 12px 14px;
  overflow: auto;
  font-size: 0.78rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}
.api-doc-block code {
  font-family: Consolas, ui-monospace, monospace;
}
.custom-preview--editable {
  cursor: grab;
  touch-action: none;
}
.custom-preview--editable:active {
  cursor: grabbing;
}
.custom-preview canvas,
.custom-preview video {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: transparent;
}
.cv-layer-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.cv-layer-tab {
  border: 1px solid rgba(0,0,0,.12);
  background: rgba(255,255,255,.55);
  color: inherit;
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: .82rem;
  cursor: pointer;
}
.cv-layer-tab.is-active {
  background: var(--ink, #1b2430);
  border-color: transparent;
  color: #fff;
}
.gv-ai-preview {
  background-color: #e8e8e8;
  background-image:
    linear-gradient(45deg, #d0d0d0 25%, transparent 25%),
    linear-gradient(-45deg, #d0d0d0 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #d0d0d0 75%),
    linear-gradient(-45deg, transparent 75%, #d0d0d0 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}
.cv-inspector {
  border-top: none;
  padding-top: 0;
}
#cvDownload video {
  width: 100%;
  max-height: min(50vh, 420px);
  margin-top: 12px;
  border-radius: 10px;
  background: #111;
}
@media (max-width: 991.98px) {
  .custom-video-panel { position: static; }
  .custom-preview { --cv-max-h: min(58vh, 520px); }
}
@media (max-width: 575.98px) {
  .custom-preview { --cv-max-h: min(48vh, 420px); border-radius: 10px; }
}

/* Template editor — Beautiful UI fieldset boxes */
.cv-editor-rail {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.bui-box {
  margin: 0;
  padding: 16px 16px 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--shadow-sm);
  min-inline-size: 0;
}
.bui-box + .bui-box,
.cv-editor-rail > .bui-box + #cvEditorWorkspace {
  margin-top: 0;
}
#cvEditorWorkspace {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.bui-box--actions {
  background:
    linear-gradient(165deg, rgba(227, 243, 236, .55) 0%, #fff 42%);
  border-color: rgba(12, 107, 79, .14);
}
.bui-box--preview {
  position: sticky;
  top: 16px;
}
.bui-legend {
  display: flex;
  align-items: center;
  gap: 10px;
  width: auto;
  float: none;
  margin: 0 0 12px;
  padding: 0;
  font-size: .92rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  border: 0;
}
.bui-legend--nested {
  margin-bottom: 8px;
  font-size: .86rem;
  color: var(--muted);
}
.bui-legend-num {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 22px;
  padding: 0 7px;
  border-radius: 7px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .04em;
}
.bui-legend-text {
  line-height: 1.2;
}
.bui-box-inner {
  padding: 12px;
  border-radius: 12px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
}
.bui-box .field {
  margin-top: 0;
}
.bui-box .form-control,
.bui-box .form-select {
  background: #fff;
}
.cv-inspector.bui-box-inner {
  margin-top: 14px;
}
.bui-disclose > .bui-legend {
  list-style: none;
  width: 100%;
  margin-bottom: 0;
  gap: 8px;
}
.bui-disclose > .bui-legend::-webkit-details-marker {
  display: none;
}
.bui-disclose > .bui-legend::after {
  content: "";
  margin-left: auto;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform .22s ease;
  flex-shrink: 0;
}
.bui-disclose[open] > .bui-legend {
  margin-bottom: 12px;
}
.bui-disclose[open] > .bui-legend::after {
  transform: rotate(225deg);
  margin-top: 4px;
}
.bui-disclose-hint {
  font-size: .72rem;
  font-weight: 500;
  margin-left: 4px;
}
.bui-disclose[open] .bui-disclose-hint {
  display: none;
}
.bui-box {
  transition: box-shadow .22s ease, border-color .22s ease;
}
.bui-box:hover {
  box-shadow: var(--shadow-md);
  border-color: rgba(12, 107, 79, .16);
}
.cv-aspect-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
}
.cv-aspect-toolbar[hidden],
.cv-aspect-tile[hidden] {
  display: none !important;
}
.cv-aspect-back {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  touch-action: manipulation;
}
.cv-aspect-back i {
  font-size: .95rem;
}
.cv-aspect-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.cv-aspect-chip {
  min-height: 44px;
  min-width: 44px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--ink);
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  transition: background .2s ease-out, border-color .2s ease-out, color .2s ease-out, box-shadow .2s ease-out;
}
.cv-aspect-chip:hover {
  background: #fff;
  border-color: rgba(12, 107, 79, .25);
}
.cv-aspect-chip.is-active,
.cv-aspect-chip[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.cv-aspect-chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.cv-aspect-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: start;
}
.cv-aspect-tile {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
  color: inherit;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
  transition: border-color .22s ease-out, box-shadow .22s ease-out, background .22s ease-out, transform .22s ease-out;
}
.cv-aspect-grid:not(.is-focus) .cv-aspect-tile:hover {
  border-color: rgba(12, 107, 79, .22);
  background: #fff;
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}
.cv-aspect-tile.is-active {
  border-color: rgba(12, 107, 79, .45);
  background: #fff;
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.cv-aspect-tile:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.cv-aspect-tile-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 36px;
}
.cv-aspect-tile-label {
  font-size: .78rem;
  font-weight: 600;
  color: var(--ink);
}
.cv-aspect-tile-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  min-height: 32px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .01em;
}
.cv-aspect-tile[data-ratio="16:9"] .custom-preview { --cv-w: 16; --cv-h: 9; }
.cv-aspect-tile[data-ratio="9:16"] .custom-preview { --cv-w: 9; --cv-h: 16; }
.cv-aspect-tile[data-ratio="1:1"] .custom-preview { --cv-w: 1; --cv-h: 1; }
.cv-aspect-tile[data-ratio="4:5"] .custom-preview { --cv-w: 4; --cv-h: 5; }
.cv-aspect-tile .custom-preview {
  --cv-max-h: min(28vh, 260px);
  width: min(100%, calc(var(--cv-max-h) * var(--cv-w) / var(--cv-h)));
  height: auto;
}
.cv-aspect-grid:not(.is-focus) .custom-preview--editable {
  cursor: pointer;
}
.cv-aspect-grid.is-focus {
  grid-template-columns: 1fr;
}
.cv-aspect-grid.is-focus .cv-aspect-tile {
  cursor: default;
  transform: none;
  padding: 16px;
  animation: cv-aspect-focus-in .28s ease-out;
}
.cv-aspect-grid.is-focus .cv-aspect-tile-cta {
  display: none;
}
.cv-aspect-grid.is-focus .cv-aspect-tile .custom-preview {
  --cv-max-h: min(70vh, 640px);
  width: min(100%, calc(var(--cv-max-h) * var(--cv-w) / var(--cv-h)));
}
@keyframes cv-aspect-focus-in {
  from { opacity: .72; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@media (max-width: 767.98px) {
  .cv-aspect-grid { grid-template-columns: 1fr; }
  .cv-aspect-tile .custom-preview { --cv-max-h: min(42vh, 360px); }
  .cv-aspect-grid.is-focus .cv-aspect-tile .custom-preview {
    --cv-max-h: min(62vh, 560px);
  }
}

/* Video library */
.vl-topbar {
  align-items: center;
}
.vl-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: 0 0 20px;
  padding: 10px 12px;
  background: rgba(255,255,255,.72);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(8px);
}
.vl-search-wrap {
  position: relative;
  flex: 1 1 220px;
  max-width: 340px;
}
.vl-search-wrap > i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: .85rem;
  pointer-events: none;
}
.vl-search-wrap .form-control {
  padding-left: 36px;
  border-radius: var(--radius-sm);
  background: var(--panel);
}
.vl-filters {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(18, 32, 46, .06);
  border: 1px solid var(--line);
}
.vl-filter {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: .82rem;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
}
.vl-filter:hover { color: var(--ink); }
.vl-filter.is-active {
  background: #fff;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line);
}
.vl-toolbar-end {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}
.vl-count {
  color: var(--muted);
  font-size: .85rem;
  white-space: nowrap;
}

.vl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 18px;
}
.vl-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.vl-card:hover,
.vl-card:focus-within {
  transform: translateY(-2px);
  border-color: rgba(18, 32, 46, .18);
  box-shadow: 0 14px 34px rgba(18, 32, 46, .08);
}
.vl-card:focus {
  outline: 2px solid rgba(227, 91, 45, .45);
  outline-offset: 2px;
}
.vl-card-media {
  position: relative;
  appearance: none;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  aspect-ratio: 9 / 14;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(227, 91, 45, .18), transparent 45%),
    linear-gradient(160deg, #152333, #0b1520 70%);
  display: block;
  overflow: hidden;
  width: 100%;
}
.vl-card.is-landscape .vl-card-media {
  aspect-ratio: 16 / 10;
}
.vl-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .35s ease;
}
.vl-card:hover .vl-card-media img {
  transform: scale(1.04);
}
.vl-card-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, .35);
  font-size: 1.75rem;
}
.vl-play-badge {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 48px;
  height: 48px;
  margin: -24px 0 0 -24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: rgba(18, 32, 46, .55);
  backdrop-filter: blur(6px);
  opacity: 0;
  transform: scale(.92);
  transition: opacity .18s ease, transform .18s ease;
  pointer-events: none;
}
.vl-card:hover .vl-play-badge,
.vl-card:focus-within .vl-play-badge {
  opacity: 1;
  transform: scale(1);
}
.vl-duration {
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .62);
  color: #fff;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .02em;
}
.vl-card-body {
  padding: 12px 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}
.vl-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.vl-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--ink);
  background: rgba(18, 32, 46, .07);
}
.vl-icon-actions {
  display: inline-flex;
  gap: 2px;
  opacity: .55;
  transition: opacity .15s ease;
}
.vl-card:hover .vl-icon-actions,
.vl-card:focus-within .vl-icon-actions {
  opacity: 1;
}
.vl-icon-btn {
  appearance: none;
  border: 0;
  background: transparent;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.vl-icon-btn:hover:not(:disabled) {
  background: rgba(18, 32, 46, .07);
  color: var(--ink);
}
.vl-icon-btn.is-danger:hover:not(:disabled) {
  background: rgba(163, 50, 50, .1);
  color: var(--bad);
}
.vl-icon-btn:disabled {
  opacity: .35;
  cursor: not-allowed;
}
.vl-card-title {
  margin: 0;
  font-size: .98rem;
  font-weight: 700;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.vl-card-meta {
  margin: 0;
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.35;
}

.vl-empty {
  text-align: center;
  padding: 64px 24px 48px;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.vl-empty-icon {
  width: 96px;
  height: 96px;
  margin: 0 auto 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  color: var(--brand);
  font-size: 1.6rem;
  border: 1px solid var(--line);
}
.vl-empty h2 {
  margin: 0 0 8px;
  font-size: 1.2rem;
}
.vl-empty p {
  margin: 0 auto 18px;
  max-width: 36ch;
  color: var(--muted);
}

.vl-skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 18px;
}
.vl-skel {
  aspect-ratio: 9 / 14;
  border-radius: 16px;
  background: linear-gradient(90deg, rgba(18,32,46,.06), rgba(18,32,46,.12), rgba(18,32,46,.06));
  background-size: 200% 100%;
  animation: vl-shimmer 1.2s ease-in-out infinite;
}
@keyframes vl-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.vl-modal-dialog {
  max-width: min(720px, calc(100vw - 24px));
}
.vl-modal {
  background: #0f1b27;
  color: #e8eef4;
  border: 0;
  border-radius: 18px;
  overflow: hidden;
}
.vl-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 10px;
}
.vl-modal-head .modal-title {
  font-size: 1.05rem;
  font-weight: 700;
}
.vl-modal-meta {
  margin-top: 4px;
  color: rgba(232, 238, 244, .65);
  font-size: .8rem;
}
.vl-modal-stage {
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.vl-player {
  width: 100%;
  max-height: min(68vh, 620px);
  background: #000;
  display: block;
}
.vl-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 18px 16px;
}
.vl-modal-actions .btn-ghost {
  border-color: rgba(255,255,255,.16);
  color: #e8eef4;
}
.vl-modal-actions .btn-ghost:hover {
  background: rgba(255,255,255,.08);
  color: #fff;
}

@media (max-width: 700px) {
  .vl-toolbar { align-items: stretch; }
  .vl-search-wrap { max-width: none; }
  .vl-toolbar-end { margin-left: 0; width: 100%; justify-content: space-between; }
  .vl-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
}

.sticky-actions {
  position: sticky;
  bottom: 12px;
  background: rgba(243, 239, 230, .92);
  backdrop-filter: blur(8px);
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  z-index: 5;
}

.aspect-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.aspect-chip {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  cursor: pointer;
  background: rgba(18,32,46,.02);
  transition: border-color .15s ease, background .15s ease;
}
.aspect-chip input { accent-color: var(--accent); margin-bottom: 4px; }
.aspect-chip strong { font-size: .92rem; }
.aspect-chip span { font-size: .78rem; color: var(--muted); }
.aspect-chip.is-on {
  border-color: rgba(227, 91, 45, .55);
  background: rgba(227, 91, 45, .08);
}

.segmented {
  display: inline-flex;
  background: rgba(18,32,46,.06);
  border-radius: 999px;
  padding: 4px;
  gap: 4px;
}
.seg-btn {
  border: 0;
  background: transparent;
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 700;
  font-size: .88rem;
  color: var(--muted);
  cursor: pointer;
}
.seg-btn.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(18,32,46,.08);
}

.job-row {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 10px;
  background: rgba(18,32,46,.02);
}

.job-stage {
  font-size: .88rem;
  line-height: 1.35;
  max-width: 42rem;
}
.job-meta {
  font-size: .78rem;
  opacity: .85;
}
.job-row.is-stuck {
  border-color: #d4a017;
  box-shadow: 0 0 0 1px rgba(212,160,23,.25);
}
.job-log {
  background: rgba(18,32,46,.04);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
}
.job-log summary {
  cursor: pointer;
  user-select: none;
}
.job-log-body {
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  margin-top: 8px;
  color: #2b3a4a;
  font-size: .75rem;
}

.preview-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 16px;
}
.video-card {
  background: rgba(18,32,46,.03);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: visible;
  display: flex;
  flex-direction: column;
}
.video-card-meta {
  padding: 10px 12px 0;
  font-size: .88rem;
}
.video-stage {
  position: relative;
  margin-top: 8px;
  background: #0b1520;
  border-radius: 0;
  /* Full frame visible — no max-height crop that clips footer/date */
  display: flex;
  flex-direction: column;
  align-items: stretch;
}
.video-stage video {
  width: 100%;
  max-height: min(62vh, 520px);
  height: auto;
  aspect-ratio: 9 / 16;
  object-fit: contain;
  display: block;
  background: #000;
  /* Native controls sit on the video; leave visual cue via letterbox above controls */
  vertical-align: bottom;
}
.video-stage-hint {
  font-size: .75rem;
  color: var(--muted, #6b7c8d);
  padding: 6px 12px 0;
}
.video-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #c5d0db;
  font-size: .85rem;
  min-height: 200px;
}
.video-card-actions {
  padding: 10px 12px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.job-preview .video-card {
  max-width: 320px;
}
.job-preview .video-stage video {
  max-height: min(55vh, 480px);
}

.preview-box {
  position: relative;
}
.preview-loader {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(238, 243, 240, .94);
  text-align: center;
  padding: 16px;
  z-index: 2;
}
.preview-loader[hidden] { display: none !important; }
.preview-loader p {
  margin: 0;
  font-weight: 700;
  color: var(--ink);
}
.spinner {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid rgba(18, 32, 46, .12);
  border-top-color: var(--accent);
  animation: spin .7s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
#btnAiProduct.is-loading {
  pointer-events: none;
  opacity: .85;
}

/* ---------- Auth / Login ---------- */
.auth-page {
  min-height: 100vh;
  margin: 0;
  font-family: var(--font);
  color: #e8f2ed;
  background: radial-gradient(ellipse 90% 70% at 50% -10%, #1a4d3a 0%, #071410 55%, #040a08 100%);
  display: grid;
  place-items: center;
  padding: 28px 16px 40px;
  position: relative;
  overflow-x: hidden;
}
.auth-glow {
  position: absolute;
  inset: auto 10% 0;
  height: 40%;
  background: radial-gradient(ellipse at center, rgba(13, 92, 69, .35), transparent 70%);
  pointer-events: none;
}
.auth-shell {
  width: min(980px, 100%);
  position: relative;
  z-index: 1;
  animation: authRise .7s ease both;
}
.auth-card {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  min-height: 560px;
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .45);
  border: 1px solid rgba(255,255,255,.08);
}
@media (max-width: 860px) {
  .auth-card { grid-template-columns: 1fr; min-height: 0; }
  .auth-brand { min-height: 220px; }
}
.auth-brand {
  position: relative;
  background:
    radial-gradient(circle at 20% 20%, rgba(143, 212, 184, .14), transparent 40%),
    linear-gradient(165deg, #14271f 0%, #0a1612 100%);
  padding: 36px 32px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
}
.auth-brand-mark {
  position: absolute;
  top: 28px;
  left: 32px;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: #0d5c45;
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: .95rem;
  letter-spacing: .02em;
}
.auth-eyebrow {
  margin: 0 0 12px;
  font-size: .72rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #9bb8ab;
}
.auth-slogan {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 560;
  font-size: clamp(1.7rem, 3.4vw, 2.35rem);
  line-height: 1.15;
  color: #fff;
  letter-spacing: -0.02em;
}
.auth-illus {
  position: absolute;
  top: 90px;
  right: 24px;
  width: 180px;
  height: 180px;
  opacity: .55;
  pointer-events: none;
}
.auth-illus-panel {
  width: 140px;
  height: 110px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.04);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.auth-illus-panel span {
  display: block;
  height: 8px;
  border-radius: 99px;
  background: rgba(255,255,255,.12);
}
.auth-illus-panel span:nth-child(2) { width: 72%; }
.auth-illus-panel span:nth-child(3) { width: 48%; }
.auth-illus-badge {
  position: absolute;
  right: 8px;
  bottom: 18px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(13, 92, 69, .85);
  border: 2px solid rgba(143, 212, 184, .5);
  display: grid;
  place-items: center;
  color: #dff7ec;
  font-size: 1.2rem;
}
.auth-panel {
  background: #fff;
  color: var(--ink);
  padding: 40px 36px 28px;
  display: flex;
  flex-direction: column;
}
.auth-panel-head {
  text-align: center;
  margin-bottom: 22px;
}
.auth-logo-seal {
  width: 42px;
  height: 42px;
  margin: 0 auto 12px;
  border-radius: 11px;
  background: #0d5c45;
  color: #fff;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
}
.auth-panel-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.auth-panel-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: .92rem;
}
.auth-alert {
  background: rgba(163, 50, 50, .08);
  border: 1px solid rgba(163, 50, 50, .2);
  color: var(--bad);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: .9rem;
  margin-bottom: 14px;
}
.auth-form { display: flex; flex-direction: column; gap: 6px; }
.auth-label {
  font-size: .82rem;
  font-weight: 600;
  color: #24352e;
  margin-top: 8px;
}
.auth-input {
  width: 100%;
  border: 1px solid rgba(18, 38, 31, .14);
  background: #f0f4f2;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: .95rem;
  color: var(--ink);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.auth-input:focus {
  border-color: rgba(13, 92, 69, .55);
  box-shadow: 0 0 0 3px rgba(13, 92, 69, .12);
  background: #fff;
}
.auth-submit {
  margin-top: 16px;
  border: 0;
  border-radius: var(--radius-sm);
  background: #0c6b4f;
  color: #fff;
  font-weight: 600;
  font-size: .98rem;
  padding: 13px 16px;
  cursor: pointer;
  transition: background .15s ease, transform .15s ease, box-shadow .15s ease;
}
.auth-submit:hover {
  background: #08533d;
  box-shadow: 0 10px 24px rgba(12, 107, 79, .28);
}
.auth-submit:active { transform: translateY(1px); }
.auth-demos {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid rgba(18, 38, 31, .08);
}
.auth-demos-title {
  margin: 0 0 10px;
  font-size: .72rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #7a8c84;
  font-weight: 700;
}
.auth-demos ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.auth-demo-fill {
  width: 100%;
  text-align: left;
  border: 1px solid rgba(18, 38, 31, .1);
  background: #f7faf8;
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 10px;
  transition: border-color .15s ease, background .15s ease;
}
.auth-demo-fill:hover {
  border-color: rgba(13, 92, 69, .35);
  background: #edf7f2;
}
.auth-demo-fill strong {
  font-size: .86rem;
  color: var(--ink);
}
.auth-demo-fill span {
  font-size: .75rem;
  color: var(--muted);
  justify-self: end;
}
.auth-demo-fill code {
  grid-column: 1 / -1;
  font-size: .72rem;
  color: #5f756b;
  background: none;
  padding: 0;
}
.auth-footer {
  text-align: center;
  margin: 18px 0 0;
  font-size: .8rem;
  color: #8fa89c;
}
@keyframes authRise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

/* Beautiful UI–inspired status / loading primitives */
.bui-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: .78rem;
  font-weight: 500;
  background: var(--surface-soft);
  color: var(--muted);
  border: 1px solid var(--line);
}
.bui-chip.is-live {
  background: var(--accent-soft);
  color: var(--accent-deep);
  border-color: rgba(12, 107, 79, .16);
}
.bui-chip .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  animation: buiPulse 1.4s ease infinite;
}
@keyframes buiPulse {
  0%, 100% { opacity: .35; transform: scale(.9); }
  50% { opacity: 1; transform: scale(1); }
}

.bui-loader {
  display: inline-grid;
  grid-template-columns: repeat(4, 7px);
  gap: 3px;
}
.bui-loader span {
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--accent);
  animation: buiGrid 1s ease infinite;
}
.bui-loader span:nth-child(2) { animation-delay: .1s; }
.bui-loader span:nth-child(3) { animation-delay: .2s; }
.bui-loader span:nth-child(4) { animation-delay: .3s; }
@keyframes buiGrid {
  0%, 100% { opacity: .25; transform: scale(.85); }
  40% { opacity: 1; transform: scale(1); }
}

.sidebar .health {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.06);
}

.ta-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
}
.ta-tab {
  min-height: 40px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  font-size: .88rem;
  font-weight: 600;
}
.ta-tab:hover { color: var(--ink); border-color: #cfd3d7; }
.ta-tab.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.ta-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ta-row {
  display: grid;
  grid-template-columns: minmax(160px, 240px) 1fr auto;
  gap: 16px;
  align-items: center;
  width: 100%;
  margin: 0;
  padding: 10px 14px 10px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  text-align: left;
  cursor: pointer;
  color: inherit;
}
.ta-row:hover { border-color: #cfd3d7; box-shadow: var(--shadow-sm); }
.ta-row:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.ta-thumb {
  aspect-ratio: 16 / 9;
  background: #111;
  border-radius: 3px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ta-thumb img,
.ta-aspect-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.ta-thumb-ph {
  color: #888;
  font-size: 1.2rem;
}
.ta-row-title {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 6px;
}
.ta-row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  color: var(--muted);
  font-size: .82rem;
}
.ta-status {
  flex: 0 0 auto;
  min-width: 88px;
  text-align: center;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 6px 10px;
  border-radius: 3px;
  background: var(--surface-soft);
}
.ta-status-pending { background: #fff4d6; color: #8a6d12; }
.ta-status-approved { background: #e3f6ec; color: var(--ok); }
.ta-status-rejected { background: #fde8e6; color: var(--bad); }
.ta-aspect-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.ta-preview-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.ta-aspect-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line);
}
.ta-aspect-thumb {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 108px;
  padding: 8px 8px 10px;
  border: 2px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.ta-aspect-thumb:hover {
  border-color: var(--ink-soft, #666);
}
.ta-aspect-thumb.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.ta-aspect-thumb-img {
  width: 100%;
  background: #111;
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 16 / 9;
}
.ta-aspect-thumb[data-ratio="9:16"] .ta-aspect-thumb-img {
  aspect-ratio: 9 / 16;
  max-height: 76px;
  width: auto;
  min-width: 42px;
}
.ta-aspect-thumb[data-ratio="1:1"] .ta-aspect-thumb-img {
  aspect-ratio: 1 / 1;
  max-width: 72px;
  margin-inline: auto;
}
.ta-aspect-thumb[data-ratio="4:5"] .ta-aspect-thumb-img {
  aspect-ratio: 4 / 5;
  max-height: 76px;
  width: auto;
  min-width: 48px;
}
.ta-aspect-thumb-img img,
.ta-aspect-thumb-img canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.ta-aspect-thumb-label {
  font-size: .72rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  color: var(--ink);
}
.ta-aspect-thumb-badge {
  font-size: .65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--accent);
}
.ta-aspect-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  min-height: 180px;
  padding-top: 4px;
}
.ta-aspect-main-frame {
  background: #111;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: min(58vh, 460px);
  position: relative;
}
.ta-preview-stage {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 80px;
}
.ta-preview-stage .cv-bg-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  z-index: 0;
  display: none;
  pointer-events: none;
  user-select: none;
}
.ta-preview-stage .cv-bg-layer.is-active {
  display: block;
}
.ta-preview-stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}
.ta-aspect-thumb-img .ta-preview-stage {
  min-height: 48px;
}
.ta-aspect-main-frame[data-ratio="16:9"] {
  aspect-ratio: 16 / 9;
  width: min(100%, calc(min(58vh, 460px) * 16 / 9));
}
.ta-aspect-main-frame[data-ratio="9:16"] {
  aspect-ratio: 9 / 16;
  height: min(58vh, 460px);
  width: auto;
  max-width: 100%;
}
.ta-aspect-main-frame[data-ratio="1:1"] {
  aspect-ratio: 1 / 1;
  width: min(100%, min(58vh, 460px));
}
.ta-aspect-main-frame[data-ratio="4:5"] {
  aspect-ratio: 4 / 5;
  height: min(58vh, 460px);
  width: auto;
  max-width: 100%;
}
.ta-aspect-main-frame img,
.ta-aspect-main-frame canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.ta-aspect-preview-loading {
  color: var(--muted);
  font-size: .75rem;
  padding: 1rem;
  text-align: center;
}
.ta-aspect-main-caption {
  font-size: .85rem;
  color: var(--muted);
  text-align: center;
}
.ta-aspect-main-empty {
  color: var(--muted);
  font-size: .9rem;
  padding: 2rem 1rem;
  text-align: center;
}
.ta-aspect {
  margin: 0;
}
.ta-aspect-frame {
  aspect-ratio: 16 / 9;
  background: #111;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ta-aspect-frame[data-ratio="9:16"] { aspect-ratio: 9 / 16; max-height: 280px; margin-inline: auto; width: min(100%, 160px); }
.ta-aspect-frame[data-ratio="1:1"] { aspect-ratio: 1 / 1; }
.ta-aspect-frame[data-ratio="4:5"] { aspect-ratio: 4 / 5; max-height: 280px; margin-inline: auto; width: min(100%, 180px); }
.ta-aspect figcaption {
  margin-top: 8px;
  font-size: .82rem;
  color: var(--muted);
}
@media (max-width: 767.98px) {
  .ta-row { grid-template-columns: 1fr; }
  .ta-aspect-grid { grid-template-columns: 1fr; }
}

/* API log */
.topbar-actions {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}
.al-layout {
  display: grid;
  grid-template-columns: minmax(280px, 380px) 1fr;
  gap: 16px;
  align-items: start;
}
.al-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}
.al-panel-head h2 {
  font-size: 1.05rem;
  margin: 0 0 4px;
  font-weight: 700;
}
.al-try-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}
.al-try-row { display: block; }
.al-code,
.al-code-block {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .78rem;
  line-height: 1.45;
}
.al-code-block {
  margin: 0;
  padding: 12px;
  background: #1b1b1b;
  color: #e8eaed;
  border-radius: 4px;
  overflow: auto;
  max-height: 420px;
  white-space: pre-wrap;
  word-break: break-word;
}
.al-result {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.al-result-meta {
  font-size: .82rem;
  color: var(--muted);
}
.al-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
  max-height: calc(100vh - 220px);
  overflow: auto;
}
.al-row {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  grid-template-areas:
    "method path code"
    "meta meta meta";
  gap: 4px 10px;
  width: 100%;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  text-align: left;
  cursor: pointer;
  color: inherit;
}
.al-row:hover { border-color: #cfd3d7; box-shadow: var(--shadow-sm); }
.al-row:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.al-row-method {
  grid-area: method;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--accent-deep);
}
.al-row-path {
  grid-area: path;
  font-size: .86rem;
  font-weight: 600;
  word-break: break-all;
}
.al-row-code {
  grid-area: code;
  font-size: .75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 3px;
  background: var(--surface-soft);
}
.al-code-ok { background: #e3f6ec; color: var(--ok); }
.al-code-bad { background: #fde8e6; color: var(--bad); }
.al-code-warn { background: #fff4d6; color: #8a6d12; }
.al-row-meta {
  grid-area: meta;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  font-size: .75rem;
  color: var(--muted);
}
.al-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.al-detail-label {
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin: 0 0 8px;
}
@media (max-width: 991.98px) {
  .al-layout { grid-template-columns: 1fr; }
  .al-detail-grid { grid-template-columns: 1fr; }
  .al-list { max-height: none; }
}

/* Social Media � Facebook compose */
.sm-layout {
  display: grid;
  grid-template-columns: minmax(280px, 420px) 1fr;
  gap: 20px;
  align-items: start;
}
.sm-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 18px 20px;
  box-shadow: var(--shadow-sm);
}
.sm-panel-head { margin-bottom: 14px; }
.sm-panel-head h2 {
  margin: 0 0 4px;
  font-size: 1.05rem;
  font-weight: 650;
}
.sm-form .field { margin-top: 12px; }
.sm-schedule-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 12px;
}
@media (max-width: 575.98px) {
  .sm-schedule-fields { grid-template-columns: 1fr; }
}
.sm-mode {
  border: 0;
  margin: 14px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 14px 18px;
  align-items: center;
}
.sm-mode legend { width: auto; float: none; margin: 0; padding: 0; }
.sm-radio {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: .92rem;
  cursor: pointer;
}
.sm-actions { margin-top: 16px; }
.sm-alert {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: .92rem;
}
.sm-alert-ok { background: #e3f6ec; color: var(--ok); }
.sm-alert-err { background: #fde8e6; color: var(--bad); }
.sm-post-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 70vh;
  overflow: auto;
}
.sm-post-list li {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.sm-post-list li:first-child { border-top: 0; padding-top: 0; }
.sm-post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  margin-bottom: 6px;
}
.sm-status {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 2px 7px;
  border-radius: 3px;
  background: var(--surface-soft);
}
.sm-status-scheduled { background: #fff4d6; color: #8a6d12; }
.sm-status-published { background: #e3f6ec; color: var(--ok); }
.sm-status-failed { background: #fde8e6; color: var(--bad); }
.sm-status-cancelled { background: #eef0f3; color: var(--muted); }
.sm-post-msg {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: .92rem;
}
.sm-post-err {
  margin: 6px 0 0;
  color: var(--bad);
  font-size: .85rem;
}
.sm-coming { margin-top: 8px; }
@media (max-width: 991.98px) {
  .sm-layout { grid-template-columns: 1fr; }
}

/* Social planner (Meta-style week / month) */
.sm-planner-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.sm-planner-views {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  background: var(--surface-soft);
  border-radius: var(--radius-sm);
}
.sm-planner-view {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: .88rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
}
.sm-planner-view.is-active {
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.sm-planner-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}
.sm-planner-nav-btn {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink);
  text-decoration: none;
  background: var(--panel);
}
.sm-planner-nav-today {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: .85rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--ink);
  background: var(--panel);
}
.sm-planner-range {
  font-weight: 650;
  font-size: .95rem;
}
.sm-planner-channels {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
}
@media (min-width: 992px) {
  .sm-planner-channels { width: auto; margin-left: auto; }
}
.sm-planner-channel {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  background: var(--panel);
}
.sm-planner-channel.is-active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(45, 106, 79, .08);
}
.sm-planner-grid {
  display: grid;
  gap: 10px;
  min-height: 420px;
}
.sm-planner-grid-week {
  grid-template-columns: repeat(7, minmax(0, 1fr));
}
.sm-planner-grid-month {
  grid-template-columns: repeat(7, minmax(0, 1fr));
}
.sm-planner-day {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-height: 280px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sm-planner-day.is-today {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(45, 106, 79, .25);
}
.sm-planner-day.is-outside {
  opacity: .55;
}
.sm-planner-day-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}
.sm-planner-day.is-today .sm-planner-day-head {
  background: rgba(45, 106, 79, .12);
}
.sm-planner-weekday {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
}
.sm-planner-date {
  font-size: 1rem;
  font-weight: 700;
}
.sm-planner-day-body {
  flex: 1;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: auto;
}
.sm-planner-empty {
  margin: auto;
  text-align: center;
}
.sm-planner-card {
  position: relative;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: #f0f7ff;
  padding: 8px;
  font-size: .82rem;
}
.sm-planner-card.is-clickable {
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.sm-planner-card.is-clickable:hover {
  border-color: rgba(54, 131, 220, .45);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.sm-planner-card.is-clickable:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.sm-planner-card-failed { background: #fff5f4; }
.sm-planner-card-published { background: #eef8f1; }
.sm-planner-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 6px;
}
.sm-planner-time {
  font-weight: 700;
  font-size: .78rem;
}
.sm-planner-menu-btn {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.sm-planner-menu-btn:hover { background: rgba(0,0,0,.06); }
.sm-planner-thumb {
  height: 56px;
  border-radius: var(--radius-sm);
  background-size: cover;
  background-position: center;
  margin-bottom: 6px;
  background-color: var(--surface-soft);
}
.sm-planner-thumb-video {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  background: var(--surface-soft);
}
.sm-planner-card-msg {
  margin: 0 0 6px;
  line-height: 1.35;
  word-break: break-word;
}
.sm-planner-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.sm-planner-channel-icon { font-size: .95rem; color: var(--muted); }
.sm-planner-popover {
  position: absolute;
  top: 32px;
  right: 6px;
  z-index: 5;
  min-width: 180px;
  padding: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
}
.sm-post-cancel .btn { font-size: .78rem; }
@media (max-width: 1199.98px) {
  .sm-planner-grid-week,
  .sm-planner-grid-month {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 575.98px) {
  .sm-planner-grid-week,
  .sm-planner-grid-month {
    grid-template-columns: 1fr;
  }
  .sm-planner-day { min-height: 200px; }
}

.sm-planner-modal[hidden] { display: none !important; }
body.sm-planner-modal-open { overflow: hidden; }
.sm-planner-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}
.sm-planner-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18, 24, 32, .55);
  backdrop-filter: blur(4px);
}
.sm-planner-modal-panel {
  position: relative;
  z-index: 1;
  width: min(720px, 100%);
  max-height: min(88vh, 900px);
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  padding: 16px 18px 18px;
}
.sm-planner-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.sm-planner-modal-title {
  margin: 0;
  font-size: 1.05rem;
}
.sm-planner-modal-close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.sm-planner-modal-close:hover { background: rgba(0,0,0,.06); color: var(--ink); }
.sm-planner-modal-caption {
  margin: 0 0 12px;
  white-space: pre-wrap;
  line-height: 1.45;
}
.sm-planner-modal-video,
.sm-planner-modal-image {
  display: block;
  width: 100%;
  max-height: min(58vh, 520px);
  border-radius: var(--radius-sm);
  background: #111;
  object-fit: contain;
}
.sm-planner-modal-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.cv-aspect-tile.is-unavailable {
  opacity: .55;
  pointer-events: none;
}
.cv-aspect-tile.is-unavailable .cv-aspect-tile-cta {
  background: var(--surface-soft);
  color: var(--muted);
}
.gv-aspect-pick-hint.is-ready { color: var(--ink); }
.sm-media-block { margin-top: 4px; }

/* Advanced Template Editor */
.cv-adv-bg-panel {
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
  background: var(--surface-soft);
}
.cv-font-list {
  list-style: disc;
  padding-left: 1.25rem;
  margin-bottom: 0;
}
.cv-decor-list {
  list-style: none;
  padding: 0;
  margin: 10px 0 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cv-decor-list[hidden] { display: none !important; }
.cv-decor-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}
.cv-decor-num {
  flex: 0 0 1.5rem;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
}
.cv-decor-thumb {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
}
.cv-decor-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.cv-decor-name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.875rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cv-decor-remove {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  min-width: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.cv-decor-remove:hover,
.cv-decor-remove:focus-visible {
  color: #c0392b;
  background: rgba(192, 57, 43, 0.08);
}
#cvIBgColorWrap[hidden] { display: none !important; }
