.account-page {
  flex:1;
  overflow:auto;
  padding:clamp(20px,4vw,56px);
  color:var(--ink);
  max-width:1200px}
.app:has(> .rail[hidden]) > .account-page {
  grid-column:1/-1;
}
.account-page h1 {
  font-size:clamp(26px,3vw,38px);
  margin:0 0 24px}
.account-card {
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:var(--radius-card);
  padding:24px;
  margin:16px 0;
  max-width:850px}
.account-card h2 {
  margin:0 0 16px;
  font-size:21px}
.account-card label {
  display:block;
  margin:14px 0}
.account-card input:not([type=checkbox]):not([type=range]),.account-card textarea,.account-card select {
  display:block;
  width:100%;
  box-sizing:border-box;
  margin-top:6px;
  border:1px solid var(--line-2);
  border-radius:10px;
  padding:11px;
  font:inherit;
  background:var(--surface);
  color:inherit}
.account-card textarea {
  min-height:110px}
.account-card button:not(.sw):not(.ib),.account-page>button {
  border:1px solid var(--line-2);
  background:var(--accent-soft);
  border-radius:12px;
  padding:10px 16px;
  font:inherit;
  cursor:pointer;
  margin:6px 8px 6px 0;
  color:var(--ink)}
.account-card button:not(.sw):not(.ib).primary {
  background:var(--accent);
  color:var(--accent-on)}
.account-card button:not(.sw):not(.ib):disabled {
  opacity:.5;
  cursor:wait}
.account-card fieldset {
  border:1px solid var(--line);
  border-radius:12px;
  margin:12px 0}
.account-card .inline {
  display:inline-flex;
  gap:8px;
  margin-right:16px}
.account-card time {
  color:var(--muted);
  font-size:13px}
.account-card pre {
  white-space:pre-wrap;
  overflow-wrap:anywhere;
  font:inherit}
.account-menu {
  margin-top:auto;
  padding:16px;
  position:relative}
.account-menu summary {
  cursor:pointer;
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px;
  border-radius:12px;
  background:var(--accent-soft)}
.account-menu img {
  width:36px;
  height:36px;
  border-radius:50%;
  object-fit:cover}
.account-menu a,.account-menu button {
  display:block;
  padding:10px;
  color:inherit;
  background:transparent;
  border:0;
  text-decoration:none;
  font:inherit;
  cursor:pointer}
.account-page a {
  color:var(--accent)}
.crm-file-picker {
  display:flex; align-items:center; flex-wrap:wrap; gap:8px;
  min-width:0; padding:9px 11px; border:1px solid var(--line-2); border-radius:10px;
  background:var(--raised); color:var(--ink);
}
.crm-file-picker input[type="file"] {
  min-width:0; max-width:100%; padding:0; border:0; border-radius:0;
  background:transparent; color:var(--ink-2); font:inherit; font-size:14px; font-weight:400;
}
.crm-file-picker input[type="file"]::file-selector-button {
  padding:5px 9px; border:1px solid var(--line-2); border-radius:8px;
  background:var(--surface); color:var(--accent-ink); font:inherit; cursor:pointer;
}
.account-card .avatar-file { display:grid; gap:5px; }
.avatar-editor { margin-block:12px; }
.avatar-editor[hidden] { display:none; }
.avatar-editor p { margin:6px 0; font-size:13px; color:var(--muted); }
.avatar-preview {
  display:block; width:256px; max-width:100%; aspect-ratio:1; height:auto;
  margin-block:10px; border-radius:12px; outline:1px solid var(--line-2);
}
canvas.avatar-preview { cursor:grab; touch-action:none; }
canvas.avatar-preview.dragging { cursor:grabbing; }
.avatar-editor input[type="range"] { accent-color:var(--accent); }
.account-alert {
  color:var(--warn)}
.account-grid {
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(240px,1fr));
  gap:16px}
.account-card.unread {
  border-left:4px solid var(--accent)}

