@import url("../v2-layout.css?v=20261012-secondary1");
@import url("../agent-identity-menu-v2.css?v=20261012-switch2");

:root {
  color-scheme: light;
  --v2-canvas: var(--v2-surface-canvas);
  --v2-surface: oklch(0.992 0.0015 245);
  --v2-surface-muted: oklch(0.976 0.002 245);
  --v2-selected: oklch(0.936 0.003 245);
  --v2-text: oklch(0.22 0.012 250);
  --v2-text-secondary: oklch(0.47 0.024 250);
  --v2-text-tertiary: oklch(0.61 0.02 250);
  --v2-line: oklch(0.885 0.005 245);
  --v2-agent: oklch(0.48 0.085 242);
  --v2-agent-strong: oklch(0.37 0.07 242);
  --v2-danger: oklch(0.5 0.14 28);
  --v2-success: oklch(0.49 0.09 155);
  --page-bg: var(--v2-canvas);
  --surface: var(--v2-surface);
  --surface-muted: var(--v2-surface-muted);
  --selected: var(--v2-selected);
  --text: var(--v2-text);
  --text-secondary: var(--v2-text-secondary);
  --text-tertiary: var(--v2-text-tertiary);
  --line: var(--v2-line);
  --agent: var(--v2-agent);
  --agent-strong: var(--v2-agent-strong);
  --danger: var(--v2-danger);
  --success: var(--v2-success);
  --radius-sm: 8px;
  --radius-md: 10px;
  --shadow-float: 0 16px 40px oklch(0.22 0.018 250 / 0.14);
  font-family: Inter, "Noto Sans SC", "PingFang SC", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--page-bg); }
body { margin: 0; min-width: 320px; background: var(--page-bg); color: var(--text); font: 14px/1.55 Inter, "Noto Sans SC", "PingFang SC", system-ui, sans-serif; }
button, a { font: inherit; }
a { color: inherit; }
button { color: inherit; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--agent); outline-offset: 3px; }
.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.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; }
.icon { width: 16px; height: 16px; flex: 0 0 auto; fill: currentColor; }

.site-header { position: sticky; top: 0; z-index: 20; height: 64px; background: var(--page-bg); }
.site-header.is-scrolled { box-shadow: inset 0 -1px var(--line); }
.site-header__inner { width: min(var(--v2-layout-shell), calc(100% - var(--v2-layout-gutter))); height: 100%; margin: 0 auto; display: flex; align-items: center; gap: 32px; }
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--text); font-size: 18px; font-weight: 600; text-decoration: none; }
.brand__mark { width: 20px; height: 20px; flex: 0 0 auto; }
.main-nav { display: flex; align-self: stretch; align-items: center; gap: 8px; }
.main-nav__link { min-height: 40px; padding: 0 14px; border-radius: var(--radius-sm); display: inline-flex; align-items: center; color: var(--text-secondary); font-weight: 500; text-decoration: none; }
.main-nav__link:hover { background: var(--surface-muted); color: var(--text); }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.account-trigger { width: 40px; height: 40px; border-radius: 50%; background: oklch(0.925 0.009 245); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; text-decoration: none; }
.account-trigger:hover { background: oklch(0.895 0.01 245); }
.mobile-nav-toggle { display: none; }

