/* Authenticated workspace */
#app {
  --workspace-canvas: #0d0d16;
  --workspace-surface: #151521;
  --workspace-input: #10101a;
  --workspace-line: rgba(190, 182, 228, .18);
  --workspace-accent: #c5b6ff;
  --workspace-highlight: rgba(167, 139, 250, .13);
  background: var(--workspace-canvas);
}

#app::before {
  background: radial-gradient(ellipse 900px 510px at 79% -90px, rgba(126, 91, 207, .17), transparent 76%);
}

#app .sidebar {
  background: #11111a;
  border-color: var(--workspace-line);
}

#app .sidebar .brand { letter-spacing: -.035em; }
#app .menu { gap: 4px; }
#app .menu-label { color: var(--muted); }
#app .menu button { min-height: 40px; }

#app .menu button.active {
  background: var(--workspace-highlight);
  box-shadow: inset 0 0 0 1px rgba(167, 139, 250, .26);
}

#app .menu button.active::before { background: var(--workspace-accent); }
#app .menu button.active .ic { color: var(--workspace-accent); }

#app .sidebar .credit-card {
  border-color: var(--workspace-line);
  background: linear-gradient(150deg, #1e1930, #161623 78%);
}

#app .credit-card strong { font-variant-numeric: tabular-nums; }
#app .credit-card .btn {
  border-color: rgba(173, 148, 248, .36);
  background: #27203d;
  color: #ebe3ff;
  box-shadow: none;
}

#app .credit-card .btn:hover { border-color: #baa6f7; background: #34294f; }
#app .side-bottom .icon-link { flex: 0 0 auto; }
#app .workspace-creditbar { display: none; }

#app :is([data-panel="home"], [data-panel="create"], [data-panel="library"], [data-panel="credits"], .workspace-creditbar, .sidebar, .mnav, .sheet-box, .mgen) :focus-visible {
  outline: 2px solid var(--workspace-accent);
  outline-offset: 2px;
}

@media (min-width: 901px) {
  #app { --side: 244px; }
  #app .sidebar { padding-inline: 16px; }
  #app .menu button.active::before { left: -16px; }
  #app .sidebar .credit-card { display: none; }
  #app .main { padding-top: 18px; }
  #app .workspace-creditbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 13px;
  }
  #app .workspace-credit-button {
    display: inline-flex;
    align-items: center;
    min-height: 42px;
    gap: 9px;
    padding: 7px 12px;
    border: 1px solid var(--workspace-line);
    border-radius: 999px;
    background: var(--workspace-surface);
    color: var(--text-2);
    font: inherit;
    font-size: .84rem;
    cursor: pointer;
  }
  #app .workspace-credit-button:is(:hover, [aria-current="page"]) {
    border-color: var(--workspace-accent);
    background: var(--workspace-highlight);
    color: var(--text);
  }
  #app .workspace-credit-button .ic { width: 16px; height: 16px; color: var(--workspace-accent); }
  #app .workspace-credit-button strong {
    color: var(--text);
    font-size: .95rem;
    font-variant-numeric: tabular-nums;
  }
  #app .workspace-credit-button .workspace-credit-arrow { margin-inline-start: 2px; }
}

/* Home */
#app .home-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-bottom: clamp(18px, 3vw, 30px);
}

#app .home-head h2 { font-size: clamp(1.25rem, 2.1vw, 1.65rem); letter-spacing: -.035em; }
#app .home-head-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }

#app .home-launch {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr);
  gap: clamp(12px, 2vw, 22px);
}

#app .home-hero {
  min-width: 0;
  padding: clamp(22px, 3.4vw, 48px);
  border: 1px solid #353641;
  border-radius: 24px;
  background: linear-gradient(145deg, #21222b 0%, #181920 56%, #14151c);
  box-shadow: inset 0 1px rgb(255 255 255 / 5%);
}