@media(max-width:760px) {
  .account-page {
  padding:20px 16px}
.account-card {
  padding:18px}
.account-page+.rail {
  display:none}
body:has(.account-page) .app {
  height:auto;
  min-height:100dvh}
body:has(.account-page) .rail {
  width:100%;
  height:auto;
  border-right:0}
body:has(.account-page) .app {
  display:flex;
  flex-direction:column}
body:has(.account-page) .nav {
  display:flex;
  flex-wrap:wrap}
body:has(.account-page) .nav a {
  padding:8px 12px}
.account-menu {
  padding:10px 16px}
}


.account-page  {
   width: 100%;
   min-width: 0;
   }

.account-page h1,.account-page h2  {
   letter-spacing: var(--track-head,-.03em);
   }

.account-page>select,#account-content>select  {
   padding: 10px 14px;
   border: 1px solid var(--line-2);
   border-radius: var(--radius-pill);
   background: var(--surface);
   color: var(--ink);
   font: inherit;
   max-width: 100%;
   }

.account-menu  {
   margin-top:auto;
   padding:0;
   width:100%;
   }

.account-menu summary  {
   flex-direction:column;
   padding:8px 2px;
   gap:4px;
   font-size:11px;
   text-align:center;
   }

.account-short-name  {
   max-width:60px;
   overflow:hidden;
   text-overflow:ellipsis;
   white-space:nowrap;
   }

.account-menu-entries  {
   position:absolute;
   left:calc(100% + 12px);
   bottom:0;
   width:240px;
   padding:10px;
   background:var(--surface);
   border:1px solid var(--line-2);
   border-radius:var(--radius-card);
   box-shadow:var(--shadow-toast);
   z-index:100;
   text-align:left;
   }

.account-menu-entries a,.account-menu-entries button  {
   box-sizing:border-box;
   width:100%;
   padding:12px;
   border-radius:10px;
   }

.account-menu-entries a:hover,.account-menu-entries button:hover  {
   background:var(--accent-soft);
   }

.account-unread  {
   color:var(--accent);
   font-family:var(--font-mono);
   }

.account-card input:focus-visible,.account-card textarea:focus-visible,.account-card button:not(.sw):not(.ib):focus-visible,.account-menu a:focus-visible  {
   outline:2px solid var(--color-focus);
   outline-offset:2px;
   }

@media(max-width:760px)  {

 .account-menu  {
   width:auto;
   min-width:44px;
   flex:none;
   margin-top:0;
   padding:0;
   }

 .account-short-name  {
   display:none;
   }

 .account-menu-entries  {
   position:fixed;
   left:auto;
   right:12px;
   bottom:90px;
   max-width:calc(100vw - 24px);
   }

 body:has(.account-page) .rail  {
   position:relative;
   left:auto;
   right:auto;
   bottom:auto;
   box-sizing:border-box;
   border-radius:var(--radius-card);
   padding:10px;
   flex-direction:row;
   flex-wrap:wrap;
   }

 body:has(.account-page) .nav  {
   flex-direction:row;
   flex:1;
   gap:0;
   }

 body:has(.account-page) .nav a  {
   min-width:55px;
   padding:6px;
   font-size:11px;
   }

 body:has(.account-page) .brand  {
   display:none;
   }

 body:has(.account-page) .account-menu-entries  {
   top:80px;
   bottom:auto;
   }

 .nav a[href="/notifications"]  {
   font-size:10px;
   }

}


.avatar-preview[hidden]  {
   display:none;
   }

@media(max-width:760px)  {
   .account-card input,.account-card textarea,.account-card select  {
   font-size:16px;
   }
 }


.account-page label  {
   display:block;
   margin:14px 0;
   }

.account-page input:not([type=checkbox]):not([type=range]),.account-page textarea  {
   display:block;
   width:100%;
   box-sizing:border-box;
   margin-top:6px;
   border:1px solid var(--line-2);
   border-radius:10px;
   padding:11px;
   font:inherit;
   background:var(--surface);
   color:var(--ink);
   }

.account-page button:not(.sw):not(.ib)  {
   min-height:44px;
   border:1px solid var(--line-2);
   background:var(--accent-soft);
   border-radius:var(--radius-pill);
   padding:10px 16px;
   font:inherit;
   cursor:pointer;
   margin:6px 8px 6px 0;
   color:var(--ink);
   }