.side-drawer { position: fixed; inset: 0 0 0 auto; width: min(460px, 100%); height: 100dvh; max-height: none; margin: 0; padding: 0; border: 0; background: var(--surface); color: var(--text); box-shadow: -16px 0 44px oklch(0.22 0.018 250 / .14); transform: translateX(100%); opacity: 0; transition: transform 220ms cubic-bezier(.22,1,.36,1), opacity 160ms cubic-bezier(.22,1,.36,1); }
.side-drawer[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; transform: translateX(0); opacity: 1; }
.side-drawer::backdrop { background: oklch(0.16 0.01 250 / .32); }
.side-drawer__header { padding: 24px 24px 18px; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.side-drawer__title, .side-drawer__lead { margin: 0; }
.side-drawer__title { font-size: 21px; line-height: 1.35; font-weight: 600; }
.side-drawer__lead { margin-top: 6px; color: var(--text-secondary); font-size: 13px; }
.side-drawer__close { width: 40px; height: 40px; margin: -8px -8px 0 0; padding: 0; border: 0; border-radius: var(--radius-sm); background: transparent; display: grid; place-items: center; color: var(--text-secondary); cursor: pointer; }
.side-drawer__close:hover { background: var(--surface-muted); color: var(--text); }
.side-drawer__body { min-height: 0; padding: 8px 24px 28px; overflow-y: auto; }
.side-drawer__footer { padding: 16px 24px 20px; background: var(--surface); display: flex; align-items: center; justify-content: flex-end; gap: 8px; }

.account-page { width: min(var(--v2-layout-settings), calc(100% - var(--v2-layout-gutter))); margin: 0 auto; padding: 48px 0 88px; display: grid; grid-template-columns: 152px minmax(0, 1fr); gap: 64px; align-items: start; }
.account-sidebar { position: sticky; top: 96px; }
.account-nav { display: grid; gap: 3px; }
.account-nav__link { min-height: 40px; padding: 0 12px; border-radius: var(--radius-sm); display: flex; align-items: center; color: var(--text-secondary); font-weight: 400; text-decoration: none; }
.account-nav__link:hover { background: var(--surface-muted); color: var(--text); }
.account-nav__link.is-current { background: var(--selected); color: var(--text); font-weight: 600; }

.account-content { min-width: 0; max-width: var(--v2-layout-reading); }
.profile-header__name, .profile-header__roles, .section-heading h2, .section-heading p { margin: 0; }
.profile-header { min-height: 72px; display: grid; grid-template-columns: 64px minmax(0, 1fr) 40px; gap: 16px; align-items: center; }
.profile-header__avatar { width: 64px; height: 64px; border-radius: 50%; background: var(--selected); display: grid; place-items: center; color: inherit; font-size: 18px; font-weight: 600; text-decoration: none; }
.avatar-hover { position: relative; overflow: hidden; }
.avatar-hover__overlay { position: absolute; inset: 0; border-radius: inherit; background: oklch(0.18 0.01 250 / .68); display: grid; place-items: center; color: white; font-size: 12px; font-weight: 500; opacity: 0; transition: opacity 160ms cubic-bezier(.22,1,.36,1); }
.avatar-hover:hover .avatar-hover__overlay, .avatar-hover:focus-visible .avatar-hover__overlay { opacity: 1; }
.avatar-hover.has-image .avatar-initial { opacity: 0; }
.profile-header__copy { min-width: 0; display: grid; gap: 3px; }
.profile-header__name { overflow: hidden; color: var(--text); font-size: 21px; line-height: 1.35; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.profile-header__roles { color: var(--text-secondary); font-size: 13px; }
.profile-header__edit { justify-self: end; }
.account-section { scroll-margin-top: 92px; }
.role-section { margin-top: 46px; }
.section-heading h2 { font-size: 18px; line-height: 1.35; font-weight: 600; }
.section-heading p { max-width: 590px; margin-top: 7px; color: var(--text-secondary); font-size: 13px; }

.icon-button { width: 40px; height: 40px; border-radius: var(--radius-sm); display: inline-flex; align-items: center; justify-content: center; color: var(--text-secondary); text-decoration: none; }
.icon-button:hover { background: var(--surface-muted); color: var(--text); }
.icon-button:active { background: var(--selected); }

.role-surface { margin-top: 16px; display: grid; gap: 14px; }
.role-row { min-height: 112px; padding: 18px 20px; border-radius: var(--radius-md); background: var(--surface); display: grid; grid-template-columns: minmax(0, 1fr) 20px; gap: 20px; align-items: center; text-decoration: none; }
.role-row:hover { background: var(--surface-muted); }
.role-row__copy { min-width: 0; display: grid; gap: 4px; color: var(--text-secondary); font-size: 13px; }
.role-row__title { color: var(--text-secondary); font-size: 13px; line-height: 1.35; font-weight: 500; }
.role-row__primary { margin-top: 3px; color: var(--text); font-size: 17px; line-height: 1.4; font-weight: 600; }
.role-row__meta { margin-top: 5px; display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--text-secondary); font-size: 12px; }
.role-row__chevron { color: var(--text-tertiary); transition: transform 160ms cubic-bezier(.22, 1, .36, 1), color 160ms cubic-bezier(.22, 1, .36, 1); }
.role-row:hover .role-row__chevron { color: var(--text); transform: translateX(2px); }

@media (max-width: 960px) {
  .account-page { grid-template-columns: 144px minmax(0, 1fr); gap: 40px; }
}

@media (max-width: 720px) {
  .site-header { height: auto; min-height: 60px; }
  .site-header__inner { width: calc(100% - var(--v2-layout-gutter-mobile)); min-height: 60px; flex-wrap: wrap; gap: 10px; }
  .mobile-nav-toggle { margin-left: auto; min-height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); display: inline-flex; align-items: center; }
  .main-nav { order: 3; width: 100%; height: auto; padding: 8px 0 12px; display: none; }
  .main-nav.is-open { display: flex; }
  .header-actions { margin-left: 0; }
  .agent-identity { display: none; }
  .account-trigger { width: 36px; height: 36px; }
  .account-page { width: calc(100% - var(--v2-layout-gutter-mobile)); padding: 24px 0 56px; display: block; }
  .account-sidebar { position: static; margin-bottom: 30px; overflow-x: auto; scrollbar-width: none; }
  .account-sidebar::-webkit-scrollbar { display: none; }
  .account-nav { width: max-content; display: flex; gap: 6px; }
  .account-nav__link { min-height: 36px; padding: 0 11px; white-space: nowrap; }
  .account-content { max-width: none; }
  .profile-header { grid-template-columns: 56px minmax(0, 1fr) 40px; gap: 13px; }
  .profile-header__avatar { width: 56px; height: 56px; font-size: 16px; }
  .profile-header__name { font-size: 20px; }
  .role-section { margin-top: 40px; }
  .role-surface { margin-top: 15px; gap: 12px; }
  .role-row { min-height: 108px; padding: 16px 14px; grid-template-columns: minmax(0, 1fr) 20px; gap: 12px; }
  .side-drawer { top: auto; width: 100%; height: min(88dvh, 760px); border-radius: 16px 16px 0 0; transform: translateY(100%); }
  .side-drawer[open] { transform: translateY(0); }
  .side-drawer__header { padding: 20px 18px 16px; }
  .side-drawer__body { padding: 6px 18px 24px; }
  .side-drawer__footer { padding: 14px 18px calc(16px + env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: no-preference) {
  .main-nav__link, .account-nav__link, .role-row, .icon-button { transition: background-color 160ms cubic-bezier(.22, 1, .36, 1), color 160ms cubic-bezier(.22, 1, .36, 1); }
}

@media (prefers-reduced-motion: reduce) {
  .side-drawer { transition: none; }
}
