/* Session control on the research workspace. */
.session-menu { position: relative; z-index: 40; flex: 0 0 auto; color: var(--ink); }
.session-menu summary { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 3px 8px 3px 4px; border: 1px solid var(--line); border-radius: 24px; background: #fff; font-weight: 600; cursor: pointer; list-style: none; }
.session-menu summary::-webkit-details-marker { display: none; }
.session-menu summary:hover, .session-menu[open] summary { border-color: var(--teal); }
.session-menu summary::after { content: ''; width: 6px; height: 6px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: translateY(-2px) rotate(45deg); margin-right: 4px; }
.session-avatar, .profile-avatar { display: grid; place-items: center; background: var(--mint); color: var(--teal); border-radius: 50%; font: 600 14px/1 var(--number-font); text-transform: uppercase; }
.session-avatar { width: 30px; height: 30px; }
.session-name { max-width: 12ch; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; font-size: 13px; }
.session-dropdown { position: absolute; top: calc(100% + 8px); right: 0; min-width: 180px; max-width: min(280px, 90vw); padding: 6px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: 0 12px 32px #18382a22; }
.session-dropdown p { padding: 7px 11px 9px; margin: 0 0 4px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; border-bottom: 1px solid var(--line); }
.session-dropdown :is(a,button) { display: block; width: 100%; padding: 9px 11px; border: 0; border-radius: 6px; text-align: left; color: var(--ink); background: transparent; font-size: 13px; }
.session-dropdown :is(a,button):hover { background: var(--paper); color: var(--teal); }

.auth-page { display: flex; flex-direction: column; min-height: 100vh; min-height: 100svh; background: var(--paper); }
.auth-page [hidden] { display: none !important; }
.auth-header, .auth-footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; padding-inline: max(6vw, calc((100vw - 1200px) / 2)); }
.auth-header { height: 78px; background: var(--paper); border-bottom: 1px solid var(--line); }
.auth-brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); }
.auth-brand img { border-radius: 9px; flex: none; }
.auth-brand > span { font-size: 21px; font-weight: 700; line-height: 1.05; letter-spacing: .06em; }
.auth-brand small { display: block; margin-top: 5px; font: 600 9px/1.1 var(--number-font); letter-spacing: .13em; color: var(--muted); }
.auth-back { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-weight: 600; color: var(--teal); }
.auth-back:hover, .auth-signout:hover { text-decoration: underline; text-underline-offset: 4px; }
.auth-footer { margin-top: auto; min-height: 62px; padding-block: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.auth-kicker, .cover-index, .cover-foot { font: 600 11px/1.5 var(--number-font); letter-spacing: .12em; }
.auth-kicker { display: flex; align-items: center; gap: 8px; color: var(--teal); }
.auth-kicker::before { content: ''; width: 19px; height: 3px; background: var(--teal); }
.auth-page h1 { color: var(--ink); font-size: clamp(32px, 3.1vw, 44px); line-height: 1.28; letter-spacing: -.035em; margin: 13px 0; font-weight: 650; }
.auth-lead, .settings-head p, #settings-loading { color: var(--muted); font-size: 14px; line-height: 1.7; margin: 0; }
.signin-layout { display: grid; grid-template-columns: 1.13fr 1fr; width: min(1120px, 89vw); max-width: none; margin: auto; gap: 0; padding: clamp(26px, 5.5vh, 64px) 0; }
.signin-cover { position: relative; isolation: isolate; overflow: hidden; border-radius: 18px 0 0 18px; padding: clamp(25px, 3.3vw, 48px); background: #153d32; color: #f4f7ec; display: flex; flex-direction: column; min-height: 520px; }
.cover-index, .cover-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cover-index { color: #d8ef8d; }
.cover-index span:last-child { color: #b5c8b8; font-size: 10px; }
.cover-title { position: relative; z-index: 1; margin-top: clamp(45px, 7vh, 86px); }
.cover-rule { display: block; height: 4px; width: 35px; background: var(--lime); }
.cover-title p { margin: 18px 0 0; font-size: clamp(34px, 4.2vw, 62px); font-weight: 550; line-height: 1.24; letter-spacing: .035em; }
.cover-waves { position: absolute; width: 100%; height: 35%; bottom: 42px; left: 0; color: #84b890; opacity: .64; }
.cover-foot { position: relative; margin-top: auto; padding-top: 15px; border-top: 1px solid #ffffff3a; color: #cad8cc; font-weight: 400; }
.cover-foot b { color: var(--lime); margin-left: 2px; }
.signin-form { display: flex; flex-direction: column; justify-content: center; min-width: 0; padding: clamp(28px, 4vw, 60px); background: #fff; border: 1px solid var(--line); border-left: none; border-radius: 0 18px 18px 0; }
.signin-form form { margin-top: 28px; }
.auth-page form { min-width: 0; }
.auth-page form label { display: block; margin: 16px 0 7px; font-weight: 600; color: var(--ink); font-size: 14px; }
.auth-page form label:first-of-type { margin-top: 0; }
.auth-page :is(input,select) { display: block; width: 100%; min-width: 0; height: 46px; padding: 9px 13px; font-size: 16px; line-height: 1.3; color: var(--ink); border: 1px solid #b9c7bc; border-radius: 7px; background: #fff; }
.auth-page input::placeholder { color: #65776c; }
.auth-page :is(input,select):focus { outline: 2px solid #4b8068; outline-offset: 1px; border-color: var(--teal); }
.auth-page form small, .auth-help { display: block; color: var(--muted); line-height: 1.7; font-size: 13px; }
.auth-page form small { margin-top: 6px; }
.auth-password { position: relative; }
.auth-password input { padding-right: 65px; }
.password-toggle { position: absolute; height: calc(100% - 6px); right: 4px; top: 3px; min-width: 47px; border: 0; border-radius: 4px; color: var(--teal); background: transparent; font-size: 13px; font-weight: 600; }
.password-toggle:hover { background: var(--mint); }
.auth-primary { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 44px; border: 1px solid transparent; border-radius: 7px; padding: 9px 18px; color: #fff; background: var(--teal); font-weight: 600; }
.auth-primary:hover { background: #103f31; }
.auth-primary:disabled { opacity: .65; cursor: wait; }
.auth-page form .auth-primary { margin-top: 22px; }
.signin-form .auth-primary { width: 100%; justify-content: space-between; padding-inline: 17px; min-height: 46px; }
.auth-help { border-top: 1px solid var(--line); padding-top: 17px; margin: 22px 0 0; }
.auth-flash { display: block; overflow-wrap: anywhere; padding: 10px 14px; border: 1px solid; border-radius: 6px; margin: 12px 0 0; font-size: 14px; }
.auth-flash.error { color: #823d30; background: #fff5f1; border-color: #e7c0b6; }
.auth-flash.success { color: #22573d; background: #eff6e7; border-color: #c6dbbf; }
.settings-layout { width: min(1180px, 88vw); max-width: none; margin: 0 auto; padding: 44px 0 60px; }
.settings-grid { display: grid; grid-template-columns: minmax(180px, .28fr) minmax(0, 1fr); gap: clamp(20px, 3vw, 44px); margin-top: 28px; align-items: start; }
.settings-side { min-width: 0; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.profile-card { display: flex; align-items: center; gap: 10px; padding: 3px 0 18px; border-bottom: 1px solid var(--line); }
.profile-avatar { width: 36px; height: 36px; flex: none; }
.profile-card strong { overflow-wrap: anywhere; color: var(--ink); }
.profile-card small { display: block; font-size: 12px; color: var(--muted); }
.settings-nav { padding-top: 8px; }
.settings-nav a { display: flex; justify-content: space-between; padding: 10px; margin: 4px 0; border-radius: 6px; color: var(--ink); font-size: 14px; }
.settings-nav a:hover, .settings-nav a[aria-current] { color: var(--teal); background: #edf3e6; }
.settings-nav a[aria-current] { font-weight: 650; }
.auth-signout { padding: 10px; min-height: 44px; border: 0; background: none; color: var(--muted); font-size: 13px; }
.settings-panel { border-radius: 12px; border: 1px solid var(--line); background: #fff; overflow: hidden; }
.settings-head { padding: 22px 25px 18px; border-bottom: 1px solid var(--line); }
.settings-head h2, .dialog-title h2 { margin: 0; font-size: 20px; color: var(--ink); }
.settings-head p { margin: 4px 0 0; }
.settings-form { max-width: 520px; padding: 22px 25px 26px; }
.settings-body > .auth-flash { margin: 0 0 16px; }
.member-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
#user-count { padding: 2px 8px; font-size: 13px; font-weight: 500; display: inline-block; vertical-align: middle; background: var(--mint); color: var(--teal); border-radius: 20px; }
.members-wrap { overflow-x: auto; }
.members-table { width: 100%; }
.members-table th, .members-table td { padding: 13px 14px; font-size: 13px; }
.members-table th { white-space: nowrap; color: var(--muted); background: #f8faf5; }
.members-table td { color: var(--ink); border-color: var(--line); }
.members-table tr:hover { background: #fafbf7; }
.members-table strong { overflow-wrap: anywhere; }
.member-self { display: block; color: var(--muted); font-size: 12px; }
.member-status { display: inline-block; padding: 2px 8px; white-space: nowrap; border-radius: 20px; background: #f0f1ec; color: #536057; }
.member-status.enabled { background: #eaf4e1; color: #2b5739; }
.member-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.member-actions button { padding: 6px 9px; min-height: 34px; border: 1px solid var(--line); border-radius: 5px; color: var(--teal); background: white; font-size: 13px; white-space: nowrap; }
.member-actions button:hover { border-color: var(--teal); }
.auth-dialog { max-width: min(420px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 24px; background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 14px; }
.auth-dialog::backdrop { background: #102d24a8; }
.dialog-title { display: flex; align-items: center; gap: 12px; justify-content: space-between; margin-bottom: 16px; }
.dialog-title h2 { overflow-wrap: anywhere; }
.dialog-close { flex: none; width: 40px; height: 40px; border: 0; border-radius: 50%; font: 24px/1 var(--ui-font); background: var(--paper); color: var(--ink); }
.auth-dialog .auth-primary { width: 100%; }

@media (max-width: 760px) {
  .auth-header, .auth-footer { padding-inline: 5vw; }
  .auth-header { height: 65px; }
  .signin-layout { display: block; width: min(460px, 90vw); padding: 32px 0; }
  .signin-cover { display: none; }
  .signin-form { border: 1px solid var(--line); border-radius: 14px; padding: clamp(23px, 5.5vw, 35px); }
  .settings-layout { width: 90vw; padding: 28px 0 38px; }
  .settings-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; margin-top: 18px; }
  .settings-side { display: grid; grid-template-columns: 1fr auto; padding: 12px 14px 8px; }
  .profile-card { padding: 0; border: 0; }
  .settings-nav { grid-column: 1/-1; display: flex; gap: 6px; border-top: 1px solid var(--line); margin-top: 10px; padding-top: 4px; }
  .settings-nav a { flex: 1; padding: 7px 10px; }
  .auth-signout { grid-area: 1/2; }
  .settings-head, .settings-form { padding: 18px; }
  .members-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .members-table, .members-table tbody { display: block; }
  .members-table tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px 12px; padding: 15px 18px; border-bottom: 1px solid var(--line); }
  .members-table tr:last-child { border: 0; }
  .members-table td { padding: 0; border: 0; font-size: 14px; }
  .members-table td::before { content: attr(data-label); margin-right: 6px; color: var(--muted); font-size: 12px; }
  .members-table td:first-child, .members-table td:nth-last-child(-n+2) { grid-column: 1/-1; }
  .members-table td:first-child::before, .members-table td:last-child::before { display: none; }
  .member-self { display: inline; margin-left: 6px; }
  .member-actions { margin-top: 5px; }
  .member-actions button { min-height: 44px; }
}
@media (max-width: 520px) {
  .session-name { display: none; }
  .session-menu summary { gap: 4px; }
  .session-dropdown :is(a,button) { min-height: 44px; }
}