.account-card button:not(.sw):not(.ib).primary  {
   background:var(--accent);
   color:var(--accent-on);
   }

.account-card h2,.account-card p  {
   overflow-wrap:anywhere;
   }

.account-page  {
   box-sizing:border-box;
   }


.nav a[href="/notifications"] { position:relative; }
.account-unread { position:absolute; top:0; right:3px; font-size:10px; line-height:16px; padding-inline:3px; background:var(--surface); border-radius:var(--radius-pill); }
@media(max-width:760px) {
 body:not(:has(.account-page)) .rail .nav { flex:1; min-width:0; overflow-x:auto; scrollbar-width:none; }
 body:not(:has(.account-page)) .rail .nav a { flex:0 0 58px; min-width:58px; }
 .account-page input:not([type=checkbox]):not([type=range]),.account-page textarea,.account-page select { font-size:16px; }
 .account-card .inline { min-height:32px; padding-block:4px; }
}

@media(max-width:760px) { #account-content>select { font-size:16px; } }

.rail:has(.account-menu[open]) { z-index:var(--z-modal,100); }

/* Экран «Меню» и панель активного сотрудника. Общий вход сохраняет прежнюю навигацию. */
.staff-mobile-nav, .staff-mobile-signout { display: none; }
.rail > .nav { min-height: 0; overflow-y: auto; }
.rail > .nav > a { flex-shrink: 0; text-align: center; }
.rail > .nav > a > span:nth-child(2) { max-width: 100%; overflow-wrap: anywhere; hyphens: auto; }
.navigation-settings-list { display: grid; gap: 5px; margin-block: 12px; }
.navigation-settings-row {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: 7px; padding: 8px 12px; border-radius: 12px; background: var(--glass-strong);
}
.navigation-settings-row label, .navigation-settings-row > div { display: flex; align-items: center; gap: 7px; }
.navigation-settings-row input[type="checkbox"] {
  appearance: none; display: grid; place-items: center; flex: none;
  width: 18px; height: 18px; margin: 0; border: 1px solid var(--muted);
  border-radius: 5px; background: var(--surface); color: var(--accent-on);
  accent-color: var(--accent); cursor: pointer;
}
.navigation-settings-row input[type="checkbox"]:checked { background: var(--accent); border-color: var(--accent); }
.navigation-settings-row input[type="checkbox"]:checked::before {
  content: ""; width: 5px; height: 9px; box-sizing: border-box; border: solid currentColor;
  border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg);
}
.navigation-settings-row button, .nav-settings-save {
  display: inline-grid; place-items: center; padding: 0;
  border: 1px solid var(--line); border-radius: 999px;
  color: var(--accent-ink); background: color-mix(in oklch, var(--raised-2) 90%, transparent);
  cursor: pointer;
}
.navigation-settings-row button { width: 44px; height: 44px; }
.navigation-settings-row button .nav-i { font-size: 18px; }
.navigation-settings-row .nav-move-up .nav-i { transform: rotate(90deg); }
.navigation-settings-row .nav-move-down .nav-i { transform: rotate(-90deg); }
.navigation-settings-row button:hover:not(:disabled), .nav-settings-save:hover:not(:disabled) {
  background: var(--accent-soft-2);
}
.nav-settings-save {
  align-self: flex-end; width: max-content; min-height: 46px; margin-inline-end: 12px;
  padding-inline: 22px; font-weight: 600;
}
.navigation-settings-row button:disabled, .nav-settings-save:disabled { opacity: .53; cursor: default; }
.nav-settings-status { min-height: 1.3em; }

@media (forced-colors: active) {
  .navigation-settings-row input[type="checkbox"] { appearance: auto; }
  .navigation-settings-row input[type="checkbox"]::before { display: none; }
}

