/* Account access and enterprise controls. Authentication remains a real server session. */
.auth-screen[hidden], [data-application][hidden], .demo-banner[hidden] { display: none !important; }

/* Login and enterprise selection */
.auth-screen { display: grid; grid-template-columns: minmax(350px, 44%) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; background: #fff; }
.auth-brand-panel { position: relative; display: flex; flex-direction: column; min-width: 0; padding: 44px clamp(32px, 5vw, 80px) 30px; background: var(--canvas); color: var(--ink); border-right: 1px solid var(--line); }
.auth-brand { display: flex; align-items: center; gap: 12px; color: inherit; font-size: 20px; font-weight: 600; }
.auth-brand .brand-symbol { flex: 0 0 38px; width: 38px; height: 38px; }
.auth-brand small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; font-weight: 400; letter-spacing: .08em; line-height: 1.5; }
.auth-loading { grid-column: 1 / -1; align-self: center; justify-self: center; padding: 32px; text-align: center; }
.auth-loading p { margin-top: 12px; font-size: 13px; }
.auth-brand .mark { width: 38px; height: 38px; flex-basis: 38px; font-size: 18px; }
.auth-intro { max-width: 470px; margin-top: clamp(48px, 8vh, 88px); }
.auth-eyebrow { display: block; margin-bottom: 18px; color: var(--brand-ink); font-size: 12px; letter-spacing: .12em; }
.auth-intro h2 { color: var(--ink); font-size: clamp(28px, 2.7vw, 38px); font-weight: 600; line-height: 1.5; letter-spacing: -.02em; }
.auth-intro > p { max-width: 390px; margin-top: 20px; color: var(--muted); font-size: 14px; line-height: 1.9; }
.auth-capabilities { display: grid; gap: 12px; margin-top: 8px; color: var(--ink); font-size: 13px; }
.auth-capabilities > div, .auth-capabilities > li { display: flex; align-items: center; gap: 11px; }
.auth-capabilities svg { flex: 0 0 17px; width: 17px; height: 17px; color: var(--brand); }
.auth-illustration { display: flex; align-items: center; flex: 1; min-height: 100px; max-height: 200px; margin: 24px 0; color: var(--brand-ink); }
.auth-illustration > svg { display: block; width: 100%; max-width: 430px; height: auto; max-height: 250px; }
.auth-brand-footer { margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.auth-main { display: flex; align-items: center; justify-content: center; flex-direction: column; min-width: 0; padding: 56px 40px 28px; }
.auth-card { width: 100%; max-width: 400px; margin: auto 0; color: var(--ink); }
.auth-screen > .auth-card { grid-column: 1 / -1; justify-self: center; margin: auto; padding: 32px; }
.auth-mobile-brand { display: none; align-items: center; gap: 10px; margin-bottom: 38px; color: var(--ink); font-size: 18px; font-weight: 600; }
.auth-heading h1, .auth-card > h1 { margin: 0; color: var(--ink); font-size: var(--font-page-title); font-weight: 600; line-height: 1.4; letter-spacing: -.03em; }
.auth-heading p, .auth-card > p { margin-top: 10px; color: var(--muted); font-size: 13px; line-height: 1.8; }
.auth-fields { display: grid; gap: 20px; margin-top: 32px; }
.auth-fields label { display: grid; gap: 8px; color: #45556e; font-size: var(--font-caption); }
.auth-fields input { width: 100%; min-width: 0; min-height: 46px; padding: 11px 13px; border: 1px solid var(--line-strong); border-radius: var(--control-radius); outline: none; background: #fff; color: var(--ink); font-size: var(--font-body); line-height: 1.6; }
.auth-fields input:focus { border-color: var(--brand); box-shadow: var(--focus-ring); }
.auth-fields input[aria-invalid="true"] { border-color: var(--danger); }
.auth-fields input:disabled { background: var(--surface-subtle); }
.auth-fields .primary { width: 100%; min-height: 46px; margin-top: 6px; font-size: var(--font-body); }
.password-control { position: relative; display: flex; min-width: 0; }
.password-control input { padding-right: 49px; }
.password-control button { position: absolute; top: 50%; right: 4px; display: grid; place-items: center; width: 38px; height: 38px; padding: 8px; border: 0; border-radius: 4px; background: transparent; color: #7b8ca3; transform: translateY(-50%); }
.password-control button:hover { color: var(--ink); background: var(--surface-subtle); }
.password-control svg { width: 19px; height: 19px; }
.auth-switch { margin-top: 24px !important; color: var(--muted); font-size: 13px; text-align: center; }
.auth-switch .link { min-height: 28px; padding: 0 3px; font-size: 13px; }
.auth-status { margin-top: 16px; color: var(--muted); font-size: 12px; line-height: 1.8; overflow-wrap: anywhere; }
.auth-status:empty { display: none; }
.auth-status.error, .auth-status.danger { color: var(--danger); }
.auth-retry { margin-top: 10px; font-size: 12px; }
.auth-footer { width: 100%; max-width: 400px; margin-top: 48px; padding-top: 24px; color: #8390a2; font-size: 12px; line-height: 1.8; text-align: center; }
.auth-tenants { display: grid; gap: 12px; margin-top: 28px; }
.auth-tenants button { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; padding: 17px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; color: var(--ink); font-size: var(--font-body); text-align: left; }
.auth-tenants button:hover { border-color: var(--brand-line); background: var(--brand-soft); }
.auth-tenants button > span { display: grid; grid-template-columns: 20px minmax(0, 1fr); align-items: center; gap: 4px 10px; min-width: 0; }
.auth-tenants button > span > svg { grid-row: 1 / 3; color: #7890ad; }
.auth-tenants button > span > small { grid-column: 2; margin-top: 0; }
.auth-tenants button > .ui-icon { width: 16px; height: 16px; color: #94a3b8; }
.auth-tenants b, .auth-tenants strong { font-weight: 500; }
.auth-tenants small { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.auth-tenant-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.sync-state.error { color: var(--danger); }

/* Single-line enterprise toolbar */
.server-workspace { min-width: 0; padding: 0; border: 0; background: transparent; }
.server-toolbar { display: flex; align-items: center; gap: 12px; min-width: 0; }
.server-toolbar .platform-return { flex-shrink: 0; min-height: 36px; padding: 7px 10px; text-decoration: none; white-space: nowrap; font-size: 12px; }
.system-notice.platform-business-context { border-color: var(--brand-line); background: var(--brand-soft); color: var(--brand-ink); }
.tenant-switch { display: flex; align-items: center; gap: 9px; max-width: 215px; min-height: 36px; padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--control-radius); background: #fff; color: #75849a; }
.tenant-switch > svg { flex: 0 0 16px; width: 16px; height: 16px; }
.tenant-switch select { width: 100%; min-width: 0; max-width: 165px; min-height: 22px; padding: 0 2px; border: 0; outline: none; background: transparent; color: #334155; font-size: 13px; text-overflow: ellipsis; cursor: pointer; }
.tenant-switch:focus-within { border-color: var(--brand); box-shadow: var(--focus-ring); }
.account-menu { position: relative; flex-shrink: 0; }
.account-menu > summary { display: flex; align-items: center; gap: 8px; min-height: 38px; padding: 2px 0 2px 3px; color: #334155; font-size: 13px; cursor: pointer; list-style: none; }
.account-menu > summary::-webkit-details-marker { display: none; }
.account-menu > summary > span:not(.account-avatar) { max-width: 115px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-menu > summary > svg { width: 14px; height: 14px; color: #8492a6; }
.account-avatar { display: inline-grid; place-items: center; flex: 0 0 30px; width: 30px; height: 30px; border: 1px solid var(--brand-line); border-radius: 50%; background: var(--brand-soft); color: var(--brand-ink); font-size: 12px; font-weight: 600; }
.account-popover { position: absolute; top: calc(100% + 12px); right: 0; z-index: 50; width: 252px; padding: 6px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; color: var(--ink); box-shadow: var(--shadow-menu); }
.account-profile { margin-bottom: 5px; padding: 12px 10px 15px; border-bottom: 1px solid var(--line); color: var(--ink); font-size: 13px; overflow-wrap: anywhere; }
.account-profile b, .account-profile strong { display: block; font-weight: 500; }
.account-profile small, .account-profile p { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.account-popover button { display: flex; align-items: center; justify-content: flex-start; gap: 9px; width: 100%; min-height: 38px; padding: 8px 10px; border: 0; border-radius: 4px; background: transparent; color: #45556d; font-size: 13px; font-weight: 400; text-align: left; }
.account-popover button:hover { background: var(--brand-soft); color: var(--brand-ink); text-decoration: none; }
.account-popover button.danger { color: var(--danger); }
.account-popover button.danger:hover { background: var(--danger-soft); }
.account-popover button svg { width: 16px; height: 16px; }
.server-identity { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--muted); font-size: 12px; }
.server-dot { flex: 0 0 7px; width: 7px; height: 7px; border-radius: 50%; background: #aab4bf; }
.server-dot.connected { background: var(--success); }
.server-dot.error { background: var(--danger); }
.server-status { color: var(--muted); font-size: 12px; line-height: 1.8; overflow-wrap: anywhere; }
.server-status .link { margin-left: 8px; font-size: 12px; }
.server-error { margin: 12px 0; color: var(--danger); font-size: 13px; line-height: 1.8; }
.server-error:empty { display: none; }

/* Enterprise settings and storage */
.server-choice { display: grid; gap: 14px; margin: 20px 0; }
.server-choice > button { padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; color: var(--ink); font-size: var(--font-body); text-align: left; }
.server-choice > button:hover { border-color: var(--brand-line); background: var(--brand-soft); }
.server-choice b, .server-choice small { display: block; }
.server-choice b { margin-bottom: 8px; font-size: var(--font-section); font-weight: 500; }
.server-choice small { color: var(--muted); font-size: 12px; line-height: 1.8; }
.server-member-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-width: 240px; }
.server-member-actions select { min-height: 36px; max-width: 210px; padding: 7px 9px; border: 1px solid var(--line-strong); border-radius: var(--control-radius); background: #fff; color: var(--ink); font-size: 12px; }
.server-member-actions .secondary { white-space: nowrap; }
.server-section-title { margin: 24px 0 16px; font-size: 14px; }
.server-storage { margin-bottom: 24px; }
.server-file { position: relative; display: inline-flex; overflow: hidden; cursor: pointer; }
.server-file input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.server-upload-status { color: var(--muted); font-size: 12px; line-height: 1.8; }
.server-upload-error { color: var(--danger); font-size: 12px; }

@media (max-width: 1100px) {
  .auth-screen { grid-template-columns: minmax(320px, 42%) minmax(0, 1fr); }
  .auth-brand-panel { padding-inline: 36px; }
  .auth-main { padding-inline: 32px; }
  .auth-intro { margin-top: 72px; }
  .auth-intro h2 { font-size: 30px; }
  .tenant-switch { max-width: 180px; }
  .tenant-switch select { max-width: 130px; }
  .account-menu > summary > span:not(.account-avatar) { max-width: 80px; }
}
@media (max-width: 760px) {
  .auth-screen { display: flex; align-items: stretch; justify-content: center; min-height: 100dvh; }
  .auth-brand-panel { display: none; }
  .auth-main { width: 100%; padding: 36px 28px 24px; }
  .auth-card { margin-block: auto; }
  .auth-mobile-brand { display: flex; }
  .auth-mobile-brand .auth-brand { color: var(--ink); font-size: 18px; }
  .auth-mobile-brand .brand-symbol { color: var(--brand); }
  .auth-mobile-brand .auth-brand small { color: #8393a9; font-size: 9px; }
  .auth-footer { margin-top: 40px; padding-top: 20px; }
  .account-menu > summary > span:not(.account-avatar) { display: none; }
  .server-toolbar { gap: 10px; }
}
@media (max-width: 680px) {
  .tenant-switch { max-width: 144px; min-height: 38px; padding: 7px 8px; gap: 6px; }
  .tenant-switch select { max-width: 100px; font-size: 12px; }
  .tenant-switch > svg { width: 15px; height: 15px; flex-basis: 15px; }
  .account-menu > summary { gap: 4px; }
  .account-menu > summary > svg { display: none; }
  .account-popover { width: 240px; }
}
@media (max-width: 420px) {
  .auth-main { padding: 28px 24px 24px; }
  .auth-mobile-brand { margin-bottom: 32px; }
  .auth-fields { gap: 18px; margin-top: 28px; }
  .auth-footer { margin-top: 32px; }
  .server-toolbar { gap: 8px; }
  .tenant-switch { max-width: 118px; }
  .tenant-switch select { max-width: 77px; }
}
