/* P2 operations UI
   Keeps the existing midnight theme and capabilities while reducing the
   number of decisions presented at once. Loaded after all legacy styles. */

:root {
  --ops-panel: color-mix(in srgb, var(--card) 96%, #102b49 4%);
  --ops-panel-soft: color-mix(in srgb, var(--card) 84%, var(--accent-soft));
  --ops-line: color-mix(in srgb, var(--line) 82%, transparent);
  --ops-line-strong: color-mix(in srgb, var(--accent) 40%, var(--line));
  --ops-shadow: 0 16px 44px rgba(1, 10, 24, .2);
}

/* Shared operation page header */
main > .view:not(.home-view):not([hidden]) {
  background:
    radial-gradient(circle at 92% 2%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 27%),
    transparent;
}

.view:not(.home-view) .page-intro {
  min-height: 102px;
  align-items: center;
  padding: 24px 0 20px;
  border-bottom: 1px solid var(--ops-line);
}

.view:not(.home-view) .page-intro.compact { min-height: 118px; }
.view:not(.home-view) .page-intro h1 {
  margin: 4px 0 7px;
  font-size: clamp(30px, 2.45vw, 42px);
  line-height: 1.16;
  letter-spacing: .015em;
}
.view:not(.home-view) .page-intro > div > p:last-child {
  max-width: 700px;
  margin: 0;
  font-size: 13px;
  line-height: 1.7;
}
.view:not(.home-view) .eyebrow {
  margin: 0;
  color: #65dfff;
  font-size: 10px;
  letter-spacing: .22em;
}

/* Clear three step path */
.progress-steps { gap: 0; min-width: 410px; }
.progress-steps li {
  min-width: 116px;
  color: #8da6c2;
  font-size: 12px;
  font-weight: 700;
}
.progress-steps li b {
  width: 32px;
  height: 32px;
  margin-right: 9px;
  border-color: rgba(116, 166, 214, .26);
  background: #0b1c31;
  font-size: 12px;
}
.progress-steps li:not(:last-child):after { width: 48px; margin: 0 12px; }

/* One primary choice at the top of the video workspace */
.studio-view > .creation-toolbar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.creation-toolbar > button {
  min-height: 84px;
  justify-content: flex-start;
  gap: 14px;
  padding: 15px 18px;
  border: 1px solid var(--ops-line);
  border-radius: 14px;
  background: var(--ops-panel);
  text-align: left;
}
.creation-toolbar > button b { font-size: 14px; }
.creation-toolbar > button small {
  margin-top: 5px;
  color: #91a9c4;
  font-size: 10px;
}
.creation-toolbar > button.active {
  border-color: rgba(63, 214, 250, .7) !important;
  background: linear-gradient(135deg, rgba(20, 71, 111, .98), rgba(17, 54, 89, .98)) !important;
  box-shadow: inset 3px 0 #36d8fb, 0 12px 28px rgba(0, 9, 22, .24) !important;
}
.creation-toolbar .toolbar-tip {
  grid-column: 1 / -1;
  display: flex;
  min-height: 46px;
  align-items: center;
  gap: 13px;
  padding: 0 16px;
  border: 1px solid rgba(73, 199, 235, .16);
  border-left: 3px solid #37d2f6;
  border-radius: 0 10px 10px 0;
  background: rgba(17, 45, 74, .68);
}
.creation-toolbar .toolbar-tip b { color: #eaf7ff; font-size: 12px; }
.creation-toolbar .toolbar-tip span { color: #9db5d0; font-size: 11px; }
.mode-guide {
  min-height: 42px;
  gap: 14px;
  border: 0;
  border-radius: 10px;
  background: rgba(12, 32, 55, .74);
}

/* P2 cards and inputs */
.view:not(.home-view) .panel,
.view:not(.home-view) .task-card,
.view:not(.home-view) .publish-row,
.view:not(.home-view) .account-card,
.view:not(.home-view) .quota-overview article,
.view:not(.home-view) .publish-summary article {
  border: 1px solid var(--ops-line);
  border-radius: 16px;
  background: linear-gradient(145deg, var(--ops-panel), color-mix(in srgb, var(--ops-panel) 91%, #071526));
  box-shadow: var(--ops-shadow);
}
.view:not(.home-view) .panel { padding: 20px; }
.view:not(.home-view) .panel-title {
  min-height: 38px;
  align-items: center;
  margin-bottom: 10px;
}
.view:not(.home-view) .panel-title > span {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
}
.view:not(.home-view) .panel-title > span > b {
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  place-items: center;
  border: 1px solid rgba(76, 212, 248, .35);
  border-radius: 9px;
  background: rgba(30, 130, 177, .15);
  color: #62ddff;
  font-size: 10px;
}
.view:not(.home-view) .material-intro { margin: 0 0 15px; font-size: 11px; }

.view:not(.home-view) select,
.view:not(.home-view) input:not([type="radio"]):not([type="checkbox"]):not([type="range"]):not([type="file"]):not([type="color"]),
.view:not(.home-view) textarea {
  border-color: rgba(117, 169, 219, .25);
  border-radius: 10px;
  background: rgba(5, 20, 37, .88);
  color: #edf7ff;
}
.view:not(.home-view) select:focus,
.view:not(.home-view) input:focus,
.view:not(.home-view) textarea:focus {
  border-color: #47d8fb;
  outline: 0;
  box-shadow: 0 0 0 3px rgba(50, 200, 242, .12);
}
.view:not(.home-view) .primary {
  min-height: 44px;
  border-radius: 11px;
  background: linear-gradient(100deg, #28bce9, #42d8d1);
  color: #062139;
  box-shadow: 0 10px 28px rgba(30, 184, 225, .2);
  font-weight: 900;
}
.view:not(.home-view) .primary:hover { filter: brightness(1.07); transform: translateY(-1px); }
.view:not(.home-view) .secondary,
.view:not(.home-view) .material-add,
.view:not(.home-view) .back-button {
  min-height: 38px;
  border-radius: 10px;
  background: rgba(16, 42, 69, .88);
}

/* Video creation: product first, only two supporting choices beside it. */
.studio-view > .studio-grid { grid-template-columns: minmax(0, 1fr) 390px; gap: 16px; }
.studio-view .studio-main {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.studio-view .studio-main > .panel:nth-child(1) { order: 2; }
.studio-view .studio-main > .panel:nth-child(2) { order: 1; grid-column: 1 / -1; }
.studio-view .studio-main > .panel:nth-child(3) { order: 3; }
.studio-view .studio-main > .panel:nth-child(4) { order: 4; grid-column: 1 / -1; }
.studio-view #product-list {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.studio-view #scene-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.studio-view .selected-material-preview { min-height: 136px; }
.studio-view .storyboard-panel { padding: 22px; }
.storyboard-narration-lock {
  border: 1px solid rgba(64, 211, 248, .22);
  border-left: 3px solid #39d4f7;
  border-radius: 10px;
  background: rgba(18, 47, 78, .74);
}
.storyboard-narration-lock textarea {
  min-height: 92px;
  font-size: 14px;
  line-height: 1.75;
}
.p2-advanced-copy {
  margin-top: 14px;
  border: 1px solid var(--ops-line);
  border-radius: 11px;
  background: rgba(6, 22, 39, .44);
}
.p2-advanced-copy > summary {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 16px;
  color: #dceafa;
  cursor: pointer;
  list-style: none;
}
.p2-advanced-copy > summary::-webkit-details-marker { display: none; }
.p2-advanced-copy > summary span,
.p2-advanced-copy > summary b,
.p2-advanced-copy > summary small { display: block; }
.p2-advanced-copy > summary b { font-size: 12px; }
.p2-advanced-copy > summary small { margin-top: 4px; color: #829bb8; font-size: 9px; }
.p2-advanced-copy > summary .app-icon { width: 16px; height: 16px; color: #62ddff; transition: transform .2s; }
.p2-advanced-copy[open] > summary .app-icon { transform: rotate(180deg); }
.p2-advanced-copy-body { display: grid; gap: 14px; padding: 0 16px 16px; }
.p2-advanced-copy .storyboard-field { margin: 0; }
.p2-advanced-copy .storyboard-field textarea { min-height: 210px; }

/* Compact generation settings. The existing independent wheel scrolling stays intact. */
.studio-side .sticky-panel,
.image-settings .sticky-panel { padding: 18px; }
.studio-side fieldset,
.image-output-panel fieldset { padding: 14px 0; }
.studio-side legend,
.image-output-panel legend { font-size: 11px; }
.studio-side .segment span { min-height: 42px; }
.studio-side .creation-checklist {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  padding: 13px;
}
.studio-side .creation-checklist p { grid-column: 1 / -1; margin: 0 0 2px; }
.studio-side .creation-checklist span { min-width: 0; }
.studio-side .cost-estimate,
.image-output-panel .cost-estimate {
  margin-top: 14px;
  padding: 16px;
  border: 1px solid rgba(82, 211, 244, .2);
  border-radius: 11px;
  background: rgba(20, 56, 89, .56);
}
.studio-side .cost-estimate strong,
.image-output-panel .cost-estimate strong { color: #6de4ff; font-size: 22px; }
.studio-side #submit-button,
.image-output-panel #image-submit-button { min-height: 56px; font-size: 16px; }

/* AI image creation uses the same product first hierarchy. */
.image-studio-grid { grid-template-columns: minmax(0, 1fr) 390px; gap: 16px; }
.image-builder {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.image-builder > .image-step-panel:nth-child(1),
.image-builder > .image-step-panel:nth-child(2) { grid-column: 1 / -1; }
.image-mode-grid label > span { min-height: 106px; padding: 15px; }
.image-mode-grid i { margin-bottom: 10px; }
.image-product-grid { gap: 10px; max-height: 390px; }
.style-preset-grid { gap: 9px; }
.style-preset-grid label > span { min-height: 124px; padding-top: 80px; }
.style-preset-grid label > span > img { height: 70px; }
.image-settings .image-output-panel { border-color: rgba(57, 207, 247, .24); }
.image-history-section { padding-top: 28px; }
.image-history-section .compact-heading { padding-top: 28px; }

/* Materials: picture led library with actions kept close to each item. */
.materials-view .library-toolbar,
.tasks-view .task-toolbar {
  margin-top: 18px;
  padding: 14px 16px;
  border: 1px solid var(--ops-line);
  border-radius: 14px;
  background: rgba(10, 29, 50, .82);
}
.material-filters { flex-wrap: wrap; }
.material-filters button,
.task-filters button {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: #9bb2cb;
}
.material-filters button.active,
.task-filters button.active {
  border-color: rgba(72, 211, 247, .45);
  background: rgba(28, 103, 145, .4);
  color: #eaf8ff;
}
.material-library {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  padding: 20px 0 60px;
}
.library-card {
  overflow: hidden;
  border: 1px solid var(--ops-line);
  border-radius: 15px;
  background: var(--ops-panel);
  box-shadow: var(--ops-shadow);
}
.library-card:hover { border-color: var(--ops-line-strong); transform: translateY(-2px); }
.library-cover { height: 170px; background: #0a1d33; }
.library-card-body { padding: 15px; }
.library-card h3 { margin: 6px 0; color: #edf6ff; font-size: 15px; }
.library-card p { min-height: 34px; color: #9db3cc; }
.library-card-actions .secondary { min-height: 34px; }

/* Works: simple rows with clear state and actions. */
.tasks-view .task-list { display: grid; gap: 12px; padding: 18px 0 60px; }
.tasks-view .task-card {
  grid-template-columns: 148px minmax(0, 1fr) 160px;
  gap: 18px;
  min-height: 130px;
  padding: 14px;
}
.tasks-view .task-thumb { width: 148px; height: 100px; }
.tasks-view .task-meta h3 { color: #eff7ff; font-size: 16px; }
.tasks-view .task-meta p { color: #9eb3cc; }
.tasks-view .task-state { align-self: center; }
.task-search { min-height: 40px; border-radius: 10px; }
.task-kind-select-wrap select { border-radius: 10px; background: #07182c; color: #eaf4ff; }

/* Publishing, quota and account pages share the same plain dashboard cards. */
.publish-summary,
.quota-overview { padding: 20px 0; }
.publish-summary article,
.quota-overview article { padding: 20px; }
.quota-overview article.remaining {
  border-color: rgba(68, 213, 247, .36);
  background: linear-gradient(145deg, rgba(18, 70, 105, .92), rgba(14, 43, 72, .94));
}
.billing-note {
  border: 1px solid rgba(74, 204, 238, .2);
  border-left: 3px solid #39d4f7;
  border-radius: 0 10px 10px 0;
  background: rgba(16, 46, 76, .72);
}
.admin-pricing,
.billing-reconcile { margin-top: 20px; }
.admin-pricing form { gap: 12px; }
.account-list { padding-bottom: 60px; }

/* Settings and personal menus use the same P2 surface language. */
.topbar-popover.profile-menu {
  width: 272px;
  padding: 10px;
  border-color: rgba(91, 172, 226, .25);
  border-radius: 15px;
  background: rgba(8, 27, 47, .98);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .5);
}
.profile-menu > a,
.profile-menu > button {
  min-height: 46px;
  border-radius: 10px;
  font-size: 12px;
}
.profile-menu > a:hover,
.profile-menu > button:hover { background: rgba(35, 104, 153, .32); }
.theme-dialog,
.material-dialog {
  max-height: calc(100dvh - 32px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #6796b6 #0b1e34;
  border: 1px solid rgba(106, 169, 219, .22);
  border-radius: 18px;
  background: #0b1e34;
  box-shadow: 0 32px 100px rgba(0, 0, 0, .6);
}
.theme-dialog form,
.material-dialog form { padding: 28px; }
.product-details-dialog { padding: 28px; }
.material-dialog .dialog-head,
.theme-dialog .theme-dialog-head {
  position: sticky;
  top: 0;
  z-index: 2;
  margin: -28px -28px 20px;
  padding: 24px 28px 16px;
  background: #0b1e34;
  border-bottom: 1px solid #28465f;
}
.material-dialog .dialog-actions,
.theme-dialog .theme-dialog-foot {
  position: sticky;
  bottom: 0;
  z-index: 2;
  margin: 24px -28px -28px;
  padding: 16px 28px;
  background: #0b1e34;
  border-top: 1px solid #28465f;
}
.voice-capture-box .audio-upload-button {
  border-color: #5d9cbe;
  background: #123953;
  color: #eef8ff;
  font-size: 14px;
}
.voice-capture-box .audio-upload-button:hover,
.voice-capture-box .audio-upload-button:focus-within {
  border-color: #49dbff;
  background: #1b4d69;
  outline: 2px solid #49dbff;
  outline-offset: 2px;
}
.theme-options { gap: 12px; }
.theme-option {
  border-radius: 14px;
  background: rgba(15, 41, 68, .9);
}
.theme-option-copy b { font-size: 13px; }
.theme-option-copy small { color: #9db3cc; }
.dialog-field > span { color: #eaf4ff; }
.dialog-field > small { color: #89a2bd; }
.material-image-picker,
.voice-capture-box { border-radius: 12px; background: rgba(5, 21, 38, .82); }

/* Mobile/tablet keeps the simple order and avoids horizontal overflow. */
@media (max-width: 1380px) {
  .studio-view > .studio-grid,
  .image-studio-grid { grid-template-columns: minmax(0, 1fr) 350px; }
  .studio-view #product-list,
  .material-library { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 1100px) {
  .progress-steps { display: none; }
  .studio-view > .studio-grid,
  .image-studio-grid { grid-template-columns: 1fr; }
  .image-builder { grid-template-columns: 1fr; }
  .image-builder > .image-step-panel { grid-column: 1 !important; }
  .material-library { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .view:not(.home-view) .page-intro { min-height: auto; }
  .studio-view > .creation-toolbar { display: flex; }
  .creation-toolbar .toolbar-tip { display: none; }
  .studio-view .studio-main { grid-template-columns: 1fr; }
  .studio-view .studio-main > .panel { grid-column: 1 !important; }
  .studio-view #product-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tasks-view .task-card { grid-template-columns: 112px minmax(0, 1fr); }
  .tasks-view .task-thumb { width: 112px; height: 84px; }
  .tasks-view .task-state { grid-column: 2; }
  .materials-view .library-toolbar,
  .tasks-view .task-toolbar { align-items: stretch; flex-direction: column; }
}

@media (max-width: 560px) {
  .view:not(.home-view) .panel { padding: 15px; }
  .material-library { grid-template-columns: 1fr; }
  .studio-view #product-list { grid-template-columns: 1fr 1fr; }
  .studio-side .creation-checklist { grid-template-columns: 1fr; }
  .studio-side .creation-checklist p { grid-column: 1; }
  .library-actions { flex-wrap: wrap; }
  .tasks-view .task-card { grid-template-columns: 92px minmax(0, 1fr); padding: 10px; }
  .tasks-view .task-thumb { width: 92px; height: 76px; }
}

/* Points wallet and headquarters recharge. */
.billing-view .quota-overview article.remaining {
  border-color: rgba(45, 215, 250, .42);
  background: linear-gradient(135deg, #0d4269, #153961);
}
.billing-view .quota-overview { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.billing-view .quota-overview strong { font-family: Inter,"PingFang SC","Microsoft YaHei",sans-serif; font-size: clamp(20px, 1.65vw, 28px); font-weight: 900; }
.billing-budget-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  padding: 13px;
  border: 1px solid #244c69;
  background: linear-gradient(145deg, #0b2948, #091f38);
}
.billing-budget-summary > div { padding: 4px 12px; border-right: 1px solid rgba(82, 130, 168, .2); }
.billing-budget-summary small,
.billing-budget-summary b { display: block; }
.billing-budget-summary small { margin-bottom: 5px; color: #829bb5; font-size: 9px; }
.billing-budget-summary b { color: #d9eaf8; font-size: 13px; }
.billing-budget-summary > span { color: #6f8ba7; font-size: 9px; white-space: nowrap; }
.billing-columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.billing-columns > .panel { min-width: 0; }
.billing-list article > strong { color: #eaf5ff; font-family: Inter,"PingFang SC","Microsoft YaHei",sans-serif; font-size: 14px; text-align: right; }
.billing-list article > strong > small { margin-top: 4px; color: #7895b1; font-size: 8px; font-weight: 500; }
.billing-list .point-positive { color: #73e6b2; }
.billing-list .point-negative { color: #ffca72; }
.cost-estimate strong.over { color: #ff7c87 !important; }
.point-price-list { display: grid; gap: 0; }
.point-price-list article {
  display: grid;
  min-height: 76px;
  grid-template-columns: 38px minmax(130px, .7fr) minmax(220px, 1.3fr);
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(63, 111, 149, .28);
}
.point-price-list article:last-child { border-bottom: 0; }
.point-price-icon { display: grid; width: 36px; height: 36px; place-items: center; border: 1px solid #2a678d; border-radius: 9px; background: #0d3b60; color: #5edbf9; }
.point-price-icon .app-icon { width: 18px; height: 18px; }
.point-price-list article > div b,
.point-price-list article > div small { display: block; }
.point-price-list article > div b { color: #edf7ff; font-size: 12px; }
.point-price-list article > div small { margin-top: 5px; color: #7793ae; font-size: 9px; }
.point-price-list article > p { display: flex; justify-content: flex-end; gap: 18px; margin: 0; }
.point-price-list article > p span { color: #7f9ab4; font-size: 9px; text-align: right; }
.point-price-list article > p strong { display: block; margin-top: 4px; color: #66defa; font-size: 12px; }

.account-card-actions { display: grid; gap: 7px; }
.admin-view .account-quota { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.account-quota .account-points-balance { border: 1px solid rgba(45, 213, 249, .35); background: #0d3e63; }
.account-quota .account-points-balance b { color: #63dcfa; }

.points-recharge-dialog { width: min(540px, calc(100vw - 32px)); }
.points-recharge-dialog .dialog-head p:last-child { margin-top: 7px; color: #84a0bb; font-size: 10px; }
.points-rate-card {
  display: grid;
  gap: 6px;
  margin-top: 20px;
  padding: 17px;
  border: 1px solid #2c668a;
  border-radius: 10px;
  background: linear-gradient(135deg, #0c4168, #132d53);
}
.points-rate-card span { color: #83a8c4; font-size: 9px; }
.points-rate-card strong { color: #62ddfb; font-size: 22px; }
.points-rate-card small { color: #a1b7cc; font-size: 10px; }
.points-presets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; margin-top: 14px; }
.points-presets button { min-height: 38px; border: 1px solid #2b5879; border-radius: 7px; background: #09233f; color: #b9d0e4; cursor: pointer; }
.points-presets button.active { border-color: #35d2f7; background: #10527a; color: #fff; }
.points-recharge-preview { display: flex; align-items: center; justify-content: space-between; margin-top: 18px; padding: 13px 15px; border-radius: 8px; background: rgba(21, 62, 94, .66); }
.points-recharge-preview span { color: #91abc3; font-size: 10px; }
.points-recharge-preview strong { color: #ffda72; font-size: 18px; }

@media (max-width: 900px) {
  .billing-view .quota-overview { grid-template-columns: 1fr 1fr; }
  .billing-columns { grid-template-columns: 1fr; }
  .billing-budget-summary { grid-template-columns: 1fr 1fr; }
  .billing-budget-summary > span { grid-column: 1 / -1; }
}

@media (max-width: 560px) {
  .billing-view .quota-overview { grid-template-columns: 1fr; }
  .billing-budget-summary { grid-template-columns: 1fr; }
  .billing-budget-summary > span { grid-column: auto; }
  .points-presets { grid-template-columns: 1fr 1fr; }
  .point-price-list article { grid-template-columns: 36px 1fr; padding: 10px 0; }
  .point-price-list article > p { grid-column: 1 / -1; justify-content: flex-start; padding-left: 48px; }
}

/* P2 assistant workspace: the first screen now follows the selected reference. */
.studio-view .p2-create-shell {
  display: grid;
  grid-template-columns: minmax(620px, 1.55fr) minmax(390px, .9fr);
  gap: 16px;
  height: 100%;
  min-height: 0;
  padding: 0;
}

.p2-assistant-column,
.p2-ready-column {
  min-width: 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-width: none;
}
.p2-assistant-column::-webkit-scrollbar,
.p2-ready-column::-webkit-scrollbar { display: none; width: 0; height: 0; }

.p2-assistant-column {
  padding: 18px;
  border: 1px solid rgba(78, 164, 220, .26);
  border-radius: 18px;
  background:
    radial-gradient(circle at 18% 9%, rgba(33, 134, 210, .21), transparent 29%),
    linear-gradient(145deg, rgba(7, 35, 65, .97), rgba(7, 25, 46, .98));
  box-shadow: 0 20px 55px rgba(0, 0, 0, .24);
}

.p2-assistant-hero {
  position: relative;
  display: grid;
  min-height: 226px;
  grid-template-columns: minmax(190px, .72fr) minmax(360px, 1.28fr);
  align-items: center;
  overflow: hidden;
  border-radius: 14px;
  background:
    radial-gradient(circle at 28% 45%, rgba(23, 137, 211, .34), transparent 32%),
    radial-gradient(circle at 75% 15%, rgba(111, 63, 221, .2), transparent 30%),
    linear-gradient(130deg, #092d53, #061b35 70%);
}
.p2-assistant-hero:after {
  position: absolute;
  right: 5%;
  bottom: -55px;
  width: 210px;
  height: 150px;
  border: 2px solid rgba(65, 221, 250, .14);
  border-radius: 50%;
  content: "";
  transform: rotate(-14deg);
}
.p2-assistant-person {
  position: relative;
  align-self: stretch;
  overflow: hidden;
  color: rgba(111, 221, 255, .72);
}
.p2-assistant-person > .app-icon {
  position: absolute;
  bottom: 38px;
  left: 50%;
  width: 92px;
  height: 92px;
  transform: translateX(-50%);
}
.p2-assistant-person img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 18%;
  filter: saturate(.92) contrast(1.03);
  -webkit-mask-image: linear-gradient(90deg, #000 72%, transparent 100%), linear-gradient(0deg, transparent, #000 22%);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(90deg, #000 72%, transparent 100%), linear-gradient(0deg, transparent, #000 22%);
  mask-composite: intersect;
}
.p2-assistant-copy { position: relative; z-index: 2; padding: 22px 30px 22px 8px; text-align: center; }
.p2-assistant-copy > p {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 13px;
  margin: 0;
  color: #f4f1ff;
  font-size: clamp(25px, 2vw, 38px);
  font-weight: 900;
  letter-spacing: .06em;
}
.p2-assistant-copy > p .app-icon { width: 30px; height: 30px; color: #a476ff; }
.p2-assistant-copy > small { display: block; margin-top: 5px; color: #c4d8ee; font-size: 13px; letter-spacing: .08em; }
.p2-assistant-copy h1 {
  position: relative;
  margin: 18px auto 12px;
  padding: 18px 26px;
  border-radius: 38px;
  background: linear-gradient(135deg, #f5f8ff, #dcecff);
  color: #09203c;
  font: 900 clamp(18px, 1.65vw, 27px)/1.2 Inter,"Microsoft YaHei",sans-serif;
  letter-spacing: .02em;
  box-shadow: 0 12px 25px rgba(0, 0, 0, .2);
}
.p2-assistant-copy h1:before {
  position: absolute;
  bottom: 8px;
  left: -11px;
  width: 24px;
  height: 24px;
  background: #eff6ff;
  clip-path: polygon(100% 0, 100% 100%, 0 54%);
  content: "";
}
.p2-assistant-copy > span { color: #a9c0da; font-size: 12px; }

.p2-assistant-column > .creation-toolbar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  margin: 12px 0 0;
}
.p2-assistant-column > .creation-toolbar > button {
  min-height: 62px;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 11px;
}
.p2-assistant-column > .creation-toolbar .creation-mode-icon { width: 34px; height: 34px; border-radius: 9px; }
.p2-assistant-column > .creation-toolbar .creation-mode-icon .app-icon { width: 19px; height: 19px; }
.p2-assistant-column > .creation-toolbar b { font-size: 12px; }
.p2-assistant-column > .creation-toolbar small { font-size: 8px; }
.p2-assistant-column > .mode-guide {
  min-height: 36px;
  margin: 8px 0 12px;
  padding: 7px 12px;
  border-left: 2px solid #37d2f6;
  font-size: 10px;
}

.studio-view .p2-product-panel {
  padding: 16px;
  border-color: rgba(84, 179, 232, .22);
  border-radius: 14px;
  background: rgba(8, 30, 53, .72);
  box-shadow: none;
}
.p2-product-panel .panel-title { margin-bottom: 8px; }
.p2-product-panel .product-source-tabs { margin-bottom: 9px; }
.p2-product-panel .product-category-filters { margin-bottom: 10px; }
.p2-product-panel #product-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.p2-product-panel .user-material-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(104, 167, 216, .25);
  border-radius: 13px;
  background: #0b223d;
}
.p2-product-panel .user-material-card > img { height: 190px; object-fit: cover; }
.p2-product-panel .user-material-card > span {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 2;
  padding: 38px 15px 14px;
  background: linear-gradient(transparent, rgba(4, 17, 32, .91));
  color: #fff;
}
.p2-product-panel .user-material-card > span b { font-size: 15px; }
.p2-product-panel .user-material-card > span small { color: #c5d5e7; font-size: 10px; }
.p2-product-panel .user-material-card.selected {
  border-color: #45e1ff;
  box-shadow: 0 0 0 2px rgba(44, 211, 247, .42), 0 10px 24px rgba(0, 0, 0, .25);
}
.p2-product-panel .material-check { top: 12px; right: 12px; background: #3cddf5; color: #07223a; }
.p2-product-panel .material-edit { z-index: 3; }
.p2-product-panel .product-selling-panel { margin-top: 12px; }

.p2-ready-column {
  padding: 22px;
  border: 1px solid rgba(88, 174, 229, .27);
  border-radius: 18px;
  background:
    radial-gradient(circle at 88% 0, rgba(91, 56, 202, .18), transparent 30%),
    linear-gradient(145deg, rgba(8, 32, 58, .99), rgba(7, 24, 44, .99));
  box-shadow: 0 20px 55px rgba(0, 0, 0, .25);
}
.p2-ready-heading { margin-bottom: 17px; }
.p2-ready-heading > span {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #dce9f8;
  font-size: 14px;
  font-weight: 800;
}
.p2-ready-heading > span .app-icon { width: 24px; height: 24px; color: #a678ff; }
.p2-ready-heading h2 {
  margin: 7px 0 0 34px;
  color: #d7ccff;
  font-size: clamp(21px, 1.75vw, 29px);
  line-height: 1.2;
}
.studio-view .creation-checklist.p2-ready-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}
.p2-ready-row {
  display: grid;
  min-height: 58px;
  grid-template-columns: 34px 84px minmax(0, 1fr) auto 14px;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  border: 1px solid rgba(90, 157, 211, .27);
  border-radius: 9px;
  background: rgba(9, 38, 68, .78);
  color: #e9f3ff;
  cursor: pointer;
  text-align: left;
  transition: border-color .18s, background .18s, transform .18s;
}
.p2-ready-row:hover { border-color: rgba(77, 218, 250, .54); background: rgba(15, 54, 89, .92); transform: translateX(-2px); }
.p2-ready-row[hidden] { display: none; }
.p2-ready-row > .app-icon { width: 23px; height: 23px; color: #ecf6ff; }
.p2-ready-row > small { color: #a6bdd5; font-size: 11px; }
.p2-ready-row > b { overflow: hidden; color: #f0f6ff; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.p2-ready-row > img { width: 45px; height: 40px; border-radius: 6px; object-fit: cover; }
.p2-ready-row > em { color: #a9c2dc; font-size: 22px; font-style: normal; }
.p2-ready-row > img + em { margin-left: -2px; }

.p2-ready-summary {
  margin-top: 13px;
  padding: 12px 2px;
  border-top: 1px solid rgba(113, 164, 210, .18);
  color: #91a9c2;
}
.p2-ready-summary strong { color: #dae9f8; font-size: 11px; }
.studio-view .p2-ready-cost {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 3px 12px;
  margin: 0 0 12px;
  padding: 11px 13px;
}
.p2-ready-cost span { font-size: 10px; }
.p2-ready-cost strong { grid-row: 1 / 3; grid-column: 2; font-size: 18px !important; }
.p2-ready-cost small { font-size: 8px; }
.studio-view .p2-generate-button {
  min-height: 62px;
  justify-content: center;
  gap: 11px;
  border-radius: 12px;
  background: linear-gradient(100deg, #8f45ff, #21c9ef 65%, #43ded4);
  color: white;
  font-size: 16px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .18);
}
.p2-generate-button .app-icon { width: 22px; height: 22px; }

.p2-control-drawer {
  margin-top: 10px;
  border: 1px solid rgba(93, 159, 211, .28);
  border-radius: 11px;
  background: rgba(7, 27, 48, .68);
}
.p2-control-drawer > summary {
  display: grid;
  min-height: 50px;
  grid-template-columns: 22px 1fr 16px;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  color: #dceafa;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  list-style: none;
}
.p2-control-drawer > summary::-webkit-details-marker { display: none; }
.p2-control-drawer > summary .app-icon { width: 18px; height: 18px; color: #87cfea; }
.p2-control-drawer > summary .app-icon:last-child { width: 14px; height: 14px; transition: transform .2s; }
.p2-control-drawer[open] > summary .app-icon:last-child { transform: rotate(180deg); }
.p2-drawer-body { display: grid; gap: 13px; padding: 0 13px 14px; }
.p2-copy-workbench .field { padding: 13px 0 0; }
.p2-copy-workbench textarea { min-height: 112px; }
.p2-copy-workbench .storyboard-panel {
  padding: 15px;
  border: 1px solid rgba(91, 161, 215, .2);
  border-radius: 11px;
  background: rgba(12, 37, 62, .78);
}
.p2-copy-workbench .storyboard-title { align-items: flex-start; }
.p2-copy-workbench .storyboard-title > span { white-space: normal; }
.p2-copy-workbench .storyboard-status { grid-template-columns: auto 1fr; }
.p2-copy-workbench .storyboard-status small { grid-column: 1 / -1; justify-self: start; }
.p2-settings-drawer .p2-drawer-body { gap: 0; }
.p2-setting-group { padding: 16px 0; border-top: 1px solid rgba(106, 160, 207, .18); }
.p2-setting-group:first-child { border-top: 0; }
.p2-setting-group .panel-title { margin-bottom: 10px; }
.p2-setting-group #scene-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.p2-setting-group .user-material-card > img { height: 105px; }
.p2-output-settings fieldset { margin: 0; padding: 14px 0; border: 0; border-top: 1px solid rgba(106, 160, 207, .18); }
.p2-output-settings legend { padding-top: 14px; color: #eaf3ff; font-size: 11px; font-weight: 800; }
.p2-output-settings .field { padding: 10px 0 0; border: 0; }
.p2-ready-column > .submit-note { margin-bottom: 0; }

@media (min-width: 901px) {
  main > .view.studio-view:not(.home-view):not([hidden]) {
    display: block;
    overflow: hidden;
    padding: 16px clamp(16px, 2vw, 30px);
  }
}

@media (max-width: 1320px) {
  .studio-view .p2-create-shell { grid-template-columns: minmax(540px, 1.4fr) minmax(360px, .85fr); }
  .p2-assistant-hero { grid-template-columns: 170px minmax(330px, 1fr); }
  .p2-product-panel .user-material-card > img { height: 160px; }
}

@media (max-width: 1100px) {
  .studio-view .p2-create-shell { grid-template-columns: 1fr; height: auto; }
  .p2-assistant-column,
  .p2-ready-column { overflow: visible; }
}

@media (max-width: 700px) {
  .p2-assistant-column,
  .p2-ready-column { padding: 13px; border-radius: 14px; }
  .p2-assistant-hero { min-height: 190px; grid-template-columns: 110px minmax(0, 1fr); }
  .p2-assistant-copy { padding: 15px 13px 15px 0; }
  .p2-assistant-copy > p { gap: 7px; font-size: 22px; }
  .p2-assistant-copy > p .app-icon { width: 22px; height: 22px; }
  .p2-assistant-copy > small { font-size: 10px; }
  .p2-assistant-copy h1 { margin: 13px auto 9px; padding: 14px 10px; font-size: 16px; }
  .p2-assistant-copy > span { font-size: 9px; }
  .p2-assistant-column > .creation-toolbar { display: grid; overflow: visible; margin-right: 0; padding-right: 0; }
  .p2-assistant-column > .creation-toolbar > button { min-width: 0; }
  .p2-assistant-column > .creation-toolbar small { display: none; }
  .p2-product-panel #product-list { grid-template-columns: 1fr; }
  .p2-product-panel .user-material-card > img { height: 180px; }
  .p2-ready-row { grid-template-columns: 28px 70px minmax(0, 1fr) auto 12px; }
}

/* Exact P2 creation workspace selected by the user. */
@media (min-width: 901px) {
  .app-sidebar {
    top: 72px;
    bottom: 0;
    width: 160px;
    padding: 16px 8px 0;
    overflow: visible;
  }
  .side-brand {
    position: fixed;
    top: 0;
    left: 18px;
    z-index: 62;
    width: 360px;
    height: 72px;
    gap: 10px;
    padding: 0;
  }
  .side-brand-mark { width: 40px; height: 40px; border-radius: 50%; }
  .side-brand-copy { display: flex; align-items: baseline; gap: 10px; }
  .side-brand-copy > b { font-family: Inter,"PingFang SC","Microsoft YaHei",sans-serif; font-size: 20px; letter-spacing: .02em; }
  .side-brand-copy > small { margin: 0; color: #91a8c4; font-size: 10px; letter-spacing: .08em; }
  .app-sidebar .side-nav { gap: 8px; margin: 8px 0 0; padding: 0 6px; }
  .app-sidebar .side-nav a {
    height: 82px;
    min-height: 82px;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    padding: 9px 8px 10px;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.35;
    text-align: center;
  }
  .app-sidebar .side-nav a > span { display: block; flex: 0 0 auto; white-space: nowrap; }
  .app-sidebar .side-nav a:hover { transform: none; }
  .app-sidebar .side-nav a.active:before { top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; }
  .app-sidebar .side-nav a > i { width: 27px; height: 27px; flex: 0 0 27px; }
  .sidebar-promo { display: none; }
  .topbar { left: 0; z-index: 55; padding-left: 390px; }
  .topbar-inner { max-width: none; }
  main { margin-left: 160px; }
  main > .view.studio-view:not(.home-view):not([hidden]) {
    display: block;
    height: calc(100dvh - 72px);
    min-height: 0;
    overflow: hidden;
    padding: 14px 18px 0;
  }
}

.studio-view .p2-exact-workspace {
  display: grid;
  width: 100%;
  height: 100%;
  min-height: 0;
  grid-template-rows: 68px 184px minmax(0, 1fr);
  gap: 12px;
  padding: 0;
}

.p2-create-header {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
}
.p2-create-header h1 { margin: 0 0 4px; color: #edf6ff; font-size: clamp(27px, 2vw, 38px); line-height: 1; letter-spacing: .01em; }
.p2-create-header p { margin: 0; color: #819bb8; font-size: 11px; }
.p2-create-steps { display: flex; align-items: center; margin: 0 12px 0 30px; padding: 0; list-style: none; }
.p2-create-steps li { display: flex; align-items: center; color: #7f99b4; font-size: 12px; font-weight: 800; }
.p2-create-steps li:not(:last-child):after { width: clamp(34px, 4vw, 72px); height: 1px; margin: 0 14px; background: #254763; content: ""; }
.p2-create-steps b { display: grid; width: 38px; height: 38px; margin-right: 9px; place-items: center; border: 1px solid #285170; border-radius: 50%; background: #0b2948; color: #b8cee3; font-size: 16px; }
.p2-create-steps .active { color: #61ddff; }
.p2-create-steps .active b { border-color: #55dcff; background: #26bfee; color: #06223a; box-shadow: 0 0 22px rgba(46, 201, 241, .3); }

.p2-exact-workspace > .p2-mode-cards {
  display: grid;
  min-height: 0;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}
.p2-exact-workspace > .p2-mode-cards > button {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-columns: 42% minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  overflow: hidden;
  padding: 14px;
  border: 1px solid #214664;
  border-radius: 12px;
  background: linear-gradient(145deg, #0c2948, #09213b);
  color: #eef7ff;
  cursor: pointer;
  text-align: left;
  box-shadow: none;
}
.p2-exact-workspace > .p2-mode-cards > button:hover { border-color: #3683ae; background: linear-gradient(145deg, #10365b, #0a2846); }
.p2-exact-workspace > .p2-mode-cards > button.active {
  border: 2px solid #29d4ff !important;
  background: linear-gradient(145deg, #0d3a65, #0b2e51) !important;
  box-shadow: 0 0 0 2px rgba(28, 185, 232, .13), inset 0 0 32px rgba(35, 185, 231, .08) !important;
}
.p2-exact-workspace > .p2-mode-cards > button > em {
  position: absolute;
  top: 12px;
  right: 12px;
  display: none;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  background: #2acbf2;
  color: #06304a;
  font-size: 19px;
  font-style: normal;
  font-weight: 900;
}
.p2-exact-workspace > .p2-mode-cards > button.active > em { display: grid; }
.p2-mode-media { display: block; width: 100%; height: 154px; overflow: hidden; border-radius: 8px; background: #102d48; }
.p2-mode-media > img { width: 100%; height: 100%; object-fit: cover; }
.p2-person-preview-placeholder { display: flex; height: 100%; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: #b8d6ea; font-size: 12px; }
.p2-person-preview-placeholder .app-icon { width: 46px; height: 46px; color: #b8d6ea; }
.p2-mode-cards .p2-mode-copy > .app-icon,
.p2-mode-cards .p2-person-preview-placeholder > .app-icon {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: currentColor !important;
  color: #a9e7ff !important;
}
.p2-person-preview-placeholder[hidden], .p2-mode-media > img[hidden] { display: none; }
.p2-portrait-placeholder { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: #b8d6ea; }
.p2-portrait-placeholder b { font-size: 19px; color: #e9f7ff; }
.p2-portrait-placeholder small { font-size: 12px; color: #b8d6ea; }
.p2-preview-upload { margin-top: 8px; padding: 5px 0; border: 0; background: transparent; color: #6de0ff; text-decoration: underline; text-underline-offset: 3px; font-size: 12px; cursor: pointer; }
.p2-mode-collage { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 2px; }
.p2-mode-copy { display: grid; min-width: 0; grid-template-columns: 38px minmax(0, 1fr); align-items: center; gap: 5px 10px; }
.p2-mode-copy > .app-icon { grid-row: 1 / 3; width: 34px; height: 34px; color: #dcecff; }
.p2-mode-copy b { color: #f4f8ff; font-size: clamp(16px, 1.15vw, 22px); line-height: 1.2; white-space: nowrap; }
.p2-mode-copy small { grid-column: 2; color: #a9bed4; font-size: 11px; line-height: 1.65; }

.p2-three-column {
  display: grid;
  min-height: 0;
  grid-template-columns: minmax(310px, .98fr) minmax(380px, 1.08fr) minmax(330px, .92fr);
  gap: 10px;
  overflow: hidden;
}
.p2-work-card {
  min-width: 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  padding: 16px;
  border: 1px solid #214661;
  border-radius: 11px;
  background: linear-gradient(145deg, rgba(10, 37, 65, .98), rgba(8, 29, 52, .98));
  color: #eaf4ff;
  scrollbar-width: none;
  box-shadow: inset 0 1px rgba(255, 255, 255, .02);
}
.p2-work-card::-webkit-scrollbar { display: none; width: 0; height: 0; }
.p2-card-title { display: flex; min-height: 32px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.p2-card-title h2 { margin: 0; color: #f3f8ff; font-size: 17px; }
.p2-card-title small { color: #7f9ab7; font-size: 10px; }

.p2-selected-list { display: grid; gap: 9px; }
.p2-selected-material {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 118px;
  grid-template-columns: 132px minmax(0, 1fr) 64px;
  align-items: center;
  gap: 14px;
  padding: 8px;
  border: 1px solid #234a68;
  border-radius: 9px;
  background: rgba(10, 40, 70, .72);
  color: #eaf4ff;
  text-align: left;
}
.p2-selected-material:hover { border-color: #3c9dcc; background: rgba(13, 52, 87, .9); }
.p2-selected-material[hidden] { display: none; }
.p2-selected-material > img,
.p2-material-placeholder { display: grid; width: 132px; height: 100px; place-items: center; overflow: hidden; border-radius: 7px; background: #102c49; object-fit: cover; }
.p2-material-placeholder .app-icon { width: 30px; height: 30px; color: #5f89a8; }
.p2-selected-copy { display: block; min-width: 0; }
.p2-selected-copy > small { display: block; margin-bottom: 8px; color: #9fb5ca; font-size: 11px; }
.p2-selected-copy > b { display: block; overflow: hidden; color: #f3f8ff; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.p2-selected-copy > span { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.p2-selected-copy i { padding: 4px 8px; border-radius: 13px; background: #173e66; color: #b9d2e8; font-size: 9px; font-style: normal; }
.p2-selected-actions { position: relative; display: block; }
.p2-change-button {
  display: flex;
  width: 100%;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 7px;
  border: 1px solid #2c668c;
  border-radius: 8px;
  background: #0a2744;
  color: #d6e9fa;
  cursor: pointer;
  font-size: 11px;
}
.p2-change-button:hover,
.p2-change-button[aria-expanded="true"] { border-color: #35cdf4; background: #0e3b60; color: #fff; }
.p2-change-button .app-icon { width: 12px; height: 12px; transition: transform .18s; }
.p2-change-button[aria-expanded="true"] .app-icon { transform: rotate(180deg); }

.p2-quick-picker-popover {
  --p2-picker-max-height: 430px;
  position: fixed;
  z-index: 120;
  overflow: hidden;
  border: 1px solid #38bfe9;
  border-radius: 12px;
  background: #081f37;
  color: #eef8ff;
  box-shadow: 0 22px 60px rgba(0, 9, 24, .55), 0 0 0 1px rgba(64, 214, 249, .08);
}
.p2-quick-picker-popover[hidden] { display: none; }
.p2-quick-picker-popover > header {
  display: grid;
  gap: 9px;
  padding: 10px 12px;
  border-bottom: 1px solid #244964;
  background: #0b2947;
}
.p2-quick-picker-heading { display: flex; min-height: 36px; align-items: center; justify-content: space-between; gap: 10px; }
.p2-quick-picker-popover > header b,
.p2-quick-picker-popover > header small { display: block; }
.p2-quick-picker-popover > header b { color: #f2f8ff; font-size: 13px; }
.p2-quick-picker-popover > header small { margin-top: 3px; color: #87a6c1; font-size: 9px; }
.p2-quick-picker-popover > header button { display: grid; width: 32px; height: 32px; place-items: center; border: 1px solid #28516f; border-radius: 8px; background: #09233d; color: #b9d1e5; cursor: pointer; }
.p2-quick-picker-popover > header button:hover { border-color: #35cdf4; color: #fff; }
.p2-quick-picker-popover > header .app-icon { width: 15px; height: 15px; }
.p2-quick-picker-search { display: grid; min-height: 36px; grid-template-columns: 16px minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 0 10px; border: 1px solid #28516f; border-radius: 8px; background: #071d33; color: #8eabc4; }
.p2-quick-picker-search:focus-within { border-color: #35cdf4; box-shadow: 0 0 0 2px rgba(53, 205, 244, .12); }
.p2-quick-picker-search .app-icon { width: 15px; height: 15px; }
.p2-quick-picker-search input { width: 100%; min-width: 0; padding: 7px 0; border: 0; outline: 0; background: transparent; color: #eef8ff; font: inherit; font-size: 11px; }
.p2-quick-picker-search input::placeholder { color: #7897b1; }
.p2-quick-picker-search > span { color: #7897b1; font-size: 9px; white-space: nowrap; }
.p2-quick-picker-list {
  display: grid;
  max-height: calc(var(--p2-picker-max-height) - 58px);
  gap: 7px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 9px;
  scrollbar-width: none;
}
.p2-quick-picker-list::-webkit-scrollbar { display: none; width: 0; height: 0; }
.p2-quick-option {
  display: grid;
  min-width: 0;
  min-height: 78px;
  grid-template-columns: 92px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 11px;
  padding: 6px;
  border: 1px solid #234963;
  border-radius: 9px;
  background: #0a2947;
  color: #e8f4ff;
  cursor: pointer;
  text-align: left;
}
.p2-quick-option:hover { border-color: #36a9d5; background: #0e3659; }
.p2-quick-option[hidden] { display: none; }
.p2-quick-option.selected { border-color: #2bd6ff; background: #10466e; box-shadow: inset 0 0 0 1px rgba(43, 214, 255, .2); }
.p2-quick-option > img,
.p2-quick-option-placeholder { display: grid; width: 92px; height: 66px; place-items: center; overflow: hidden; border-radius: 6px; background: #102f4d; object-fit: cover; }
.p2-quick-option-placeholder .app-icon { width: 25px; height: 25px; color: #6c96b5; }
.p2-quick-option > span:nth-child(2) { min-width: 0; }
.p2-quick-option b,
.p2-quick-option small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p2-quick-option b { color: #f2f8ff; font-size: 13px; }
.p2-quick-option small { margin-top: 6px; color: #8ca9c2; font-size: 9px; }
.p2-quick-option > .app-icon { width: 17px; height: 17px; color: transparent; }
.p2-quick-option.selected > .app-icon { color: #50defe; }
.p2-quick-picker-empty { margin: 0; padding: 28px 10px; color: #8ca7bf; font-size: 11px; text-align: center; }

.p2-picker-drawer { margin-top: 9px; border: 1px solid #285171; border-radius: 9px; background: rgba(5, 24, 43, .9); }
.p2-picker-drawer > summary { display: flex; min-height: 44px; align-items: center; justify-content: space-between; padding: 0 13px; color: #dceafb; cursor: pointer; font-size: 11px; font-weight: 800; list-style: none; }
.p2-picker-drawer > summary::-webkit-details-marker { display: none; }
.p2-picker-drawer > summary .app-icon { width: 14px; height: 14px; transition: transform .2s; }
.p2-picker-drawer[open] > summary .app-icon { transform: rotate(180deg); }
.p2-picker-body { padding: 10px; border-top: 1px solid #213f59; }
.p2-picker-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.p2-picker-heading b { font-size: 12px; }
.p2-picker-body .material-add { min-height: 32px; padding: 0 9px; font-size: 10px; }
.p2-picker-body .user-material-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.p2-picker-body .user-material-card > img { height: 105px; }
.p2-picker-body .user-material-card > span { padding: 8px; }

.p2-copy-column { display: flex; flex-direction: column; }
.p2-narration-heading { display: flex; align-items: center; justify-content: space-between; margin: 0 1px 7px; color: #dbe9f7; }
.p2-narration-heading b { font-size: 11px; }
.p2-narration-heading small { color: #7f9ab7; font-size: 9px; }
.p2-narration-box { display: flex; min-height: 0; flex: 0 0 auto; flex-direction: column; }
.p2-narration-box textarea {
  width: 100%;
  min-height: 82px;
  max-height: 104px;
  flex: 0 0 92px;
  resize: none;
  padding: 11px 13px;
  border: 1px solid #2b5677;
  border-radius: 9px;
  background: rgba(5, 24, 43, .88);
  color: #edf6ff;
  font-size: 13px;
  line-height: 1.65;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}
.p2-narration-box > small { display: block; margin: 7px 2px 0; color: #829db9; font-size: 9px; line-height: 1.5; }
.p2-ai-generate {
  display: flex;
  min-height: 48px;
  flex: 0 0 48px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 10px 0;
  border: 0;
  border-radius: 9px;
  background: linear-gradient(100deg, #7540d8, #176fa5 57%, #08777b);
  color: white;
  cursor: pointer;
  font-size: 14px;
  font-weight: 900;
  box-shadow: 0 12px 27px rgba(40, 124, 222, .2);
}
.p2-ai-generate:hover { filter: brightness(1.08); }
.p2-ai-generate:disabled { cursor: wait; opacity: .72; }
.p2-ai-generate .app-icon { width: 20px; height: 20px; }
.p2-hidden-status { position: absolute !important; width: 1px !important; height: 1px !important; overflow: hidden !important; clip: rect(0 0 0 0) !important; }
.p2-combined-editor { display: flex; min-height: 180px; flex: 1 1 auto; flex-direction: column; }
.p2-combined-editor > span { display: flex; flex: 0 0 26px; align-items: center; justify-content: space-between; color: #e6f1fc; }
.p2-combined-editor > span b { font-size: 11px; }
.p2-combined-editor > span small { color: #8fa8c3; font-size: 9px; }
.p2-combined-editor textarea {
  width: 100%;
  min-height: 180px;
  flex: 1 1 auto;
  resize: none;
  padding: 13px;
  border: 1px solid #2b5677;
  border-radius: 9px;
  background: rgba(5, 24, 43, .88);
  color: #eaf4ff;
  font-size: 12px;
  line-height: 1.72;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}
.p2-combined-editor textarea::-webkit-scrollbar,
.p2-narration-box textarea::-webkit-scrollbar,
.p2-copy-source textarea::-webkit-scrollbar { display: none; width: 0; height: 0; }
.p2-story-row,
.p2-copy-source { flex: 0 0 auto; margin-top: 8px; border: 1px solid #28506f; border-radius: 8px; background: rgba(7, 27, 48, .74); }
.p2-story-row > summary { display: grid; min-height: 52px; grid-template-columns: 1fr auto 15px; align-items: center; gap: 9px; padding: 0 13px; color: #e7f2ff; cursor: pointer; list-style: none; }
.p2-story-row > summary::-webkit-details-marker,
.p2-copy-source > summary::-webkit-details-marker { display: none; }
.p2-story-row > summary > span:first-child { display: flex; align-items: center; gap: 9px; }
.p2-story-row > summary .app-icon { width: 17px; height: 17px; color: #a9cdf0; }
.p2-story-row > summary > span:nth-child(2) { color: #8fa8c3; font-size: 10px; }
.p2-story-row > summary > .app-icon { width: 13px; height: 13px; transition: transform .2s; }
.p2-story-row[open] > summary > .app-icon { transform: rotate(180deg); }
.p2-story-row > div { padding: 0 12px 12px; }
.p2-story-row textarea { min-height: 210px; }
.p2-copy-source > summary { display: flex; min-height: 42px; align-items: center; justify-content: space-between; padding: 0 13px; color: #91abc5; cursor: pointer; font-size: 10px; list-style: none; }
.p2-copy-source > summary .app-icon { width: 13px; height: 13px; }
.p2-copy-source > div { padding: 0 12px 12px; }

.p2-video-settings { display: flex; flex-direction: column; }
.p2-settings-list { display: grid; }
.p2-setting-row { position: relative; min-width: 0; margin: 0; padding: 10px 0 10px 84px; border: 0; border-top: 1px solid rgba(91, 141, 183, .22); }
.p2-setting-row > legend { position: absolute; top: 20px; left: 0; padding: 0; color: #dce9f7; font-size: 11px; font-weight: 800; }
.p2-setting-row select { width: 100%; height: 42px; padding: 0 34px 0 11px; border: 1px solid #2a587a; border-radius: 8px; background: #09213b; color: #eaf4ff; font-size: 11px; }
.p2-setting-row .segment { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; margin: 0; }
.p2-setting-row .segment:has(label:nth-child(2):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.p2-setting-row .segment span { min-height: 38px; border-color: #285171; border-radius: 8px; background: #09213b; color: #a8bfd5; }
.p2-setting-row .segment input:checked + span { border-color: #20d1fb; background: #0d537c; color: #effbff; box-shadow: inset 0 0 0 1px rgba(34, 215, 252, .25); }
.p2-model-row { padding-bottom: 10px; }
.p2-model-row .video-model-note { position: static; margin: 8px 0 0; color: #c9b8ff; font-size: 12px; line-height: 1.6; white-space: normal; overflow-wrap: anywhere; }
.p2-select-with-action { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 6px; }
.p2-select-with-action:has(button:only-of-type) { grid-template-columns: minmax(0, 1fr) auto; }
.p2-mini-action { min-height: 42px; padding: 0 10px; border: 1px solid #285171; border-radius: 8px; background: #0a2744; color: #bfd4e8; cursor: pointer; font-size: 9px; }
.p2-mini-action:disabled { cursor: default; opacity: .42; }
.p2-add-voice { display: flex; min-height: 28px; align-items: center; gap: 5px; margin-top: 6px; padding: 0; border: 0; background: transparent; color: #79cde9; cursor: pointer; font-size: 9px; }
.p2-add-voice .app-icon { width: 13px; height: 13px; }
.p2-volume-row { min-height: 72px; }
.music-fieldset .ai-music-option { margin: 7px 0 0; padding: 8px; }
.music-fieldset .ai-music-option > span:last-child b { font-size: 11px; }
.music-fieldset .ai-music-option > span:last-child small { font-size: 9px; }
.music-fieldset .music-recommendation { margin: 5px 0 0; color: #a9bfd5; font-size: 9px; line-height: 1.5; }
.p2-volume-row > legend { top: 28px; }
.p2-volume-row .music-volume-control { padding: 0; border: 0; }
.p2-volume-row .music-volume-control > div:first-child { display: flex; justify-content: flex-end; min-height: 13px; }
.p2-volume-row .music-volume-control output { color: #d7ebfc; font-size: 10px; }
.p2-volume-row .music-volume-control input { margin: 5px 0 0; }
.p2-volume-row .music-volume-scale { margin-top: 4px; font-size: 12px; }
.p2-more-settings { margin-top: 5px; border-top: 1px solid rgba(91, 141, 183, .22); }
.p2-more-settings > summary { display: flex; min-height: 36px; align-items: center; justify-content: space-between; color: #93abc2; cursor: pointer; font-size: 10px; list-style: none; }
.p2-more-settings > summary::-webkit-details-marker { display: none; }
.p2-more-settings > summary .app-icon { width: 12px; height: 12px; }
.p2-more-settings > div { display: grid; gap: 8px; padding-bottom: 10px; }
.p2-more-settings .ai-music-option { padding: 10px; }
.p2-more-settings .music-recommendation { margin: 0; font-size: 9px; }
.p2-more-settings .field { padding: 8px 0 0; }
.p2-final-cost { display: grid; flex: 0 0 auto; grid-template-columns: auto 1fr auto; align-items: center; gap: 7px; margin: auto 0 8px; padding: 10px 0 0; border-top: 1px solid rgba(91, 141, 183, .22); background: transparent; }
.p2-final-cost span { color: #91aac2; font-size: 11px; }
.p2-final-cost strong { color: #ffdc66 !important; font-size: 20px !important; }
.p2-final-cost small { grid-column: 1 / -1; color: #b4c9dc; font-size: 12px; line-height: 1.5; white-space: normal; }
.studio-view .p2-generate-button { min-height: 58px; flex: 0 0 58px; border-radius: 9px; background: linear-gradient(100deg, #8b43fb, #1caff1 57%, #22e0d7); color: #fff; font-size: 16px; }
.p2-video-settings > .submit-note { margin-top: 6px; }

@media (max-width: 1320px) {
  .p2-three-column { grid-template-columns: minmax(270px, .9fr) minmax(330px, 1.05fr) minmax(300px, .92fr); }
  .p2-selected-material { grid-template-columns: 104px minmax(0, 1fr) 52px; gap: 9px; }
  .p2-selected-material > img,
  .p2-material-placeholder { width: 104px; }
  .p2-mode-copy small { font-size: 9px; }
}

@media (max-width: 1200px) {
  .studio-view .p2-exact-workspace { height: auto; grid-template-rows: auto auto auto; }
  .p2-three-column { grid-template-columns: 1fr; overflow: visible; }
  .p2-work-card { overflow: visible; }
  .p2-exact-workspace > .p2-mode-cards { grid-template-columns: 1fr; }
  .p2-exact-workspace > .p2-mode-cards > button { grid-template-columns: 150px minmax(0, 1fr); }
  .p2-mode-media { height: 120px; }
}

@media (max-width: 700px) {
  .studio-view .p2-exact-workspace { gap: 10px; }
  .p2-create-header { align-items: flex-start; flex-direction: column; gap: 16px; padding: 10px 0 0; }
  .p2-create-steps { width: 100%; justify-content: space-between; margin: 0; }
  .p2-create-steps li:not(:last-child):after { width: 16px; margin: 0 6px; }
  .p2-create-steps b { width: 30px; height: 30px; }
  .p2-exact-workspace > .p2-mode-cards > button { grid-template-columns: 112px minmax(0, 1fr); padding: 10px; }
  .p2-mode-media { height: 96px; }
  .p2-mode-copy b { font-size: 15px; }
  .p2-selected-material { grid-template-columns: 90px minmax(0, 1fr) 48px; min-height: 98px; }
  .p2-selected-material > img,
  .p2-material-placeholder { width: 90px; height: 80px; }
  .p2-setting-row { padding-left: 72px; }
  .p2-setting-row > legend { font-size: 10px; }
  .p2-model-row .video-model-note { left: 72px; }
}

/* P2 workspace language shared by image, material, work and account pages. */
.p2-secondary-workspace > .page-intro {
  min-height: 82px;
  padding: 13px 4px 12px;
  border-bottom: 1px solid #1d3c56;
}
.p2-secondary-workspace > .page-intro .eyebrow { display: none; }
.p2-secondary-workspace > .page-intro h1 {
  margin: 0 0 6px;
  color: #f0f7ff;
  font-family: Inter,"PingFang SC","Microsoft YaHei",sans-serif;
  font-size: clamp(26px, 2vw, 34px);
  font-weight: 900;
  letter-spacing: .01em;
}
.p2-secondary-workspace > .page-intro > div > p:last-child { color: #8ca5bf; font-size: 11px; }
.p2-secondary-workspace > .page-intro > .primary { min-height: 46px; padding: 0 20px; }
.p2-page-progress { display: flex; align-items: center; gap: 10px; }
.p2-page-progress > span { display: flex; align-items: center; gap: 7px; color: #829bb6; font-size: 11px; font-weight: 800; }
.p2-page-progress > span > b { display: grid; width: 30px; height: 30px; place-items: center; border: 1px solid #285171; border-radius: 50%; background: #0a243f; color: #abc2d8; }
.p2-page-progress > span.active { color: #58d9fb; }
.p2-page-progress > span.active > b { border-color: #42d5f8; background: #25bde9; color: #06233a; }
.p2-page-progress > i { width: 34px; height: 1px; background: #26465f; }
.p2-page-progress .image-model-badge { margin-left: 10px; }

@media (min-width: 1381px) {
  .image-studio-view .image-studio-grid {
    display: grid;
    grid-template-columns: minmax(330px, .94fr) minmax(390px, 1.12fr) minmax(320px, .84fr);
    grid-template-rows: auto auto auto;
    gap: 12px;
    padding-top: 14px;
    align-items: start;
  }
  .image-studio-view .image-builder,
  .image-studio-view .image-settings { display: contents; }
  .image-studio-view .image-builder > .image-step-panel:nth-child(1) { grid-column: 1 / -1; grid-row: 1; }
  .image-studio-view .image-builder > .image-step-panel:nth-child(2) { grid-column: 1; grid-row: 2 / 4; }
  .image-studio-view .image-builder > .image-step-panel:nth-child(3) { grid-column: 2; grid-row: 2; }
  .image-studio-view .image-builder > .image-step-panel:nth-child(4) { grid-column: 2; grid-row: 3; }
  .image-studio-view .image-output-panel { position: static; grid-column: 3; grid-row: 2 / 4; max-height: 920px; overflow-y: auto; scrollbar-width: none; }
  .image-studio-view .image-output-panel::-webkit-scrollbar { display: none; }
}
.image-studio-view .image-step-panel,
.image-studio-view .image-output-panel {
  border-color: #214661;
  border-radius: 11px;
  background: linear-gradient(145deg, rgba(10, 37, 65, .98), rgba(8, 29, 52, .98));
  box-shadow: none;
}
.image-studio-view .image-mode-grid label > span { min-height: 92px; border-color: #295171; border-radius: 9px; background: #09233f; }
.image-studio-view .image-mode-grid input:checked + span { border-color: #2ed6fb; background: #0d4168; box-shadow: inset 0 0 0 1px rgba(43, 211, 249, .25); }
.image-studio-view .image-product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: 410px; }
.image-studio-view .image-product-grid .user-material-card > img { height: 126px; }
.image-studio-view .style-preset-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.image-studio-view .style-preset-grid label > span { min-height: 116px; padding-top: 74px; }
.image-studio-view .image-step-panel textarea { min-height: 92px; }
.image-studio-view .image-output-panel #image-submit-button { background: linear-gradient(100deg, #7540d8, #176fa5 57%, #08777b); color: #fff; }

@media (min-width: 901px) {
  main > .materials-view.p2-secondary-workspace:not([hidden]),
  main > .tasks-view.p2-secondary-workspace:not([hidden]) {
    display: flex;
    height: calc(100dvh - 72px);
    min-height: 0;
    flex-direction: column;
    overflow: hidden;
    padding: 14px 18px 0;
  }
  .materials-view .material-library,
  .tasks-view .task-list {
    min-height: 0;
    flex: 1 1 auto;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    scrollbar-width: none;
  }
  .materials-view .material-library::-webkit-scrollbar,
  .tasks-view .task-list::-webkit-scrollbar { display: none; width: 0; height: 0; }
}

.materials-view .library-toolbar,
.tasks-view .task-toolbar {
  flex: 0 0 auto;
  margin-top: 12px;
  padding: 11px 13px;
  border-color: #244c69;
  border-radius: 10px;
  background: linear-gradient(145deg, #0b2a49, #09213b);
  box-shadow: inset 0 1px rgba(255,255,255,.025);
}
.materials-view .material-filters,
.tasks-view .task-filters { gap: 5px; }
.materials-view .material-filters button,
.tasks-view .task-filters button { min-height: 34px; border-radius: 7px; }
.materials-view .material-filters button.active,
.tasks-view .task-filters button.active { border-color: #37cef2; background: #114f76; box-shadow: inset 0 0 0 1px rgba(48, 209, 247, .18); }
.materials-view .library-actions { gap: 6px; padding-left: 12px; border-left: 1px solid #24455f; }
.materials-view .material-library { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; padding: 14px 0 16px; }
.materials-view .library-card { display: flex; min-height: 310px; flex-direction: column; border-radius: 10px; background: linear-gradient(145deg, #0b2948, #091f38); box-shadow: none; }
.materials-view .library-cover { height: 176px; flex: 0 0 176px; }
.materials-view .library-card-body { display: flex; min-height: 0; flex: 1; flex-direction: column; padding: 12px; }
.materials-view .library-card-body p { min-height: 0; margin-bottom: 8px; }
.materials-view .library-card-actions { margin-top: auto; }
.materials-view .library-card-actions .secondary { border-color: #2a5c7d; background: #0b2e4f; color: #d9ecfb; }

.tasks-view .task-toolbar { align-items: end; }
.tasks-view .task-list { gap: 16px; padding: 14px 0 16px; }
.tasks-view .task-kind-section { min-width: 0; }
.tasks-view .task-kind-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; padding: 0 2px; }
.tasks-view .task-kind-heading h2 { margin: 0; color: #eaf4ff; font-size: 15px; }
.tasks-view .task-kind-heading span { color: #839eb8; font-size: 10px; }
.tasks-view .task-kind-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.tasks-view .task-card {
  display: grid;
  min-height: 270px;
  grid-template-columns: 1fr;
  grid-template-rows: 154px auto auto;
  align-items: stretch;
  gap: 10px;
  padding: 10px;
  border-radius: 10px;
  background: linear-gradient(145deg, #0b2948, #091f38);
  box-shadow: none;
}
.tasks-view .task-thumb { width: 100%; height: 154px; border-radius: 7px; }
.tasks-view .task-meta { min-width: 0; padding: 0 3px; }
.tasks-view .task-meta h3 { margin: 7px 0 5px; font-size: 14px; }
.tasks-view .task-meta p { overflow: hidden; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.tasks-view .task-tags { display: flex; overflow: hidden; flex-wrap: nowrap; }
.tasks-view .task-state { display: flex; min-width: 0; align-items: center; justify-content: space-between; padding: 0 3px 2px; text-align: left; }
.tasks-view .task-card-actions { margin: 0; }

.publish-view .publish-summary,
.billing-view .quota-overview { gap: 10px; padding: 14px 0; }
.publish-view .publish-summary article,
.billing-view .quota-overview article { min-height: 104px; border-radius: 10px; background: linear-gradient(145deg, #0b2948, #091f38); box-shadow: none; }
.publish-view .publish-list,
.billing-view .panel,
.admin-view .panel,
.admin-view .account-list { border-radius: 10px; box-shadow: none; }
.publish-view .publish-row { border-radius: 10px; background: linear-gradient(145deg, #0b2948, #091f38); box-shadow: none; }

.profile-menu .profile-summary { display: flex; align-items: center; gap: 11px; padding: 10px; }
.profile-summary-avatar { display: grid; width: 38px; height: 38px; flex: 0 0 38px; place-items: center; border: 1px solid #3c6f91; border-radius: 50%; background: #143d62; color: #dff5ff; font-weight: 900; }
.profile-menu .profile-summary > span:last-child { min-width: 0; }
.profile-menu .profile-summary small { display: block; margin-bottom: 4px; color: #7f9bb6; font-size: 9px; }
.profile-menu .profile-summary b { display: block; overflow: hidden; color: #eff7ff; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }

/* Result details need explicit dark-theme colors because the legacy --ink token is a dark background color in midnight mode. */
:root[data-theme="midnight"] .result-info .storyboard-result {
  overflow: hidden;
  border-color: #315a78;
  border-radius: 9px;
  background: #0b2642;
}
:root[data-theme="midnight"] .result-info .storyboard-result > summary {
  min-height: 54px;
  padding: 16px 18px;
  background: #102f4f;
  color: #f1f8ff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 850;
  line-height: 1.55;
}
:root[data-theme="midnight"] .result-info .storyboard-result > summary::marker { color: #62ddff; }
:root[data-theme="midnight"] .result-info .storyboard-result > summary:hover,
:root[data-theme="midnight"] .result-info .storyboard-result[open] > summary { background: #153b60; color: #fff; }
:root[data-theme="midnight"] .result-info .storyboard-result > summary:focus-visible { outline: 2px solid #45d8fb; outline-offset: -3px; }
:root[data-theme="midnight"] .result-info .storyboard-result > pre {
  margin: 0;
  padding: 18px;
  border-top-color: #315a78;
  background: #081d33;
  color: #dcecf9;
  font-size: 13px;
  line-height: 1.85;
}

@media (max-width: 1380px) {
  .materials-view .material-library { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tasks-view .task-kind-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .p2-page-progress { display: none; }
  .materials-view .material-library,
  .tasks-view .task-kind-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tasks-view .task-state { grid-column: auto; }
}

@media (max-width: 560px) {
  .materials-view .material-library,
  .tasks-view .task-kind-cards { grid-template-columns: 1fr; }
}

/* Readable workspace labels without squeezing controls into fixed-height rows. */
.p2-card-title small,
.p2-selected-copy > small,
.p2-selected-copy i,
.p2-change-button,
.p2-quick-picker-popover > header small,
.p2-quick-option small,
.p2-mode-copy small,
.p2-narration-heading b,
.p2-narration-heading small,
.p2-narration-box > small,
.p2-combined-editor > span b,
.p2-combined-editor > span small,
.p2-setting-row > legend,
.p2-setting-row select,
.p2-mini-action,
.p2-add-voice,
.p2-volume-row .music-volume-control output,
.p2-more-settings > summary,
.p2-more-settings .music-recommendation,
.p2-copy-source > summary,
.p2-final-cost span,
.tasks-view .task-meta { font-size: 12px; }
.p2-narration-box textarea,
.p2-combined-editor textarea { font-size: 14px; overscroll-behavior-y: auto; }
.p2-mode-copy b { white-space: normal; }
.p2-portrait-placeholder small { color: #b8d6ea; }
.library-cover > .p2-portrait-placeholder { width: 100%; height: 100%; }
.p2-final-cost > small { max-width: none; overflow: visible; }
.topbar-inner { min-width: 0; gap: 16px; }
.topbar-actions { flex: 0 0 auto; margin-left: auto; }
.topbar-motto { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
@media (min-width: 901px) and (max-width: 1380px) {
  .topbar .model-chip, .topbar .header-divider { display: none; }
}

/* Keep the three soundtrack sources visible together in the settings column. */
.p2-setting-row.music-fieldset { padding-left: 0; padding-top: 14px; }
.p2-setting-row.music-fieldset > legend { position: static; margin-bottom: 4px; }
.music-source-options { display: flex; flex-wrap: wrap; gap: 8px; }
.music-source-options button {
  flex: 1 1 72px;
  min-width: 0;
  min-height: 42px;
  padding: 9px 8px;
  border: 1px solid #315b79;
  border-radius: 8px;
  background: #0b243b;
  color: #dcecf9;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.45;
  cursor: pointer;
}
.music-source-options button.active { border-color: #2ac8e9; background: #15496a; color: #fff; box-shadow: inset 0 0 0 1px #2ac8e9; }
.music-source-options button:hover { border-color: #68def7; color: #fff; }
.music-source-options button:focus-visible { outline: 2px solid #76e1f6; outline-offset: 3px; }
.music-source-options button[hidden], #music-library-controls[hidden], #music-volume-row[hidden] { display: none !important; }
.music-fieldset #music-recommendation { margin: 12px 0; color: #bdd4e8; font-size: 12px; line-height: 1.7; }
.music-fieldset #music-recommendation b { color: #80e3f7; font-weight: 650; }

/* Keep image viewer controls readable even when icon masks fail to load. */
.image-viewer .viewer-tools { gap: 8px; }
.image-viewer .viewer-tools button,
.image-viewer .viewer-tools a {
  min-width: 42px;
  min-height: 40px;
  gap: 7px;
  padding: 0 13px;
  border-color: #496a82;
  background: #17364b;
  color: #f4faff;
  font-size: 13px;
  font-weight: 650;
  opacity: 1;
}
.image-viewer .viewer-tools button:hover:not(:disabled),
.image-viewer .viewer-tools a:hover { border-color: #48d8f6; background: #1b4a65; color: #fff; }
.image-viewer .viewer-tools button:disabled { border-color: #3a566c; background: #142e42; color: #c5d5e2; opacity: 1; }
.image-viewer .viewer-tools .app-icon { width: 16px; height: 16px; flex: 0 0 16px; background-color: currentColor; color: #f4faff !important; opacity: 1; }
.image-viewer #viewer-zoom { min-width: 58px; padding: 7px 9px; border: 1px solid #45677f; border-radius: 8px; background: #122d42; color: #f4faff; font-size: 13px; font-weight: 600; }
.image-viewer .viewer-close { min-width: 76px; }
.image-viewer .viewer-nav button { border-color: #496a82; background: #17364b; color: #f4faff; font-size: 13px; }
.image-viewer .viewer-nav button:disabled { color: #c5d5e2; opacity: 1; }
@media (min-width: 901px) and (max-width: 1200px) {
  .topbar-motto { display: none; }
}
@media (max-width: 700px) {
  .theme-dialog form, .material-dialog form, .product-details-dialog { padding: 20px; }
  .material-dialog .dialog-head, .theme-dialog .theme-dialog-head { margin: -20px -20px 16px; padding: 20px 20px 14px; }
  .material-dialog .dialog-actions, .theme-dialog .theme-dialog-foot { margin: 20px -20px -20px; padding: 14px 20px; flex-wrap: wrap; }
}
