    :root {
      color-scheme: light dark;

      /* accent palette */
      --accent-blue:        #2AABEE;
      --accent-blue-dark:   #229ED9;
      --accent-blue-darker: #1E8EC6;
      --accent-blue-light:  #40BFF9;
      --accent-blue-ghost:  rgba(42, 171, 238, 0.1);
      --accent-gradient:    linear-gradient(180deg, #2AABEE 0%, #229ED9 100%);

      /* Light theme */
      --bg:        #ffffff;
      --panel:     #f4f4f5;
      --text:      #0f1419;
      --text-dim:  #707579;
      --border:    rgba(15, 20, 25, 0.08);
      --hover:     rgba(42, 171, 238, 0.06);

      /* Status colors */
      --error-bg:   #fdecea;
      --error-br:   #f5b1aa;
      --error-txt:  #9b2d20;
      --ok-bg:      #e5f4fd;
      --ok-br:      #96d1f0;
      --ok-txt:     #1a6ca3;
    }
    @media (prefers-color-scheme: dark) {
      :root {
        /* chat dark theme */
        --bg:       #17212b;
        --panel:    #212d3b;
        --text:     #f5f5f5;
        --text-dim: #93a2ae;
        --border:   rgba(255, 255, 255, 0.08);
        --hover:    rgba(42, 171, 238, 0.14);

        --error-bg:   #3a1b1b;
        --error-br:   rgba(245, 177, 170, 0.3);
        --error-txt:  #ffb3ac;
        --ok-bg:      rgba(42, 171, 238, 0.15);
        --ok-br:      rgba(42, 171, 238, 0.4);
        --ok-txt:     #87cefa;
      }
    }

    * { box-sizing: border-box; }
    html, body { background: var(--bg); color: var(--text); }
    body {
      font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
      max-width: 960px;
      margin: 0 auto;
      padding: 1.5em 1em 3em;
      line-height: 1.5;
      -webkit-font-smoothing: antialiased;
    }

    h1 { margin: 0 0 0.4em; font-weight: 600; letter-spacing: -0.01em; }
    p { margin: 0.5em 0; }
    a { color: var(--accent-blue); text-decoration: none; }
    a:hover { text-decoration: underline; }
    code {
      background: var(--panel);
      padding: 0.1em 0.4em;
      border-radius: 6px;
      font-size: 0.92em;
      font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    }

    .lead { color: var(--text-dim); margin-top: 0; }
    .hint { color: var(--text-dim); font-size: 0.9em; margin-top: 0.3em; }

    label {
      display: block;
      margin: 1.2em 0 0.35em;
      font-weight: 500;
      font-size: 0.95em;
      color: var(--text-dim);
    }
    input[type=tel], input[type=text], input[type=password] {
      width: 100%;
      padding: 0.75em 0.9em;
      font-size: 1em;
      font-family: inherit;
      color: var(--text);
      background: var(--panel);
      border: 1px solid transparent;
      border-radius: 10px;
      transition: border-color 0.15s, background 0.15s;
    }
    input[type=tel]:focus, input[type=text]:focus, input[type=password]:focus {
      outline: none;
      border-color: var(--accent-blue);
      background: var(--bg);
    }

    button {
      padding: 0.7em 1.4em;
      font-size: 0.98em;
      font-family: inherit;
      font-weight: 500;
      cursor: pointer;
      border: 0;
      background: var(--accent-gradient);
      color: #fff;
      border-radius: 10px;
      transition: transform 0.1s, box-shadow 0.15s, filter 0.15s;
    }
    button:hover:not([disabled]) {
      filter: brightness(1.05);
      box-shadow: 0 4px 12px rgba(42, 171, 238, 0.3);
    }
    button:active:not([disabled]) { transform: translateY(1px); }
    button[disabled] { opacity: 0.5; cursor: not-allowed; }

    button.ghost {
      background: transparent;
      color: var(--accent-blue);
      border: 1px solid var(--accent-blue);
    }
    button.ghost:hover:not([disabled]) {
      background: var(--accent-blue-ghost);
      filter: none;
      box-shadow: none;
    }

    form.actions { margin-top: 1.2em; }

    /* ---- Toast notifications (replaces static flash alerts) ---- */
    .toasts {
      position: fixed;
      top: 1em;
      right: 1em;
      z-index: 2000;
      display: flex;
      flex-direction: column;
      gap: 0.6em;
      width: 360px;
      max-width: calc(100vw - 2em);
      pointer-events: none;
    }
    .toast {
      pointer-events: auto;
      display: flex;
      align-items: flex-start;
      gap: 0.7em;
      padding: 0.8em 0.9em 0.8em 1em;
      background: var(--bg);
      color: var(--text);
      border-radius: 12px;
      box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 2px 4px rgba(0, 0, 0, 0.06);
      border-left: 4px solid var(--accent-blue);
      opacity: 0;
      transform: translateX(120%);
      animation: toast-in 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.2) forwards;
    }
    .toast.toast-leaving {
      animation: toast-out 0.25s ease-in forwards;
    }
    .toast-ok    { border-left-color: #4caf50; }
    .toast-error { border-left-color: #e53935; }
    .toast-icon {
      width: 22px; height: 22px;
      flex-shrink: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      margin-top: 0.1em;
    }
    .toast-icon svg { width: 22px; height: 22px; }
    .toast-ok    .toast-icon { color: #4caf50; }
    .toast-error .toast-icon { color: #e53935; }
    .toast-text  { flex: 1; font-size: 0.93em; line-height: 1.4; }
    .toast-close {
      flex-shrink: 0;
      padding: 0 0.3em;
      margin: -0.3em -0.2em 0 0;
      background: transparent;
      border: 0;
      color: var(--text-dim);
      font-size: 1.4em;
      line-height: 1;
      cursor: pointer;
      font-family: inherit;
      box-shadow: none;
      border-radius: 6px;
    }
    .toast-close:hover:not([disabled]) {
      background: var(--panel);
      color: var(--text);
      filter: none;
      box-shadow: none;
    }
    @keyframes toast-in {
      from { opacity: 0; transform: translateX(120%); }
      to   { opacity: 1; transform: translateX(0); }
    }
    @keyframes toast-out {
      from { opacity: 1; transform: translateX(0); max-height: 100px; margin-bottom: 0.6em; }
      to   { opacity: 0; transform: translateX(120%); max-height: 0; margin-bottom: -0.6em; }
    }
    @media (prefers-reduced-motion: reduce) {
      .toast { animation: none; opacity: 1; transform: none; }
      .toast.toast-leaving { animation: none; opacity: 0; }
    }
    @media (max-width: 480px) {
      .toasts { top: 0.6em; right: 0.6em; left: 0.6em; width: auto; max-width: none; }
    }

    header.topbar {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0.6em 0 1em;
      margin-bottom: 1.2em;
      border-bottom: 1px solid var(--border);
    }
    header.topbar .brand {
      display: inline-flex;
      align-items: center;
      gap: 0.55em;
      color: var(--text);
      text-decoration: none;
    }
    header.topbar h1 { font-size: 1.15em; margin: 0; font-weight: 600; }
    header.topbar .topbar-logout {
      display: flex;
      align-items: center;
      gap: 0.8em;
    }
    header.topbar .logout-hint {
      color: var(--text-dim);
      font-size: 0.78em;
      line-height: 1.25;
      text-align: right;
      opacity: 0.85;
    }
    header.topbar .topbar-center {
      flex: 1;
      display: flex;
      justify-content: center;
      min-width: 0;
      padding: 0 0.6em;
    }
    header.topbar .topbar-files {
      display: inline-flex;
      align-items: center;
      gap: 0.45em;
      padding: 0.45em 0.9em;
      border: 1px solid indigo;
      border-radius: 8px;
      background-color: yellow;
      color: indigo;
      text-decoration: none;
      font-size: 0.9em;
      font-weight: 500;
      white-space: nowrap;
    }
    header.topbar .topbar-files:hover { background-color: gold; }
    header.topbar .topbar-files svg { width: 16px; height: 16px; fill: currentColor; }
    @media (max-width: 480px) {
      header.topbar .logout-hint { display: none; }
    }
    @media (max-width: 560px) {
      header.topbar .topbar-files span { display: none; }
    }
    .brand-logo {
      width: 28px; height: 28px;
      background: var(--accent-gradient);
      border-radius: 50%;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
    }
    .brand-logo svg { width: 16px; height: 16px; fill: #fff; }

    /* ---- Auth-page mode (centered single-column login flow) ---- */
    body.auth {
      max-width: none;
      padding: 0;
      min-height: 100vh;
      background: var(--panel);
      display: flex;
      flex-direction: column;
    }
    .auth-topbar {
      padding: 0.9em 1.2em;
      display: flex;
      align-items: center;
      gap: 0.5em;
      color: var(--text-dim);
      font-size: 0.9em;
    }
    .auth-topbar .brand-logo { width: 24px; height: 24px; }
    .auth-topbar .brand-logo svg { width: 13px; height: 13px; }
    .auth-container {
      flex: 1;
      display: flex;
      flex-direction: column;
      align-items: center;
      padding: 2em 1em 3em;
      width: 100%;
      max-width: 440px;
      margin: 0 auto;
    }
    .auth-logo-big {
      width: 140px;
      height: 140px;
      background: var(--accent-gradient);
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      margin: 1em 0 1.2em;
      box-shadow: 0 10px 30px rgba(42, 171, 238, 0.28);
    }
    .auth-logo-big svg { width: 72px; height: 72px; fill: #fff; }
    .auth-title {
      font-size: 1.6em;
      font-weight: 700;
      text-align: center;
      margin: 0 0 0.6em;
      letter-spacing: -0.01em;
    }
    .auth-subtitle {
      text-align: center;
      color: var(--text-dim);
      margin: 0 0 1.6em;
      font-size: 0.98em;
      line-height: 1.5;
    }
    .auth-card {
      background: var(--bg);
      border-radius: 16px;
      padding: 1.4em;
      width: 100%;
      box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
    }
    @media (prefers-color-scheme: dark) {
      .auth-card { box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3); }
    }
    .auth-card label { margin-top: 0; color: var(--text-dim); font-size: 0.9em; }
    .auth-card label:first-child { margin-top: 0; }
    .auth-card button[type=submit] {
      width: 100%;
      padding: 0.9em;
      font-size: 1em;
      font-weight: 600;
      border-radius: 24px;
      margin-top: 1.2em;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 0.5em;
    }
    .auth-card button[type=submit] svg { width: 14px; height: 14px; fill: #fff; }
    .auth-card .hint { margin-top: 0.4em; }
    .auth-card .hint a { color: var(--accent-blue); }
    .auth-aside {
      margin-top: 1.2em;
      text-align: center;
      font-size: 0.9em;
      color: var(--text-dim);
    }
    .auth-aside a { color: var(--accent-blue); }
    .auth-aside .ghost-btn {
      display: inline-block;
      margin-top: 0.7em;
      padding: 0.5em 1.2em;
      background: transparent;
      color: var(--accent-blue);
      border: 1px solid var(--accent-blue);
      border-radius: 24px;
      font-size: 0.95em;
      cursor: pointer;
      font-family: inherit;
      font-weight: 500;
    }
    .auth-aside .ghost-btn:hover:not([disabled]) {
      background: var(--accent-blue-ghost);
    }
    .auth-aside .ghost-btn[disabled] { opacity: 0.5; cursor: not-allowed; }
    body.auth .error, body.auth .ok {
      width: 100%;
      margin: 0 0 1em;
      text-align: center;
    }