#app .home-director-name { display: inline-flex; align-items: center; gap: 8px; color: #cbc8df; font-size: .86rem; font-weight: 600; }
#app .home-director-name .ic { width: 20px; height: 20px; }
#app .hh-title { margin-top: 15px; color: #fafafa; font-size: clamp(2rem, 3.9vw, 3.48rem); font-weight: 650; line-height: 1.025; letter-spacing: -.055em; }
#app .hh-sub { margin-top: 11px; max-width: 45ch; font-size: .95rem; line-height: 1.55; color: #bfbdca; }
#app .hh-form { margin-top: 23px; gap: 8px; }

#app .hh-formats button {
  min-height: 42px;
  border-radius: var(--r-xs);
  background: rgba(15, 14, 24, .32);
}

#app .hh-formats button.on {
  background: var(--workspace-highlight);
  color: #e4dcff;
  border-color: rgba(190, 168, 255, .6);
}

#app .hh-input {
  display: grid;
  gap: 0;
  padding: 0;
  border-color: #51505d;
  border-radius: 18px;
  background: #101117;
  box-shadow: 0 12px 24px -18px #000b;
}

#app .hh-input:focus-within { border-color: var(--workspace-accent); box-shadow: 0 0 0 2px rgba(184, 165, 243, .15); }
#app .home-idea-label { display: block; padding: 14px 16px 0; color: #d3d2da; font-size: .78rem; font-weight: 600; }
#app .hh-input textarea { min-width: 0; min-height: 66px; color: #fafafa; padding: 4px 16px 10px; resize: vertical; }
#app .hh-input textarea::placeholder { color: #a7a6b4; }
#app .hh-input textarea:focus-visible { outline-offset: -3px; }

#app .home-composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 4px 9px 9px 12px;
  color: #d5d4de;
  font-size: .83rem;
}

#app #homeDirectorIntent { width: auto; max-width: 100%; min-height: 42px; padding: 5px 8px; font: inherit; appearance: auto; color-scheme: dark; color: inherit; background: #1d1e27; border: 1px solid #373843; border-radius: 10px; cursor: pointer; }
#app .hh-input .home-continue {
  min-height: 42px;
  width: auto;
  border: 1px solid transparent;
  border-radius: 11px;
  background: #edecf4;
  color: #191a22;
  box-shadow: none;
  font-size: .86rem;
}

#app .hh-input .home-continue:hover { background: #fff; }
#app .hh-input .home-continue .ic { width: 16px; height: 16px; }
#app .home-video-language { display: flex; flex-wrap: wrap; gap: 5px 9px; align-items: center; }
#app .home-video-language select { width: auto; max-width: 100%; padding: 6px; color: var(--text); background: var(--workspace-input); border: 1px solid var(--workspace-line); border-radius: var(--r-xs); }
#app .home-manual-create { justify-self: start; display: inline-flex; align-items: center; gap: 5px; min-height: 36px; color: #d0cadd; font-size: .8rem; font-weight: 500; }
#app .home-manual-create .ic { width: 14px; height: 14px; }
#app .hh-chips { gap: 6px; }
#app .hh-chips .chip { min-height: 33px; border-color: var(--workspace-line); background: rgba(255, 255, 255, .025); font-size: .77rem; }
#app .hh-chips .chip:hover { border-color: var(--workspace-accent); }

