/* Member authentication has its own public layout; the owner console stays separate. */
@media screen {
  body.member-auth-ui {
    --ink: #213c42;
    --muted: #60777c;
    --teal: #064a53;
    --line: #dce7e8;
    --bg: #f3f7f7;
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    color-scheme: light;
    font-family: var(--app-font, "Fatoura Inter", "Fatoura Arabic", "Segoe UI", Arial, sans-serif);
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    font-optical-sizing: auto;
  }

  .member-auth-ui #app { min-height: 100vh; min-height: 100svh; }
  .member-auth-ui :is(h1, h2, h3, button, input, select, textarea) { font-family: inherit; }
  .member-auth-ui main { margin: 0; }
  .member-auth-ui button,
  .member-auth-ui a { -webkit-tap-highlight-color: transparent; }
  .member-auth-ui :is(button, a, input, select):focus-visible {
    outline: 3px solid #62aeb5;
    outline-offset: 3px;
  }
  .member-auth-ui .ui-icon { display: inline-block; width: 20px; height: 20px; flex: 0 0 auto; vertical-align: middle; }

  .member-auth-shell {
    display: grid;
    grid-template-columns: minmax(360px, 0.95fr) minmax(460px, 1.05fr);
    min-height: 100vh;
    min-height: 100svh;
    width: 100%;
    isolation: isolate;
  }

  .member-auth-story {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 28px;
    padding: clamp(38px, 5.2vw, 86px);
    overflow: hidden;
    isolation: isolate;
    background: linear-gradient(145deg, #033b43 0%, #064a53 60%, #116570 100%);
    color: #fff;
  }
  .member-auth-story::before {
    content: "";
    position: absolute;
    width: 390px;
    height: 390px;
    inset-inline-end: -210px;
    top: 18%;
    border: 1px solid #98cdd12b;
    border-radius: 50%;
    box-shadow: 0 0 0 55px #98cdd109, 0 0 0 110px #98cdd106;
    pointer-events: none;
    z-index: -1;
  }
  .member-auth-story > * { position: relative; }
  .member-auth-brand {
    display: inline-flex;
    align-items: center;
    gap: 13px;
    width: fit-content;
    color: inherit;
    text-decoration: none;
  }
  .member-auth-brand > .mark {
    display: grid;
    place-items: center;
    min-width: 44px;
    height: 46px;
    padding: 0 11px;
    background: #ffffff14;
    border: 1px solid #ffffff29;
    border-radius: 13px;
    color: #c5f2e8;
    font-size: 27px;
    font-weight: 750;
    line-height: 1;
    letter-spacing: -1.5px;
  }
  .member-auth-brand strong { display: block; font-size: 19px; font-weight: 700; line-height: 1.35; letter-spacing: -0.45px; }
  .member-auth-brand small { display: block; margin-top: 3px; color: #b8d8db; font-size: 10px; font-weight: 450; letter-spacing: 0.5px; }
  .member-auth-brand strong small { display: inline; margin: 0; margin-inline-start: 3px; font-size: 13px; letter-spacing: 0; }
  .member-auth-story .member-auth-brand { margin-bottom: 35px; }
  .member-auth-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: fit-content;
    color: #a5dfd4;
    font-size: 11px;
    font-weight: 650;
    letter-spacing: 1.3px;
    text-transform: uppercase;
  }
  .member-auth-kicker::before { content: ""; width: 23px; height: 2px; border-radius: 2px; background: currentColor; }
  .member-auth-story > div:not(.member-auth-brand) > .member-auth-kicker { margin-bottom: 16px; }
  .member-auth-story :is(h1, h2) {
    max-width: 470px;
    margin: 0;
    color: #fff;
    font-size: clamp(34px, 3.25vw, 50px);
    font-weight: 650;
    line-height: 1.14;
    letter-spacing: -1.9px;
    text-wrap: balance;
  }
  .member-auth-story > p:not(.member-auth-story-footer),
  .member-auth-story > div > p {
    max-width: 440px;
    margin: 16px 0 0;
    color: #b8d8db;
    font-size: 14px;
    line-height: 1.9;
  }
  .member-auth-features {
    display: grid;
    gap: 16px;
    padding: 0;
    margin: 28px 0 15px;
    list-style: none;
    color: #e5f1f2;
    font-size: 13px;
  }
  .member-auth-features li { display: flex; align-items: center; gap: 13px; }
  .member-auth-features li svg { width: 19px; height: 19px; color: #8dd9c9; flex: 0 0 auto; }
  .member-auth-story-footer { margin-top: 25px; padding-top: 22px; border-top: 1px solid #ffffff1c; color: #a8c9cd; font-size: 10px; line-height: 1.7; }

  .member-auth-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 24px;
    min-width: 0;
    padding: 45px clamp(28px, 5vw, 80px);
    background: #f3f7f7;
  }
  .member-auth-card {
    width: 100%;
    max-width: 460px;
    padding: clamp(28px, 3vw, 40px);
    border: 1px solid #dce7e8;
    border-radius: 22px;
    background: #fff;
    box-shadow: 0 18px 55px #064a5310, 0 3px 10px #064a5304;
  }
  .member-auth-card > .member-auth-kicker { margin-bottom: 14px; color: #446d74; font-size: 10px; letter-spacing: 1px; }
  .member-auth-card h1 { margin: 0 0 9px; font-size: 27px; font-weight: 680; line-height: 1.3; letter-spacing: -0.95px; color: #213c42; }
  .member-auth-card > p:not(.member-auth-note) { margin: 0 0 26px; color: #60777c; font-size: 12px; line-height: 1.75; }
  .member-auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 4px;
    margin: 0 0 25px;
    border: 1px solid #e3edee;
    border-radius: 11px;
    background: #edf3f4;
  }
  .member-auth-tabs button {
    min-width: 0;
    min-height: 38px;
    padding: 9px 10px;
    border: 1px solid transparent;
    border-radius: 8px;
    color: #60777c;
    font-size: 11px;
    font-weight: 600;
    transition: color 140ms ease, background 140ms ease, box-shadow 140ms ease;
  }
  .member-auth-tabs button:hover { color: #064a53; }
  .member-auth-tabs :is(button.active, button[aria-selected="true"]) { background: #fff; color: #064a53; border-color: #dce7e8; box-shadow: 0 2px 5px #064a5310; }
  .member-auth-form { display: grid; gap: 19px; margin: 0; }
  .member-auth-field { display: grid; gap: 7px; min-width: 0; color: #38575e; font-size: 11px; font-weight: 600; }
  .member-auth-field label { color: inherit; font: inherit; }
  .member-auth-field :is(input, select) {
    width: 100%;
    min-width: 0;
    min-height: 46px;
    margin: 0;
    padding: 11px 13px;
    border: 1px solid #d4e2e4;
    border-radius: 9px;
    background: #fbfdfd;
    color: #213c42;
    font-size: 13px;
    font-weight: 450;
    transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
  }
  .member-auth-field input::placeholder { color: #8a9fa3; opacity: 1; font-size: 12px; }
  .member-auth-field :is(input, select):hover { border-color: #a7c3c8; }
  .member-auth-field :is(input, select):focus { border-color: #4b969f; background: #fff; box-shadow: 0 0 0 3px #064a5310; }
  .member-auth-field input[aria-invalid="true"] { border-color: #c75561; }
  .member-auth-field :is(small, .member-auth-form-hint),
  .member-auth-form-hint { color: #71888d; font-size: 10px; font-weight: 400; line-height: 1.6; }
  .member-auth-form-hint { margin-top: -5px; }
  .member-auth-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 45px;
    padding: 12px 18px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: #064a53;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    box-shadow: 0 3px 8px #064a5324;
    transition: background 140ms ease, border-color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
  }
  .member-auth-form > .member-auth-button { width: 100%; margin-top: 3px; }
  .member-auth-button:hover { background: #033b43; box-shadow: 0 5px 12px #064a532b; }
  .member-auth-button:active { transform: translateY(1px); }
  .member-auth-button.secondary { background: #fff; border-color: #dce7e8; color: #3d6870; box-shadow: none; }
  .member-auth-button.secondary:hover { background: #f3f7f7; border-color: #b4ced2; }
  .member-auth-button.ghost { background: transparent; color: #426f77; box-shadow: none; }
  .member-auth-button.ghost:hover { background: #e7f1f2; }
  .member-auth-button:disabled { opacity: 0.55; cursor: wait; box-shadow: none; transform: none; }
  .member-auth-button .ui-icon { width: 17px; height: 17px; }
  .member-auth-error { margin: 0 0 18px; padding: 12px 13px; border: 1px solid #f1d7da; border-radius: 9px; background: #fff3f4; color: #a33545; font-size: 11px; line-height: 1.65; overflow-wrap: anywhere; }
  .member-auth-error[hidden] { display: none; }
  .member-auth-note { margin: 21px 0 0; padding-top: 18px; border-top: 1px solid #e8eff0; color: #748d92; font-size: 10px; line-height: 1.7; }
  .member-auth-note a { color: #064a53; text-decoration: none; }
  .member-auth-note a:hover { text-decoration: underline; }
  .member-auth-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    width: 100%;
    max-width: 460px;
    color: #71888d;
    font-size: 10px;
  }
  .member-auth-meta :is(a, button) { padding: 4px 0; border-radius: 3px; color: #60777c; font-size: inherit; text-decoration: none; }
  .member-auth-meta :is(a, button):hover { color: #064a53; text-decoration: underline; text-underline-offset: 3px; }
  .member-auth-meta .ui-icon { width: 13px; height: 13px; margin-inline-end: 4px; }
  .member-auth-card .member-auth-meta { margin-top: 18px; }
  .member-auth-public-links { display: flex; justify-content: center; flex-wrap: wrap; gap: 7px 15px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--app-border, #e8eff0); color: var(--app-muted, #71888d); font-size: 10px; line-height: 1.6; }
  .member-auth-public-links a { padding-block: 3px; border-radius: 3px; color: inherit; text-decoration: none; }
  .member-auth-public-links a:hover { color: var(--app-primary, #064a53); text-decoration: underline; text-underline-offset: 3px; }
  .member-auth-public-language { flex-basis: 100%; text-align: center; font-size: 9px; }
  .member-google-auth { margin: 0 0 19px; }
  .member-google-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 11px;
    min-height: 46px;
    padding: 11px 17px;
    border: 1px solid var(--app-border, #d4e2e4);
    border-radius: 10px;
    background: var(--app-surface, #fff);
    color: var(--app-text, #213c42);
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
  }
  .member-google-auth > .member-google-button { width: 100%; background: #fff; color: #213c42; }
  .member-google-button:hover { border-color: #9bbdc2; box-shadow: 0 3px 10px #064a5310; }
  .member-google-button:focus-visible { outline: 3px solid #62aeb5; outline-offset: 3px; }
  .member-google-button:disabled { opacity: .6; cursor: wait; }
  .member-google-icon { display: inline-block; flex: 0 0 20px; width: 20px; height: 20px; vertical-align: middle; }
  .member-auth-divider { display: flex; align-items: center; gap: 11px; margin-top: 19px; color: #71888d; font-size: 10px; }
  .member-auth-divider::before, .member-auth-divider::after { content: ''; flex: 1; height: 1px; background: #e3edee; }
  .member-google-settings { margin-block: 19px; padding: 16px; border: 1px solid var(--app-border, #dce7e8); border-radius: 12px; background: var(--app-soft, #f3f7f7); }
  .member-google-heading { display: flex; align-items: flex-start; flex-wrap: wrap; gap: 11px; }
  .member-google-heading > div { flex: 1; min-width: 180px; }
  .member-google-heading strong { font-size: 13px; }
  .member-google-heading p { margin: 5px 0 0; color: var(--app-muted, #60777c); font-size: 11px; line-height: 1.7; }
  .member-google-settings > .member-google-button, .member-google-settings > .member-auth-error { margin-top: 14px; }
  .member-google-settings > .member-auth-error { margin-bottom: 0; }
  .member-google-linked { padding: 4px 8px; border-radius: 6px; background: var(--app-success-bg, #e8f5ee); color: var(--app-success-text, #247552); font-size: 10px; font-weight: 600; }
  html[lang="ar"] .member-auth-ui :is(h1, h2, strong, .member-auth-kicker) { letter-spacing: 0; }
  .member-auth-ui.rtl .member-auth-button .ui-icon { transform: scaleX(-1); }

  /* The tenant's identity and subscription status sit in the workspace shell. */
  .member-account-menu { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--app-text, #213c42); }
  .member-account-menu > div { min-width: 0; }
  .member-account-menu :is(strong, .member-account-label) { display: block; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; font-weight: 600; }
  .member-account-menu :is(small, .member-account-email) { display: block; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--app-muted, #60777c); font-size: 10px; }
  .member-account-menu button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 32px; min-height: 32px; padding: 6px 8px; border: 1px solid var(--app-border, #dce7e8); border-radius: 8px; color: var(--app-muted, #60777c); font-size: 10px; }
  .member-account-menu button:hover { background: var(--app-soft, #e7f1f2); color: var(--app-primary, #064a53); }
  .member-account-menu button .ui-icon { width: 15px; height: 15px; }
  .erp-topbar .member-account-menu { color: var(--app-header-text, #ecf5f5); }
  .erp-topbar .member-account-menu :is(small, .member-account-email) { color: color-mix(in srgb, var(--app-header-text, #ecf5f5), transparent 20%); }
  .erp-topbar .member-account-menu button { color: var(--app-header-text, #ecf5f5); border-color: #ffffff33; background: #ffffff0b; }
  .erp-topbar .member-account-menu button:hover { color: var(--app-header-text, #ecf5f5); background: #ffffff20; }
  @media (min-width: 761px) and (max-width: 1340px) {
    .erp-topbar .member-account-menu > :is(span, div) { display: none; }
    .erp-topbar .erp-account { gap: 8px; padding-inline: 12px; }
  }
  .account-subscription-state { display: inline-flex; align-items: center; gap: 6px; width: fit-content; padding: 6px 9px; border: 1px solid var(--app-border, #dce7e8); border-radius: 7px; color: var(--app-muted, #60777c); font-size: 10px; font-weight: 550; }
  .account-subscription-state.active,
  .account-subscription-state[data-status="active"] { color: var(--app-success-text, #247552); background: var(--app-success-bg, #e8f5ee); border-color: transparent; }
  .subscription-account-banner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; padding: 12px 16px; border: 1px solid var(--app-border, #dce7e8); border-radius: 10px; background: var(--app-surface, #fff); color: var(--app-muted, #60777c); font-size: 11px; line-height: 1.6; }
  .subscription-account-banner strong { color: var(--app-text, #213c42); font-weight: 650; }
  .subscription-account-banner .ui-icon { width: 18px; height: 18px; color: var(--app-primary, #064a53); }
  [data-trial-banner][hidden] { display: none !important; }

  @media (min-width: 1500px) { .member-auth-story { padding-inline: max(70px, calc((100vw - 1240px) / 2)); } }
  @media (max-width: 1000px) {
    .member-auth-shell { grid-template-columns: minmax(300px, 0.9fr) minmax(390px, 1.1fr); }
    .member-auth-story { padding: 40px 34px; }
    .member-auth-story :is(h1, h2) { font-size: 36px; letter-spacing: -1.3px; }
    .member-auth-panel { padding: 35px 26px; }
    .member-auth-card { padding: 30px; }
  }
  @media (max-width: 760px) {
    .member-auth-shell { grid-template-columns: minmax(0, 1fr); }
    .member-auth-story { justify-content: flex-start; gap: 15px; padding: 26px 25px 31px; }
    .member-auth-story .member-auth-brand { margin-bottom: 4px; }
    .member-auth-brand > .mark { min-width: 37px; height: 39px; border-radius: 11px; font-size: 23px; }
    .member-auth-brand strong { font-size: 17px; }
    .member-auth-brand small { font-size: 9px; }
    .member-auth-story .member-auth-kicker { margin-top: 8px; font-size: 9px; }
    .member-auth-story :is(h1, h2) { max-width: 100%; font-size: 29px; line-height: 1.2; letter-spacing: -0.9px; }
    .member-auth-story > p:not(.member-auth-story-footer),
    .member-auth-story > div > p { margin-top: 10px; font-size: 12px; line-height: 1.75; }
    .member-auth-features { display: none; }
    .member-auth-story-footer { display: none; }
    .member-auth-panel { justify-content: flex-start; gap: 22px; padding: 26px 19px 30px; }
    .member-auth-card { max-width: 460px; padding: 27px 24px; border-radius: 17px; box-shadow: 0 8px 24px #064a5309; }
    .member-auth-card h1 { font-size: 24px; }
    .member-auth-card > p:not(.member-auth-note) { margin-bottom: 22px; font-size: 11px; }
    .member-auth-tabs { margin-bottom: 22px; }
    .member-auth-form { gap: 17px; }
    .member-auth-field :is(input, select) { font-size: 16px; }
    .member-auth-meta { padding-inline: 5px; }
    .member-account-menu :is(strong, .member-account-label) { max-width: 105px; font-size: 10px; }
    .member-account-menu :is(small, .member-account-email) { display: none; }
    .member-account-menu button { min-width: 30px; padding: 5px; }
    .erp-topbar .member-account-menu > :is(span, div) { display: none; }
    .erp-topbar .erp-account button[onclick="toggleLang()"] { min-width: 33px; width: 33px; padding: 7px; font-size: 0; gap: 0; }
    .erp-topbar .erp-account button[onclick="toggleLang()"] .ui-button-label { display: none; }
    .account-subscription-state { padding: 5px 7px; font-size: 9px; }
  }
  @media (max-width: 360px) {
    .erp-topbar .erp-brand :is(b, small) { display: none; }
  }
  @media (prefers-reduced-motion: reduce) {
    .member-auth-ui :is(button, input, select) { transition: none; }
  }
}
