/* Account library extends the existing paiban components and ink-blue tokens. */
.account-profiles [hidden] { display: none !important; }
.account-profiles button { touch-action: manipulation; }
.account-profiles #profileButton { margin-left: auto; }
.ap-top-account { padding: 9px 14px; border: 1px solid var(--line); border-radius: 6px; color: var(--navy); background: #fff; cursor: pointer; white-space: nowrap; }
.ap-login-complete { padding: 12px 24px; margin: 0; background: #edf3f7; color: var(--navy); font-size: 13px; text-align: center; }
.account-profiles .profile-dialog { width: min(1260px, calc(100% - 48px)); max-height: calc(100dvh - 36px); }
.account-profiles .dialog-shell { height: min(830px, calc(100dvh - 36px)); max-height: none; border-radius: 12px; }
.account-profiles .dialog-header { align-items: center; flex: none; padding: 20px 26px; }
.account-profiles .dialog-header > div { display: flex; align-items: center; flex-wrap: wrap; gap: 0 12px; }
.account-profiles .dialog-header h2 { font-size: 24px; margin: 0; }
.ap-subtitle { flex-basis: 100%; margin: 5px 0 0; font-size: 12px; color: var(--muted); }
.ap-badge { padding: 3px 9px; font-size: 11px; border: 1px solid #e4d1ae; border-radius: 4px; color: #855d22; background: #fbf5ea; }
.account-profiles .dialog-close { border-radius: 5px; font-size: 12px; }
.ap-body { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 0; flex: 1; }
.ap-sidebar { display: flex; flex-direction: column; min-height: 0; padding: 20px 16px 18px; border-right: 1px solid #dde4eb; background: #f7f9fb; }
.ap-library { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; }
.ap-library-toggle { display: none; }
.ap-library-section + .ap-library-section { margin-top: 20px; }
.ap-library-section h3 { margin: 0 10px 8px; display: flex; align-items: center; justify-content: space-between; color: #657786; font-size: 11px; font-weight: 500; gap: 6px; }
.ap-library-section h3 small { font-size: 10px; font-weight: 400; }
.ap-profile-item { width: 100%; padding: 12px 10px; margin: 0 0 3px; text-align: left; background: transparent; border: 1px solid transparent; border-radius: 6px; color: #526675; font-size: 13px; font-weight: 600; overflow-wrap: anywhere; cursor: pointer; }
.ap-profile-item:hover { background: #edf2f6; }
.ap-profile-item[aria-current] { background: #e6edf3; border-color: #c8d6e1; color: var(--navy); box-shadow: inset 3px 0 0 var(--navy); }
.ap-empty { margin: 8px 10px; font-size: 12px; color: #657786; line-height: 1.85; }
.ap-quota { flex: none; margin-top: 18px; padding: 14px 12px; background: #fff; border: 1px solid #dce4eb; border-radius: 7px; }
.ap-quota-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: #536675; font-size: 11px; }
.ap-quota-heading strong { font: 600 23px/1 "Segoe UI", sans-serif; color: var(--navy); }
.ap-quota-heading small { font-size: 11px; color: #667987; font-weight: 400; }
.ap-quota progress { width: 100%; height: 4px; display: block; margin: 12px 0; border: 0; border-radius: 8px; overflow: hidden; background: #e9eef2; accent-color: var(--navy); }
.ap-quota progress::-webkit-progress-bar { background: #e9eef2; }
.ap-quota progress::-webkit-progress-value { background: #49667e; }
.ap-quota p { margin: 9px 0; color: #657786; font-size: 11px; line-height: 1.8; }
.ap-link { color: var(--navy); background: transparent; border: 0; padding: 0; font-size: 12px; font-weight: 600; text-align: left; cursor: pointer; }
.ap-quota .ap-link { width: 100%; border-top: 1px solid #e5eaf0; padding-top: 11px; }
.ap-quota > strong { display: block; font-size: 12px; margin-bottom: 10px; }
.ap-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #fff; }
.account-profiles .profile-toolbar { padding: 14px 24px; min-height: 64px; gap: 12px; background: #fff; align-items: center; flex: none; }
.ap-current { min-width: 0; display: flex; align-items: center; gap: 10px; }
.ap-current strong { color: var(--navy); font-size: 15px; overflow-wrap: anywhere; }
.ap-current > span { font-size: 10px; color: #657786; white-space: nowrap; border: 1px solid #dce4eb; border-radius: 3px; padding: 2px 5px; }
.account-profiles .profile-toolbar .button { font-size: 11px; min-height: 32px; white-space: nowrap; }
.account-profiles .profile-editor { flex: 1; min-height: 0; overscroll-behavior: contain; scrollbar-width: thin; }
.account-profiles .profile-section { grid-template-columns: 88px minmax(0, 1fr); gap: 20px; padding: 20px 24px; }
.account-profiles .profile-section h3 { font-size: 13px; }
.account-profiles .profile-section > header { gap: 7px; padding-top: 2px; }
.account-profiles .profile-field-grid label > span { color: #667887; font-size: 11px; }
.account-profiles .style-editor-row, .account-profiles .style-editor-head { grid-template-columns: 70px minmax(100px, 1fr) 70px 70px 55px; }
.account-profiles .style-editor-row { min-height: 47px; }
.account-profiles .style-editor-head { font-size: 10px; }
.account-profiles .profile-field-grid { gap: 12px; }
.account-profiles .profile-field-grid input, .account-profiles .profile-field-grid select,
.account-profiles .style-editor-row input[type="text"], .account-profiles .style-editor-row input[type="number"] { border-color: #ccd6df; font-size: 12px; }
.ap-destination { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 24px 0; font-size: 11px; color: #657786; border-top: 1px solid #dce4eb; background: #f9fbfc; }
.ap-destination > div { display: flex; border: 1px solid #cbd7e0; border-radius: 5px; padding: 2px; background: #fff; }
.ap-destination-button { min-height: 30px; padding: 4px 13px; background: transparent; color: #61717e; border: 0; border-radius: 3px; cursor: pointer; font-size: 11px; }
.ap-destination-button[aria-pressed="true"] { color: #fff; background: var(--navy); }
.account-profiles .dialog-footer { flex: none; border-top: 0; background: #f9fbfc; padding: 12px 24px 17px; }
.account-profiles .dialog-footer .button { font-size: 12px; min-height: 39px; border-radius: 5px; padding: 8px 18px; white-space: nowrap; }
.account-profiles .dialog-footer > div { flex: none; }
.ap-notice { padding: 11px 24px; flex: none; font-size: 12px; line-height: 1.8; background: #edf3f7; color: #375168; border-bottom: 1px solid #dce4eb; }
.ap-notice[data-tone="warning"] { background: #fcf6ea; color: #805b21; border-color: #e9d8b9; }
.ap-notice[data-tone="error"] { color: #a52e39; background: #fff1f1; }
.ap-notice .ap-link { color: inherit; text-underline-offset: 3px; text-decoration: underline; }
.ap-secondary { color: var(--ink); width: min(480px, calc(100% - 32px)); max-height: calc(100dvh - 32px); padding: 32px; border: 1px solid #d4dfe7; border-radius: 12px; box-shadow: 0 22px 70px #152f4a33; }
.ap-secondary::backdrop { background: #10283e5c; backdrop-filter: blur(1px); }
.ap-secondary h2 { margin: 10px 0 18px; font-size: 22px; color: var(--navy); line-height: 1.5; }
.ap-secondary p { font-size: 13px; color: #61717e; line-height: 1.9; }
.ap-eyebrow { color: #697c8d; font-size: 11px; }
.ap-plan-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 20px 0; }
.ap-plan-grid > div { border: 1px solid #d5dfe7; border-radius: 7px; padding: 18px 16px; }
.ap-plan-grid > div:last-child { border-color: #b8cbda; background: #eff4f8; }
.ap-plan-grid span { font-size: 12px; color: #61717e; }
.ap-plan-grid strong { display: block; font: 600 36px/1.5 "Segoe UI", sans-serif; color: var(--navy); }
.ap-plan-grid small { font-size: 13px; font-weight: 400; }
.ap-plan-grid p { font-size: 11px; margin: 4px 0 0; }
.ap-secondary-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; margin-top: 24px; }
.ap-secondary-actions .button { font-size: 12px; border-radius: 5px; text-decoration: none; }
@media (max-width: 1050px) {
  .ap-body { grid-template-columns: 210px minmax(0, 1fr); }
  .account-profiles .profile-section { grid-template-columns: 1fr; gap: 11px; padding: 16px 20px; }
  .account-profiles .profile-toolbar { padding: 12px 20px; }
}
@media (max-width: 760px) {
  .account-profiles .profile-dialog { width: calc(100% - 16px); max-height: calc(100dvh - 16px); }
  .account-profiles .dialog-shell { height: calc(100dvh - 16px); border-radius: 9px; }
  .account-profiles .dialog-header { padding: 15px 16px; }
  .account-profiles .dialog-header h2 { font-size: 21px; }
  .ap-subtitle { font-size: 11px; }
  .ap-body { display: flex; flex-direction: column; }
  .ap-sidebar { padding: 0 16px; flex: none; border-right: 0; border-bottom: 1px solid #dce4eb; }
  .ap-library-toggle { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 42px; color: var(--navy); background: none; border: 0; padding: 6px 0; text-align: left; font-size: 12px; cursor: pointer; }
  .ap-library-toggle > span { margin-left: auto; color: #61717e; max-width: 55%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .ap-library-toggle[aria-expanded="false"] ~ .ap-library { display: none; }
  .ap-library { max-height: 30dvh; flex: none; padding: 10px 0; border-top: 1px solid #dce4eb; }
  .ap-library-section + .ap-library-section { margin-top: 12px; }
  .ap-profile-item { padding: 10px; }
  .ap-quota { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0; border: 0; border-top: 1px solid #e0e6ec; border-radius: 0; background: none; padding: 8px 0 10px; }
  .ap-quota-heading { gap: 10px; }
  .ap-quota-heading strong { font-size: 17px; }
  .ap-quota p, .ap-quota progress { display: none; }
  .ap-quota .ap-link { width: auto; border: 0; padding: 0; font-size: 11px; }
  .ap-quota > strong { font-size: 11px; margin: 0 auto 0 0; }
  .ap-main { flex: 1; }
  .account-profiles .profile-toolbar { padding: 10px 16px; flex-direction: row; min-height: 57px; gap: 7px; }
  .ap-current { gap: 4px; flex-direction: column; align-items: flex-start; }
  .ap-current strong { font-size: 13px; line-height: 1.4; }
  .ap-current > span { border: 0; padding: 0; }
  .account-profiles .profile-toolbar-actions { gap: 2px; }
  .account-profiles .profile-toolbar .button { padding: 6px 8px; font-size: 11px; }
  .account-profiles .profile-section { padding: 16px; }
  .account-profiles .profile-field-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .account-profiles .style-editor-head { display: none; }
  .account-profiles .style-editor-row { grid-template-columns: 65px minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: 50px 50px; gap: 6px; }
  .account-profiles .style-editor-row .sr-only { position: static; width: auto; height: auto; overflow: visible; clip: auto; white-space: normal; font-size: 10px; }
  .account-profiles .style-editor-row > label:not(.check-field) { display: grid; align-self: stretch; gap: 3px; }
  .account-profiles .style-editor-row > strong { grid-column: 1; grid-row: 1; }
  .account-profiles .style-editor-row > label:nth-of-type(1) { grid-column: 2 / 4; grid-row: 1; }
  .account-profiles .style-editor-row > label:nth-of-type(2) { grid-column: 2; grid-row: 2; }
  .account-profiles .style-editor-row > label:nth-of-type(3) { grid-column: 3; grid-row: 2; }
  .account-profiles .style-editor-row > .check-field { grid-column: 1; grid-row: 2; }
  .ap-destination { gap: 8px; padding: 10px 16px 0; }
  .ap-destination-hint { font-size: 10px; flex: 1; min-width: 65px; }
  .ap-destination-button { padding: 4px 9px; }
  .account-profiles .dialog-footer { padding: 10px 16px 13px; flex-direction: row; gap: 12px; }
  .account-profiles .dialog-footer p { font-size: 10px; }
  .account-profiles .dialog-footer .button { padding: 8px 11px; }
  .ap-notice { padding: 9px 16px; font-size: 11px; }
  .ap-secondary { padding: 25px 22px; }
  .ap-secondary h2 { font-size: 20px; }
  .account-profiles .topbar-inner { flex-wrap: wrap; gap: 10px; }
  .ap-top-account { font-size: 11px; padding: 6px 10px; }
  .account-profiles #profileButton { margin-left: 0; }
}