#app .home-composer-tools { display: flex; flex-wrap: wrap; align-items: start; gap: 0 14px; }
#app .home-composer-tools details { max-width: 100%; min-width: 0; }
#app .home-composer-tools details[open] { flex-basis: 100%; }
#app .home-composer-tools summary { width: fit-content; min-height: 36px; padding-block: 7px; color: #d3d1df; line-height: 22px; font-size: .8rem; font-weight: 550; cursor: pointer; }
#app .home-settings-body { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 2px 0 5px; }
#app .home-settings-body .hh-formats button { min-height: 38px; }
#app .home-director-intro:has(~ #homeDirectorDock:not([hidden])), #app .home-hero:has(#homeDirectorDock:not([hidden])) .hh-gift { display: none; }
#app .home-launch:has(#homeDirectorDock:not([hidden])) { grid-template-columns: minmax(0, 1fr); }
#app .home-launch:has(#homeDirectorDock:not([hidden])) .home-feature { display: none; }
#app .home-hero:has(#homeDirectorDock:not([hidden])) { padding: 0; }
#homeDirectorDock { min-width: 0; scroll-margin-block-start: 5rem; }
#homeDirectorDock .production-help-dialog[open] { display: block; position: static; width: 100%; max-width: none; height: auto; max-height: none; margin: 0; border: 0; border-radius: inherit; background: transparent; box-shadow: none; }
#homeDirectorDock .production-help-dialog form { height: auto; min-height: min(60dvh, 27rem); grid-template-rows: auto minmax(min-content, 1fr) auto; }
#homeDirectorDock .production-help-header { align-items: center; background: #202129; }
#homeDirectorDock .production-help-body { max-height: 46dvh; }
#homeDirectorDock .production-help-footer { background: #191a22; }
#homeDirectorDock .production-help-header .x { min-width: 42px; min-height: 42px; }
#homeDirectorDock .production-help-quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 5.5rem), 1fr)); gap: 5px; }
#homeDirectorDock .production-help-quick button { justify-content: center; min-height: 40px; }
#homeDirectorDock .production-help-send-actions .primary { background: #eeedf5; color: #191a22; border-color: transparent; box-shadow: none; }

#app .home-feature {
  position: relative;
  isolation: isolate;
  display: grid;
  align-items: end;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--workspace-line);
  border-radius: var(--r-xl);
  background: #171726;
}

#app .home-feature img,
#app .home-feature::after { position: absolute; inset: 0; width: 100%; height: 100%; }
#app .home-feature img { z-index: -2; object-fit: cover; object-position: 50% 49%; }
#app .home-feature::after { content: ""; z-index: -1; background: linear-gradient(180deg, transparent 48%, rgba(9, 8, 16, .97) 100%); }

#app .home-feature figcaption {
  display: grid;
  gap: 7px;
  justify-items: start;
  padding: clamp(15px, 2.2vw, 23px);
  font-weight: 700;
}

#app .home-feature h3 { font-family: var(--font-display); font-size: clamp(1.15rem, 2.1vw, 1.52rem); }
#app .home-feature-actions { display: flex; flex-wrap: wrap; gap: 6px; }
#app .home-feature-actions .btn { min-height: 38px; }
#app .home-feature-actions .primary { background: #dceadf; color: #17241c; border-color: #dceadf; box-shadow: none; }
#app .home-feature-actions .primary:hover { background: #f2faf2; }
#app .home-feature-actions .ghost { background: #101617dc; border-color: #ffffff55; color: #f4faf7; }

#app .home-youtube {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px 14px;
  margin-top: 16px;
  padding: clamp(12px, 2vw, 18px);
  border: 1px solid var(--workspace-line);
  border-radius: var(--r);
  background: var(--workspace-surface);
}

#app .home-youtube h3 { margin-bottom: 4px; font-size: 1rem; }
#app .home-youtube p { margin: 0; color: var(--muted); font-size: .86rem; }

#app .home-youtube-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: var(--r-sm);
  background: rgba(255, 120, 138, .11);
  color: #ff8d9b;
}
#app .home-youtube .btn { min-height: 44px; max-width: 100%; white-space: normal; }

@media (max-width: 620px) {
  #app .home-youtube { grid-template-columns: auto minmax(0, 1fr); align-items: start; }
  #app .home-youtube .btn { grid-column: 2; justify-self: start; }
}

#app .home-block { margin-top: clamp(28px, 3.3vw, 44px); }

#app .hb-head {
  padding-bottom: 11px;
  border-bottom: 1px solid var(--workspace-line);
  margin-bottom: 14px;
}

#app .hb-head h3 { font-size: 1.24rem; }
#app .home-recent { grid-template-columns: repeat(auto-fit, minmax(min(100%, 258px), 1fr)); gap: 12px; }
#app .home-tips { grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 12px; }
#app :is(.hr-item, .tip) { background: var(--workspace-surface); border-color: var(--workspace-line); }
#app .hr-item:hover { border-color: rgba(182, 157, 255, .47); }

