@charset "UTF-8";

/* Shared cabinet chrome: mobile only; desktop keeps its existing navigation. */
body.psx-cabinet main#vue-app.psx-shell .psx-content > .psx-mobile-page-heading { display: none; }
header .header_cabinet_tab__icon { display: none; }

@media (max-width: 992px) {
  :root, body.psx-cabinet {
    --psx-header-h: calc(64px + env(safe-area-inset-top, 0px));
  }
  :root { --psx-visible-height: 100vh; }
  @supports (height: 100dvh) {
    :root { --psx-visible-height: 100dvh; }
  }

  body.psx-cabinet > header {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) 48px;
    grid-template-rows: 48px;
    gap: 6px;
    height: var(--psx-header-h);
    min-height: 0;
    padding: calc(8px + env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-right, 0px)) 7px max(12px, env(safe-area-inset-left, 0px));
    border-bottom: 1px solid #e5e7eb;
    box-shadow: none;
    z-index: 1105 !important;
  }
  body.psx-cabinet > header .logo-link { grid-column: 1; grid-row: 1; min-height: 44px; }
  body.psx-cabinet > header .logo { width: 32px; height: auto; }
  body.psx-cabinet > header .right_block { grid-column: 3; grid-row: 1; min-width: 0; margin: 0; }
  body.psx-cabinet > header .user_and_arrow { gap: 0; height: 44px; min-width: 0; }
  body.psx-cabinet > header .user_menu_toggle {
    width: 48px;
    min-width: 44px;
    height: 44px;
    flex-shrink: 0;
    gap: 4px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
  }
  body.psx-cabinet > header .user_menu_toggle .arrow_down {
    display: block;
    width: 14px;
    height: 14px;
    flex: 0 0 14px;
    color: #374151;
  }
  body.psx-cabinet > header .user_menu_toggle :is(.avatar_thumbnail, .avatar_fallback, .psx-media-fallback--avatar) {
    width: 30px;
    height: 30px;
    flex-basis: 30px;
  }
  body.psx-cabinet > header .user_menu_toggle[aria-expanded="true"] { background: #fff1e6; }
  body.psx-cabinet > header .user_name,
  body.psx-cabinet > header .user_menu_label,
  body.psx-cabinet > header .header_balance_link,
  body.psx-cabinet > header .header_support_link,
  body.psx-cabinet > header .manager_task_bell { display: none; }

  body.psx-cabinet > header .header_cabinet_tabs {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    width: 100%;
    max-width: 420px;
    min-width: 0;
    padding: 0;
    margin: 0 auto;
    gap: 4px;
    border-radius: 0;
    background: transparent;
    box-sizing: border-box;
    overflow: visible;
  }
  body.psx-cabinet > header .header_cabinet_tab {
    flex: 1 1 0;
    flex-direction: column;
    min-width: 0;
    height: 48px;
    padding: 0 5px;
    gap: 3px;
    font-size: 12px;
    line-height: 15px;
    font-weight: 600;
    border: 1px solid #ffc99f;
    border-radius: 10px;
    box-sizing: border-box;
    color: #202936;
    background: #fff;
    transition: background-color .16s ease, border-color .16s ease, color .16s ease;
  }
  body.psx-cabinet > header .header_cabinet_tab__icon {
    display: block;
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    background-color: #ff6a00;
    -webkit-mask: var(--psx-service-icon) center / contain no-repeat;
    mask: var(--psx-service-icon) center / contain no-repeat;
  }
  body.psx-cabinet > header .header_cabinet_tab--distribution { --psx-service-icon: url('../../imgs/icons/lucide-disc-3.svg'); }
  body.psx-cabinet > header .header_cabinet_tab--tiktok { --psx-service-icon: url('../../imgs/icons/simple-tiktok.svg'); }
  body.psx-cabinet > header .header_cabinet_tab--studio { --psx-service-icon: url('../../imgs/icons/lucide-sparkles.svg'); }
  body.psx-cabinet > header .header_cabinet_tab:not(.is-locked):hover { background: #fff7f0; border-color: #ff6a00; }
  body.psx-cabinet > header .header_cabinet_tab:not(.is-locked):active { background: #ffeddf; }
  body.psx-cabinet > header .header_cabinet_tab.is-active,
  body.psx-cabinet > header .header_cabinet_tab.is-active:hover {
    background: #fff7f0;
    border-color: #ff6a00;
    color: #b94800;
    font-weight: 700;
    box-shadow: none;
  }
  body.psx-cabinet > header .header_cabinet_tab.is-active::after,
  body.psx-cabinet > header .header_cabinet_tab.is-active::before,
  body.psx-cabinet > header .header_cabinet_tab:not(.is-locked)::before { display: none; }
  body.psx-cabinet > header .header_cabinet_tab:focus-visible { outline: 2px solid #9e3b00; outline-offset: 2px; }
  body.psx-cabinet > header .header_cabinet_tab.is-locked { flex-direction: column; gap: 0; color: #6b7280; }
  body.psx-cabinet > header .header_cabinet_tab.is-locked .header_cabinet_tab__icon { display: none; }
  body.psx-cabinet > header .header_cabinet_tab__soon { font-size: 9px; line-height: 12px; }
  body.psx-cabinet > header .header_cabinet_tab--distribution { flex-grow: 1.4; }
  body.psx-cabinet > header .header_cabinet_tab--tiktok { flex-grow: .85; }
  body.psx-cabinet > header .header_cabinet_tab--studio { flex-grow: 1.15; }
  body.psx-cabinet > header .header_menu {
    max-width: calc(100vw - 24px);
    max-height: calc(var(--psx-visible-height) - var(--psx-header-h) - 24px);
    overflow-y: auto;
    right: 12px;
  }
  body.psx-cabinet > header .header_menu a { min-height: 48px; font-size: 16px; }
  body.psx-cabinet > header .header_menu .header_menu_balance {
    display: flex;
    flex-direction: column;
    gap: 4px;
    border-bottom: 2px solid #f5f5f5;
  }
  body.psx-cabinet > header .header_menu_balance__amount {
    color: #a9430b;
    font-size: 14px;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  body.psx-cabinet main#vue-app.psx-shell { padding-top: var(--psx-header-h); }
  body.psx-cabinet main#vue-app.psx-shell .psx-content { min-width: 0; padding: 0 12px; }
  body.psx-cabinet main#vue-app.psx-shell .psx-content > .psx-mobile-page-heading {
    display: flex;
    position: sticky;
    top: var(--psx-header-h);
    z-index: 1002;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    box-sizing: border-box;
    width: calc(100% + 24px);
    min-height: 48px;
    margin: 0 -12px;
    padding: 0 12px;
    border-bottom: 1px solid #e5e7eb;
    background: #fff;
  }
  .psx-mobile-page-heading__copy {
    flex: 1;
    min-width: 0;
    padding: 4px 0;
  }
  .psx-mobile-page-heading__section {
    display: block;
    margin-bottom: 1px;
    color: #6b7280;
    font: 500 11px/14px var(--psx-font-sans);
  }
  .psx-mobile-page-heading h1 {
    margin: 0;
    color: #1f2937;
    font: 600 16px/20px var(--psx-font-sans);
    overflow-wrap: anywhere;
  }
  body.psx-cabinet main#vue-app.psx-shell .psx-mobile-page-heading .psx-mobile-nav-toggle {
    display: inline-flex;
    position: static;
    width: auto;
    top: auto;
    left: auto;
    right: auto;
    box-shadow: none;
    align-items: center;
    justify-content: flex-end;
    flex: 0 0 auto;
    gap: 6px;
    min-width: 76px;
    height: 44px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #374151;
    font: 600 13px/1.2 var(--psx-font-sans);
    cursor: pointer;
  }
  .psx-mobile-page-heading .psx-mobile-nav-toggle img { width: 20px; height: 20px; }
  .psx-mobile-page-heading .psx-menu-close-icon,
  .psx-mobile-page-heading .is-open .psx-menu-icon { display: none; }
  .psx-mobile-page-heading .is-open .psx-menu-close-icon { display: block; }
  .psx-mobile-page-heading .psx-mobile-nav-toggle:focus-visible { outline: 2px solid #9e3b00; outline-offset: 2px; }
  body.psx-cabinet main#vue-app.psx-shell .psx-content > .psx-mobile-page-heading + * {
    min-width: 0;
    margin: 16px 0 max(32px, env(safe-area-inset-bottom, 0px));
  }
  /* The visible mobile title is now alongside Menu; keep original titles on desktop. */
  body.psx-cabinet .psx-mobile-page-heading + * > .title:first-child { display: none; }
  body.psx-cabinet .profile > .profile-page-head,
  body.psx-cabinet .instruction__header > .title,
  body.psx-cabinet .videoshot-head .title,
  body.psx-cabinet .manager_hub > .manager-hub-title,
  body.psx-cabinet .manager-tiktok-head .title { display: none; }
  body.psx-cabinet main#vue-app.psx-shell .psx-sidebar {
    top: calc(var(--psx-header-h) + var(--psx-section-heading-h, 48px));
    max-height: calc(var(--psx-visible-height) - var(--psx-header-h) - var(--psx-section-heading-h, 48px));
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
  }
  body.psx-cabinet main#vue-app.psx-shell .psx-sidebar a { min-height: 48px; font-size: 16px; }
  body.psx-cabinet main#vue-app.psx-shell .psx-sidebar .subtabs a { font-size: 14px; }
}

@media (max-width: 359px) {
  body.psx-cabinet > header {
    grid-template-columns: 32px minmax(0, 1fr) 44px;
    gap: 4px;
    padding-right: max(8px, env(safe-area-inset-right, 0px));
    padding-left: max(8px, env(safe-area-inset-left, 0px));
  }
  body.psx-cabinet > header .logo { width: 28px; }
  body.psx-cabinet > header .user_menu_toggle { width: 44px; gap: 2px; }
  body.psx-cabinet > header .user_menu_toggle :is(.avatar_thumbnail, .avatar_fallback, .psx-media-fallback--avatar) { width: 28px; height: 28px; flex-basis: 28px; }
  body.psx-cabinet > header .header_cabinet_tab { font-size: 10.5px; padding: 0 2px; }
}

@media (max-width: 760px) {
  /* Intentional priority: legacy page selectors and inline styles must not shrink
     editable text below 16px. Do not disable browser/user zoom to hide the issue. */
  body:is(.psx-cabinet, .page-auth) :is(
    input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="color"]):not([type="submit"]):not([type="button"]),
    textarea, select, [contenteditable="true"]
  ) {
    font-size: 16px !important;
    scroll-margin-top: calc(var(--psx-header-h, 70px) + 16px);
    scroll-margin-bottom: 24px;
  }

  body:is(.psx-cabinet, .page-auth) :is(
    input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="tel"], input[type="url"], input[type="number"], select
  ) { min-height: 44px; }
  body.psx-cabinet .selectize-control .selectize-input > input { min-height: 0; height: auto; }
  body.psx-cabinet .selectize-control .selectize-input { min-height: 46px; font-size: 16px; }
  body.psx-cabinet .selectize-dropdown { font-size: 16px; }
  body.psx-cabinet .selectize-dropdown .option { min-height: 44px; padding: 10px 12px; }
  body.psx-cabinet :is(.input-simple-base, .input-search-base, .input-date-range-base, .input_date__control) { min-height: 48px; min-width: 0; }
  body.psx-cabinet :is(.input_simple__control, .input_search__control, .input_date__control-input, .input_date_range__control) { min-width: 0; }
  body.psx-cabinet .inputs_row { display: grid; grid-template-columns: minmax(0, 1fr); }
  body.psx-cabinet .input_block { min-width: 0; }
  body.psx-cabinet .input_block > p { font-size: 14px; line-height: 1.4; }
  body.psx-cabinet :is(.psx-btn, .psx-button, .pr-btn, button[type="submit"]) { min-height: 44px; }
  body.psx-cabinet .psx-content :is(.page_block, .psx-card) { max-width: 100%; min-width: 0; }

  body.page-auth .auth-shell { padding-bottom: max(24px, env(safe-area-inset-bottom, 0px)); }

  /* Charts recalculate asynchronously on rotation; never let an old canvas width
     expand the viewport and make the whole page shrink in the meantime. */
  body.psx-cabinet .analytics .analytics-chart :is(.apexcharts-canvas, .apexcharts-svg) {
    max-width: 100% !important;
  }

  /* Keep the existing release-step controller; only its mobile rail changes. */
  body.pattern-new_release main#vue-app.psx-shell .new_release {
    margin-top: 12px !important;
  }
  body.pattern-new_release .new_release .nr-subheader {
    top: calc(var(--psx-header-h) + var(--psx-section-heading-h, 48px));
    padding: 6px 0;
  }
  body.pattern-new_release .new_release .nr-stages {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    padding: 2px 0 6px;
  }
  body.pattern-new_release .new_release .nr-stages .release-flow__stage {
    flex: 0 0 auto;
    min-height: 52px;
    padding: 8px 12px;
    gap: 8px;
    border-radius: 12px;
    scroll-snap-align: start;
    box-shadow: none;
  }
  body.pattern-new_release .new_release .nr-stage__index { width: 28px; height: 28px; flex-basis: 28px; }
  body.pattern-new_release .new_release .nr-stage__title { font-size: 14px; white-space: nowrap; }
  body.pattern-new_release .new_release .nr-stage__hint { display: none; }

  /* Prompt first; reference/tool controls get their own row instead of squeezing text. */
  body.psx-cabinet.pattern-ai_studio .ai-image-composer .ai-image-prompt-row {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 10px;
  }
  body.pattern-ai_studio .ai-image-composer .ai-image-prompt-row > .ai-prompt-shell {
    grid-column: 1 / -1;
    grid-row: 1;
    width: 100%;
    --ai-prompt-min-height: 112px;
  }
  body.pattern-ai_studio .ai-image-composer .ai-image-prompt-row > .ai-reference-plus {
    grid-column: 1;
    grid-row: 2;
    width: 44px;
    height: 44px;
    min-height: 44px;
    margin: 0;
  }
  body.pattern-ai_studio .ai-image-composer .ai-artist-prompt-tools {
    grid-column: 2;
    grid-row: 2;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }
  body.pattern-ai_studio .ai-image-composer .ai-artist-prompt-tools > button {
    min-height: 44px;
    padding: 6px 8px;
  }

  /* Keep the native phone picker; remove only the browser's desktop-style bevel. */
  body.pattern-ai_studio .ai-image-dock .ai-dock-field select:not([data-ai-aspect-native]) {
    -webkit-appearance: none;
    appearance: none;
    min-height: 46px;
    padding-right: 36px;
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='m7 10 5 5 5-5' stroke='%2364748b' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px 16px;
    cursor: pointer;
  }

  body.pattern-ai_studio .ai-image-dock .ai-dock-field select:disabled {
    background-color: #f8fafc;
    color: #94a3b8;
    cursor: not-allowed;
  }
}