.staff-menu { max-width: 480px; display: grid; gap: 10px; }
.staff-menu-profile, .staff-menu-row {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  min-height: 50px;
  color: var(--ink);
}
.account-page :is(.staff-menu-profile,.staff-menu-row) { color: var(--ink); }
.staff-menu-profile {
  min-height: 84px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--accent-soft);
}
.staff-menu-profile strong, .staff-menu-row strong { display: block; overflow-wrap: anywhere; font-weight: 600; }
.staff-menu-profile strong { font-size: var(--text-md); }
.staff-menu-profile small, .staff-menu-row small { display: block; color: var(--ink-2); }
.staff-menu-profile > .ms:last-child, .staff-menu-row > .ms:last-child {
  margin-inline-start: auto;
  font-size: 16px;
  color: var(--ink-2);
  transform: rotate(-90deg);
}
.staff-mobile-avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 23px;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 50%;
  background: var(--accent-soft-2);
  color: var(--accent-ink);
  font-size: 9px;
  font-weight: 600;
}
.staff-mobile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.staff-menu-profile .staff-mobile-avatar { width: 50px; font-size: var(--text-md); }
.staff-menu-group { border: 1px solid var(--line); border-radius: var(--radius-card); background: var(--surface); }
.staff-menu-row { position: relative; padding: 6px 13px; }
.staff-menu-row:not(:first-child)::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 45px;
  border-top: 1px solid var(--line);
}
.staff-menu-row > .ms:first-child { color: var(--accent-ink); }
.staff-menu-unread:not(:empty) {
  margin-inline-start: auto;
  min-width: 20px;
  padding: 0 5px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  text-align: center;
  font-size: 12px;
}
.staff-menu-unread:not(:empty) + .ms:last-child { margin-inline-start: 0; }

@media (max-width: 760px) {
  html:has(meta[name="crm-account"]) .app > .rail { display: none; }
  .app:has(> .staff-mobile-nav) {
    --staff-dock-space: calc(78px + env(safe-area-inset-bottom));
    padding-bottom: var(--staff-dock-space);
  }
  body:has(.staff-mobile-nav) .app:has(> .account-page) {
    height: var(--app-h, 100dvh);
    min-height: 0;
    padding: calc(8px + env(safe-area-inset-top)) calc(8px + env(safe-area-inset-right))
             var(--staff-dock-space) calc(8px + env(safe-area-inset-left));
  }
  body:has(.staff-mobile-nav) .account-page { min-height: 0; overscroll-behavior: contain; }
  .account-page:has(.staff-menu) { padding: 8px 4px 12px; }
  .account-page:has(.staff-menu) h1 { margin: 3px 1px 12px; font-size: 24px; }
  .staff-mobile-signout { display: inline-block; }
  .staff-mobile-nav {
    display: flex;
    position: fixed;
    z-index: var(--z-sticky);
    bottom: calc(8px + env(safe-area-inset-bottom));
    left: calc(8px + env(safe-area-inset-left));
    right: calc(8px + env(safe-area-inset-right));
    height: 62px;
    padding: 4px;
    border: 1px solid var(--glass-strong);
    border-radius: 24px;
    background: var(--glass-strong);
    box-shadow: var(--glass-shadow);
    -webkit-backdrop-filter: var(--glass-filter);
    backdrop-filter: var(--glass-filter);
  }
  .staff-mobile-tabs { flex: 1; min-width: 0; display: flex; overflow-x: auto; scrollbar-width: none; }
  .staff-mobile-tabs a { flex: 1 0 66px; }
  .staff-mobile-nav > a { flex: 0 0 58px; }
  .staff-mobile-nav a {
    display: grid;
    place-items: center;
    align-content: center;
    gap: 3px;
    min-width: 0;
    border-radius: 17px;
    text-decoration: none;
    padding-inline: 3px;
    text-align: center;
    color: var(--ink-2);
    font-size: 11px;
    line-height: 14px;
    font-weight: 500;
  }
  .staff-mobile-nav .ms { font-size: 22px; }
  .staff-mobile-nav [aria-current] { color: var(--accent-ink); background: var(--accent-soft); font-weight: 600; }
  .staff-mobile-nav [aria-current] svg { stroke-width: 2.1; }
  .kb-open .staff-mobile-nav { display: none; }
  html.kb-open .app:has(> .staff-mobile-nav) { --staff-dock-space: 8px; }
  .list-pane .hd > .acct { width: auto; min-height: 44px; align-self: flex-end; flex-direction: row; padding: 0 10px; }
  .list-pane .hd > .acct .dot { margin: 0; }
}