#app .home-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 214px), 1fr));
  gap: 12px;
  margin-top: clamp(16px, 2.6vw, 28px);
}

#app .home-action {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 74px;
  padding: 12px 14px;
  border: 1px solid var(--workspace-line);
  border-radius: var(--r);
  background: var(--workspace-surface);
  color: var(--text);
  text-align: start;
  font: inherit;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}

#app .home-action:hover { border-color: rgba(182, 157, 255, .51); background: #1c192c; }
#app .home-action-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: var(--r-sm); color: var(--workspace-accent); background: var(--workspace-highlight); }
#app .home-action b { display: block; font-size: .9rem; }
#app .home-action small { display: block; color: var(--text-2); font-size: .76rem; line-height: 1.35; }
#app .home-action > .ic { color: var(--workspace-accent); width: 16px; height: 16px; }

#app #homeTpl { margin: 0; padding: 2px 3px 10px; mask-image: none; }
#app #homeTpl .tpl-card { flex-basis: clamp(138px, 17vw, 190px); border-color: var(--workspace-line); background: var(--workspace-surface); }
#app #homeTpl .tpl-card:hover { border-color: rgba(182, 157, 255, .51); }
#app #homeTpl .tpl-card.has-media .tpl-media { aspect-ratio: 4 / 5; }
#app #homeTpl .tpl-card.has-media .tpl-media :is(video, img) { object-position: center 37%; }
#app #homeTpl .tpl-card.has-media .tpl-body { padding: 10px 11px 13px; }
#app #homeTpl :is(.tpl-go, .tpl-recipe) { color: var(--workspace-accent); }

#app .home-publish { border: 1px solid var(--workspace-line); border-radius: var(--r); background: var(--workspace-surface); }
#app .home-publish > summary { padding: 14px 16px; font-weight: 600; cursor: pointer; }
#app .home-publish .home-tips { padding: 0 12px 12px; }
#app .home-publish .tip { background: var(--workspace-input); }
#app .home-publish .tip b { margin-top: 0; }

@media (max-width: 760px) {
  #app .home-launch { grid-template-columns: minmax(0, 1fr); }
  #app .home-feature { min-height: 175px; border-radius: var(--r); }
  #app .home-feature img { object-position: 50% 43%; }
  #app .home-feature::after { background: linear-gradient(180deg, transparent 24%, rgba(9, 8, 16, .84)); }
}

@media (max-width: 410px) {
  #app .home-head h2 { font-size: 1.4rem; }
  #app .hh-input .home-continue { justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  #app :is(.home-action, .home-tpl .tpl-card, .hr-item) { transition: none; }
  #app :is(.home-tpl .tpl-card, .hr-item):hover { transform: none; }
}

/* Create, library and billing */
#app :is([data-panel="create"], [data-panel="library"], [data-panel="credits"]) > .panel-head {
  padding: 0 0 clamp(15px, 2.5vw, 24px);
  border-bottom: 1px solid var(--workspace-line);
  margin-bottom: clamp(18px, 2.3vw, 30px);
}

#app :is([data-panel="create"], [data-panel="library"], [data-panel="credits"]) > .panel-head h2 {
  font-size: clamp(1.65rem, 3vw, 2.45rem);
  color: var(--text);
  background: none;
}

#app #modeSwitch { background: var(--workspace-input); border-color: var(--workspace-line); }

#app #modeSwitch button.on {
  background: var(--workspace-highlight);
  box-shadow: inset 0 0 0 1px rgba(167, 139, 250, .36);
}

#app #createForm { gap: clamp(12px, 2vw, 20px); }

#app #createForm > .card {
  background: var(--workspace-surface);
  border-color: var(--workspace-line);
  box-shadow: inset 0 1px rgba(255, 255, 255, .025);
}

