:root {
      --shell-bg: #0d1321;
      --shell-surface: #151e2f;
      --shell-surface-2: #1d2d44;
      --shell-line: #314763;
      --shell-text: #f4fcfb;
      --shell-muted: #acbcbf;
      --shell-accent: #55c2da;
      --shell-accent-strong: #8eddeb;
      --shell-accent-ink: #061b20;
      --shell-danger: #ff8f96;
      --shell-success: #75d5a6;
    }
    html[data-theme="light"] {
      --shell-bg: #f4f7f8;
      --shell-surface: #ffffff;
      --shell-surface-2: #eaf1f4;
      --shell-line: #cbd8de;
      --shell-text: #172630;
      --shell-muted: #526a77;
      --shell-accent: #087e9c;
      --shell-accent-strong: #056983;
      --shell-accent-ink: #ffffff;
      --shell-danger: #b4232c;
      --shell-success: #087a49;
    }
    * { box-sizing: border-box; }
    html, body { width: 100%; min-width: 320px; height: 100%; margin: 0; }
    body {
      overflow: hidden;
      background: var(--shell-bg);
      color: var(--shell-text);
      font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
      line-height: 1.5;
    }
    button, input, select { font: inherit; letter-spacing: 0; }
    [hidden] { display: none !important; }

    .auth-screen {
      min-height: 100%;
      display: grid;
      grid-template-columns: minmax(0, 1.1fr) minmax(360px, .9fr);
      background: var(--shell-bg);
    }
    .auth-intro {
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      min-width: 0;
      padding: clamp(32px, 7vw, 92px);
      border-right: 1px solid var(--shell-line);
    }
    .auth-brand { display: flex; align-items: center; gap: 12px; font-weight: 780; }
    .auth-mark {
      width: 36px;
      height: 36px;
      display: grid;
      place-items: center;
      border-radius: 7px;
      background: var(--shell-accent-strong);
      color: var(--shell-accent-ink);
      font-size: 12px;
      font-weight: 850;
    }
    .auth-message { max-width: 700px; padding: 80px 0; }
    .auth-eyebrow { margin: 0 0 12px; color: var(--shell-accent-strong); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; }
    .auth-message h1 { margin: 0; max-width: 720px; font-size: clamp(38px, 6vw, 70px); line-height: 1.02; letter-spacing: 0; }
    .auth-message p { max-width: 590px; margin: 20px 0 0; color: var(--shell-muted); font-size: 16px; }
    .auth-local { color: var(--shell-muted); font-size: 12px; }

    .auth-workspace { display: grid; place-items: center; padding: 28px; background: var(--shell-surface); }
    .auth-panel { width: min(410px, 100%); }
    .auth-panel h2 { margin: 0 0 7px; font-size: 25px; }
    .auth-copy { margin: 0 0 26px; color: var(--shell-muted); font-size: 14px; }
    .auth-form { display: grid; gap: 17px; }
    .auth-field { display: grid; gap: 7px; }
    .auth-field label { color: var(--shell-muted); font-size: 12px; font-weight: 750; text-transform: uppercase; letter-spacing: .06em; }
    .auth-field input,
    .auth-field select {
      width: 100%;
      min-height: 46px;
      border: 1px solid var(--shell-line);
      border-radius: 7px;
      padding: 9px 12px;
      background: var(--shell-bg);
      color: var(--shell-text);
    }
    .auth-field input:focus-visible,
    .auth-field select:focus-visible { outline: 3px solid rgb(85 194 218 / .35); border-color: var(--shell-accent); outline-offset: 1px; }
    .otp-input { font-variant-numeric: tabular-nums; font-size: 22px !important; font-weight: 760; letter-spacing: .24em !important; }
    .auth-button {
      min-height: 46px;
      border: 1px solid transparent;
      border-radius: 7px;
      padding: 0 16px;
      background: var(--shell-accent);
      color: var(--shell-accent-ink);
      font-weight: 780;
      cursor: pointer;
    }
    .auth-button:hover:not(:disabled) { background: var(--shell-accent-strong); }
    .auth-button:disabled { opacity: .5; cursor: wait; }
    .auth-link {
      justify-self: start;
      border: 0;
      padding: 2px 0;
      background: transparent;
      color: var(--shell-accent-strong);
      cursor: pointer;
      font-size: 13px;
    }
    .auth-link:hover { text-decoration: underline; }
    .auth-status { display: none; margin: 18px 0 0; padding: 11px 13px; border-left: 3px solid var(--shell-accent); background: var(--shell-bg); color: var(--shell-muted); font-size: 13px; }
    .auth-status.visible { display: block; }
    .auth-status.error { border-left-color: var(--shell-danger); color: var(--shell-danger); }
    .auth-status.success { border-left-color: var(--shell-success); color: var(--shell-success); }
    .auth-note { margin: 22px 0 0; color: var(--shell-muted); font-size: 12px; }

    .auth-loading { min-height: 100%; display: grid; place-items: center; color: var(--shell-muted); }
    .app-shell { height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr); }
    .app-switcher {
      position: relative;
      z-index: 2;
      min-height: 58px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 20px;
      padding: 7px max(12px, calc((100% - 1180px) / 2));
      border-bottom: 1px solid var(--shell-line);
      background: var(--shell-bg);
    }
    .tabs { display: flex; gap: 4px; min-width: 0; padding: 4px; border: 1px solid var(--shell-line); border-radius: 7px; background: var(--shell-surface); }
    .tab {
      min-height: 34px;
      padding: 0 14px;
      border: 0;
      border-radius: 5px;
      background: transparent;
      color: var(--shell-muted);
      font: 720 13px/1 Inter, ui-sans-serif, system-ui, sans-serif;
      white-space: nowrap;
      cursor: pointer;
    }
    .tab:hover { color: var(--shell-text); background: var(--shell-surface-2); }
    .tab:focus-visible, .account-button:focus-visible { outline: 3px solid rgb(85 194 218 / .38); outline-offset: 2px; }
    .tab[aria-selected="true"] { color: var(--shell-accent-ink); background: var(--shell-accent); }
    .account { min-width: 0; display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
    .account-copy { min-width: 0; text-align: right; }
    .account-name { display: block; max-width: 270px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 720; }
    .account-role { display: block; color: var(--shell-accent-strong); font-size: 10px; font-weight: 800; text-transform: uppercase; }
    .account-button { min-height: 34px; border: 1px solid var(--shell-line); border-radius: 6px; padding: 0 12px; background: transparent; color: var(--shell-text); font-size: 12px; font-weight: 720; cursor: pointer; }
    .account-button:hover { background: var(--shell-surface-2); }
    .app-panels { position: relative; min-height: 0; }
    .app-panel { position: absolute; inset: 0; }
    .app-panel[hidden] { display: none; }
    iframe { display: block; width: 100%; height: 100%; border: 0; background: var(--shell-bg); }
    .loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--shell-muted); font-size: 14px; pointer-events: none; }
    .app-panel.ready .loading { display: none; }

    @media (max-width: 760px) {
      .auth-screen { grid-template-columns: 1fr; overflow: auto; }
      .auth-intro { min-height: 310px; padding: 28px 24px; border-right: 0; border-bottom: 1px solid var(--shell-line); }
      .auth-message { padding: 50px 0 24px; }
      .auth-message h1 { font-size: 40px; }
      .auth-workspace { padding: 38px 20px 54px; }
      .app-switcher { min-height: 96px; align-items: stretch; flex-direction: column-reverse; gap: 7px; padding: 7px 8px; }
      .tabs { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
      .tab { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
      .account { min-height: 34px; }
      .account-copy { flex: 1; text-align: left; }
      .account-name { max-width: none; }
    }
    @media (prefers-reduced-motion: reduce) {
      *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
    }
