.user-menu { position: fixed; z-index: var(--z-popover); top: 58px; right: 14px; width: 268px; padding: 8px; border: 1px solid var(--line-2); border-radius: 12px; background: rgba(13,17,24,.98); box-shadow: var(--shadow); display: none; }
.user-menu.open { display: block; }
.user-menu-head { display: flex; align-items: center; gap: 10px; padding: 9px 9px 12px; border-bottom: 1px solid var(--line); margin-bottom: 5px; }
.user-menu-head strong, .user-menu-head span { display: block; }
.user-menu-head span { color: var(--subtle); font-size: 11px; }
.user-menu > button { width: 100%; min-height: 42px; display: flex; align-items: center; gap: 10px; padding: 0 10px; border-radius: 8px; color: var(--muted); text-align: left; }
.user-menu > button:hover { background: var(--surface-2); color: var(--text); }
.user-menu-separator { height: 1px; background: var(--line); margin: 5px 4px; }
.danger-action { color: #ff9ba8 !important; }
.account-usage-inline { display: grid; gap: 2px; padding: 10px; border-block: 1px solid var(--line); margin: 5px 0; }
.account-usage-inline small { color: var(--subtle); }

.account-modal { width: min(1120px, calc(100vw - 32px)); height: min(790px, calc(100dvh - 32px)); display: grid; grid-template-columns: 232px minmax(0,1fr); overflow: hidden; }
.account-center { --subtle: #8f98a8; --muted: #aab2bf; }
.account-center .secondary, .account-center .workspace-mini-btn, .account-center .account-library-item button { color: #c3cad5 !important; border-color: var(--line-2); }
.account-center #profileReset,
.account-center #accountChartTotal,
.account-center #planWorkspacePercent,
.account-center #planWorkspaceUsed,
.account-center #planWorkspaceLimit,
.account-center #planWorkspaceNote,
.account-center #accountLibraryStatus,
.account-center .usage-day > span,
.account-center .metric > span,
.account-center .metric > small,
.account-center .memory-insight > span,
.account-center .library-stat > span,
.account-center .account-library-item small,
.account-center .setting-row span,
.account-center .automatic-safe-card span,
.account-center .privacy-card p,
.account-center .memory-item p,
.account-center .memory-item-meta,
.account-center .memory-item-actions button { color: #aeb7c5; }
.account-center .account-library-type { color: #ffd487; }
.account-nav { min-width: 0; border-right: 1px solid var(--line); padding: 14px 12px; display: flex; flex-direction: column; gap: 4px; background: rgba(8,11,16,.46); }
.account-head { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 8px 7px 16px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.account-head .profile-copy { min-width: 0; }
.account-head strong, .account-head span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-head span { color: var(--subtle); font-size: 11px; }
.account-nav .nav-btn { min-height: 42px; justify-content: flex-start; gap: 10px; padding: 0 10px; border-radius: 8px; color: var(--muted); }
.account-nav .nav-btn:hover { color: var(--text); background: var(--surface); }
.account-nav .nav-btn.active { color: var(--text); background: var(--surface-2); box-shadow: inset 3px 0 0 #7dd7ba; }
.account-nav-mark { width: 22px; color: var(--subtle); font-size: 10px; font-variant-numeric: tabular-nums; }
.account-nav .nav-btn.active .account-nav-mark { color: #7dd7ba; }
.account-nav-spacer { flex: 1; }

.account-content { min-width: 0; overflow: auto; overscroll-behavior: contain; padding: 22px 26px 30px; scrollbar-gutter: stable; }
.account-content-head { position: sticky; z-index: 2; top: -22px; display: flex; align-items: center; gap: 12px; margin: -8px -6px 22px; padding: 12px 6px 16px; border-bottom: 1px solid var(--line); background: linear-gradient(to bottom, var(--bg), rgba(10,13,18,.96)); }
.account-content-head > div { flex: 1; min-width: 0; }
.account-content-head h2, .account-content-head p { margin: 0; }
.account-content-head h2 { font-size: 20px; }
.account-content-head p { margin-top: 3px; color: var(--subtle); font-size: 11px; }
.account-eyebrow, .account-kicker { display: block; margin-bottom: 4px; color: #93e7ca; font-size: 10px; font-weight: 700; letter-spacing: 0; text-transform: uppercase; }
.account-section { display: none; }
.account-section.is-active { display: block; animation: account-panel-in .18s ease-out; }
@keyframes account-panel-in { from { transform: translateY(3px); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { .account-section.is-active { animation: none; } }
.account-section h2, .account-section h3, .account-section p { margin-top: 0; }
.account-section h2 { margin-bottom: 4px; font-size: 24px; }
.account-section h3 { margin-bottom: 5px; font-size: 15px; }
.account-section-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.account-section-title p { max-width: 680px; margin-bottom: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.status-pill, .plan-badge, .memory-status-badge { flex: 0 0 auto; display: inline-flex; align-items: center; min-height: 28px; padding: 0 10px; border-radius: 999px; font-size: 10px; font-weight: 700; }
.status-pill { background: rgba(111,224,178,.09); color: var(--success); }
.plan-badge { background: rgba(125,215,186,.1); color: #9ae4ca; }
.memory-status-badge { background: rgba(127,175,255,.1); color: #a9c7ff; }

.account-hero { display: flex; align-items: center; gap: 15px; padding: 17px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.account-hero-rich { min-height: 132px; background: linear-gradient(120deg, rgba(125,215,186,.07), rgba(127,175,255,.04) 55%, rgba(243,195,110,.04)); }
.account-avatar-large { width: 64px; height: 64px; font-size: 22px; background: #223126; color: #baf2dd; }
.account-hero-copy { min-width: 0; flex: 1; }
.account-hero-copy strong, .account-hero-copy > span { display: block; }
.account-hero-copy strong { overflow-wrap: anywhere; font-size: 21px; }
.account-hero-copy > span:not(.account-kicker) { color: var(--subtle); font-size: 11px; }
.account-hero-copy p { max-width: 590px; margin: 9px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.account-hero-score { min-width: 112px; padding-left: 18px; border-left: 1px solid var(--line); text-align: center; }
.account-hero-score strong, .account-hero-score span { display: block; }
.account-hero-score strong { color: #9ae4ca; font-size: 28px; font-variant-numeric: tabular-nums; }
.account-hero-score span { color: var(--subtle); font-size: 10px; }

.account-overview-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; margin-top: 10px; }
.account-summary-card { min-width: 0; min-height: 76px; display: grid; grid-template-columns: 34px minmax(0,1fr) auto; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); text-align: left; }
.account-summary-card:hover { border-color: var(--line-2); background: var(--surface-2); }
.account-summary-card strong, .account-summary-card small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-summary-card strong { font-size: 13px; }
.account-summary-card small { margin-top: 3px; color: #8f98a8; font-size: 10px; }
.summary-card-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 8px; font-weight: 800; }
.memory-tone { background: rgba(127,175,255,.11); color: #a9c7ff; }
.library-tone { background: rgba(243,195,110,.1); color: #f3c36e; }
.usage-tone { background: rgba(125,215,186,.1); color: #9ae4ca; }
.summary-card-arrow { color: var(--subtle); font-size: 20px; }

.account-surface, .metric, .memory-insight, .library-stat, .setting-row, .automatic-safe-card { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.account-surface { padding: 16px; }
.workspace-summary-card, .workspace-detail-card { margin-top: 10px; }
.surface-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.surface-heading h3 { margin-bottom: 0; }
.surface-heading > strong, .surface-heading > span { color: var(--muted); font-size: 11px; }
.usage-track, .memory-coverage-track { height: 8px; overflow: hidden; margin: 14px 0 8px; border-radius: 999px; background: #202631; }
.usage-track > span, .memory-coverage-track > span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #7dd7ba, #7fafff); transition: width .25s ease; }
.usage-track.workspace > span { background: linear-gradient(90deg, #7dd7ba, #f3c36e); }
.storage-labels { display: flex; justify-content: space-between; gap: 12px; color: #8f98a8; font-size: 10px; }
.workspace-summary-card > p, .workspace-detail-card > p { margin: 11px 0 0; color: var(--muted); font-size: 11px; }

.plan-dashboard { display: grid; grid-template-columns: minmax(280px,.8fr) minmax(360px,1.2fr); gap: 10px; }
.usage-ring-card { display: flex; align-items: center; gap: 18px; }
.usage-ring { --usage-percent: 0; flex: 0 0 auto; width: 126px; aspect-ratio: 1; display: grid; place-items: center; border-radius: 50%; background: conic-gradient(#7dd7ba calc(var(--usage-percent) * 1%), #242b36 0); position: relative; }
.usage-ring::before { content: ""; position: absolute; inset: 10px; border-radius: 50%; background: var(--surface); }
.usage-ring > div { position: relative; z-index: 1; text-align: center; }
.usage-ring strong, .usage-ring span { display: block; }
.usage-ring strong { max-width: 88px; overflow-wrap: anywhere; font-size: 17px; }
.usage-ring span { margin-top: 2px; color: var(--subtle); font-size: 9px; }
.usage-ring-card > div:last-child { min-width: 0; }
.usage-ring-card p { margin: 4px 0 0; color: var(--subtle); font-size: 10px; }
.weekly-chart-card { min-height: 190px; }
.usage-chart { height: 120px; display: grid; grid-template-columns: repeat(7,minmax(20px,1fr)); align-items: end; gap: 8px; margin-top: 16px; }
.usage-day { min-width: 0; height: 100%; display: grid; grid-template-rows: 1fr auto; align-items: end; gap: 6px; text-align: center; }
.usage-day-track { width: min(24px,80%); height: 100%; display: flex; align-items: end; justify-self: center; border-radius: 5px 5px 2px 2px; background: #202631; overflow: hidden; }
.usage-day-bar { width: 100%; min-height: 3px; border-radius: inherit; background: linear-gradient(to top, #7fafff, #7dd7ba); }
.usage-day span { color: var(--subtle); font-size: 9px; }
.metric-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; margin-top: 10px; }
.metric { min-width: 0; min-height: 106px; padding: 14px 15px; }
.metric span, .metric strong, .metric small { display: block; }
.metric span, .metric small { color: var(--subtle); font-size: 10px; }
.metric-head { min-height: 24px; display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.metric-head > span:first-child { color: var(--muted); font-weight: 700; }
.metric .metric-badge { flex: 0 0 auto; min-height: 22px; display: inline-flex; align-items: center; padding: 0 7px; border-radius: 999px; background: rgba(125,215,186,.09); color: #9ae4ca; font-size: 9px; font-weight: 700; }
.metric strong { margin: 8px 0 5px; overflow-wrap: anywhere; font-size: 20px; line-height: 1.15; }
.metric small { line-height: 1.4; }

.model-choice-card { margin-top: 10px; }
.model-current-family { display: inline-flex; min-height: 26px; align-items: center; padding: 0 9px; border-radius: 999px; background: rgba(125,215,186,.09); color: #a9ead4 !important; font-weight: 700; }
.model-choice-control { display: grid; grid-template-columns: minmax(120px,.35fr) minmax(220px,1fr); align-items: center; gap: 12px; margin-top: 14px; }
.model-choice-control label { color: var(--muted); font-size: 11px; font-weight: 700; }
.model-choice-control select { min-height: 40px; }
.account-model-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 7px; margin-top: 12px; }
.account-model-option { min-width: 0; min-height: 112px; display: flex; flex-direction: column; align-items: stretch; gap: 8px; padding: 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-2); color: var(--text); text-align: left; }
.account-model-option:hover { border-color: var(--line-2); background: var(--surface-2); }
.account-model-option.is-selected { border-color: rgba(125,215,186,.42); background: rgba(125,215,186,.065); box-shadow: inset 3px 0 0 #7dd7ba; }
.account-model-option-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.account-model-option-head strong, .account-model-option-head span { display: block; }
.account-model-option-head strong { overflow-wrap: anywhere; font-size: 12px; }
.account-model-option-head span { flex: 0 0 auto; color: #9ae4ca; font-size: 9px; font-weight: 700; }
.account-model-option > p { min-height: 30px; margin: 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
.account-model-signals { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 5px; margin-top: auto; }
.account-model-signals span { min-width: 0; padding-top: 6px; border-top: 1px solid var(--line); color: var(--subtle); font-size: 8px; line-height: 1.35; overflow-wrap: anywhere; }
.account-model-signals strong { display: block; margin-top: 2px; color: var(--muted); font-size: 9px; }
.model-policy-card { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 10px; padding: 12px 13px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-2); }
.model-policy-card > div { min-width: 150px; }
.model-policy-card span, .model-policy-card strong { display: block; }
.model-policy-card span { color: #9ae4ca; font-size: 9px; font-weight: 700; }
.model-policy-card strong { margin-top: 3px; font-size: 12px; }
.model-policy-card p { max-width: 580px; margin: 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
.model-policy-card.is-strong { border-color: rgba(127,175,255,.23); }
.model-policy-card.is-neutral { border-color: rgba(243,195,110,.18); }

.memory-insight-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 8px; }
.memory-insight { padding: 12px; }
.memory-insight strong, .memory-insight span { display: block; }
.memory-insight strong { font-size: 20px; }
.memory-insight span { margin-top: 3px; color: var(--subtle); font-size: 10px; }
.memory-personality-card { margin-top: 10px; background: linear-gradient(120deg, rgba(127,175,255,.06), rgba(125,215,186,.04)); }
.memory-personality-card p { margin: 10px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.memory-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 14px 0 10px; }
.memory-filter-row { display: flex; gap: 5px; overflow-x: auto; }
.memory-filter-row button { min-height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 10px; white-space: nowrap; }
.memory-filter-row button.is-active { border-color: rgba(125,215,186,.32); background: rgba(125,215,186,.08); color: #a9ead4; }
.memory-search { width: min(210px,36%); }
.memory-search input { min-height: 34px; }
.memory-list { display: grid; gap: 8px; }
.memory-group { display: grid; gap: 7px; }
.memory-group + .memory-group { margin-top: 10px; }
.memory-group-title { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 11px; }
.memory-group-title span { color: var(--subtle); font-size: 9px; }
.memory-item { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 12px; padding: 12px 13px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.memory-item-head { display: flex; align-items: center; gap: 8px; }
.memory-item-head strong { font-size: 12px; }
.memory-sensitive-mark { padding: 2px 6px; border-radius: 999px; background: rgba(243,195,110,.09); color: #f3c36e; font-size: 8px; }
.memory-item p { margin: 5px 0; color: var(--muted); font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; }
.memory-item-meta { color: var(--subtle); font-size: 9px; }
.memory-item-actions { display: flex; align-items: flex-start; gap: 4px; }
.memory-item-actions button { min-height: 30px; padding: 0 7px; border-radius: 6px; color: var(--muted); font-size: 9px; }
.memory-item-actions button:hover { background: var(--surface-2); color: var(--text); }
.memory-item.is-disabled { opacity: .56; }
.memory-edit-form { grid-column: 1 / -1; display: flex; gap: 7px; padding-top: 10px; border-top: 1px solid var(--line); }
.memory-edit-form input { flex: 1; }
.account-inline-message { min-height: 18px; margin-top: 9px; color: #ffabb5; font-size: 10px; }

.library-stat-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 8px; }
.library-capacity-card { margin-top: 10px; }
.library-stat { padding: 14px; }
.library-stat strong, .library-stat span { display: block; }
.library-stat strong { font-size: 21px; }
.library-stat span { margin-top: 3px; color: var(--subtle); font-size: 10px; }
.library-overview-card { margin-top: 10px; }
.account-library-list { display: grid; gap: 6px; margin-top: 12px; }
.account-library-item { display: grid; grid-template-columns: 34px minmax(0,1fr) auto; align-items: center; gap: 10px; min-height: 56px; padding: 8px; border-top: 1px solid var(--line); }
.account-library-item:first-child { border-top: 0; }
.account-library-type { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 7px; background: rgba(243,195,110,.08); color: #f3c36e; font-size: 9px; font-weight: 800; text-transform: uppercase; }
.account-library-item strong, .account-library-item small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-library-item strong { font-size: 11px; }
.account-library-item small { margin-top: 3px; color: var(--subtle); font-size: 9px; }
.account-library-item button { min-height: 30px; padding: 0 8px; color: var(--muted); font-size: 9px; }
.account-empty-state { padding: 26px 12px; color: var(--subtle); font-size: 11px; text-align: center; }
.library-callout { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 10px; padding: 14px; border: 1px solid rgba(125,215,186,.17); border-radius: 8px; background: rgba(125,215,186,.035); }
.library-callout strong, .library-callout span { display: block; }
.library-callout strong { font-size: 12px; }
.library-callout span { margin-top: 3px; color: var(--muted); font-size: 10px; }

.account-settings-grid { display: grid; gap: 8px; }
.setting-row { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px; }
.setting-row strong, .setting-row span { display: block; }
.setting-row strong { font-size: 12px; }
.setting-row span { margin-top: 4px; color: var(--subtle); font-size: 10px; }
.au-toggle { flex: 0 0 auto; width: 44px; height: 24px; border-radius: 999px; background: #2b3240; position: relative; }
.au-toggle::after { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; border-radius: 50%; background: #dbe2ee; transition: transform .2s; }
.au-toggle.is-on { background: #559d83; }
.au-toggle.is-on::after { transform: translateX(20px); }
.automatic-safe-card { display: flex; align-items: center; gap: 12px; padding: 15px; }
.automatic-safe-card strong, .automatic-safe-card span { display: block; }
.automatic-safe-card strong { font-size: 13px; }
.automatic-safe-card span { margin-top: 3px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.safe-indicator { flex: 0 0 auto; width: 12px; height: 12px; border-radius: 50%; background: #7dd7ba; box-shadow: 0 0 0 6px rgba(125,215,186,.08); }
.privacy-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; margin-top: 10px; }
.privacy-card p { min-height: 42px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 18px; padding: 14px; border: 1px solid rgba(255,126,143,.18); border-radius: 8px; background: rgba(255,126,143,.035); }
.danger-zone strong, .danger-zone span { display: block; }
.danger-zone strong { color: #ffb0ba; font-size: 12px; }
.danger-zone span { margin-top: 4px; color: var(--muted); font-size: 10px; }
.danger-button { min-height: 36px; padding: 0 11px; border: 1px solid rgba(255,126,143,.25); border-radius: 7px; color: #ffabb5; white-space: nowrap; }

.account-content input, .account-content textarea, .account-content select { width: 100%; border: 1px solid var(--line); border-radius: 7px; background: var(--bg-2); color: var(--text); padding: 9px 10px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 820px) {
  .account-modal { width: min(100%, 720px); height: min(100dvh, 780px); grid-template-columns: 1fr; grid-template-rows: auto minmax(0,1fr); border-radius: 0; }
  .account-nav { min-width: 0; overflow-x: auto; flex-direction: row; align-items: center; padding: 8px; border-right: 0; border-bottom: 1px solid var(--line); scrollbar-width: none; }
  .account-nav::-webkit-scrollbar { display: none; }
  .account-head, .account-nav-spacer, .account-nav > .danger-action { display: none; }
  .account-nav .nav-btn { flex: 0 0 auto; min-height: 36px; padding: 0 10px; white-space: nowrap; }
  .account-nav .nav-btn.active { box-shadow: inset 0 -2px 0 #7dd7ba; }
  .account-nav-mark { display: none; }
  .account-content { padding: 16px; scrollbar-gutter: auto; }
  .account-content-head { top: -16px; margin: -6px -2px 18px; padding-top: 10px; }
  .account-overview-grid { grid-template-columns: 1fr; }
  .plan-dashboard { grid-template-columns: 1fr; }
  .account-model-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .memory-insight-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

@media (max-width: 560px) {
  .account-modal { width: 100%; height: 100dvh; }
  .account-content { padding: 14px 12px 24px; }
  .account-content-head { top: -14px; margin-bottom: 15px; }
  .account-content-head p { display: none; }
  .account-section-title { display: block; }
  .account-section-title > span, .account-section-title > button { margin-top: 10px; }
  .account-section h2 { font-size: 21px; }
  .account-hero-rich { align-items: flex-start; flex-wrap: wrap; }
  .account-hero-score { width: 100%; padding: 10px 0 0; border-left: 0; border-top: 1px solid var(--line); text-align: left; }
  .account-hero-score strong, .account-hero-score span { display: inline; }
  .account-hero-score span { margin-left: 5px; }
  .metric-grid, .library-stat-grid, .privacy-grid { grid-template-columns: 1fr; }
  .model-choice-control, .account-model-grid { grid-template-columns: 1fr; }
  .model-policy-card { align-items: flex-start; flex-direction: column; }
  .usage-ring-card { align-items: flex-start; }
  .usage-ring { width: 108px; }
  .memory-toolbar { align-items: stretch; flex-direction: column; }
  .memory-search { width: 100%; }
  .memory-item { grid-template-columns: 1fr; }
  .memory-item-actions { overflow-x: auto; }
  .memory-edit-form { flex-wrap: wrap; }
  .memory-edit-form input { flex-basis: 100%; }
  .library-callout, .danger-zone { align-items: stretch; flex-direction: column; }
  .storage-labels { flex-direction: column; gap: 3px; }
}