#app #createForm > .card > .card-step { flex-wrap: wrap; }

#app #createForm > .card > .card-step > b {
  background: var(--workspace-highlight);
  color: var(--workspace-accent);
  box-shadow: none;
}

#app #formatOpts { gap: 8px; }
#app #formatOpts .format-opt { min-width: 0; min-height: 96px; padding: 10px; border-color: var(--workspace-line); background: var(--workspace-input); }
#app #formatOpts .format-opt b { overflow-wrap: anywhere; }
#app #formatOpts .format-opt:hover { border-color: rgba(167, 139, 250, .4); }

#app #formatOpts .format-opt.on {
  background: var(--workspace-highlight);
  border-color: rgba(167, 139, 250, .65);
  box-shadow: inset 0 0 0 1px rgba(167, 139, 250, .24);
}

#app #formatOpts .format-opt.on > span { color: var(--workspace-accent); }
#app #createForm #idea { min-height: 116px; background: var(--workspace-input); border-color: var(--workspace-line); }
#app #createForm #idea:focus { border-color: var(--workspace-accent); }
#app #createForm > .generate-card { border-color: rgba(177, 150, 255, .35); background: linear-gradient(150deg, #1c1830, var(--workspace-surface) 78%); }
#app #createForm .create-summary > div { background: var(--workspace-input); border-color: var(--workspace-line); }

@media (max-width: 1240px) {
  #app #formatOpts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

#app [data-panel="library"] > .panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
#app #libFolders { gap: 8px; margin: 0 0 22px; padding: 10px; border: 1px solid var(--workspace-line); border-radius: var(--r); background: var(--workspace-input); }
#app #libFolders .fchip { min-height: 38px; max-width: 100%; overflow-wrap: anywhere; font: 600 .86rem/1.2 var(--font); }
#app #libFolders .fchip .ic { flex: none; }
#app #libFolders .fchip.on { background: var(--workspace-highlight); color: var(--text); border-color: rgba(167, 139, 250, .55); }
#app #libFolders .fchip.on small { color: var(--workspace-accent); }
#app #libraryGrid { gap: 26px; }
#app #libraryGrid .library-series { padding: clamp(10px, 1.5vw, 18px); background: rgba(20, 19, 33, .64); border-color: var(--workspace-line); }
#app #libraryGrid .library-section h3 { font-size: 1.19rem; }
#app #libraryGrid .library-series h4 { margin-bottom: 12px; }

#app #libraryGrid .vcard { background: var(--workspace-surface); border-color: var(--workspace-line); }
#app #libraryGrid .vcard:hover { border-color: rgba(182, 157, 255, .5); }
#app #libraryGrid .vthumb:focus-visible { outline-offset: -4px; z-index: 1; }
#app #libraryGrid .vbody { padding: 12px 14px; }
#app #libraryGrid .vbody h4 { font-size: .95rem; line-height: 1.4; }
#app #libraryGrid .vactions .btn { min-height: 38px; }

#app #libraryEmpty { background: var(--workspace-surface); border-color: var(--workspace-line); padding: clamp(34px, 6vw, 72px) 20px; }
#app #libraryEmpty .empty-ico { color: var(--workspace-accent); }
#app #libraryEmpty h3 { color: var(--text); }
#app #libraryEmpty p { margin: 10px auto 18px; max-width: 45ch; }

/* Credits and subscriptions */
#app [data-panel="credits"] .balance {
  padding: clamp(20px, 3vw, 32px);
  border-color: rgba(179, 156, 246, .32);
  background: radial-gradient(ellipse at 0 0, rgba(155, 109, 234, .2), transparent 70%), var(--workspace-surface);
}

#app [data-panel="credits"] .balance strong { font-variant-numeric: tabular-nums; color: var(--text); background: none; }
#app [data-panel="credits"] .balance-eq { color: var(--text-2); gap: 7px; }
#app [data-panel="credits"] .buy-title { font-size: clamp(1.12rem, 2vw, 1.35rem); }
#app [data-panel="credits"] .buy-title small { flex: 1 1 260px; }
#app [data-panel="credits"] > .perks { margin-block-start: 24px; }
#app [data-panel="credits"] .perk { background: var(--workspace-input); border-color: var(--workspace-line); }
#app [data-panel="credits"] .perk > span { background: var(--workspace-highlight); color: var(--workspace-accent); }
#app [data-panel="credits"] .perks-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 225px), 1fr)); }
#app [data-panel="credits"] :is(.perks:not(.is-pro), .pack:not(.premium):not(.featured), .purchases) { border-color: var(--workspace-line); background: var(--workspace-surface); }
#app [data-panel="credits"] .pack:hover { transform: none; }
#app [data-panel="credits"] .pack .price { font-variant-numeric: tabular-nums; }
#app [data-panel="credits"] .pack .pack-lock { color: var(--text-2); }
#app [data-panel="credits"] .pack .btn { min-height: 42px; }

#app [data-panel="credits"] .topup-card input[type="range"] { accent-color: var(--workspace-accent); }
#app [data-panel="credits"] .topup-card .topup-steps li.on { border-color: var(--workspace-accent); background: var(--workspace-highlight); }

.checkout-review {
  box-sizing: border-box;
  width: min(29rem, calc(100% - 1.5rem));
  max-height: calc(100dvh - 1.5rem);
  padding: clamp(16px, 4vw, 25px);
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 24px 72px #0008;
  overflow: hidden;
}
.checkout-review[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.checkout-review::backdrop { background: #080711bd; }
.checkout-review-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.checkout-review-head h3 { margin: 0; font-size: 1.3rem; }
.checkout-review-head .x { position: static; flex: none; min-width: 36px; min-height: 36px; }
.checkout-review-body { overflow-y: auto; overscroll-behavior: contain; }
.checkout-review-name { margin: 12px 0; font-weight: 700; }
.checkout-review-totals { margin: 0 0 12px; border-top: 1px solid var(--line); }
.checkout-review-totals > div {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 2px 12px;
  padding-block: 10px;
  border-bottom: 1px solid var(--line);
}
.checkout-review-totals dt { color: var(--text-2); }
.checkout-review-totals dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.checkout-review p { overflow-wrap: anywhere; }
.checkout-review :is(#checkoutReviewDetails, #checkoutReviewTerms) { margin-block: 8px; }
.checkout-review-status { margin-block: 12px; }
.checkout-review-status[data-error] { color: var(--err); }
.checkout-ad-context {
  margin: 10px 0;
  padding: 9px 12px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text-2);
  text-align: start;
  overflow-wrap: anywhere;
}
.checkout-review-actions { display: grid; justify-items: center; gap: 9px; margin-top: 16px; }
.checkout-review-actions > a { text-underline-offset: .17em; }
/* (1-dic-2026) Nota de confianza bajo «Ir a pagar»: quién procesa el pago y que la web nunca ve la tarjeta. */
.checkout-secure { display: flex; align-items: flex-start; justify-content: center; gap: 6px; margin: 0; color: var(--muted); text-align: center; line-height: 1.4; }
.checkout-secure .ic { flex: none; width: 14px; height: 14px; margin-top: 2px; color: var(--ok, #34d399); }
.project-estimate-sample { display: inline-flex; align-items: center; gap: 6px; margin-block: 3px 8px; text-align: start; }
.project-estimate-sample .ic { width: 14px; height: 14px; }

/* Administration */
#app [data-panel="admin"] { container: admin-workspace / inline-size; }
#app [data-panel="admin"] :focus-visible { outline: 2px solid var(--workspace-accent); outline-offset: 2px; }

#app .admin-nav {
  position: static;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  overflow: visible;
  margin: 0 0 18px;
  padding: 7px;
  border: 1px solid var(--workspace-line);
  border-radius: var(--r);
  background: var(--workspace-canvas);
}

#app .admin-nav button {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  min-height: 50px;
  padding: 6px 4px;
  border-radius: var(--r-sm);
  border-color: transparent;
  background: transparent;
  font-size: .8rem;
  line-height: 1.2;
  text-align: center;
  overflow-wrap: anywhere;
}

#app .admin-nav button .ic { flex: none; width: 16px; height: 16px; }
#app .admin-nav button:hover { border-color: var(--workspace-line); background: var(--workspace-input); }
#app .admin-nav button.on { border-color: rgba(167, 139, 250, .5); background: var(--workspace-highlight); color: var(--text); box-shadow: none; }
#app .admin-nav button.on .ic { color: var(--workspace-accent); }
#app .admin-nav .an-badge { position: absolute; inset: 4px 4px auto auto; font-variant-numeric: tabular-nums; line-height: 1; }

@container admin-workspace (min-width: 555px) {
  #app .admin-nav { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

@container admin-workspace (min-width: 840px) {
  #app .admin-nav { position: sticky; top: 6px; grid-template-columns: repeat(9, minmax(0, 1fr)); }
}

#app .admin-pane { grid-template-columns: minmax(0, 1fr); }
#app .admin-pane > .card, #app .admin-pane .stat { background: var(--workspace-surface); border-color: var(--workspace-line); }
#app .admin-pane .card-step > .ic { flex: none; color: var(--workspace-accent); }
#app .admin-pane .stat strong { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
#app .admin-pane .seg button, #app .admin-pane .admin-search :is(input, button) { min-height: 44px; }
#app .admin-pane .admin-search input { min-width: 0; }
#app .admin-pane .urow { grid-template-columns: minmax(0, 1fr) auto; }
#app .admin-pane .uinfo b { white-space: normal; overflow-wrap: anywhere; }
#app .admin-pane .ucredits { font-variant-numeric: tabular-nums; }
#app .admin-pane .uactions { grid-column: 1 / -1; }
#app .admin-pane .uactions :is(.btn, input, .mini-check) { min-height: 44px; }
#app .admin-pane .uactions .mini-check input { min-height: auto; }
#app .admin-pane .src-table :is(th, td):first-child { white-space: normal; overflow-wrap: anywhere; }
#app .admin-pane .ai-guide-view summary { padding-block: 12px; }

@container admin-workspace (min-width: 720px) {
  #app .admin-pane .urow { grid-template-columns: minmax(0, 1fr) auto auto; }
  #app .admin-pane .uactions { grid-column: auto; }
}

@container admin-workspace (max-width: 480px) {
  #app .admin-pane .card-step:has(> .ic) { flex-wrap: wrap; }
  #app .admin-pane .card-step > small { flex-basis: 100%; }
  #app .admin-pane .chart-seg { width: 100%; }
}

@container admin-workspace (max-width: 345px) {
  #app .admin-pane .chart-seg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

#app .admin-pane > #adminMotionLab { border-color: rgba(167, 139, 250, .42); }
#adminMotionLab > summary {
  min-height: 46px;
  padding: 12px;
  border-radius: var(--r-sm);
  background: var(--workspace-highlight);
  color: var(--text);
  cursor: pointer;
}

#adminMotionLab > summary::marker { color: var(--workspace-accent); }
#adminMotionLab > summary:hover { color: var(--workspace-accent); }
#adminMotionLab > summary + p { margin-top: 12px; }
#adminMotionLab > p:empty { display: none; }

#adminMotionLab > form,
#adminMotionReferences {
  display: grid;
  gap: 12px;
  min-width: 0;
}

#adminMotionLab > form { margin-block: 14px; }
#adminMotionReferences {
  margin: 0;
  padding: 12px;
  border: 1px solid var(--workspace-line);
  border-radius: var(--r-sm);
}

#adminMotionLab .label { display: grid; min-width: 0; margin: 0; }
#adminMotionLab select, #adminMotionLab textarea { min-width: 0; width: 100%; background: var(--workspace-input); }
#adminMotionLab select, #adminMotionLab .btn { min-height: 44px; }
#adminMotionLab .btn { justify-self: start; white-space: normal; }
#adminMotionPhotoPreview { display: block; max-width: 100%; max-height: 180px; object-fit: contain; border-radius: var(--r-sm); }
#adminMotionConfirm {
  padding: 14px;
  border: 1px solid var(--workspace-line);
  border-radius: var(--r-sm);
  background: var(--workspace-highlight);
}

#adminMotionPrice { margin: 0 0 10px; font-variant-numeric: tabular-nums; }
#adminMotionResult { margin-top: 12px; }
#adminMotionResult video { display: block; max-width: 100%; max-height: 480px; border-radius: var(--r-sm); background: var(--workspace-input); }
#adminMotionResult > p { display: flex; flex-wrap: wrap; gap: 8px; margin-block: 12px 0; }

@container admin-workspace (min-width: 590px) {
  #adminMotionReferences { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@container admin-workspace (min-width: 640px) {
  #adminMotionLab > form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #adminMotionLab > form > :is(fieldset, div, label:has(textarea)) { grid-column: 1 / -1; }
  #adminMotionLab #adminMotionQuote { justify-self: end; }
}

@media (max-width: 900px) {
  #app .sidebar, #app .mnav {
    background: rgba(17, 17, 28, .95);
    border-color: var(--workspace-line);
    backdrop-filter: blur(18px);
  }
  #app .sidebar { flex-wrap: wrap; row-gap: 4px; padding-block: calc(6px + env(safe-area-inset-top)) 6px; }
  #app .sidebar .side-bottom { flex: 0 0 auto; }
  #app .sidebar .credit-card { flex: none; }
  #app .sidebar .credit-card .btn { min-height: 44px; }
  #app .sidebar .lang-pick { width: auto; min-height: 44px; margin: 0; flex: none; }

  #app .mnav button.active .ic { color: var(--workspace-accent); filter: none; }
  #app .mnav button.active::before { background: var(--workspace-accent); }
  #app .sheet-box { background: var(--workspace-surface); border-color: var(--workspace-line); max-height: calc(100dvh - env(safe-area-inset-top) - 12px); overflow-y: auto; }
  #app .sheet-box button { flex-shrink: 0; }
  #app .sheet-box button > span { background: var(--workspace-highlight); color: var(--workspace-accent); }
}

@media (max-width: 640px) {
  #app .home-hero { padding: 21px 16px 14px; border-radius: 18px; }
  #app .hh-title { margin-top: 11px; }
  #app .hh-form { margin-top: 17px; }
  #app .home-composer-footer { gap: 4px 6px; }
  #app .hh-formats { gap: 6px; }
  #app .hh-formats button { padding-inline: 10px; font-size: .81rem; }
  #app #createForm .create-summary > div { padding: 7px; }
  #app #libraryGrid .vbody { padding: 10px; }
  #app #libFolders { padding: 8px; }
}

@media (max-width: 440px) {
  #app .sidebar > .brand { min-width: 44px; min-height: 44px; justify-content: center; }
  #app .sidebar > .brand span { display: none; }
}

@media (max-width: 350px) {
  #app #homeDirectorIntent { max-width: 100%; }
  #app .home-composer-footer > * { flex: 1 1 auto; }
  #app .sidebar { padding-inline: 8px; gap: 8px; }
  #app .sidebar .side-bottom { min-width: 0; gap: 5px; }
  #app .sidebar .credit-card { flex-shrink: 0; gap: 5px; padding-inline-start: 8px; }
  #app .sidebar .cc-top { display: none; }
  #app .sidebar .credit-card .btn { padding-inline: 8px; }
  #app .sidebar .lang-pick { padding-inline: 4px; }
  #app .hh-formats button { padding-inline: 8px; }
  #app #libraryGrid .grid { grid-template-columns: minmax(0, 1fr); }
}
.team-admin-inbox .team-admin-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.team-admin-head h3 { margin: 0; font-size: 1rem; }
.team-admin-list .msg { max-width: none; }
.team-admin-project { white-space: pre-wrap; overflow-wrap: anywhere; }
