/*
 * Amplify — App · Foundation
 *
 * Purpose: Defines the application-wide visual system, page shells, base components and legacy-compatible selectors.
 * Contract: Loaded first; feature styles may specialize these primitives without redefining the application identity.
 * Dependencies: CSS custom properties and the DOM structure in index.html.
 * Invariants: Base variables and shared layout semantics must remain stable because every feature depends on them.
 * Maintenance: Comments describe current intent, not release history. Remove obsolete rules instead of stacking versioned patches.
 */

:root {
        --bg: #101010;
        --card: rgba(24, 24, 24, 0.94);
        --card-top: rgba(31, 31, 31, 0.96);
        --field: rgba(10, 10, 10, 0.82);
        --field-hover: rgba(14, 14, 14, 0.94);
        --border: rgba(255, 255, 255, 0.11);
        --border-strong: rgba(255, 255, 255, 0.17);
        --text: #f4f4f2;
        --muted: rgba(244, 244, 242, 0.72);
        --soft: rgba(244, 244, 242, 0.48);
        --gold: #fee993;
        --gold-soft: #f8df78;
        --gold-border: rgba(254, 233, 147, 0.68);
        --gold-faint: rgba(254, 233, 147, 0.08);
        --gold-fainter: rgba(254, 233, 147, 0.045);
        --shadow: rgba(0, 0, 0, 0.56);
        --danger: #ffb0b0;
      }

      * {
        box-sizing: border-box;
      }

      html {
        color-scheme: dark;
      }

      body {
        margin: 0;
        min-height: 100vh;
        display: grid;
        place-items: center;
        padding: 34px 20px;
        overflow-x: hidden;
        position: relative;
        background: var(--bg);
        color: var(--text);
        font-family:
          "Plus Jakarta Sans",
          "Segoe UI",
          system-ui,
          -apple-system,
          BlinkMacSystemFont,
          sans-serif;
      }

      body::before {
        content: "";
        position: fixed;
        inset: 0;
        pointer-events: none;
        background:
          radial-gradient(
            circle at 50% 22%,
            rgba(254, 233, 147, 0.055),
            transparent 34%
          ),
          linear-gradient(
            rgba(5, 5, 5, 0.82),
            rgba(5, 5, 5, 0.93)
          ),
          url("https://minioconsole.aiamplify.tech/api/v1/buckets/amplify/objects/download?preview=true&prefix=public%2FBackground2.png&version_id=null") center / cover no-repeat;
        filter: saturate(0.8);
      }

      body::after {
        content: "";
        position: fixed;
        inset: 0;
        pointer-events: none;
        background-image:
          linear-gradient(
            rgba(254, 233, 147, 0.055) 1px,
            transparent 1px
          ),
          linear-gradient(
            90deg,
            rgba(254, 233, 147, 0.055) 1px,
            transparent 1px
          );
        background-size: 72px 72px;
        mask-image:
          linear-gradient(
            to bottom,
            rgba(0, 0, 0, 0.7),
            transparent 92%
          );
        -webkit-mask-image:
          linear-gradient(
            to bottom,
            rgba(0, 0, 0, 0.7),
            transparent 92%
          );
      }

      button,
      input {
        font: inherit;
      }

      [hidden] {
        display: none !important;
      }

      .wrap {
        width: min(620px, 96vw);
        position: relative;
        z-index: 1;
      }

      .card {
        position: relative;
        overflow: hidden;
        padding: 40px;
        border: 1px solid var(--gold-border);
        border-radius: 26px;
        background:
          linear-gradient(
            180deg,
            var(--card-top) 0%,
            var(--card) 100%
          );
        box-shadow:
          0 0 0 1px rgba(254, 233, 147, 0.055),
          0 0 34px rgba(254, 233, 147, 0.055),
          0 30px 80px var(--shadow);
        backdrop-filter: blur(15px);
        -webkit-backdrop-filter: blur(15px);
      }

      .card::before {
        content: "";
        position: absolute;
        inset: 0;
        pointer-events: none;
        background:
          linear-gradient(
            115deg,
            rgba(255, 255, 255, 0.028),
            transparent 32%
          );
      }

      .header {
        position: relative;
        z-index: 1;
        display: grid;
        grid-template-columns: auto 1fr;
        align-items: center;
        gap: 18px;
      }

      .logo {
        width: 88px;
        height: 88px;
        overflow: hidden;
        flex: 0 0 auto;
        display: grid;
        place-items: center;
        border: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: 18px;
        background: #171717;
        box-shadow:
          inset 0 1px 0 rgba(255, 255, 255, 0.04),
          0 10px 24px rgba(0, 0, 0, 0.18);
      }

      .logo img {
        width: 100%;
        height: 100%;
        display: block;
        object-fit: cover;
      }

      .hero {
        min-width: 0;
      }

      h1 {
        margin: 0;
        color: var(--gold);
        font-size: clamp(29px, 4vw, 36px);
        line-height: 1.08;
        font-weight: 600;
        letter-spacing: -0.035em;
      }

      .subtitle {
        max-width: 470px;
        margin: 10px 0 0;
        color: var(--muted);
        font-size: 15.5px;
        line-height: 1.62;
        font-weight: 400;
        letter-spacing: -0.006em;
      }

      .form {
        position: relative;
        z-index: 1;
        margin-top: 34px;
        display: grid;
        gap: 21px;
      }

      .field {
        display: grid;
        gap: 9px;
      }

      .field label {
        color: rgba(244, 244, 242, 0.9);
        font-size: 15px;
        line-height: 1.3;
        font-weight: 600;
        letter-spacing: -0.005em;
      }

      .input-shell {
        position: relative;
      }

      .field input {
        width: 100%;
        min-height: 54px;
        padding: 0 16px;
        outline: none;
        border: 1px solid var(--border-strong);
        border-radius: 14px;
        background: var(--field);
        color: var(--text);
        font-size: 15px;
        font-weight: 400;
        box-shadow:
          inset 0 1px 0 rgba(255, 255, 255, 0.015);
        transition:
          border-color 0.18s ease,
          background 0.18s ease,
          box-shadow 0.18s ease,
          transform 0.18s ease;
      }

      .field input::placeholder {
        color: rgba(244, 244, 242, 0.34);
      }

      .field input:hover {
        background: var(--field-hover);
        border-color: rgba(255, 255, 255, 0.22);
      }

      .field input:focus {
        background: #101010;
        border-color: rgba(254, 233, 147, 0.7);
        box-shadow:
          0 0 0 4px rgba(254, 233, 147, 0.07),
          inset 0 1px 0 rgba(255, 255, 255, 0.02);
      }

      .field-hint {
        margin: -1px 0 0;
        color: var(--soft);
        font-size: 12.5px;
        line-height: 1.5;
        font-weight: 400;
      }

      .submit {
        width: 100%;
        min-height: 56px;
        margin-top: 2px;
        border: 1px solid rgba(255, 244, 191, 0.76);
        border-radius: 15px;
        cursor: pointer;
        background:
          linear-gradient(
            180deg,
            #f8df78 0%,
            #f2d66c 100%
          );
        color: #1d1b13;
        font-size: 16.5px;
        font-weight: 700;
        letter-spacing: -0.012em;
        box-shadow:
          inset 0 1px 0 rgba(255, 255, 255, 0.18),
          0 9px 24px rgba(254, 233, 147, 0.07);
        transition:
          transform 0.18s ease,
          filter 0.18s ease,
          box-shadow 0.18s ease;
      }

      .submit:hover,
      .submit:focus-visible {
        outline: none;
        transform: translateY(-2px);
        filter: brightness(1.03);
        box-shadow:
          inset 0 1px 0 rgba(255, 255, 255, 0.22),
          0 13px 30px rgba(254, 233, 147, 0.10);
      }

      .submit:active {
        transform: translateY(0);
      }

      .access-note {
        position: relative;
        z-index: 1;
        margin-top: 24px;
        padding: 18px;
        border: 1px solid rgba(254, 233, 147, 0.18);
        border-radius: 16px;
        background:
          linear-gradient(
            180deg,
            var(--gold-faint),
            var(--gold-fainter)
          );
      }

      .note-heading {
        display: flex;
        align-items: center;
        gap: 12px;
      }

      .note-icon {
        width: 32px;
        height: 32px;
        flex: 0 0 32px;
        display: grid;
        place-items: center;
        border: 1px solid rgba(254, 233, 147, 0.2);
        border-radius: 9px;
        background: rgba(254, 233, 147, 0.075);
        color: var(--gold);
      }

      .note-content {
        min-width: 0;
      }

      .note-title {
        margin: 0;
        color: rgba(255, 244, 191, 0.96);
        font-size: 14px;
        line-height: 1.35;
        font-weight: 600;
        letter-spacing: -0.01em;
      }

      .note-text {
        margin: 9px 0 0 44px;
        color: rgba(244, 244, 242, 0.68);
        font-size: 14px;
        line-height: 1.62;
        font-weight: 400;
      }

      .status-view {
        position: relative;
        z-index: 1;
        min-height: 360px;
        padding: 44px 18px 26px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
      }

      .status-spinner {
        width: 50px;
        height: 50px;
        margin-bottom: 26px;
        border: 4px solid rgba(254, 233, 147, 0.14);
        border-top-color: var(--gold);
        border-radius: 50%;
        animation: spin 0.8s linear infinite;
        box-shadow: 0 0 28px rgba(254, 233, 147, 0.08);
      }

      @keyframes spin {
        to {
          transform: rotate(360deg);
        }
      }

      .status-icon {
        width: 66px;
        height: 66px;
        margin-bottom: 24px;
        display: grid;
        place-items: center;
        border-radius: 50%;
        background: rgba(254, 233, 147, 0.08);
        border: 1px solid rgba(254, 233, 147, 0.3);
        color: var(--gold);
      }

      .status-icon.error {
        background: rgba(255, 110, 110, 0.07);
        border-color: rgba(255, 110, 110, 0.25);
        color: #ff9b9b;
      }

      .status-title {
        margin: 0;
        color: var(--gold);
        font-size: 25px;
        line-height: 1.2;
        font-weight: 600;
        letter-spacing: -0.025em;
      }

      .status-title.error {
        color: var(--danger);
      }

      .status-text {
        max-width: 455px;
        margin: 14px 0 0;
        color: var(--muted);
        font-size: 15px;
        line-height: 1.7;
      }

      .secondary-button {
        min-height: 48px;
        margin-top: 26px;
        padding: 0 24px;
        border: 1px solid var(--border-strong);
        border-radius: 13px;
        cursor: pointer;
        background: rgba(255, 255, 255, 0.045);
        color: var(--text);
        font-size: 14.5px;
        font-weight: 600;
        transition:
          background 0.18s ease,
          border-color 0.18s ease,
          transform 0.18s ease;
      }

      .secondary-button:hover {
        background: rgba(255, 255, 255, 0.075);
        border-color: rgba(255, 255, 255, 0.25);
        transform: translateY(-1px);
      }

      dialog {
        width: min(500px, calc(100vw - 32px));
        padding: 0;
        border: 1px solid var(--gold-border);
        border-radius: 22px;
        background:
          linear-gradient(
            180deg,
            rgba(34, 34, 34, 0.99),
            rgba(22, 22, 22, 0.99)
          );
        color: var(--text);
        box-shadow:
          0 0 38px rgba(254, 233, 147, 0.08),
          0 30px 90px rgba(0, 0, 0, 0.72);
      }

      dialog::backdrop {
        background: rgba(0, 0, 0, 0.76);
        backdrop-filter: blur(5px);
      }

      .dialog-content {
        padding: 30px;
      }

      .dialog-heading {
        display: flex;
        align-items: center;
        gap: 13px;
      }

      .dialog-warning {
        width: 38px;
        height: 38px;
        flex: 0 0 38px;
        display: grid;
        place-items: center;
        color: var(--gold);
        filter: drop-shadow(0 0 10px rgba(254, 233, 147, 0.08));
      }

      .dialog-title {
        margin: 0;
        color: var(--gold);
        font-size: 21px;
        line-height: 1.3;
        font-weight: 600;
        letter-spacing: -0.02em;
      }

      .dialog-text {
        margin: 16px 0 0 51px;
        color: var(--muted);
        font-size: 14.5px;
        line-height: 1.7;
      }

      .dialog-actions {
        margin-top: 25px;
        display: grid;
        gap: 10px;
      }

      .dialog-primary,
      .dialog-secondary {
        width: 100%;
        min-height: 49px;
        border-radius: 13px;
        cursor: pointer;
        font-size: 14.5px;
        font-weight: 700;
        transition:
          transform 0.18s ease,
          filter 0.18s ease,
          box-shadow 0.18s ease,
          background 0.18s ease,
          border-color 0.18s ease;
      }

      .dialog-primary {
        border: 1px solid rgba(255, 244, 191, 0.76);
        background:
          linear-gradient(
            180deg,
            #f8df78 0%,
            #f2d66c 100%
          );
        color: #1d1b13;
        box-shadow:
          inset 0 1px 0 rgba(255, 255, 255, 0.18),
          0 9px 24px rgba(254, 233, 147, 0.07);
      }

      .dialog-primary:hover,
      .dialog-primary:focus-visible {
        outline: none;
        transform: translateY(-2px);
        filter: brightness(1.03);
        box-shadow:
          inset 0 1px 0 rgba(255, 255, 255, 0.22),
          0 13px 30px rgba(254, 233, 147, 0.10);
      }

      .dialog-secondary {
        border: 1px solid var(--border-strong);
        background: rgba(255, 255, 255, 0.045);
        color: var(--text);
        box-shadow:
          inset 0 1px 0 rgba(255, 255, 255, 0.025),
          0 7px 20px rgba(0, 0, 0, 0.14);
      }

      .dialog-secondary:hover,
      .dialog-secondary:focus-visible {
        outline: none;
        transform: translateY(-2px);
        background: rgba(255, 255, 255, 0.075);
        border-color: rgba(255, 255, 255, 0.25);
        box-shadow:
          inset 0 1px 0 rgba(255, 255, 255, 0.045),
          0 11px 26px rgba(0, 0, 0, 0.22);
      }

      .dialog-primary:active,
      .dialog-secondary:active {
        transform: translateY(0);
      }

      @media (max-width: 640px) {
        body {
          padding: 20px 14px;
        }

        .card {
          padding: 28px 22px;
          border-radius: 22px;
        }

        .header {
          gap: 15px;
        }

        .logo {
          width: 76px;
          height: 76px;
          border-radius: 16px;
        }

        .form {
          margin-top: 30px;
        }
      }

      @media (max-width: 470px) {
        .header {
          grid-template-columns: 1fr;
          gap: 15px;
        }

        .logo {
          width: 76px;
          height: 76px;
        }

        h1 {
          font-size: 30px;
        }

        .subtitle {
          font-size: 15px;
        }

        .note-text {
          margin-left: 0;
        }

        .dialog-content {
          padding: 24px 20px;
        }

        .dialog-text {
          margin-left: 0;
        }
      }
    

      .auth-switch { margin-top: 22px; text-align: center; color: var(--muted); font-size: 13.5px; line-height: 1.6; }

      .login-error {
        margin: 0;
        color: var(--danger);
        font-size: 12.5px;
        line-height: 1.5;
      }

      .login-error:empty {
        display: none;
      }

      .auth-divider {
        display: flex;
        align-items: center;
        gap: 14px;
        margin: 14px 0 16px;
        color: rgba(244, 244, 242, 0.42);
        font-size: 11px;
        font-weight: 700;
        letter-spacing: 0.12em;
      }

      .auth-divider::before,
      .auth-divider::after {
        content: "";
        height: 1px;
        flex: 1;
        background: rgba(244, 244, 242, 0.16);
      }

      .silver-button {
        width: 100%;
        min-height: 54px;
        border: 1px solid rgba(255, 255, 255, 0.28);
        border-radius: 15px;
        cursor: pointer;
        background:
          linear-gradient(
            180deg,
            #ededeb 0%,
            #d2d2cf 100%
          );
        color: #171717;
        font-size: 15.5px;
        font-weight: 700;
        letter-spacing: -0.012em;
        box-shadow:
          inset 0 1px 0 rgba(255, 255, 255, 0.55),
          0 9px 22px rgba(0, 0, 0, 0.18);
        transition:
          transform 0.18s ease,
          filter 0.18s ease,
          box-shadow 0.18s ease;
      }

      .silver-button:hover,
      .silver-button:focus-visible {
        outline: none;
        transform: translateY(-2px);
        filter: brightness(1.04);
        box-shadow:
          inset 0 1px 0 rgba(255, 255, 255, 0.65),
          0 13px 28px rgba(0, 0, 0, 0.24);
      }

      .silver-button:active {
        transform: translateY(0);
      }

      .recovery-message {
        margin-top: 18px;
        padding: 14px 16px;
        border: 1px solid rgba(254, 233, 147, 0.18);
        border-radius: 13px;
        color: var(--muted);
        background: rgba(254, 233, 147, 0.05);
        font-size: 13.5px;
        line-height: 1.6;
      }
      .text-link { padding: 0; border: 0; background: transparent; color: var(--gold); cursor: pointer; font-weight: 700; }
      .text-link:hover { text-decoration: underline; }
      .dashboard-head { display:flex; align-items:center; justify-content:space-between; gap:18px; margin-bottom:26px; }
      .dashboard-brand { display:flex; align-items:center; gap:14px; }
      .dashboard-brand .logo { width:58px; height:58px; border-radius:14px; }
      .dashboard-title { margin:0; color:var(--gold); font-size:clamp(25px,4vw,34px); letter-spacing:-.035em; }
      .dashboard-subtitle { margin:6px 0 0; color:var(--muted); font-size:14px; }
      .ghost-action { min-height:42px; padding:0 15px; border:1px solid var(--border-strong); border-radius:12px; background:rgba(255,255,255,.045); color:var(--text); cursor:pointer; font-weight:700; }
      .agent-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; }
      .agent-card { min-height:180px; padding:22px; border:1px solid rgba(254,233,147,.18); border-radius:18px; background:linear-gradient(180deg,rgba(254,233,147,.06),rgba(255,255,255,.025)); }
      .agent-card h3 { margin:0 0 8px; color:var(--text); font-size:18px; }
      .agent-card p { margin:0; color:var(--muted); font-size:13.5px; line-height:1.6; }
      .agent-card .submit { margin-top:22px; min-height:48px; font-size:14px; }
      .route-note { margin-top:18px; padding:14px 16px; border:1px solid var(--border); border-radius:13px; color:var(--soft); background:rgba(255,255,255,.025); font-size:12.5px; line-height:1.6; }
      .boot-view { min-height:360px; display:grid; place-items:center; }
      @media (max-width:700px){ .agent-grid{grid-template-columns:1fr;} .dashboard-head{align-items:flex-start;flex-direction:column;} }

  
      /* ======================================================
         Authenticated app — full-screen operational shell
         ====================================================== */

      body.app-mode {
        display: block;
        padding: 0;
        min-height: 100vh;
      }

      body.app-mode .wrap {
        width: 100%;
        min-height: 100vh;
      }

      body.app-mode .card {
        min-height: 100vh;
        padding: 0;
        overflow: visible;
        border: 0;
        border-radius: 0;
        background: rgba(7, 7, 7, 0.78);
        box-shadow: none;
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
      }

      body.app-mode .card::before {
        display: none;
      }

      .app-shell {
        min-height: 100vh;
        display: grid;
        grid-template-columns: 238px minmax(0, 1fr);
      }

      .app-sidebar {
        min-height: 100vh;
        padding: 24px 18px;
        border-right: 1px solid rgba(255,255,255,.08);
        background: rgba(10,10,10,.82);
        backdrop-filter: blur(18px);
      }

      .app-brand {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 0 8px 24px;
        border-bottom: 1px solid rgba(255,255,255,.07);
      }

      .app-brand .logo {
        width: 44px;
        height: 44px;
        border-radius: 12px;
      }

      .app-brand-title {
        margin: 0;
        color: var(--gold);
        font-size: 16px;
        font-weight: 700;
      }

      .app-brand-copy {
        margin: 3px 0 0;
        color: var(--soft);
        font-size: 11.5px;
      }

      .app-nav {
        display: grid;
        gap: 8px;
        margin-top: 24px;
      }

      .app-nav-label {
        margin: 14px 10px 4px;
        color: rgba(244,244,242,.35);
        font-size: 10px;
        font-weight: 700;
        letter-spacing: .11em;
        text-transform: uppercase;
      }

      .app-nav-item {
        min-height: 44px;
        display: flex;
        align-items: center;
        gap: 11px;
        padding: 0 12px;
        border: 1px solid transparent;
        border-radius: 11px;
        background: transparent;
        color: var(--muted);
        font-size: 13.5px;
        font-weight: 600;
      }

      .app-nav-item.active {
        border-color: rgba(254,233,147,.2);
        background: rgba(254,233,147,.075);
        color: var(--gold);
      }

      .app-nav-item.disabled {
        opacity: .38;
      }

      .app-main {
        min-width: 0;
        padding: 0 32px 40px;
      }

      .app-topbar {
        min-height: 84px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 20px;
        border-bottom: 1px solid rgba(255,255,255,.07);
      }

      .app-user {
        min-width: 0;
      }

      .app-user-email {
        margin: 0;
        color: var(--muted);
        font-size: 13px;
      }

      .ghost-action.compact {
        min-height: 40px;
        padding: 0 14px;
      }

      .agents-page {
        padding-top: 34px;
      }

      .agents-header {
        display: flex;
        align-items: flex-end;
        justify-content: space-between;
        gap: 18px;
        margin-bottom: 24px;
      }

      .agents-title {
        margin: 0;
        color: var(--gold);
        font-size: clamp(26px, 3.2vw, 36px);
        letter-spacing: -.04em;
      }

      .agents-copy {
        margin: 8px 0 0;
        max-width: 680px;
        color: var(--muted);
        font-size: 14px;
        line-height: 1.6;
      }

      .small-primary {
        min-height: 42px;
        padding: 0 16px;
        border: 1px solid rgba(255,244,191,.72);
        border-radius: 12px;
        cursor: pointer;
        background: linear-gradient(180deg, #f8df78, #f2d66c);
        color: #1d1b13;
        font-size: 13px;
        font-weight: 700;
        white-space: nowrap;
      }

      .agents-toolbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        margin-bottom: 18px;
      }

      .agents-meta {
        margin: 0;
        color: var(--soft);
        font-size: 12.5px;
      }

      .refresh-agents {
        min-height: 38px;
        padding: 0 12px;
        border: 1px solid var(--border);
        border-radius: 10px;
        background: rgba(255,255,255,.035);
        color: var(--muted);
        cursor: pointer;
        font-size: 12px;
        font-weight: 700;
      }

      .real-agent-grid {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 16px;
      }

      .real-agent-card {
        min-width: 0;
        min-height: 260px;
        padding: 20px;
        display: flex;
        flex-direction: column;
        border: 1px solid rgba(254,233,147,.16);
        border-radius: 18px;
        background:
          linear-gradient(180deg, rgba(31,31,31,.94), rgba(18,18,18,.96));
        box-shadow:
          inset 0 1px 0 rgba(255,255,255,.025),
          0 16px 38px rgba(0,0,0,.18);
      }

      .agent-card-head {
        display: flex;
        align-items: center;
        gap: 14px;
      }

      .agent-avatar {
        width: 58px;
        height: 58px;
        flex: 0 0 58px;
        overflow: hidden;
        display: grid;
        place-items: center;
        border: 1px solid rgba(254,233,147,.22);
        border-radius: 16px;
        background: rgba(254,233,147,.075);
        color: var(--gold);
        font-size: 18px;
        font-weight: 700;
      }

      .agent-avatar img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
      }

      .agent-identity {
        min-width: 0;
      }

      .agent-name {
        margin: 0;
        overflow: hidden;
        color: var(--text);
        font-size: 17px;
        font-weight: 700;
        text-overflow: ellipsis;
        white-space: nowrap;
      }

      .agent-company {
        margin: 5px 0 0;
        overflow: hidden;
        color: var(--muted);
        font-size: 12.5px;
        text-overflow: ellipsis;
        white-space: nowrap;
      }

      .agent-slug {
        margin: 18px 0 0;
        color: var(--soft);
        font-size: 11.5px;
        font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
      }

      .agent-state-row {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        margin-top: 18px;
      }

      .agent-badge {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        min-height: 28px;
        padding: 0 9px;
        border: 1px solid var(--border);
        border-radius: 999px;
        color: var(--muted);
        background: rgba(255,255,255,.03);
        font-size: 10.5px;
        font-weight: 700;
      }

      .agent-badge.active {
        border-color: rgba(111,220,145,.22);
        background: rgba(111,220,145,.08);
        color: #a9ebbd;
      }

      .agent-badge.inactive {
        border-color: rgba(255,180,120,.18);
        background: rgba(255,180,120,.055);
        color: #e9bd93;
      }

      .agent-badge.connected {
        border-color: rgba(111,220,145,.22);
        background: rgba(111,220,145,.08);
        color: #a9ebbd;
      }

      .agent-phone {
        min-height: 20px;
        margin: 13px 0 0;
        color: var(--muted);
        font-size: 12.5px;
      }

      .agent-card-footer {
        margin-top: auto;
        padding-top: 20px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        border-top: 1px solid rgba(255,255,255,.07);
      }

      .primary-agent-label {
        color: var(--soft);
        font-size: 10.5px;
      }

      .manage-agent {
        min-height: 38px;
        padding: 0 13px;
        border: 1px solid rgba(254,233,147,.28);
        border-radius: 10px;
        background: rgba(254,233,147,.075);
        color: var(--gold);
        cursor: pointer;
        font-size: 11.5px;
        font-weight: 700;
      }

      .agents-state {
        min-height: 250px;
        display: grid;
        place-items: center;
        padding: 32px;
        border: 1px dashed rgba(255,255,255,.12);
        border-radius: 18px;
        color: var(--muted);
        text-align: center;
      }

      .agents-state-inner {
        max-width: 430px;
      }

      .agents-state h3 {
        margin: 0 0 8px;
        color: var(--text);
        font-size: 18px;
      }

      .agents-state p {
        margin: 0;
        line-height: 1.6;
        font-size: 13.5px;
      }

      .app-toast {
        position: fixed;
        right: 24px;
        bottom: 24px;
        z-index: 40;
        max-width: 380px;
        padding: 13px 16px;
        border: 1px solid rgba(254,233,147,.24);
        border-radius: 12px;
        background: rgba(18,18,18,.98);
        color: var(--text);
        box-shadow: 0 18px 50px rgba(0,0,0,.42);
        opacity: 0;
        transform: translateY(10px);
        pointer-events: none;
        transition: .2s ease;
      }

      .app-toast.show {
        opacity: 1;
        transform: translateY(0);
      }

      @media (max-width: 1100px) {
        .real-agent-grid {
          grid-template-columns: repeat(2, minmax(0, 1fr));
        }
      }

      @media (max-width: 760px) {
        .app-shell {
          grid-template-columns: 1fr;
        }

        .app-sidebar {
          min-height: auto;
          padding: 14px 16px;
          border-right: 0;
          border-bottom: 1px solid rgba(255,255,255,.08);
        }

        .app-brand {
          padding-bottom: 14px;
        }

        .app-nav {
          display: flex;
          margin-top: 12px;
          overflow-x: auto;
        }

        .app-nav-label,
        .app-nav-item.disabled {
          display: none;
        }

        .app-main {
          padding: 0 16px 28px;
        }

        .agents-header {
          align-items: flex-start;
          flex-direction: column;
        }

        .real-agent-grid {
          grid-template-columns: 1fr;
        }
      }

  
      /*  */
      .app-brand-title { font-size: 18px; }
      .app-brand-copy { font-size: 13px; }
      .app-nav-label { font-size: 11.5px; }
      .app-nav-item { font-size: 15px; min-height: 48px; }
      .app-user-email { font-size: 14.5px; }
      .agents-title { font-size: clamp(32px, 3.4vw, 42px); }
      .agents-copy { font-size: 16px; }
      .small-primary { font-size: 14px; min-height: 46px; }
      .agents-meta { font-size: 14px; }
      .refresh-agents { font-size: 13px; min-height: 42px; }
      .agent-name { font-size: 20px; }
      .agent-company { font-size: 14px; }
      .agent-badge { font-size: 12px; min-height: 30px; }
      .agent-phone { font-size: 14px; }
      .primary-agent-label { font-size: 12px; }
      .manage-agent { font-size: 13px; min-height: 40px; }

      .app-shell.sidebar-collapsed { grid-template-columns: 78px minmax(0, 1fr); }
      .sidebar-toggle {
        width: 40px; height: 40px; display: grid; place-items: center;
        margin-left: auto; border: 1px solid rgba(255,255,255,.1);
        border-radius: 10px; background: rgba(255,255,255,.035);
        color: var(--muted); cursor: pointer; font-size: 20px;
      }
      .app-shell.sidebar-collapsed .app-brand-copy,
      .app-shell.sidebar-collapsed .app-brand-title,
      .app-shell.sidebar-collapsed .app-nav-label,
      .app-shell.sidebar-collapsed .nav-text { display: none; }
      .app-shell.sidebar-collapsed .app-brand { justify-content: center; padding-left: 0; padding-right: 0; }
      .app-shell.sidebar-collapsed .sidebar-toggle { margin-left: 0; }
      .app-shell.sidebar-collapsed .app-nav-item { justify-content: center; padding: 0; }
      .agent-context-nav[hidden] { display: none !important; }
      .agent-missing-name { color: var(--muted); font-weight: 650; }
      .agent-id-label {
        margin: 18px 0 0; color: var(--soft); font-size: 11.5px;
        font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
      }
      .agent-id-value {
        margin: 5px 0 0; color: var(--muted); font-size: 13.5px;
        font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
      }


      /* ======================================================
          — Sidebar polished / collapsible
         ====================================================== */

      .app-shell {
        --sidebar-width: 238px;
        grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
        transition: grid-template-columns .22s ease;
      }

      .app-shell.sidebar-collapsed {
        --sidebar-width: 82px;
        grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
      }

      .app-sidebar {
        position: sticky;
        top: 0;
        height: 100vh;
        min-height: 100vh;
        overflow: visible;
        padding: 24px 16px;
        transition: padding .22s ease, width .22s ease;
        z-index: 15;
      }

      .app-brand {
        min-height: 62px;
        padding: 0 4px 20px;
        gap: 12px;
        transition: justify-content .22s ease, gap .22s ease;
      }

      .app-brand > div:not(.logo) {
        min-width: 0;
        overflow: hidden;
        white-space: nowrap;
        opacity: 1;
        transition: opacity .16s ease, width .22s ease;
      }

      .app-shell.sidebar-collapsed .app-brand {
        justify-content: center;
        gap: 0;
      }

      .app-shell.sidebar-collapsed .app-brand > div:not(.logo) {
        width: 0;
        opacity: 0;
      }

      .app-shell.sidebar-collapsed .app-brand .logo {
        width: 46px;
        height: 46px;
        flex: 0 0 46px;
      }

      /* Toggle flutuante, circular e centralizado verticalmente na borda */
      .sidebar-toggle {
        position: absolute;
        right: -18px;
        top: 50%;
        transform: translateY(-50%);
        width: 36px;
        height: 36px;
        margin: 0;
        padding: 0;
        display: grid;
        place-items: center;
        border: 1px solid rgba(254,233,147,.34);
        border-radius: 50%;
        background:
          linear-gradient(180deg, rgba(31,31,31,.98), rgba(17,17,17,.98));
        color: var(--gold);
        cursor: pointer;
        box-shadow:
          0 8px 26px rgba(0,0,0,.4),
          inset 0 1px 0 rgba(255,255,255,.055);
        transition:
          transform .18s ease,
          border-color .18s ease,
          background .18s ease,
          box-shadow .18s ease;
        z-index: 30;
      }

      .sidebar-toggle:hover {
        border-color: rgba(254,233,147,.62);
        background:
          linear-gradient(180deg, rgba(42,40,31,.99), rgba(22,21,17,.99));
        box-shadow:
          0 10px 32px rgba(0,0,0,.48),
          0 0 0 4px rgba(254,233,147,.035);
      }

      .sidebar-toggle:focus-visible {
        outline: 2px solid rgba(254,233,147,.7);
        outline-offset: 3px;
      }

      .toggle-icon {
        width: 18px;
        height: 18px;
        fill: none;
        stroke: currentColor;
        stroke-width: 2.2;
        stroke-linecap: round;
        stroke-linejoin: round;
        transition: transform .22s ease;
      }

      .app-shell.sidebar-collapsed .toggle-icon {
        transform: rotate(180deg);
      }

      .app-nav {
        gap: 7px;
      }

      .app-nav-label {
        overflow: hidden;
        white-space: nowrap;
        transition: opacity .14s ease, height .18s ease, margin .18s ease;
      }

      .app-nav-item {
        position: relative;
        width: 100%;
        min-height: 48px;
        padding: 0 13px;
        border: 1px solid transparent;
        appearance: none;
        text-align: left;
        cursor: pointer;
        transition:
          background .16s ease,
          border-color .16s ease,
          color .16s ease,
          padding .22s ease,
          justify-content .22s ease;
      }

      button.app-nav-item {
        font-family: inherit;
      }

      .app-nav-item:hover {
        background: rgba(255,255,255,.035);
        border-color: rgba(255,255,255,.07);
        color: var(--text);
      }

      .app-nav-item.active:hover {
        border-color: rgba(254,233,147,.28);
        background: rgba(254,233,147,.09);
        color: var(--gold);
      }

      .app-nav-item.coming-soon {
        opacity: .66;
      }

      .app-nav-item.coming-soon:hover {
        opacity: .92;
      }

      .nav-icon {
        width: 20px;
        height: 20px;
        flex: 0 0 20px;
        fill: none;
        stroke: currentColor;
        stroke-width: 1.8;
        stroke-linecap: round;
        stroke-linejoin: round;
      }

      .nav-text {
        min-width: 0;
        overflow: hidden;
        white-space: nowrap;
        opacity: 1;
        transition: opacity .12s ease, width .2s ease;
      }

      .agent-context-nav[hidden] {
        display: none !important;
      }

      .agent-context-nav {
        display: contents;
      }

      /* Modo compacto: somente ícones */
      .app-shell.sidebar-collapsed .app-sidebar {
        padding-left: 12px;
        padding-right: 12px;
      }

      .app-shell.sidebar-collapsed .app-nav-label {
        height: 0;
        margin: 0;
        opacity: 0;
      }

      .app-shell.sidebar-collapsed .app-nav-item {
        justify-content: center;
        padding-left: 0;
        padding-right: 0;
      }

      .app-shell.sidebar-collapsed .nav-text {
        width: 0;
        opacity: 0;
      }

      .app-shell.sidebar-collapsed .nav-icon {
        width: 22px;
        height: 22px;
        flex-basis: 22px;
      }

      /* Tooltip em modo compacto */
      .app-shell.sidebar-collapsed .app-nav-item[data-tooltip]::after {
        content: attr(data-tooltip);
        position: absolute;
        left: calc(100% + 12px);
        top: 50%;
        transform: translate(6px, -50%);
        padding: 8px 10px;
        border: 1px solid rgba(254,233,147,.18);
        border-radius: 9px;
        background: rgba(18,18,18,.98);
        color: var(--text);
        font-size: 12.5px;
        font-weight: 600;
        line-height: 1;
        white-space: nowrap;
        box-shadow: 0 12px 28px rgba(0,0,0,.4);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity .14s ease, transform .14s ease, visibility .14s ease;
        z-index: 60;
      }

      .app-shell.sidebar-collapsed .app-nav-item[data-tooltip]:hover::after,
      .app-shell.sidebar-collapsed .app-nav-item[data-tooltip]:focus-visible::after {
        opacity: 1;
        visibility: visible;
        transform: translate(0, -50%);
      }

      .app-shell.sidebar-collapsed .app-nav-item.active {
        box-shadow: inset 0 0 0 1px rgba(254,233,147,.025);
      }

      @media (max-width: 760px) {
        .app-shell,
        .app-shell.sidebar-collapsed {
          --sidebar-width: 1fr;
          grid-template-columns: 1fr;
        }

        .sidebar-toggle {
          display: none;
        }

        .app-shell.sidebar-collapsed .app-brand > div:not(.logo),
        .app-shell.sidebar-collapsed .nav-text {
          width: auto;
          opacity: 1;
          display: initial;
        }

        .app-shell.sidebar-collapsed .app-nav-item {
          justify-content: flex-start;
          padding: 0 12px;
        }
      }


      .agent-nav-spacer {
        height: 12px;
      }

      .app-shell.sidebar-collapsed .agent-nav-spacer {
        height: 10px;
      }


      /* ======================================================
         TRAINING
      ====================================================== */

      .training-page {
        min-width: 0;
        width: 100%;
        padding: 34px clamp(22px, 4vw, 56px) 64px;
      }

      .training-page-inner {
        width: min(1120px, 100%);
        margin: 0 auto;
      }

      .training-back {
        border: 0;
        padding: 0;
        background: transparent;
        color: var(--soft);
        cursor: pointer;
        font-size: 13px;
        font-weight: 700;
        letter-spacing: 0.01em;
        transition: color 180ms ease;
      }

      .training-back:hover {
        color: var(--gold);
      }

      .training-hero {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 26px;
        margin-top: 18px;
      }

      .training-eyebrow {
        margin: 0 0 8px;
        color: var(--gold-soft);
        font-size: 12px;
        font-weight: 800;
        letter-spacing: 0.11em;
        text-transform: uppercase;
      }

      .training-title {
        margin: 0;
        color: var(--text);
        font-size: clamp(30px, 4vw, 42px);
        line-height: 1.06;
        font-weight: 650;
        letter-spacing: -0.04em;
      }

      .training-copy {
        max-width: 720px;
        margin: 12px 0 0;
        color: var(--muted);
        font-size: 15px;
        line-height: 1.7;
      }

      .training-status-panel {
        min-width: 224px;
        padding: 14px 16px;
        border: 1px solid var(--border);
        border-radius: 16px;
        background: rgba(255,255,255,.025);
      }

      .training-status-line {
        display: flex;
        align-items: center;
        gap: 8px;
        color: var(--muted);
        font-size: 12.5px;
        line-height: 1.4;
      }

      .training-status-dot {
        width: 8px;
        height: 8px;
        flex: 0 0 auto;
        border-radius: 50%;
        background: rgba(255,255,255,.28);
        box-shadow: 0 0 0 4px rgba(255,255,255,.035);
      }

      .training-status-dot.saved {
        background: #9fe0ae;
        box-shadow: 0 0 0 4px rgba(159,224,174,.08);
      }

      .training-status-dot.saving {
        background: var(--gold);
        box-shadow: 0 0 0 4px rgba(254,233,147,.08);
      }

      .training-status-dot.error {
        background: var(--danger);
        box-shadow: 0 0 0 4px rgba(255,176,176,.08);
      }

      .training-status-label {
        font-weight: 700;
        color: var(--text);
      }

      .training-status-meta {
        margin: 9px 0 0;
        color: var(--soft);
        font-size: 11.5px;
        line-height: 1.5;
      }

      .training-agent-strip {
        margin-top: 26px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 16px;
        padding: 16px 18px;
        border: 1px solid var(--border);
        border-radius: 18px;
        background:
          linear-gradient(180deg, rgba(255,255,255,.035), rgba(255,255,255,.018));
      }

      .training-agent-info {
        display: flex;
        align-items: center;
        gap: 12px;
        min-width: 0;
      }

      .training-agent-avatar {
        width: 40px;
        height: 40px;
        display: grid;
        place-items: center;
        flex: 0 0 auto;
        border: 1px solid rgba(254,233,147,.24);
        border-radius: 12px;
        background: var(--gold-faint);
        color: var(--gold);
        font-weight: 800;
        overflow: hidden;
      }

      .training-agent-avatar img {
        width: 100%;
        height: 100%;
        object-fit: cover;
      }

      .training-agent-name {
        margin: 0;
        color: var(--text);
        font-size: 14px;
        font-weight: 800;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }

      .training-agent-company {
        margin: 3px 0 0;
        color: var(--soft);
        font-size: 12px;
      }

      .training-version {
        color: var(--soft);
        font-size: 12px;
        text-align: right;
      }

      .training-sections-nav {
        position: sticky;
        top: 0;
        z-index: 5;
        display: flex;
        gap: 8px;
        overflow-x: auto;
        margin: 26px -8px 0;
        padding: 10px 8px;
        scrollbar-width: none;
        background:
          linear-gradient(180deg, rgba(16,16,16,.98) 72%, rgba(16,16,16,0));
      }

      .training-sections-nav::-webkit-scrollbar {
        display: none;
      }

      .training-section-tab {
        min-height: 38px;
        padding: 0 14px;
        white-space: nowrap;
        border: 1px solid var(--border);
        border-radius: 999px;
        background: rgba(255,255,255,.028);
        color: var(--muted);
        cursor: pointer;
        font-size: 12.5px;
        font-weight: 750;
        transition: 180ms ease;
      }

      .training-section-tab:hover,
      .training-section-tab.active {
        border-color: rgba(254,233,147,.42);
        background: var(--gold-faint);
        color: var(--gold);
      }

      .training-form {
        display: grid;
        gap: 18px;
        margin-top: 10px;
      }

      .training-card {
        scroll-margin-top: 72px;
        padding: clamp(22px, 3vw, 30px);
        border: 1px solid var(--border);
        border-radius: 22px;
        background:
          linear-gradient(
            180deg,
            rgba(28,28,28,.92),
            rgba(20,20,20,.92)
          );
        box-shadow: 0 18px 46px rgba(0,0,0,.16);
      }

      .training-card-head {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 18px;
        margin-bottom: 24px;
      }

      .training-section-number {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 28px;
        height: 28px;
        margin-bottom: 12px;
        border: 1px solid rgba(254,233,147,.26);
        border-radius: 9px;
        background: var(--gold-faint);
        color: var(--gold);
        font-size: 12px;
        font-weight: 850;
      }

      .training-card h2 {
        margin: 0;
        color: var(--text);
        font-size: 21px;
        font-weight: 700;
        letter-spacing: -0.025em;
      }

      .training-card-description {
        max-width: 680px;
        margin: 7px 0 0;
        color: var(--soft);
        font-size: 13px;
        line-height: 1.65;
      }

      .training-fields {
        display: grid;
        gap: 20px;
      }

      .training-fields.two-columns {
        grid-template-columns: repeat(2, minmax(0,1fr));
      }

      .training-field {
        display: grid;
        gap: 8px;
        min-width: 0;
      }

      .training-field.full {
        grid-column: 1 / -1;
      }

      .training-field label,
      .training-list-label {
        color: var(--text);
        font-size: 13px;
        font-weight: 750;
        line-height: 1.4;
      }

      .training-field-help {
        margin: -2px 0 0;
        color: var(--soft);
        font-size: 11.5px;
        line-height: 1.55;
      }

      .training-field input,
      .training-field textarea {
        width: 100%;
        outline: none;
        border: 1px solid var(--border);
        border-radius: 13px;
        background: rgba(8,8,8,.7);
        color: var(--text);
        font: inherit;
        font-size: 13.5px;
        line-height: 1.55;
        transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
      }

      .training-field input {
        min-height: 46px;
        padding: 0 13px;
      }

      .training-field textarea {
        min-height: 104px;
        padding: 12px 13px;
        resize: vertical;
      }

      .training-field textarea.compact {
        min-height: 86px;
      }

      .training-field input::placeholder,
      .training-field textarea::placeholder {
        color: rgba(244,244,242,.27);
      }

      .training-field input:focus,
      .training-field textarea:focus,
      .training-list-input:focus {
        border-color: rgba(254,233,147,.5);
        background: rgba(11,11,11,.94);
        box-shadow: 0 0 0 3px rgba(254,233,147,.055);
      }

      .training-list {
        display: grid;
        gap: 10px;
      }

      .training-list-compose {
        display: grid;
        grid-template-columns: 1fr auto;
        gap: 9px;
      }

      .training-list-input {
        width: 100%;
        min-height: 44px;
        outline: none;
        padding: 0 13px;
        border: 1px solid var(--border);
        border-radius: 12px;
        background: rgba(8,8,8,.7);
        color: var(--text);
        font: inherit;
        font-size: 13px;
      }

      .training-list-add {
        min-height: 44px;
        padding: 0 14px;
        border: 1px solid rgba(254,233,147,.27);
        border-radius: 12px;
        background: var(--gold-faint);
        color: var(--gold);
        cursor: pointer;
        font-size: 12.5px;
        font-weight: 800;
      }

      .training-list-items {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
      }

      .training-list-empty {
        width: 100%;
        padding: 11px 12px;
        border: 1px dashed var(--border);
        border-radius: 12px;
        color: var(--soft);
        font-size: 11.5px;
      }

      .training-chip {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        max-width: 100%;
        padding: 8px 9px 8px 11px;
        border: 1px solid rgba(255,255,255,.11);
        border-radius: 11px;
        background: rgba(255,255,255,.035);
        color: var(--muted);
        font-size: 12px;
        line-height: 1.4;
      }

      .training-chip span {
        min-width: 0;
        overflow-wrap: anywhere;
      }

      .training-chip-remove {
        width: 22px;
        height: 22px;
        display: grid;
        place-items: center;
        flex: 0 0 auto;
        border: 0;
        border-radius: 7px;
        background: transparent;
        color: var(--soft);
        cursor: pointer;
        font-size: 16px;
        line-height: 1;
      }

      .training-chip-remove:hover {
        background: rgba(255,255,255,.055);
        color: var(--text);
      }

      .training-advanced {
        border-top: 1px solid var(--border);
        margin-top: 24px;
        padding-top: 18px;
      }

      .training-advanced summary {
        cursor: pointer;
        color: var(--muted);
        font-size: 12.5px;
        font-weight: 750;
        user-select: none;
      }

      .training-advanced summary:hover {
        color: var(--gold);
      }

      .training-advanced-content {
        display: grid;
        grid-template-columns: repeat(3,minmax(0,1fr));
        gap: 14px;
        margin-top: 18px;
      }

      .training-footer {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 18px;
        margin-top: 24px;
        padding: 18px 0 0;
      }

      .training-footer-copy {
        margin: 0;
        color: var(--soft);
        font-size: 12px;
        line-height: 1.55;
      }

      .training-publish {
        min-height: 44px;
        padding: 0 18px;
        border: 1px solid rgba(254,233,147,.52);
        border-radius: 12px;
        background: var(--gold);
        color: #17140a;
        font-size: 12.5px;
        font-weight: 850;
      }

      .training-publish:disabled {
        opacity: .42;
        cursor: not-allowed;
      }

      .training-loading,
      .training-load-error {
        display: grid;
        place-items: center;
        min-height: 360px;
        padding: 40px;
        border: 1px solid var(--border);
        border-radius: 22px;
        background: rgba(255,255,255,.02);
        text-align: center;
      }

      .training-load-error h3 {
        margin: 0;
        color: var(--text);
        font-size: 18px;
      }

      .training-load-error p {
        max-width: 520px;
        margin: 10px auto 0;
        color: var(--muted);
        font-size: 13px;
        line-height: 1.6;
      }

      .training-retry {
        min-height: 40px;
        margin-top: 18px;
        padding: 0 14px;
        border: 1px solid var(--gold-border);
        border-radius: 11px;
        background: var(--gold-faint);
        color: var(--gold);
        cursor: pointer;
        font-weight: 800;
      }

      @media (max-width: 900px) {
        .training-hero {
          display: grid;
        }

        .training-status-panel {
          min-width: 0;
          width: 100%;
        }

        .training-fields.two-columns,
        .training-advanced-content {
          grid-template-columns: 1fr;
        }
      }

      @media (max-width: 620px) {
        .training-page {
          padding: 24px 16px 44px;
        }

        .training-agent-strip {
          align-items: flex-start;
          flex-direction: column;
        }

        .training-version {
          text-align: left;
        }

        .training-list-compose {
          grid-template-columns: 1fr;
        }

        .training-footer {
          align-items: stretch;
          flex-direction: column;
        }

        .training-publish {
          width: 100%;
        }
      }


      /* ======================================================
         TRAINING  — Interest classification + human routing
      ====================================================== */

      .interest-training-block {
        padding: 18px;
        border: 1px solid rgba(254,233,147,.14);
        border-radius: 16px;
        background:
          linear-gradient(
            180deg,
            rgba(254,233,147,.045),
            rgba(255,255,255,.018)
          );
      }

      .interest-training-grid {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 12px;
        margin-top: 14px;
      }

      .interest-training-card {
        display: grid;
        gap: 9px;
        min-width: 0;
        padding: 15px;
        border: 1px solid var(--border);
        border-radius: 15px;
        background: rgba(8,8,8,.38);
      }

      .interest-training-card label {
        color: var(--text);
        font-size: 14px;
        font-weight: 800;
      }

      .interest-training-card p {
        margin: 0;
        color: var(--soft);
        font-size: 11.5px;
        line-height: 1.55;
      }

      .interest-training-card textarea {
        width: 100%;
        min-height: 220px;
        padding: 12px 13px;
        resize: vertical;
        outline: none;
        border: 1px solid var(--border);
        border-radius: 12px;
        background: rgba(8,8,8,.72);
        color: var(--text);
        font: inherit;
        font-size: 14px;
        line-height: 1.55;
        transition:
          border-color 160ms ease,
          background 160ms ease,
          box-shadow 160ms ease;
      }

      .interest-training-card textarea::placeholder {
        color: rgba(244,244,242,.27);
      }

      .interest-training-card textarea:focus {
        border-color: rgba(254,233,147,.5);
        background: rgba(11,11,11,.94);
        box-shadow: 0 0 0 3px rgba(254,233,147,.055);
      }

      .handoff-type-panel {
        padding: 16px;
        border: 1px solid var(--border);
        border-radius: 15px;
        background: rgba(255,255,255,.02);
      }

      .handoff-type-picker {
        display: flex;
        flex-wrap: wrap;
        gap: 9px;
        margin-top: 12px;
      }

      .handoff-type-button {
        min-height: 40px;
        padding: 0 14px;
        border: 1px solid var(--border);
        border-radius: 999px;
        background: rgba(255,255,255,.025);
        color: var(--muted);
        cursor: pointer;
        font: inherit;
        font-size: 12.5px;
        font-weight: 800;
        transition:
          border-color 160ms ease,
          background 160ms ease,
          color 160ms ease;
      }

      .handoff-type-button:hover {
        border-color: rgba(254,233,147,.3);
        color: var(--text);
      }

      .handoff-type-button.selected {
        border-color: rgba(254,233,147,.5);
        background: var(--gold-faint);
        color: var(--gold);
      }

      .handoff-route-type-badge {
        display: inline-flex;
        align-items: center;
        min-height: 22px;
        margin: 0 0 7px;
        padding: 0 8px;
        border: 1px solid rgba(254,233,147,.2);
        border-radius: 999px;
        background: rgba(254,233,147,.045);
        color: var(--gold-soft);
        font-size: 9.5px;
        font-weight: 850;
        letter-spacing: .055em;
        text-transform: uppercase;
      }

      @media (max-width: 900px) {
        .interest-training-grid {
          grid-template-columns: 1fr;
        }
      }


      /* ======================================================
         AGENT WORKSPACE
      ====================================================== */

      .agent-workspace-page,
      .agent-section-page {
        min-width: 0;
        width: 100%;
        padding: 34px clamp(22px, 4vw, 56px) 64px;
      }

      .agent-workspace-inner,
      .agent-section-inner {
        width: min(1120px, 100%);
        margin: 0 auto;
      }

      .agent-workspace-back {
        border: 0;
        padding: 0;
        background: transparent;
        color: var(--soft);
        cursor: pointer;
        font-size: 13px;
        font-weight: 700;
        transition: color 180ms ease;
      }

      .agent-workspace-back:hover {
        color: var(--gold);
      }

      .agent-workspace-hero {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr) auto;
        gap: 18px;
        align-items: center;
        margin-top: 22px;
        padding: 24px;
        border: 1px solid var(--border);
        border-radius: 22px;
        background:
          radial-gradient(circle at 0 0, rgba(254,233,147,.07), transparent 34%),
          linear-gradient(180deg, rgba(255,255,255,.032), rgba(255,255,255,.016));
      }

      .agent-workspace-avatar {
        width: 62px;
        height: 62px;
        display: grid;
        place-items: center;
        overflow: hidden;
        border: 1px solid rgba(254,233,147,.28);
        border-radius: 17px;
        background: var(--gold-faint);
        color: var(--gold);
        font-size: 19px;
        font-weight: 850;
      }

      .agent-workspace-avatar img {
        width: 100%;
        height: 100%;
        object-fit: cover;
      }

      .agent-workspace-kicker {
        margin: 0 0 5px;
        color: var(--gold-soft);
        font-size: 11px;
        font-weight: 800;
        letter-spacing: .1em;
        text-transform: uppercase;
      }

      .agent-workspace-name {
        margin: 0;
        color: var(--text);
        font-size: clamp(26px, 3vw, 36px);
        line-height: 1.08;
        letter-spacing: -.035em;
      }

      .agent-workspace-company {
        margin: 7px 0 0;
        color: var(--muted);
        font-size: 14px;
      }

      .agent-workspace-id {
        margin: 5px 0 0;
        color: var(--soft);
        font-size: 11.5px;
      }

      .agent-workspace-badges {
        display: flex;
        flex-wrap: wrap;
        justify-content: flex-end;
        gap: 8px;
      }

      .agent-workspace-grid {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 14px;
        margin-top: 24px;
      }

      .agent-workspace-card {
        min-height: 178px;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        padding: 20px;
        border: 1px solid var(--border);
        border-radius: 18px;
        background:
          linear-gradient(180deg, rgba(28,28,28,.9), rgba(19,19,19,.9));
        text-align: left;
        transition:
          transform 180ms ease,
          border-color 180ms ease,
          background 180ms ease;
      }

      button.agent-workspace-card,
      a.agent-workspace-card {
        width: 100%;
        color: inherit;
        cursor: pointer;
      }

      button.agent-workspace-card:hover,
      a.agent-workspace-card:hover {
        transform: translateY(-2px);
        border-color: rgba(254,233,147,.28);
        background:
          linear-gradient(180deg, rgba(33,31,24,.94), rgba(21,20,17,.94));
      }

      .agent-workspace-card-icon {
        width: 38px;
        height: 38px;
        display: grid;
        place-items: center;
        margin-bottom: 20px;
        border: 1px solid rgba(254,233,147,.18);
        border-radius: 11px;
        background: var(--gold-faint);
        color: var(--gold);
      }

      .agent-workspace-card-icon svg {
        width: 19px;
        height: 19px;
        fill: none;
        stroke: currentColor;
        stroke-width: 1.7;
        stroke-linecap: round;
        stroke-linejoin: round;
      }

      .agent-workspace-card-title {
        margin: 0;
        color: var(--text);
        font-size: 15px;
        font-weight: 800;
      }

      .agent-workspace-card-copy {
        margin: 7px 0 0;
        color: var(--soft);
        font-size: 12px;
        line-height: 1.55;
      }

      .agent-workspace-card-status {
        margin-top: auto;
        padding-top: 15px;
        color: var(--gold-soft);
        font-size: 11px;
        font-weight: 750;
      }

      .agent-section-hero {
        margin-top: 22px;
        padding: 28px;
        border: 1px solid var(--border);
        border-radius: 22px;
        background:
          radial-gradient(circle at 0 0, rgba(254,233,147,.07), transparent 32%),
          linear-gradient(180deg, rgba(255,255,255,.032), rgba(255,255,255,.015));
      }

      .agent-section-kicker {
        margin: 0 0 7px;
        color: var(--gold-soft);
        font-size: 11px;
        font-weight: 800;
        letter-spacing: .1em;
        text-transform: uppercase;
      }

      .agent-section-title {
        margin: 0;
        color: var(--text);
        font-size: clamp(28px, 4vw, 40px);
        line-height: 1.08;
        letter-spacing: -.035em;
      }

      .agent-section-copy {
        max-width: 720px;
        margin: 11px 0 0;
        color: var(--muted);
        font-size: 14px;
        line-height: 1.7;
      }

      .agent-section-placeholder {
        margin-top: 20px;
        padding: 28px;
        border: 1px dashed var(--border);
        border-radius: 18px;
        color: var(--soft);
        font-size: 13px;
        line-height: 1.65;
      }

      .agent-context-name {
        display: block;
        max-width: 170px;
        margin: -4px 12px 9px;
        color: var(--gold-soft);
        font-size: 11px;
        line-height: 1.35;
        font-weight: 750;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }

      .app-shell.sidebar-collapsed .agent-context-name {
        display: none;
      }

      @media (max-width: 980px) {
        .agent-workspace-grid {
          grid-template-columns: repeat(2, minmax(0, 1fr));
        }
      }

      @media (max-width: 680px) {
        .agent-workspace-page,
        .agent-section-page {
          padding: 24px 16px 44px;
        }

        .agent-workspace-hero {
          grid-template-columns: auto 1fr;
        }

        .agent-workspace-badges {
          grid-column: 1 / -1;
          justify-content: flex-start;
        }

        .agent-workspace-grid {
          grid-template-columns: 1fr;
        }
      }


      /* Training  typography refinements */
      .agent-context-name {
        max-width: 178px;
        margin-top: -1px;
        margin-bottom: 12px;
        font-size: 13.5px;
        line-height: 1.45;
      }

      .training-section-tab {
        min-height: 44px;
        padding: 0 17px;
        font-size: 14px;
      }

      .training-card h2 {
        font-size: 24px;
      }

      .training-card-description {
        font-size: 14.5px;
      }

      .training-field label,
      .training-list-label {
        font-size: 15px;
      }

      .training-field-help {
        font-size: 13px;
      }

      .training-field input,
      .training-field textarea,
      .training-list-input,
      .training-list-add {
        font-size: 15px;
      }

      .training-chip {
        font-size: 13.5px;
      }

      .training-choice-group {
        display: flex;
        flex-wrap: wrap;
        gap: 9px;
      }

      .training-choice {
        min-height: 39px;
        padding: 0 12px;
        border: 1px solid var(--border);
        border-radius: 999px;
        background: rgba(255,255,255,.025);
        color: var(--muted);
        cursor: pointer;
        font-size: 13px;
        font-weight: 750;
        transition: 160ms ease;
      }

      .training-choice:hover {
        border-color: rgba(254,233,147,.32);
        color: var(--text);
      }

      .training-choice.selected {
        border-color: rgba(254,233,147,.52);
        background: var(--gold-faint);
        color: var(--gold);
      }

      .training-choice-counter {
        margin: 8px 0 0;
        color: var(--soft);
        font-size: 12px;
      }

      .training-voice-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px;
      }

      .training-field select {
        width: 100%;
        min-height: 46px;
        outline: none;
        padding: 0 13px;
        border: 1px solid var(--border);
        border-radius: 13px;
        background: rgba(8,8,8,.7);
        color: var(--text);
        font: inherit;
        font-size: 15px;
      }

      .handoff-builder {
        display: grid;
        grid-template-columns: 1.2fr .8fr 1fr auto;
        gap: 9px;
        align-items: end;
      }

      .handoff-route-list {
        display: grid;
        gap: 10px;
      }

      .handoff-route-card {
        display: grid;
        grid-template-columns: 1.2fr .8fr 1fr auto;
        gap: 12px;
        align-items: start;
        padding: 14px;
        border: 1px solid var(--border);
        border-radius: 14px;
        background: rgba(255,255,255,.025);
      }

      .handoff-route-item strong {
        display: block;
        margin-bottom: 4px;
        color: var(--soft);
        font-size: 10px;
        letter-spacing: .06em;
        text-transform: uppercase;
      }

      .handoff-route-item span {
        color: var(--muted);
        font-size: 13px;
        line-height: 1.5;
      }

      .training-experimental {
        display: inline-flex;
        margin-left: 6px;
        padding: 2px 7px;
        border: 1px solid rgba(254,233,147,.22);
        border-radius: 999px;
        color: var(--gold-soft);
        font-size: 10px;
        font-weight: 800;
        letter-spacing: .03em;
        text-transform: uppercase;
      }

      @media (max-width: 900px) {
        .training-voice-grid,
        .handoff-builder,
        .handoff-route-card {
          grid-template-columns: 1fr;
        }
      }


      /* ======================================================
         TRAINING — Choice controls and section navigation
      ====================================================== */

      .training-sections-nav {
        margin: 26px 0 0;
        padding: 10px;
        border: 1px solid var(--border);
        border-radius: 18px;
        background: rgba(15, 15, 15, .96);
        box-shadow: 0 12px 28px rgba(0, 0, 0, .16);
      }

      #communicationToneChoices,
      #responseStyleChoices {
        margin-top: 16px;
      }

      .training-choice-group {
        row-gap: 10px;
      }

      .training-choice-counter {
        display: none !important;
      }

      /* Custom voice picker */
      .voice-picker {
        position: relative;
      }

      .voice-picker-trigger {
        width: 100%;
        min-height: 50px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 14px;
        padding: 0 14px;
        border: 1px solid var(--border);
        border-radius: 13px;
        background: rgba(8, 8, 8, .7);
        color: var(--text);
        cursor: pointer;
        font: inherit;
        font-size: 15px;
        text-align: left;
        transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
      }

      .voice-picker-trigger:hover,
      .voice-picker.open .voice-picker-trigger {
        border-color: rgba(254, 233, 147, .46);
        background: rgba(11, 11, 11, .96);
        box-shadow: 0 0 0 3px rgba(254, 233, 147, .045);
      }

      .voice-picker-value {
        display: flex;
        align-items: center;
        gap: 10px;
        min-width: 0;
      }

      .voice-picker-value-main {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }

      .voice-picker-value-meta {
        color: var(--soft);
        font-size: 12px;
        white-space: nowrap;
      }

      .voice-picker-chevron {
        flex: 0 0 auto;
        color: var(--soft);
        transition: transform 160ms ease;
      }

      .voice-picker.open .voice-picker-chevron {
        transform: rotate(180deg);
      }

      .voice-picker-panel {
        position: absolute;
        z-index: 30;
        top: calc(100% + 8px);
        left: 0;
        right: 0;
        max-height: 390px;
        overflow: auto;
        padding: 12px;
        border: 1px solid rgba(254, 233, 147, .22);
        border-radius: 16px;
        background: #121212;
        box-shadow: 0 22px 50px rgba(0, 0, 0, .5);
      }

      .voice-picker-panel[hidden] {
        display: none;
      }

      .voice-picker-group + .voice-picker-group {
        margin-top: 16px;
        padding-top: 16px;
        border-top: 1px solid var(--border);
      }

      .voice-picker-group-title {
        margin: 0 0 9px;
        color: var(--gold-soft);
        font-size: 11px;
        font-weight: 850;
        letter-spacing: .08em;
        text-transform: uppercase;
      }

      .voice-picker-grid {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 7px;
      }

      .voice-option {
        min-height: 40px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        padding: 0 11px;
        border: 1px solid var(--border);
        border-radius: 10px;
        background: rgba(255, 255, 255, .025);
        color: var(--muted);
        cursor: pointer;
        font: inherit;
        font-size: 13px;
        font-weight: 700;
        text-align: left;
        transition: 150ms ease;
      }

      .voice-option:hover {
        border-color: rgba(254, 233, 147, .3);
        background: rgba(254, 233, 147, .045);
        color: var(--text);
      }

      .voice-option.selected {
        border-color: rgba(254, 233, 147, .5);
        background: var(--gold-faint);
        color: var(--gold);
      }

      .voice-option-check {
        opacity: 0;
        color: var(--gold);
        font-size: 12px;
      }

      .voice-option.selected .voice-option-check {
        opacity: 1;
      }

      @media (max-width: 760px) {
        .voice-picker-grid {
          grid-template-columns: repeat(2, minmax(0, 1fr));
        }
      }

      @media (max-width: 480px) {
        .voice-picker-grid {
          grid-template-columns: 1fr;
        }
      }


      /* ======================================================
         TRAINING — Publish action and handoff readability
      ====================================================== */

      .handoff-route-item strong {
        font-size: 11.5px;
      }

      .handoff-route-item span {
        font-size: 15px;
        line-height: 1.6;
      }

      .training-footer {
        display: grid;
        gap: 14px;
        margin-top: 30px;
      }

      .training-footer-copy {
        text-align: center;
        font-size: 13px;
      }

      .training-publish {
        width: 100%;
        min-height: 62px;
        padding: 0 24px;
        border-radius: 15px;
        font-size: 16px;
        letter-spacing: .01em;
        box-shadow: 0 10px 30px rgba(254, 233, 147, .08);
        transition:
          transform 180ms ease,
          box-shadow 180ms ease,
          filter 180ms ease,
          opacity 180ms ease;
      }

      .training-publish:not(:disabled) {
        cursor: pointer;
        animation: trainingPublishPulse 2.2s ease-in-out infinite;
      }

      .training-publish:not(:disabled):hover {
        animation-play-state: paused;
        transform: translateY(-2px) scale(1.006);
        box-shadow:
          0 14px 38px rgba(254, 233, 147, .18),
          0 0 0 5px rgba(254, 233, 147, .05);
        filter: brightness(1.035);
      }

      .training-publish:disabled {
        min-height: 62px;
        opacity: .38;
      }

      @keyframes trainingPublishPulse {
        0%, 100% {
          transform: scale(1);
          box-shadow:
            0 10px 30px rgba(254, 233, 147, .08),
            0 0 0 0 rgba(254, 233, 147, 0);
        }

        50% {
          transform: scale(1.008);
          box-shadow:
            0 14px 34px rgba(254, 233, 147, .16),
            0 0 0 7px rgba(254, 233, 147, .045);
        }
      }

      @media (prefers-reduced-motion: reduce) {
        .training-publish:not(:disabled) {
          animation: none;
        }
      }


      /* TRAINING — Footer width and alignment */
      .training-footer {
        width: min(760px, 100%);
        margin: 34px auto 0;
        justify-items: center;
        text-align: center;
      }

      .training-publish {
        width: 100%;
      }

      .training-footer-copy {
        width: 100%;
        margin: 0;
        text-align: center;
      }

      .voice-picker-value {
        align-items: baseline;
      }

      .voice-picker-value-main,
      .voice-picker-value-meta {
        line-height: 1.2;
      }

      .voice-picker-value-meta {
        display: inline-flex;
        align-items: center;
        transform: translateY(1px);
      }


      /* ======================================================
         TRAINING STEP 6 — PUBLISH / HISTORY
      ====================================================== */

      .training-version-column {
        display: grid;
        justify-items: end;
        gap: 10px;
      }

      .training-history-button {
        min-height: 36px;
        padding: 0 12px;
        border: 1px solid var(--border);
        border-radius: 10px;
        background: rgba(255,255,255,.025);
        color: var(--muted);
        cursor: pointer;
        font-size: 12px;
        font-weight: 750;
        transition: 160ms ease;
      }

      .training-history-button:hover {
        border-color: rgba(254,233,147,.34);
        color: var(--gold);
      }

      .training-modal-backdrop {
        position: fixed;
        inset: 0;
        z-index: 1000;
        display: grid;
        place-items: center;
        padding: 22px;
        background: rgba(0,0,0,.72);
        backdrop-filter: blur(8px);
      }

      .training-modal-backdrop[hidden] {
        display: none;
      }

      .training-modal {
        width: min(620px, 100%);
        max-height: min(760px, calc(100vh - 44px));
        overflow: auto;
        padding: 24px;
        border: 1px solid rgba(254,233,147,.22);
        border-radius: 20px;
        background: #151515;
        box-shadow: 0 30px 80px rgba(0,0,0,.58);
      }

      .training-modal-head {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 18px;
      }

      .training-modal-title {
        margin: 0;
        color: var(--text);
        font-size: 22px;
        letter-spacing: -.02em;
      }

      .training-modal-copy {
        margin: 8px 0 0;
        color: var(--muted);
        font-size: 13px;
        line-height: 1.65;
      }

      .training-modal-close {
        width: 36px;
        height: 36px;
        display: grid;
        place-items: center;
        flex: 0 0 auto;
        border: 1px solid var(--border);
        border-radius: 10px;
        background: rgba(255,255,255,.025);
        color: var(--muted);
        cursor: pointer;
        font-size: 18px;
      }

      .training-modal-field {
        display: grid;
        gap: 8px;
        margin-top: 22px;
      }

      .training-modal-field label {
        color: var(--text);
        font-size: 13px;
        font-weight: 750;
      }

      .training-modal-field input {
        min-height: 46px;
        width: 100%;
        padding: 0 13px;
        outline: none;
        border: 1px solid var(--border);
        border-radius: 12px;
        background: rgba(8,8,8,.8);
        color: var(--text);
        font: inherit;
        font-size: 14px;
      }

      .training-modal-field input:focus {
        border-color: rgba(254,233,147,.46);
        box-shadow: 0 0 0 3px rgba(254,233,147,.05);
      }

      .training-modal-actions {
        display: flex;
        justify-content: flex-end;
        gap: 10px;
        margin-top: 22px;
      }

      .training-modal-secondary,
      .training-modal-primary {
        min-height: 42px;
        padding: 0 15px;
        border-radius: 11px;
        cursor: pointer;
        font-size: 13px;
        font-weight: 800;
      }

      .training-modal-secondary {
        border: 1px solid var(--border);
        background: transparent;
        color: var(--muted);
      }

      .training-modal-primary {
        border: 1px solid rgba(254,233,147,.5);
        background: var(--gold);
        color: #17140a;
      }

      .training-modal-primary:disabled {
        opacity: .45;
        cursor: not-allowed;
      }

      .training-versions-list {
        display: grid;
        gap: 10px;
        margin-top: 20px;
      }

      .training-version-card {
        display: grid;
        grid-template-columns: auto minmax(0,1fr) auto;
        gap: 12px;
        align-items: center;
        padding: 14px;
        border: 1px solid var(--border);
        border-radius: 14px;
        background: rgba(255,255,255,.025);
      }

      .training-version-number {
        width: 42px;
        height: 42px;
        display: grid;
        place-items: center;
        border: 1px solid rgba(254,233,147,.22);
        border-radius: 11px;
        background: var(--gold-faint);
        color: var(--gold);
        font-size: 12px;
        font-weight: 850;
      }

      .training-version-name {
        margin: 0;
        color: var(--text);
        font-size: 13.5px;
        font-weight: 800;
      }

      .training-version-date {
        margin: 4px 0 0;
        color: var(--soft);
        font-size: 11.5px;
      }

      .training-version-source {
        display: inline-flex;
        margin-left: 7px;
        padding: 2px 7px;
        border: 1px solid var(--border);
        border-radius: 999px;
        color: var(--soft);
        font-size: 9.5px;
        font-weight: 800;
        text-transform: uppercase;
      }

      .training-version-restore {
        min-height: 36px;
        padding: 0 11px;
        border: 1px solid rgba(254,233,147,.26);
        border-radius: 10px;
        background: transparent;
        color: var(--gold-soft);
        cursor: pointer;
        font-size: 11.5px;
        font-weight: 800;
      }

      .training-version-restore:hover {
        background: var(--gold-faint);
      }

      .training-version-current {
        color: #9fe0ae;
        font-size: 11px;
        font-weight: 800;
      }

      .training-versions-empty {
        padding: 24px;
        border: 1px dashed var(--border);
        border-radius: 14px;
        color: var(--soft);
        font-size: 12.5px;
        text-align: center;
      }

      @media (max-width: 600px) {
        .training-version-column {
          justify-items: start;
        }

        .training-version-card {
          grid-template-columns: auto 1fr;
        }

        .training-version-card > :last-child {
          grid-column: 1 / -1;
        }

        .training-version-restore {
          width: 100%;
        }
      }


      /* ======================================================
         TRAINING  — CLOSING METHOD
      ====================================================== */

      .training-help-link {
        width: fit-content;
        display: inline-flex;
        align-items: center;
        gap: 5px;
        margin-top: 8px;
        color: var(--muted);
        font-size: 13px;
        line-height: 1.5;
        font-weight: 650;
        text-decoration: none;
        transition: color 160ms ease;
      }

      .training-help-link span {
        color: var(--gold);
        font-weight: 800;
      }

      .training-help-link:hover {
        color: var(--text);
      }

      .training-help-link:hover span {
        text-decoration: underline;
      }

      .closing-method-block {
        display: grid;
        gap: 14px;
        padding: 18px;
        border: 1px solid rgba(254,233,147,.13);
        border-radius: 16px;
        background:
          linear-gradient(180deg, rgba(254,233,147,.035), rgba(255,255,255,.015));
      }

      .closing-method-options {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 11px;
      }

      .closing-method-option {
        min-height: 116px;
        display: grid;
        align-content: start;
        gap: 7px;
        padding: 15px;
        border: 1px solid var(--border);
        border-radius: 14px;
        background: rgba(8,8,8,.46);
        color: inherit;
        cursor: pointer;
        text-align: left;
        transition:
          border-color 160ms ease,
          background 160ms ease,
          transform 160ms ease,
          box-shadow 160ms ease;
      }

      .closing-method-option:hover {
        transform: translateY(-1px);
        border-color: rgba(254,233,147,.3);
        background: rgba(254,233,147,.035);
      }

      .closing-method-option.selected {
        border-color: rgba(254,233,147,.52);
        background: var(--gold-faint);
        box-shadow: 0 0 0 3px rgba(254,233,147,.035);
      }

      .closing-method-option-title {
        color: var(--text);
        font-size: 14px;
        font-weight: 850;
      }

      .closing-method-option.selected .closing-method-option-title {
        color: var(--gold);
      }

      .closing-method-option-copy {
        color: var(--soft);
        font-size: 12.5px;
        line-height: 1.58;
        font-weight: 500;
      }

      .closing-human-details {
        display: grid;
        grid-template-columns: 1fr;
        gap: 12px;
        margin-top: 2px;
        padding-top: 14px;
        border-top: 1px solid var(--border);
      }

      .closing-human-details[hidden] {
        display: none !important;
      }

      @media (max-width: 760px) {
        .closing-method-options,
        .closing-human-details {
          grid-template-columns: 1fr;
        }
      }


      /* ======================================================
         AGENT WORKSPACE  — STATUS / ACTIVATION
      ====================================================== */

      .agent-context-home {
        position: relative;
        width: calc(100% - 14px);
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 2px 8px;
        align-items: center;
        margin: 3px 7px 9px;
        padding: 9px 9px 10px;
        border: 1px solid transparent;
        border-radius: 11px;
        background: transparent;
        color: inherit;
        cursor: pointer;
        text-align: left;
        transition:
          background 160ms ease,
          border-color 160ms ease,
          transform 160ms ease;
      }

      .agent-context-home:hover {
        border-color: rgba(254,233,147,.14);
        background: rgba(254,233,147,.045);
        transform: translateX(1px);
      }

      .agent-context-home-label {
        grid-column: 1 / -1;
        color: var(--soft);
        font-size: 10px;
        line-height: 1.2;
        font-weight: 800;
        letter-spacing: .08em;
        text-transform: uppercase;
      }

      .agent-context-home .agent-context-name {
        max-width: 150px;
        margin: 3px 0 0;
        color: var(--gold-soft);
        font-size: 13.5px;
        line-height: 1.35;
      }

      .agent-context-home-arrow {
        align-self: end;
        margin-bottom: 1px;
        color: rgba(254,233,147,.56);
        font-size: 13px;
        transition: transform 160ms ease, color 160ms ease;
      }

      .agent-context-home:hover .agent-context-home-arrow {
        color: var(--gold);
        transform: translateX(2px);
      }

      .app-shell.sidebar-collapsed .agent-context-home {
        display: none;
      }

      .agent-workspace-badges {
        gap: 9px;
      }

      .status-pill,
      .connection-pill {
        position: relative;
        min-height: 32px;
        display: inline-flex;
        align-items: center;
        gap: 7px;
        padding: 0 11px;
        border: 1px solid;
        border-radius: 999px;
        font-size: 11px;
        font-weight: 850;
        letter-spacing: .01em;
        box-shadow: inset 0 1px 0 rgba(255,255,255,.025);
      }

      .status-pill::before,
      .connection-pill::before {
        content: "";
        width: 7px;
        height: 7px;
        flex: 0 0 7px;
        border-radius: 999px;
        background: currentColor;
        box-shadow: 0 0 0 3px currentColor;
        opacity: .88;
      }

      .status-pill.active,
      .connection-pill.connected {
        border-color: rgba(96,218,133,.28);
        background: rgba(96,218,133,.085);
        color: #9deab6;
        box-shadow:
          inset 0 1px 0 rgba(255,255,255,.025),
          0 0 18px rgba(96,218,133,.035);
      }

      .status-pill.inactive {
        border-color: rgba(245,189,92,.28);
        background: rgba(245,189,92,.075);
        color: #f2c779;
        box-shadow:
          inset 0 1px 0 rgba(255,255,255,.025),
          0 0 18px rgba(245,189,92,.035);
      }

      .connection-pill.disconnected {
        border-color: rgba(222,123,112,.25);
        background: rgba(222,123,112,.07);
        color: #e5aaa2;
        box-shadow:
          inset 0 1px 0 rgba(255,255,255,.025),
          0 0 18px rgba(222,123,112,.03);
      }

      .status-pill::before,
      .connection-pill::before {
        box-shadow: 0 0 7px currentColor;
      }

      .agent-activation-notice {
        position: relative;
        display: grid;
        grid-template-columns: auto minmax(0, 1fr) auto;
        gap: 16px;
        align-items: center;
        margin-top: 14px;
        padding: 18px 19px;
        overflow: hidden;
        border: 1px solid rgba(254,233,147,.18);
        border-radius: 17px;
        background:
          radial-gradient(circle at 0 0, rgba(254,233,147,.085), transparent 29%),
          linear-gradient(100deg, rgba(39,34,18,.66), rgba(21,20,17,.92) 58%, rgba(17,17,17,.96));
        box-shadow: 0 16px 42px rgba(0,0,0,.12);
      }

      .agent-activation-notice[hidden] {
        display: none !important;
      }

      .agent-activation-notice-icon {
        width: 42px;
        height: 42px;
        display: grid;
        place-items: center;
        border: 1px solid rgba(254,233,147,.23);
        border-radius: 12px;
        background: rgba(254,233,147,.07);
        color: var(--gold);
      }

      .agent-activation-notice-icon svg {
        width: 20px;
        height: 20px;
        fill: none;
        stroke: currentColor;
        stroke-width: 1.7;
        stroke-linecap: round;
        stroke-linejoin: round;
      }

      .agent-activation-notice-content {
        min-width: 0;
      }

      .agent-activation-notice-kicker {
        margin: 0 0 4px;
        color: var(--gold-soft);
        font-size: 10px;
        font-weight: 850;
        letter-spacing: .09em;
        text-transform: uppercase;
      }

      .agent-activation-notice-title {
        margin: 0;
        color: var(--text);
        font-size: 15px;
        line-height: 1.35;
        font-weight: 850;
        letter-spacing: -.01em;
      }

      .agent-activation-notice-copy {
        max-width: 760px;
        margin: 6px 0 0;
        color: var(--muted);
        font-size: 12.5px;
        line-height: 1.6;
      }

      .agent-activation-notice-action {
        min-height: 42px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        padding: 0 14px;
        border: 1px solid rgba(254,233,147,.36);
        border-radius: 11px;
        background: rgba(254,233,147,.1);
        color: var(--gold);
        cursor: pointer;
        font: inherit;
        font-size: 12px;
        font-weight: 850;
        white-space: nowrap;
        transition:
          transform 160ms ease,
          border-color 160ms ease,
          background 160ms ease;
      }

      .agent-activation-notice-action:hover {
        transform: translateY(-1px);
        border-color: rgba(254,233,147,.56);
        background: rgba(254,233,147,.145);
      }

      @media (max-width: 760px) {
        .agent-activation-notice {
          grid-template-columns: auto 1fr;
        }

        .agent-activation-notice-action {
          grid-column: 1 / -1;
          width: 100%;
        }
      }


      /* ======================================================
         FRONTEND  — LONG CONTENT / RESPONSIVE HARDENING
      ====================================================== */

      html,
      body {
        max-width: 100%;
        overflow-x: clip;
      }

      .app-shell,
      .app-content,
      .agent-workspace-page,
      .training-page,
      .training-card,
      .training-fields,
      .handoff-builder,
      .handoff-route-list,
      .handoff-route-card,
      .handoff-route-item {
        min-width: 0;
      }

      .handoff-builder > *,
      .handoff-route-card > * {
        min-width: 0;
      }

      .handoff-auto-grow {
        width: 100%;
        min-height: 46px;
        max-height: 240px;
        padding: 12px 13px;
        overflow-y: auto;
        resize: none;
        outline: none;
        border: 1px solid var(--border);
        border-radius: 12px;
        background: rgba(8,8,8,.72);
        color: var(--text);
        font: inherit;
        font-size: 15px;
        line-height: 1.5;
        transition:
          border-color 160ms ease,
          background 160ms ease,
          box-shadow 160ms ease;
      }

      .handoff-auto-grow:focus {
        border-color: rgba(254,233,147,.5);
        background: rgba(11,11,11,.94);
        box-shadow: 0 0 0 3px rgba(254,233,147,.055);
      }

      .handoff-route-item span {
        display: block;
        max-width: 100%;
        overflow-wrap: anywhere;
        word-break: break-word;
        white-space: normal;
      }

      .handoff-route-card {
        overflow: hidden;
      }


      /* ======================================================
         AGENT WORKSPACE  — ACTIVATION BANNERS
      ====================================================== */

      .agent-activation-notice {
        gap: 19px;
        padding: 22px 22px;
      }

      .agent-activation-notice-icon {
        width: 56px;
        height: 56px;
        border-radius: 15px;
      }

      .agent-activation-notice-icon svg {
        width: 31px;
        height: 31px;
        stroke-width: 2.05;
      }

      .agent-activation-notice-kicker {
        margin-bottom: 5px;
        font-size: 13px;
        letter-spacing: .075em;
      }

      .agent-activation-notice-title {
        font-size: 18px;
        line-height: 1.35;
      }

      .agent-activation-notice-copy {
        max-width: 840px;
        margin-top: 7px;
        font-size: 14px;
        line-height: 1.65;
      }

      .agent-activation-notice-action {
        min-height: 46px;
        padding: 0 16px;
        font-size: 13.5px;
      }

      .agent-connection-notice {
        border-color: rgba(96,218,133,.2);
        background:
          radial-gradient(circle at 0 0, rgba(96,218,133,.08), transparent 29%),
          linear-gradient(100deg, rgba(18,40,26,.62), rgba(18,24,20,.92) 58%, rgba(17,17,17,.96));
      }

      .agent-connection-notice-icon {
        border-color: rgba(96,218,133,.24);
        background: rgba(96,218,133,.075);
        color: #9deab6;
      }

      .agent-connection-notice-kicker {
        color: #9deab6;
      }

      .agent-connection-notice-action {
        border-color: rgba(96,218,133,.34);
        background: rgba(96,218,133,.09);
        color: #a9edbc;
      }

      .agent-connection-notice-action:hover {
        border-color: rgba(96,218,133,.52);
        background: rgba(96,218,133,.14);
      }


      /* ======================================================
         FRONTEND  — HUMAN HANDOFF LAYOUT
      ====================================================== */

      #trainingSectionLimits .handoff-builder {
        display: grid;
        grid-template-columns:
          minmax(0, 1fr)
          minmax(0, 1fr)
          auto;
        grid-template-areas:
          "when when when"
          "category collect add";
        gap: 12px 10px;
        align-items: end;
      }

      #trainingSectionLimits .handoff-when-field {
        grid-area: when;
        min-width: 0;
      }

      #trainingSectionLimits .handoff-category-field {
        grid-area: category;
        min-width: 0;
      }

      #trainingSectionLimits .handoff-collect-field {
        grid-area: collect;
        min-width: 0;
      }

      #trainingSectionLimits #addHandoffRoute {
        grid-area: add;
        min-height: 46px;
        align-self: end;
      }

      #trainingSectionLimits .handoff-when-field .handoff-auto-grow {
        width: 100%;
        min-height: 52px;
      }

      #trainingSectionLimits .handoff-category-field input,
      #trainingSectionLimits .handoff-collect-field input {
        width: 100%;
        min-width: 0;
      }

      @media (max-width: 900px) {
        #trainingSectionLimits .handoff-builder {
          grid-template-columns: 1fr;
          grid-template-areas:
            "when"
            "category"
            "collect"
            "add";
        }

        #trainingSectionLimits #addHandoffRoute {
          width: 100%;
        }
      }


      /* ======================================================
         KNOWLEDGE  — NATIVE KNOWLEDGE MANAGEMENT
      ====================================================== */

      .knowledge-page {
        min-height: calc(100vh - 76px);
      }

      .knowledge-page-inner {
        width: min(1120px, calc(100% - 44px));
        margin: 0 auto;
        padding: 28px 0 72px;
      }

      .knowledge-hero {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 28px;
        align-items: start;
        margin: 16px 0 24px;
      }

      .knowledge-hero-copy h1 {
        max-width: 760px;
        margin: 8px 0 10px;
        color: var(--text);
        font-size: clamp(30px, 4vw, 45px);
        line-height: 1.04;
        letter-spacing: -.045em;
      }

      .knowledge-hero-copy > p:last-child {
        max-width: 760px;
        margin: 0;
        color: var(--muted);
        font-size: 15px;
        line-height: 1.7;
      }

      .knowledge-status-card {
        min-width: 220px;
      }

      .knowledge-agent-card {
        margin-bottom: 22px;
      }

      .knowledge-summary {
        display: flex;
        align-items: center;
        gap: 9px;
      }

      .knowledge-summary-item {
        min-width: 84px;
        padding: 9px 12px;
        border: 1px solid var(--border);
        border-radius: 12px;
        background: rgba(255,255,255,.018);
        text-align: center;
      }

      .knowledge-summary-item strong {
        display: block;
        color: var(--text);
        font-size: 16px;
        line-height: 1.1;
      }

      .knowledge-summary-item span {
        display: block;
        margin-top: 4px;
        color: var(--soft);
        font-size: 10px;
        font-weight: 700;
      }

      .knowledge-section-nav {
        margin-bottom: 12px;
      }

      .knowledge-section {
        scroll-margin-top: 18px;
        margin-top: 12px;
      }

      .knowledge-upload-box {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr) auto;
        gap: 16px;
        align-items: center;
        margin-top: 25px;
        padding: 20px;
        border: 1px dashed rgba(254,233,147,.24);
        border-radius: 16px;
        background:
          radial-gradient(circle at 0 0, rgba(254,233,147,.055), transparent 31%),
          rgba(8,8,8,.36);
        transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
      }

      .knowledge-upload-box.dragging {
        border-color: rgba(254,233,147,.62);
        background: rgba(254,233,147,.065);
        transform: translateY(-1px);
      }

      .knowledge-upload-icon {
        width: 48px;
        height: 48px;
        display: grid;
        place-items: center;
        border: 1px solid rgba(254,233,147,.2);
        border-radius: 13px;
        background: rgba(254,233,147,.07);
        color: var(--gold);
      }

      .knowledge-upload-icon svg {
        width: 23px;
        height: 23px;
        fill: none;
        stroke: currentColor;
        stroke-width: 1.7;
        stroke-linecap: round;
        stroke-linejoin: round;
      }

      .knowledge-upload-copy {
        min-width: 0;
      }

      .knowledge-upload-copy strong {
        display: block;
        color: var(--text);
        font-size: 14px;
      }

      .knowledge-upload-copy span,
      .knowledge-upload-copy small {
        display: block;
        margin-top: 5px;
        color: var(--muted);
        font-size: 12px;
        line-height: 1.45;
      }

      .knowledge-upload-copy small {
        color: var(--soft);
        font-size: 10.5px;
      }

      .knowledge-primary-button,
      .knowledge-secondary-button {
        min-height: 42px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 11px;
        cursor: pointer;
        font: inherit;
        font-size: 12px;
        font-weight: 850;
        transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
      }

      .knowledge-primary-button {
        padding: 0 16px;
        border: 1px solid rgba(254,233,147,.46);
        background: rgba(254,233,147,.12);
        color: var(--gold);
      }

      .knowledge-primary-button:hover,
      .knowledge-secondary-button:hover {
        transform: translateY(-1px);
      }

      .knowledge-secondary-button {
        padding: 0 14px;
        border: 1px solid rgba(254,233,147,.24);
        background: rgba(254,233,147,.065);
        color: var(--gold-soft);
      }

      .knowledge-upload-progress {
        display: flex;
        gap: 12px;
        align-items: center;
        margin-top: 12px;
        padding: 12px 14px;
        border: 1px solid rgba(254,233,147,.13);
        border-radius: 12px;
        background: rgba(254,233,147,.035);
      }

      .knowledge-upload-progress[hidden] {
        display: none !important;
      }

      .knowledge-upload-progress .status-spinner {
        width: 20px;
        height: 20px;
        flex: 0 0 20px;
      }

      .knowledge-upload-progress strong,
      .knowledge-upload-progress span {
        display: block;
      }

      .knowledge-upload-progress strong {
        color: var(--text);
        font-size: 12.5px;
      }

      .knowledge-upload-progress span {
        margin-top: 3px;
        color: var(--muted);
        font-size: 11px;
      }

      .knowledge-file-list-header {
        display: flex;
        justify-content: space-between;
        gap: 18px;
        align-items: end;
        margin: 26px 0 11px;
      }

      .knowledge-file-list-header h3 {
        margin: 0;
        color: var(--text);
        font-size: 14px;
      }

      .knowledge-file-list-header p {
        margin: 5px 0 0;
        color: var(--muted);
        font-size: 11.5px;
      }

      .knowledge-file-count {
        color: var(--soft);
        font-size: 11px;
        font-weight: 700;
        white-space: nowrap;
      }

      .knowledge-file-list {
        display: grid;
        gap: 9px;
      }

      .knowledge-file-empty {
        padding: 22px;
        border: 1px dashed var(--border);
        border-radius: 14px;
        color: var(--soft);
        font-size: 12px;
        text-align: center;
      }

      .knowledge-file-card {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr) auto;
        gap: 13px;
        align-items: center;
        min-width: 0;
        padding: 14px;
        border: 1px solid var(--border);
        border-radius: 14px;
        background: rgba(8,8,8,.38);
      }

      .knowledge-file-icon {
        width: 40px;
        height: 40px;
        display: grid;
        place-items: center;
        border: 1px solid rgba(254,233,147,.14);
        border-radius: 11px;
        background: rgba(254,233,147,.045);
        color: var(--gold-soft);
      }

      .knowledge-file-icon svg {
        width: 19px;
        height: 19px;
        fill: none;
        stroke: currentColor;
        stroke-width: 1.65;
        stroke-linecap: round;
        stroke-linejoin: round;
      }

      .knowledge-file-main {
        min-width: 0;
      }

      .knowledge-file-title-row {
        display: flex;
        align-items: center;
        gap: 8px;
        min-width: 0;
      }

      .knowledge-file-name {
        min-width: 0;
        overflow: hidden;
        color: var(--text);
        font-size: 12.5px;
        font-weight: 800;
        text-overflow: ellipsis;
        white-space: nowrap;
      }

      .knowledge-file-meta {
        display: flex;
        flex-wrap: wrap;
        gap: 6px 11px;
        margin-top: 5px;
        color: var(--soft);
        font-size: 10.5px;
      }

      .knowledge-file-warning {
        margin: 7px 0 0;
        color: #e3aaa2;
        font-size: 10.5px;
        line-height: 1.45;
      }

      .knowledge-file-status {
        display: inline-flex;
        align-items: center;
        gap: 5px;
        flex: 0 0 auto;
        padding: 4px 7px;
        border: 1px solid;
        border-radius: 999px;
        font-size: 9.5px;
        font-weight: 850;
      }

      .knowledge-file-status::before {
        content: "";
        width: 5px;
        height: 5px;
        border-radius: 999px;
        background: currentColor;
      }

      .knowledge-file-status.ready {
        border-color: rgba(96,218,133,.24);
        background: rgba(96,218,133,.07);
        color: #9deab6;
      }

      .knowledge-file-status.processing {
        border-color: rgba(245,189,92,.26);
        background: rgba(245,189,92,.07);
        color: #f2c779;
      }

      .knowledge-file-status.error {
        border-color: rgba(222,123,112,.26);
        background: rgba(222,123,112,.07);
        color: #e5aaa2;
      }

      .knowledge-file-actions {
        display: flex;
        gap: 7px;
        align-items: center;
      }

      .knowledge-file-action {
        min-height: 34px;
        padding: 0 10px;
        border: 1px solid var(--border);
        border-radius: 9px;
        background: rgba(255,255,255,.018);
        color: var(--muted);
        cursor: pointer;
        font: inherit;
        font-size: 10.5px;
        font-weight: 750;
      }

      .knowledge-file-action:hover {
        border-color: rgba(254,233,147,.25);
        color: var(--text);
      }

      .knowledge-file-action.delete-armed {
        border-color: rgba(222,123,112,.34);
        background: rgba(222,123,112,.075);
        color: #e5aaa2;
      }

      .knowledge-instructions-field {
        margin-top: 28px;
        padding-top: 24px;
        border-top: 1px solid var(--border);
      }

      .knowledge-large-textarea {
        min-height: 170px;
      }

      .knowledge-medium-textarea {
        min-height: 132px;
      }

      .knowledge-online-toggle-card {
        display: flex;
        justify-content: space-between;
        gap: 20px;
        align-items: center;
        margin-top: 24px;
        padding: 17px;
        border: 1px solid var(--border);
        border-radius: 14px;
        background: rgba(8,8,8,.38);
      }

      .knowledge-online-toggle-card strong {
        color: var(--text);
        font-size: 13px;
      }

      .knowledge-online-toggle-card p {
        max-width: 760px;
        margin: 5px 0 0;
        color: var(--muted);
        font-size: 11.5px;
        line-height: 1.5;
      }

      .knowledge-switch {
        position: relative;
        width: 46px;
        height: 26px;
        flex: 0 0 46px;
        cursor: pointer;
      }

      .knowledge-switch input {
        position: absolute;
        opacity: 0;
        pointer-events: none;
      }

      .knowledge-switch span {
        position: absolute;
        inset: 0;
        border: 1px solid var(--border);
        border-radius: 999px;
        background: rgba(255,255,255,.045);
        transition: border-color 160ms ease, background 160ms ease;
      }

      .knowledge-switch span::after {
        content: "";
        position: absolute;
        top: 4px;
        left: 4px;
        width: 16px;
        height: 16px;
        border-radius: 999px;
        background: var(--muted);
        transition: transform 160ms ease, background 160ms ease;
      }

      .knowledge-switch input:checked + span {
        border-color: rgba(254,233,147,.4);
        background: rgba(254,233,147,.12);
      }

      .knowledge-switch input:checked + span::after {
        background: var(--gold);
        transform: translateX(20px);
      }

      .knowledge-internal-fields {
        transition: opacity 160ms ease;
      }

      .knowledge-internal-fields.disabled {
        opacity: .44;
      }

      .knowledge-internal-fields.disabled .knowledge-upload-box,
      .knowledge-internal-fields.disabled .knowledge-file-guidance,
      .knowledge-internal-fields.disabled .knowledge-upload-progress,
      .knowledge-internal-fields.disabled .knowledge-file-list-header,
      .knowledge-internal-fields.disabled .knowledge-file-list,
      .knowledge-internal-fields.disabled .knowledge-instructions-field {
        pointer-events: none;
      }

      .knowledge-online-fields {
        display: grid;
        gap: 22px;
        margin-top: 22px;
        transition: opacity 160ms ease;
      }

      .knowledge-online-fields.disabled {
        opacity: .44;
      }

      .knowledge-online-fields.disabled input,
      .knowledge-online-fields.disabled textarea,
      .knowledge-online-fields.disabled button {
        pointer-events: none;
      }

      .knowledge-domain-builder {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 9px;
      }

      .knowledge-domain-builder input {
        min-width: 0;
      }

      .knowledge-domain-list {
        display: flex;
        flex-wrap: wrap;
        gap: 7px;
        margin-top: 10px;
      }

      .knowledge-domain-empty {
        color: var(--soft);
        font-size: 11px;
      }

      .knowledge-domain-chip {
        display: inline-flex;
        align-items: center;
        gap: 7px;
        max-width: 100%;
        padding: 6px 8px 6px 10px;
        border: 1px solid rgba(254,233,147,.16);
        border-radius: 999px;
        background: rgba(254,233,147,.045);
        color: var(--text);
        font-size: 10.5px;
        font-weight: 700;
      }

      .knowledge-domain-chip span {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }

      .knowledge-domain-chip button {
        width: 18px;
        height: 18px;
        display: grid;
        place-items: center;
        padding: 0;
        border: 0;
        border-radius: 999px;
        background: rgba(255,255,255,.05);
        color: var(--soft);
        cursor: pointer;
        font: inherit;
      }

      @media (max-width: 820px) {
        .knowledge-hero {
          grid-template-columns: 1fr;
        }

        .knowledge-status-card {
          width: 100%;
        }

        .knowledge-upload-box {
          grid-template-columns: auto minmax(0, 1fr);
        }

        .knowledge-upload-box .knowledge-primary-button {
          grid-column: 1 / -1;
          width: 100%;
        }

        .knowledge-file-card {
          grid-template-columns: auto minmax(0, 1fr);
        }

        .knowledge-file-actions {
          grid-column: 1 / -1;
          justify-content: flex-end;
        }
      }

      @media (max-width: 560px) {
        .knowledge-page-inner {
          width: min(100% - 24px, 1120px);
        }

        .knowledge-upload-box {
          grid-template-columns: 1fr;
          text-align: center;
        }

        .knowledge-upload-icon {
          margin: 0 auto;
        }

        .knowledge-file-card {
          grid-template-columns: 1fr;
        }

        .knowledge-file-icon {
          display: none;
        }

        .knowledge-file-actions {
          justify-content: stretch;
        }

        .knowledge-file-action {
          flex: 1;
        }

        .knowledge-domain-builder {
          grid-template-columns: 1fr;
        }
      }


      /* ======================================================
         KNOWLEDGE — Source cards and visual hierarchy
         Aligns Knowledge with the Training design language.
      ====================================================== */

      .knowledge-page-inner {
        width: min(1120px, 100%);
        padding: 28px 0 84px;
      }

      .knowledge-hero {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 30px;
        margin: 18px 0 0;
      }

      .knowledge-hero-copy {
        min-width: 0;
      }

      .knowledge-hero .training-kicker {
        margin: 0 0 8px;
        color: var(--gold-soft);
        font-size: 12px;
        font-weight: 800;
        letter-spacing: .11em;
        text-transform: uppercase;
      }

      .knowledge-hero-copy h1 {
        max-width: 860px;
        margin: 0;
        color: var(--text);
        font-size: clamp(30px, 4vw, 42px);
        line-height: 1.06;
        font-weight: 650;
        letter-spacing: -.04em;
      }

      .knowledge-hero-copy > p:last-child {
        max-width: 760px;
        margin: 12px 0 0;
        color: var(--muted);
        font-size: 15px;
        line-height: 1.7;
      }

      .knowledge-status-card {
        min-width: 224px;
      }

      .knowledge-agent-card {
        margin-top: 26px;
        margin-bottom: 0;
      }

      .knowledge-agent-card .training-agent-info > div:last-child {
        min-width: 0;
      }

      .knowledge-agent-card .training-agent-name,
      .knowledge-agent-card .training-agent-company {
        display: block;
      }

      .knowledge-summary {
        display: flex;
        align-items: stretch;
        gap: 8px;
      }

      .knowledge-summary-item {
        min-width: 92px;
        display: grid;
        align-content: center;
        padding: 10px 13px;
        border: 1px solid rgba(255,255,255,.075);
        border-radius: 12px;
        background:
          linear-gradient(180deg, rgba(255,255,255,.035), rgba(255,255,255,.016));
        text-align: center;
      }

      .knowledge-summary-item strong {
        color: var(--text);
        font-size: 17px;
        font-weight: 800;
        line-height: 1;
      }

      .knowledge-summary-item span {
        margin-top: 5px;
        color: var(--soft);
        font-size: 10.5px;
        font-weight: 650;
      }

      .knowledge-section-nav {
        margin: 26px -8px 0;
      }

      .knowledge-section-nav .training-section-tab {
        min-height: 42px;
        padding: 0 16px;
        font-size: 13px;
      }

      .knowledge-section {
        scroll-margin-top: 72px;
        margin-top: 10px;
      }

      .knowledge-section + .knowledge-section {
        margin-top: 18px;
      }

      .knowledge-section > .training-section-number {
        width: 30px;
        height: 30px;
        margin-bottom: 14px;
        border-radius: 9px;
        font-size: 12px;
      }

      .knowledge-section > h2 {
        margin: 0;
        color: var(--text);
        font-size: 22px;
        font-weight: 700;
        letter-spacing: -.025em;
      }

      .knowledge-section > .training-card-description {
        max-width: 760px;
        margin-top: 8px;
        font-size: 13.5px;
        line-height: 1.65;
      }

      .knowledge-upload-box {
        position: relative;
        display: grid;
        grid-template-columns: auto minmax(0, 1fr) auto;
        gap: 18px;
        align-items: center;
        margin-top: 26px;
        padding: 22px 22px;
        overflow: hidden;
        border: 1px dashed rgba(254,233,147,.28);
        border-radius: 16px;
        background:
          radial-gradient(circle at 8% 0%, rgba(254,233,147,.085), transparent 31%),
          linear-gradient(180deg, rgba(16,16,16,.76), rgba(9,9,9,.66));
        box-shadow: inset 0 1px 0 rgba(255,255,255,.018);
      }

      .knowledge-upload-box::after {
        content: "";
        position: absolute;
        inset: 0;
        pointer-events: none;
        background: linear-gradient(90deg, transparent, rgba(254,233,147,.025), transparent);
        opacity: .7;
      }

      .knowledge-upload-box.dragging {
        border-color: rgba(254,233,147,.68);
        background:
          radial-gradient(circle at 8% 0%, rgba(254,233,147,.13), transparent 33%),
          rgba(17,16,11,.88);
        transform: translateY(-1px);
        box-shadow: 0 14px 34px rgba(0,0,0,.16);
      }

      .knowledge-upload-icon {
        width: 54px;
        height: 54px;
        border-radius: 14px;
        border-color: rgba(254,233,147,.24);
        background: var(--gold-faint);
      }

      .knowledge-upload-icon svg {
        width: 25px;
        height: 25px;
      }

      .knowledge-upload-copy strong {
        font-size: 14.5px;
        font-weight: 800;
      }

      .knowledge-upload-copy span {
        margin-top: 6px;
        font-size: 12.5px;
        line-height: 1.5;
      }

      .knowledge-upload-copy small {
        margin-top: 7px;
        font-size: 11px;
        line-height: 1.5;
      }

      .knowledge-primary-button {
        min-height: 44px;
        padding: 0 17px;
        border-radius: 11px;
        border-color: rgba(254,233,147,.45);
        background: rgba(254,233,147,.105);
        font-size: 12.5px;
        box-shadow: inset 0 1px 0 rgba(255,255,255,.025);
      }

      .knowledge-primary-button:hover {
        border-color: rgba(254,233,147,.66);
        background: rgba(254,233,147,.15);
      }

      .knowledge-file-list-header {
        align-items: center;
        margin: 30px 0 12px;
        padding-bottom: 12px;
        border-bottom: 1px solid rgba(255,255,255,.065);
      }

      .knowledge-file-list-header h3 {
        font-size: 14px;
        font-weight: 800;
      }

      .knowledge-file-list-header p {
        margin-top: 5px;
        font-size: 11.5px;
        line-height: 1.55;
      }

      .knowledge-file-count {
        min-height: 28px;
        display: inline-flex;
        align-items: center;
        padding: 0 10px;
        border: 1px solid var(--border);
        border-radius: 999px;
        background: rgba(255,255,255,.02);
        color: var(--muted);
        font-size: 10.5px;
        font-weight: 750;
      }

      .knowledge-file-list {
        gap: 10px;
      }

      .knowledge-file-empty {
        min-height: 92px;
        display: grid;
        place-items: center;
        padding: 22px;
        border: 1px dashed rgba(255,255,255,.095);
        border-radius: 14px;
        background: rgba(0,0,0,.12);
        color: var(--soft);
        font-size: 12px;
        line-height: 1.55;
      }

      .knowledge-file-card {
        gap: 15px;
        padding: 15px 16px;
        border-radius: 14px;
        background:
          linear-gradient(180deg, rgba(255,255,255,.027), rgba(255,255,255,.012));
        transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
      }

      .knowledge-file-card:hover {
        transform: translateY(-1px);
        border-color: rgba(254,233,147,.16);
        background:
          linear-gradient(180deg, rgba(255,255,255,.038), rgba(255,255,255,.017));
      }

      .knowledge-file-icon {
        width: 44px;
        height: 44px;
        border-radius: 12px;
      }

      .knowledge-file-name {
        font-size: 13px;
      }

      .knowledge-file-meta {
        margin-top: 6px;
        font-size: 10.5px;
      }

      .knowledge-file-status {
        padding: 5px 8px;
        font-size: 9.5px;
      }

      .knowledge-file-action {
        min-height: 36px;
        padding: 0 11px;
        border-radius: 9px;
        font-size: 10.5px;
        transition: 160ms ease;
      }

      .knowledge-instructions-field {
        margin-top: 30px;
        padding-top: 28px;
      }

      .knowledge-instructions-field label,
      .knowledge-online-fields .training-field label {
        font-size: 13.5px;
        font-weight: 780;
      }

      .knowledge-instructions-field .training-field-help,
      .knowledge-online-fields .training-field-help {
        font-size: 12px;
        line-height: 1.6;
      }

      .knowledge-large-textarea {
        min-height: 168px !important;
        padding: 14px 15px !important;
        font-size: 14px !important;
        line-height: 1.6 !important;
      }

      .knowledge-medium-textarea {
        min-height: 138px !important;
        padding: 14px 15px !important;
        font-size: 14px !important;
        line-height: 1.6 !important;
      }

      .knowledge-online-toggle-card {
        margin-top: 26px;
        padding: 18px 19px;
        border-radius: 14px;
        background:
          linear-gradient(180deg, rgba(255,255,255,.028), rgba(255,255,255,.012));
      }

      .knowledge-online-toggle-card strong {
        font-size: 13.5px;
        font-weight: 800;
      }

      .knowledge-online-toggle-card p {
        margin-top: 6px;
        font-size: 12px;
        line-height: 1.55;
      }

      .knowledge-switch {
        width: 50px;
        height: 28px;
        flex-basis: 50px;
      }

      .knowledge-switch span::after {
        width: 18px;
        height: 18px;
      }

      .knowledge-switch input:checked + span::after {
        transform: translateX(22px);
      }

      .knowledge-online-fields {
        gap: 24px;
        margin-top: 26px;
      }

      .knowledge-domain-builder {
        gap: 10px;
      }

      .knowledge-domain-builder input {
        min-height: 46px;
        padding: 0 14px;
        border-radius: 12px;
        font-size: 13.5px;
      }

      .knowledge-secondary-button {
        min-height: 46px;
        padding: 0 16px;
        font-size: 12px;
      }

      .knowledge-domain-list {
        gap: 8px;
        margin-top: 12px;
      }

      .knowledge-domain-chip {
        padding: 7px 8px 7px 11px;
        font-size: 11px;
      }

      @media (max-width: 900px) {
        .knowledge-page-inner {
          width: min(100% - 28px, 1120px);
        }

        .knowledge-hero {
          display: grid;
          grid-template-columns: 1fr;
        }

        .knowledge-status-card {
          width: 100%;
          min-width: 0;
        }
      }


      /* ======================================================
         KNOWLEDGE — Guidance and instructional copy layout
      ====================================================== */

      .knowledge-file-guidance {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        gap: 12px;
        align-items: start;
        margin-top: 12px;
        padding: 14px 15px;
        border: 1px solid rgba(255,255,255,.07);
        border-radius: 13px;
        background: rgba(255,255,255,.018);
      }

      .knowledge-file-guidance-icon {
        width: 34px;
        height: 34px;
        display: grid;
        place-items: center;
        border: 1px solid rgba(254,233,147,.15);
        border-radius: 10px;
        background: rgba(254,233,147,.045);
        color: var(--gold-soft);
      }

      .knowledge-file-guidance-icon svg {
        width: 17px;
        height: 17px;
        fill: none;
        stroke: currentColor;
        stroke-width: 1.65;
        stroke-linecap: round;
        stroke-linejoin: round;
      }

      .knowledge-file-guidance strong {
        display: block;
        color: var(--text);
        font-size: 12.5px;
        font-weight: 800;
      }

      .knowledge-file-guidance p {
        max-width: 900px;
        margin: 5px 0 0;
        color: var(--muted);
        font-size: 11.5px;
        line-height: 1.6;
      }

      .knowledge-file-empty strong,
      .knowledge-file-empty span {
        display: block;
      }

      .knowledge-file-empty strong {
        color: var(--muted);
        font-size: 12.5px;
        font-weight: 800;
      }

      .knowledge-file-empty span {
        max-width: 620px;
        margin: 5px auto 0;
        color: var(--soft);
        font-size: 11.5px;
        line-height: 1.55;
      }


      /* ======================================================
         KNOWLEDGE  — UX DETAILS
      ====================================================== */

      /* Keep the navigation banner aligned with the agent strip and cards. */
      .knowledge-section-nav {
        margin: 26px 0 0 !important;
      }

      /* "How to choose the file?" callout */
      @keyframes knowledge-help-pulse {
        0%, 100% {
          box-shadow:
            0 0 0 0 rgba(254,233,147,.18),
            inset 0 1px 0 rgba(255,255,255,.02);
          transform: scale(1);
        }
        50% {
          box-shadow:
            0 0 0 7px rgba(254,233,147,0),
            0 0 18px rgba(254,233,147,.10),
            inset 0 1px 0 rgba(255,255,255,.025);
          transform: scale(1.035);
        }
      }

      .knowledge-file-guidance {
        grid-template-columns: 46px minmax(0, 1fr);
        gap: 14px;
        align-items: center;
        padding: 16px 17px;
      }

      .knowledge-file-guidance-icon {
        width: 42px;
        height: 42px;
        align-self: center;
        justify-self: center;
        border-radius: 12px;
        animation: knowledge-help-pulse 2.4s ease-in-out infinite;
      }

      .knowledge-file-guidance-icon svg {
        width: 23px;
        height: 23px;
        display: block;
        margin: auto;
        stroke-width: 1.8;
      }

      .knowledge-file-guidance strong {
        font-size: 14px;
        line-height: 1.35;
      }

      .knowledge-file-guidance p {
        max-width: 940px;
        margin-top: 6px;
        font-size: 13px;
        line-height: 1.62;
      }

      /* File list title and explanatory copy */
      .knowledge-file-list-header h3 {
        font-size: 16px;
        line-height: 1.3;
      }

      .knowledge-file-list-header p {
        margin-top: 6px;
        font-size: 13px;
        line-height: 1.55;
      }

      /* Optional retrieval guidance */
      .knowledge-instructions-field label {
        font-size: 14px !important;
      }

      .knowledge-instructions-field .training-field-help {
        max-width: 900px;
        font-size: 12.5px !important;
        line-height: 1.62 !important;
      }

      @media (prefers-reduced-motion: reduce) {
        .knowledge-file-guidance-icon {
          animation: none;
        }
      }


      /* ======================================================
         KNOWLEDGE  — ONLINE SEARCH TYPOGRAPHY
      ====================================================== */

      #knowledgeOnlineSection > h2 {
        font-size: 22px;
        line-height: 1.25;
      }

      #knowledgeOnlineSection > .training-card-description {
        max-width: 800px;
        font-size: 13.5px;
        line-height: 1.65;
      }

      #knowledgeOnlineSection .knowledge-online-toggle-card strong {
        font-size: 14px;
        line-height: 1.35;
      }

      #knowledgeOnlineSection .knowledge-online-toggle-card p {
        max-width: 820px;
        font-size: 13px;
        line-height: 1.6;
      }

      #knowledgeOnlineSection .knowledge-online-fields .training-field label {
        font-size: 14px !important;
        line-height: 1.35;
      }

      #knowledgeOnlineSection .knowledge-online-fields .training-field-help {
        max-width: 900px;
        font-size: 13px !important;
        line-height: 1.62 !important;
      }

      #knowledgeOnlineSection .knowledge-medium-textarea,
      #knowledgeOnlineSection .knowledge-domain-builder input {
        font-size: 14px !important;
      }

      #knowledgeOnlineSection .knowledge-domain-empty {
        font-size: 12px;
        line-height: 1.5;
      }


      /* ======================================================
         KNOWLEDGE  — ONLINE SOURCES WITH GUIDANCE
      ====================================================== */

      .knowledge-source-builder {
        display: grid;
        grid-template-columns: minmax(180px, .7fr) minmax(320px, 1.3fr) auto;
        gap: 10px;
        align-items: end;
      }

      .knowledge-source-builder-field {
        min-width: 0;
      }

      .knowledge-source-builder-field > label {
        display: block;
        margin: 0 0 7px;
        color: var(--text);
        font-size: 12px !important;
        font-weight: 760;
      }

      .knowledge-source-builder-field > label span {
        color: var(--soft);
        font-weight: 600;
      }

      .knowledge-source-builder input {
        width: 100%;
        min-height: 46px;
        padding: 0 14px;
        border: 1px solid var(--border);
        border-radius: 12px;
        outline: none;
        background: rgba(0,0,0,.34);
        color: var(--text);
        font: inherit;
        font-size: 13.5px;
        transition: border-color 160ms ease, box-shadow 160ms ease;
      }

      .knowledge-source-builder input:focus {
        border-color: rgba(254,233,147,.32);
        box-shadow: 0 0 0 3px rgba(254,233,147,.04);
      }

      .knowledge-add-source-button {
        min-width: 116px;
        white-space: nowrap;
      }

      .knowledge-source-list {
        display: grid;
        gap: 9px;
        margin-top: 13px;
      }

      .knowledge-online-source-card {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 16px;
        align-items: center;
        padding: 13px 14px;
        border: 1px solid var(--border);
        border-radius: 13px;
        background:
          linear-gradient(180deg, rgba(255,255,255,.026), rgba(255,255,255,.012));
      }

      .knowledge-online-source-main {
        min-width: 0;
      }

      .knowledge-online-source-domain {
        display: block;
        color: var(--text);
        font-size: 13px;
        font-weight: 820;
        line-height: 1.35;
      }

      .knowledge-online-source-main p {
        margin: 5px 0 0;
        color: var(--muted);
        font-size: 11.5px;
        line-height: 1.55;
      }

      .knowledge-online-source-main .knowledge-online-source-no-guidance {
        color: var(--soft);
      }

      .knowledge-online-source-actions {
        display: flex;
        gap: 7px;
        align-items: center;
      }

      .knowledge-online-source-actions button {
        min-height: 34px;
        padding: 0 10px;
        border: 1px solid var(--border);
        border-radius: 9px;
        background: rgba(255,255,255,.018);
        color: var(--muted);
        cursor: pointer;
        font: inherit;
        font-size: 10.5px;
        font-weight: 750;
      }

      .knowledge-online-source-actions button:hover {
        border-color: rgba(254,233,147,.24);
        color: var(--text);
      }

      @media (max-width: 860px) {
        .knowledge-source-builder {
          grid-template-columns: 1fr;
        }

        .knowledge-add-source-button {
          width: 100%;
        }
      }

      @media (max-width: 560px) {
        .knowledge-online-source-card {
          grid-template-columns: 1fr;
        }

        .knowledge-online-source-actions {
          justify-content: flex-end;
        }
      }


      /* ======================================================
         KNOWLEDGE  — UPLOAD ERROR VISIBILITY
      ====================================================== */

      .knowledge-upload-progress.error {
        border-color: rgba(222,123,112,.32);
        background: rgba(222,123,112,.065);
      }

      .knowledge-upload-progress.error .status-spinner {
        display: none;
      }

      .knowledge-upload-progress.error::before {
        content: "!";
        width: 22px;
        height: 22px;
        flex: 0 0 22px;
        display: grid;
        place-items: center;
        border: 1px solid rgba(222,123,112,.36);
        border-radius: 999px;
        color: #e5aaa2;
        font-size: 13px;
        font-weight: 900;
      }

      .knowledge-upload-progress.error strong {
        color: #e5aaa2;
      }

      .knowledge-upload-progress.error span {
        color: #c9948e;
      }


      /* ======================================================
         KNOWLEDGE  — DOWNLOAD + CLEAN FILE METADATA
      ====================================================== */

      .knowledge-file-actions {
        flex-wrap: wrap;
        justify-content: flex-end;
      }

      @media (max-width: 720px) {
        .knowledge-file-actions {
          width: 100%;
          grid-column: 2 / -1;
        }
      }


      /* ======================================================
         MATERIALS  — CLIENT UI
      ====================================================== */

      .materials-page {
        min-height: 100vh;
        padding: 0 0 80px;
      }

      .materials-page-inner {
        width: min(1120px, calc(100% - 48px));
        margin: 0 auto;
        padding-top: 34px;
      }

      .materials-hero {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 36px;
        align-items: start;
        margin: 30px 0 28px;
      }

      .materials-hero-copy {
        max-width: 820px;
      }

      .materials-hero-copy h1 {
        margin: 8px 0 12px;
        font-size: clamp(38px, 4vw, 56px);
        line-height: 1.03;
        letter-spacing: -0.045em;
        color: var(--text);
      }

      .materials-hero-copy > p:last-child {
        max-width: 820px;
        margin: 0;
        color: var(--muted);
        font-size: 17px;
        line-height: 1.62;
      }

      .materials-hero-summary {
        min-width: 168px;
        padding: 18px 20px;
        border: 1px solid var(--line);
        border-radius: 18px;
        background:
          linear-gradient(180deg, rgba(255,255,255,.035), rgba(255,255,255,.012));
        text-align: center;
      }

      .materials-hero-summary strong {
        display: block;
        color: var(--text);
        font-size: 30px;
        line-height: 1;
      }

      .materials-hero-summary span {
        display: block;
        margin-top: 8px;
        color: var(--muted);
        font-size: 13px;
      }

      .materials-agent-card {
        margin-bottom: 18px;
      }

      .materials-primary-action,
      .materials-secondary-action,
      .materials-save-button,
      .materials-cancel-button {
        min-height: 46px;
        border-radius: 13px;
        padding: 0 18px;
        font: inherit;
        font-size: 14px;
        font-weight: 800;
        cursor: pointer;
        transition:
          transform .18s ease,
          border-color .18s ease,
          background .18s ease,
          color .18s ease;
      }

      .materials-primary-action,
      .materials-save-button {
        border: 1px solid rgba(233, 204, 92, .62);
        background:
          linear-gradient(180deg, rgba(233,204,92,.22), rgba(233,204,92,.12));
        color: #f8df79;
      }

      .materials-primary-action:hover,
      .materials-save-button:hover {
        transform: translateY(-1px);
        border-color: rgba(233, 204, 92, .9);
        background:
          linear-gradient(180deg, rgba(233,204,92,.29), rgba(233,204,92,.15));
      }

      .materials-secondary-action,
      .materials-cancel-button {
        border: 1px solid var(--line);
        background: rgba(255,255,255,.025);
        color: var(--text);
      }

      .materials-secondary-action:hover,
      .materials-cancel-button:hover {
        border-color: rgba(233,204,92,.45);
      }

      .materials-guidance-card {
        display: flex;
        gap: 16px;
        align-items: flex-start;
        margin: 0 0 18px;
        padding: 20px 22px;
        border: 1px solid rgba(233,204,92,.18);
        border-radius: 18px;
        background:
          linear-gradient(135deg, rgba(233,204,92,.06), rgba(255,255,255,.018));
      }

      .materials-guidance-icon {
        flex: 0 0 44px;
        width: 44px;
        height: 44px;
        display: grid;
        place-items: center;
        border-radius: 13px;
        color: #f4d969;
        border: 1px solid rgba(233,204,92,.28);
        background: rgba(233,204,92,.08);
      }

      .materials-guidance-icon svg {
        width: 23px;
        height: 23px;
        fill: none;
        stroke: currentColor;
        stroke-width: 1.7;
        stroke-linecap: round;
        stroke-linejoin: round;
      }

      .materials-guidance-card strong {
        display: block;
        color: var(--text);
        font-size: 16px;
        line-height: 1.35;
      }

      .materials-guidance-card p {
        margin: 7px 0 0;
        color: var(--muted);
        font-size: 14px;
        line-height: 1.6;
      }

      .materials-section-card,
      .materials-editor-card {
        margin-bottom: 20px;
      }

      .materials-section-heading,
      .materials-editor-heading,
      .materials-files-heading {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 24px;
      }

      .materials-section-heading h2,
      .materials-editor-heading h2 {
        margin: 12px 0 8px;
        font-size: 27px;
        letter-spacing: -0.03em;
      }

      .materials-empty-state {
        margin-top: 26px;
        display: grid;
        grid-template-columns: auto minmax(0, 1fr) auto;
        gap: 18px;
        align-items: center;
        padding: 24px;
        border: 1px dashed rgba(255,255,255,.14);
        border-radius: 18px;
        background: rgba(255,255,255,.018);
      }

      .materials-empty-icon {
        width: 50px;
        height: 50px;
        display: grid;
        place-items: center;
        border-radius: 15px;
        color: #f4d969;
        background: rgba(233,204,92,.08);
        border: 1px solid rgba(233,204,92,.24);
      }

      .materials-empty-icon svg {
        width: 26px;
        height: 26px;
        fill: none;
        stroke: currentColor;
        stroke-width: 1.6;
        stroke-linecap: round;
        stroke-linejoin: round;
      }

      .materials-empty-state strong {
        color: var(--text);
        font-size: 17px;
      }

      .materials-empty-state p {
        margin: 7px 0 0;
        color: var(--muted);
        font-size: 14px;
        line-height: 1.55;
      }

      .materials-editor-card {
        scroll-margin-top: 24px;
      }

      .materials-editor-heading {
        padding-bottom: 24px;
        border-bottom: 1px solid var(--line);
      }

      .materials-editor-heading > div > p:last-child {
        margin: 8px 0 0;
        color: var(--muted);
        font-size: 15px;
        line-height: 1.55;
      }

      .materials-icon-button {
        width: 42px;
        height: 42px;
        flex: 0 0 42px;
        border-radius: 12px;
        border: 1px solid var(--line);
        background: rgba(255,255,255,.02);
        color: var(--muted);
        font-size: 25px;
        line-height: 1;
        cursor: pointer;
      }

      .materials-form-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 24px;
        margin-top: 28px;
      }

      .materials-form-grid .training-field label {
        font-size: 16px;
      }

      .materials-form-grid .training-field-help {
        margin-top: 7px;
        font-size: 14px;
        line-height: 1.55;
      }

      .materials-form-grid input,
      .materials-form-grid textarea {
        font-size: 15px;
        line-height: 1.55;
      }

      .materials-medium-textarea {
        min-height: 118px;
        resize: vertical;
      }

      .materials-short-textarea {
        min-height: 92px;
        resize: vertical;
      }

      .materials-optional {
        color: var(--muted);
        font-weight: 600;
      }

      .materials-files-section {
        margin-top: 28px;
        padding-top: 28px;
        border-top: 1px solid var(--line);
      }

      .materials-files-heading h3 {
        margin: 0;
        color: var(--text);
        font-size: 18px;
      }

      .materials-files-heading p {
        margin: 7px 0 0;
        color: var(--muted);
        font-size: 14px;
        line-height: 1.55;
      }

      .materials-files-counter {
        flex: 0 0 auto;
        padding: 7px 10px;
        border: 1px solid var(--line);
        border-radius: 999px;
        color: var(--muted);
        font-size: 12px;
        font-weight: 800;
      }

      .materials-upload-box {
        margin-top: 18px;
        min-height: 112px;
        display: grid;
        grid-template-columns: auto minmax(0, 1fr) auto;
        gap: 18px;
        align-items: center;
        padding: 20px;
        border: 1px dashed rgba(233,204,92,.32);
        border-radius: 17px;
        background: rgba(233,204,92,.025);
      }

      .materials-upload-box.dragover {
        border-color: rgba(244,217,105,.86);
        background: rgba(233,204,92,.07);
      }

      .materials-upload-copy strong {
        display: block;
        color: var(--text);
        font-size: 16px;
      }

      .materials-upload-copy span {
        display: block;
        margin-top: 5px;
        color: var(--muted);
        font-size: 13px;
      }

      .materials-upload-copy small {
        display: block;
        margin-top: 8px;
        color: rgba(255,255,255,.42);
        font-size: 12px;
      }

      .materials-selected-empty {
        margin-top: 14px;
        padding: 16px;
        border-radius: 14px;
        border: 1px dashed rgba(255,255,255,.11);
        color: rgba(255,255,255,.45);
        font-size: 13px;
        text-align: center;
      }

      .materials-selected-files {
        display: grid;
        gap: 10px;
        margin-top: 14px;
      }

      .materials-selected-file {
        display: grid;
        grid-template-columns: 36px 42px minmax(0, 1fr) auto;
        gap: 12px;
        align-items: center;
        padding: 13px 14px;
        border: 1px solid var(--line);
        border-radius: 14px;
        background: rgba(255,255,255,.018);
      }

      .materials-file-order {
        width: 32px;
        height: 32px;
        display: grid;
        place-items: center;
        border-radius: 9px;
        background: rgba(233,204,92,.07);
        color: #f2d76a;
        font-size: 12px;
        font-weight: 900;
      }

      .materials-file-type-icon {
        width: 40px;
        height: 40px;
        display: grid;
        place-items: center;
        border-radius: 11px;
        border: 1px solid rgba(233,204,92,.2);
        color: #f1d668;
        background: rgba(233,204,92,.045);
      }

      .materials-file-type-icon svg {
        width: 20px;
        height: 20px;
        fill: none;
        stroke: currentColor;
        stroke-width: 1.6;
        stroke-linecap: round;
        stroke-linejoin: round;
      }

      .materials-file-copy strong {
        display: block;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        color: var(--text);
        font-size: 14px;
      }

      .materials-file-copy span {
        display: block;
        margin-top: 4px;
        color: var(--muted);
        font-size: 12px;
      }

      .materials-file-controls {
        display: flex;
        gap: 6px;
      }

      .materials-file-control {
        width: 34px;
        height: 34px;
        display: grid;
        place-items: center;
        border-radius: 9px;
        border: 1px solid var(--line);
        background: transparent;
        color: var(--muted);
        cursor: pointer;
        font-size: 15px;
      }

      .materials-file-control:hover:not(:disabled) {
        border-color: rgba(233,204,92,.38);
        color: var(--text);
      }

      .materials-file-control:disabled {
        opacity: .3;
        cursor: default;
      }

      .materials-file-control.remove:hover {
        border-color: rgba(244,114,114,.4);
        color: #ff9d9d;
      }

      .materials-order-hint {
        margin: 11px 0 0;
        color: rgba(255,255,255,.42);
        font-size: 12px;
      }

      .materials-editor-actions {
        display: flex;
        justify-content: flex-end;
        gap: 10px;
        margin-top: 30px;
        padding-top: 24px;
        border-top: 1px solid var(--line);
      }

      .materials-save-button {
        min-width: 178px;
      }

      .materials-save-button:disabled {
        opacity: .42;
        cursor: default;
        transform: none;
      }

      .materials-list {
        display: grid;
        gap: 12px;
        margin-top: 24px;
      }

      .materials-card {
        padding: 20px;
        border-radius: 16px;
        border: 1px solid var(--line);
        background: rgba(255,255,255,.018);
      }

      .materials-card-top {
        display: flex;
        justify-content: space-between;
        gap: 20px;
        align-items: flex-start;
      }

      .materials-card h3 {
        margin: 0;
        color: var(--text);
        font-size: 17px;
      }

      .materials-card p {
        margin: 7px 0 0;
        color: var(--muted);
        font-size: 13px;
        line-height: 1.55;
      }

      .materials-card-badge {
        padding: 6px 9px;
        border-radius: 999px;
        background: rgba(82,201,126,.09);
        border: 1px solid rgba(82,201,126,.26);
        color: #84e0a5;
        font-size: 11px;
        font-weight: 800;
      }

      .materials-card-when {
        margin-top: 15px;
        padding: 12px 14px;
        border-radius: 12px;
        background: rgba(233,204,92,.04);
        border: 1px solid rgba(233,204,92,.13);
      }

      .materials-card-when span {
        display: block;
        color: rgba(244,217,105,.72);
        font-size: 10px;
        font-weight: 900;
        letter-spacing: .08em;
        text-transform: uppercase;
      }

      .materials-card-when strong {
        display: block;
        margin-top: 5px;
        color: var(--text);
        font-size: 13px;
        line-height: 1.5;
      }

      @media (max-width: 820px) {
        .materials-hero {
          grid-template-columns: 1fr;
        }

        .materials-hero-summary {
          width: fit-content;
        }

        .materials-upload-box,
        .materials-empty-state {
          grid-template-columns: 1fr;
        }

        .materials-upload-box .knowledge-upload-icon,
        .materials-empty-icon {
          margin-bottom: 2px;
        }

        .materials-section-heading,
        .materials-editor-heading,
        .materials-files-heading {
          flex-direction: column;
        }

        .materials-selected-file {
          grid-template-columns: 32px 38px minmax(0, 1fr);
        }

        .materials-file-controls {
          grid-column: 2 / -1;
          justify-content: flex-end;
        }
      }

      @media (max-width: 560px) {
        .materials-page-inner {
          width: min(100% - 28px, 1120px);
        }

        .materials-hero-copy h1 {
          font-size: 38px;
        }

        .materials-editor-actions {
          flex-direction: column-reverse;
        }

        .materials-save-button,
        .materials-cancel-button {
          width: 100%;
        }
      }


      /* ======================================================
         MATERIALS — Cards and editor hierarchy
         Match Training / Knowledge scale and button language.
      ====================================================== */

      .materials-page {
        min-height: calc(100vh - 76px);
        padding: 0;
      }

      .materials-page-inner {
        width: min(1120px, calc(100% - 44px));
        margin: 0 auto;
        padding: 28px 0 84px;
      }

      .materials-hero {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 30px;
        margin: 18px 0 0;
      }

      .materials-hero-copy {
        min-width: 0;
        max-width: none;
      }

      .materials-hero-copy .training-kicker {
        margin: 0 0 8px;
        color: var(--gold-soft);
        font-size: 12px;
        font-weight: 800;
        letter-spacing: .11em;
        text-transform: uppercase;
      }

      .materials-hero-copy h1 {
        max-width: 860px;
        margin: 0;
        color: var(--text);
        font-size: clamp(30px, 4vw, 42px);
        line-height: 1.06;
        font-weight: 650;
        letter-spacing: -.04em;
      }

      .materials-hero-copy > p:last-child {
        max-width: 790px;
        margin: 12px 0 0;
        color: var(--muted);
        font-size: 15px;
        line-height: 1.7;
      }

      .materials-hero-summary {
        min-width: 170px;
        padding: 14px 16px;
        border: 1px solid var(--border);
        border-radius: 16px;
        background: rgba(255,255,255,.025);
        text-align: center;
      }

      .materials-hero-summary strong {
        display: block;
        color: var(--text);
        font-size: 21px;
        font-weight: 800;
        line-height: 1;
      }

      .materials-hero-summary span {
        display: block;
        margin-top: 7px;
        color: var(--soft);
        font-size: 11.5px;
        line-height: 1.4;
      }

      .materials-agent-card {
        margin-top: 26px;
        margin-bottom: 18px;
      }

      .materials-agent-card .training-agent-info > div:last-child {
        min-width: 0;
      }

      .materials-agent-card .training-agent-name,
      .materials-agent-card .training-agent-company {
        display: block;
      }

      .materials-agent-card .training-agent-company {
        margin-top: 3px;
      }

      .materials-guidance-card {
        display: grid;
        grid-template-columns: 46px minmax(0, 1fr);
        gap: 14px;
        align-items: center;
        margin: 0 0 18px;
        padding: 16px 17px;
        border: 1px solid rgba(255,255,255,.07);
        border-radius: 13px;
        background: rgba(255,255,255,.018);
      }

      .materials-guidance-icon {
        width: 42px;
        height: 42px;
        display: grid;
        place-items: center;
        align-self: center;
        justify-self: center;
        border: 1px solid rgba(254,233,147,.15);
        border-radius: 12px;
        background: rgba(254,233,147,.045);
        color: var(--gold-soft);
        animation: knowledge-help-pulse 2.4s ease-in-out infinite;
      }

      .materials-guidance-icon svg {
        width: 23px;
        height: 23px;
        display: block;
        margin: auto;
        fill: none;
        stroke: currentColor;
        stroke-width: 1.8;
        stroke-linecap: round;
        stroke-linejoin: round;
      }

      .materials-guidance-card strong {
        display: block;
        color: var(--text);
        font-size: 14px;
        font-weight: 800;
      }

      .materials-guidance-card p {
        max-width: 900px;
        margin: 5px 0 0;
        color: var(--muted);
        font-size: 12.5px;
        line-height: 1.6;
      }

      .materials-section-heading,
      .materials-editor-heading,
      .materials-files-heading {
        gap: 18px;
      }

      .materials-section-heading h2,
      .materials-editor-heading h2 {
        margin: 0;
        color: var(--text);
        font-size: 21px;
        font-weight: 700;
        letter-spacing: -.025em;
      }

      .materials-section-heading .training-section-number {
        margin-bottom: 12px;
      }

      .materials-section-heading .training-card-description {
        max-width: 760px;
        margin-top: 7px;
        font-size: 13px;
        line-height: 1.65;
      }

      .materials-primary-action,
      .materials-save-button {
        min-height: 44px;
        padding: 0 17px;
        border: 1px solid rgba(254,233,147,.45);
        border-radius: 11px;
        background: rgba(254,233,147,.105);
        color: var(--gold);
        font: inherit;
        font-size: 12.5px;
        font-weight: 850;
        box-shadow: inset 0 1px 0 rgba(255,255,255,.025);
      }

      .materials-primary-action:hover,
      .materials-save-button:hover:not(:disabled) {
        transform: translateY(-1px);
        border-color: rgba(254,233,147,.66);
        background: rgba(254,233,147,.15);
      }

      .materials-secondary-action,
      .materials-cancel-button {
        min-height: 42px;
        padding: 0 14px;
        border: 1px solid rgba(255,255,255,.10);
        border-radius: 11px;
        background: rgba(255,255,255,.025);
        color: var(--muted);
        font: inherit;
        font-size: 12px;
        font-weight: 800;
      }

      .materials-secondary-action:hover,
      .materials-cancel-button:hover {
        border-color: rgba(254,233,147,.28);
        color: var(--text);
        background: rgba(255,255,255,.04);
      }

      .materials-empty-state {
        margin-top: 24px;
        grid-template-columns: auto minmax(0, 1fr) auto;
        gap: 16px;
        padding: 20px;
        border-radius: 16px;
      }

      .materials-empty-icon {
        width: 44px;
        height: 44px;
        border-radius: 13px;
      }

      .materials-empty-icon svg {
        width: 22px;
        height: 22px;
      }

      .materials-empty-state strong {
        font-size: 14px;
      }

      .materials-empty-state p {
        max-width: 700px;
        margin-top: 5px;
        font-size: 12.5px;
        line-height: 1.6;
      }

      .materials-editor-card {
        padding: clamp(22px, 3vw, 30px);
      }

      .materials-editor-heading {
        padding-bottom: 20px;
      }

      .materials-editor-heading > div > p:last-child {
        max-width: 760px;
        margin: 7px 0 0;
        color: var(--muted);
        font-size: 13px;
        line-height: 1.65;
      }

      .materials-form-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 20px;
        margin-top: 24px;
      }

      .materials-full-field {
        grid-column: 1 / -1;
      }

      .materials-form-grid .training-field label {
        font-size: 14px;
      }

      .materials-form-grid .training-field-help {
        margin-top: 6px;
        font-size: 12.5px;
        line-height: 1.55;
      }

      .materials-form-grid input,
      .materials-form-grid textarea {
        font-size: 14px;
        line-height: 1.5;
      }

      .materials-medium-textarea {
        min-height: 126px;
      }

      .materials-short-textarea {
        min-height: 86px;
      }

      .materials-files-section {
        margin-top: 24px;
        padding-top: 24px;
      }

      .materials-files-heading h3 {
        font-size: 16px;
      }

      .materials-files-heading p {
        margin-top: 6px;
        font-size: 12.5px;
        line-height: 1.55;
      }

      .materials-files-counter {
        padding: 6px 9px;
        font-size: 11px;
      }

      .materials-upload-box {
        min-height: 104px;
        gap: 16px;
        margin-top: 16px;
        padding: 18px 20px;
        border-radius: 16px;
      }

      .materials-upload-copy strong {
        font-size: 14px;
      }

      .materials-upload-copy span {
        margin-top: 4px;
        font-size: 12px;
      }

      .materials-upload-copy small {
        margin-top: 7px;
        font-size: 10.5px;
      }

      .materials-selected-empty {
        font-size: 12px;
      }

      .materials-order-hint {
        margin-top: 10px;
        font-size: 11.5px;
      }

      .materials-editor-actions {
        margin-top: 24px;
        padding-top: 20px;
      }

      .materials-save-button {
        min-width: 150px;
      }

      @media (max-width: 820px) {
        .materials-hero {
          display: grid;
          grid-template-columns: 1fr;
        }

        .materials-form-grid {
          grid-template-columns: 1fr;
        }

        .materials-full-field {
          grid-column: auto;
        }
      }

      @media (max-width: 560px) {
        .materials-page-inner {
          width: min(1120px, calc(100% - 28px));
        }

        .materials-hero-copy h1 {
          font-size: 34px;
        }
      }


      /* ======================================================
         MATERIALS — Local edit/delete controls
      ====================================================== */
      .materials-icon-button {
        display: grid;
        place-items: center;
        padding: 0;
        line-height: 1;
      }

      .materials-icon-button span,
      .materials-icon-button strong {
        display: block;
        line-height: 1;
      }

      .materials-guidance-card strong {
        font-size: 13.5px;
      }

      .materials-section-heading .training-card-description {
        max-width: 780px;
      }

      .materials-editor-actions {
        align-items: center;
      }

      .materials-cancel-button,
      .materials-save-button {
        min-height: 48px;
        padding: 0 20px;
        border-radius: 12px;
        font-size: 13px;
      }

      .materials-cancel-button {
        min-width: 104px;
      }

      .materials-save-button {
        min-width: 168px;
      }

      .materials-save-button:not(:disabled) {
        animation: materials-save-pulse 1.8s ease-in-out infinite;
      }

      @keyframes materials-save-pulse {
        0%, 100% {
          box-shadow: 0 0 0 0 rgba(254,233,147,.08), inset 0 1px 0 rgba(255,255,255,.025);
          transform: translateY(0);
        }
        50% {
          box-shadow: 0 0 0 8px rgba(254,233,147,0);
          transform: translateY(-1px);
        }
      }

      .materials-card {
        position: relative;
      }

      .materials-card-top {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 16px;
      }

      .materials-card-main {
        min-width: 0;
      }

      .materials-card-main h3 {
        margin: 0;
      }

      .materials-card-main p {
        margin-top: 6px;
      }

      .materials-card-side {
        display: flex;
        align-items: center;
        gap: 10px;
        flex-wrap: wrap;
        justify-content: flex-end;
      }

      .materials-card-actions {
        display: flex;
        gap: 8px;
        align-items: center;
      }

      .materials-card-action {
        min-height: 34px;
        padding: 0 12px;
        border-radius: 10px;
        border: 1px solid rgba(255,255,255,.09);
        background: rgba(255,255,255,.025);
        color: var(--muted);
        font: inherit;
        font-size: 11.5px;
        font-weight: 800;
        cursor: pointer;
        transition: .18s ease;
      }

      .materials-card-action:hover {
        color: var(--text);
        border-color: rgba(254,233,147,.28);
        background: rgba(255,255,255,.04);
        transform: translateY(-1px);
      }

      .materials-card-action.danger:hover {
        color: #ffb6b6;
        border-color: rgba(255,110,110,.28);
        background: rgba(255,110,110,.06);
      }

      .materials-card-meta {
        margin-top: 12px;
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
      }

      .materials-card-file {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 6px 9px;
        border-radius: 999px;
        border: 1px solid rgba(255,255,255,.08);
        background: rgba(255,255,255,.02);
        color: var(--soft);
        font-size: 11px;
        line-height: 1.3;
      }


      /* ======================================================
         MATERIALS  — COMPANION MESSAGE POSITION
      ====================================================== */

      .materials-companion-position {
        display: grid;
        gap: 9px;
        margin-top: 14px;
        padding: 14px 15px;
        border: 1px solid rgba(255,255,255,.08);
        border-radius: 13px;
        background: rgba(255,255,255,.018);
      }

      .materials-companion-position-label {
        color: var(--text);
        font-size: 12.5px;
        font-weight: 800;
      }

      .materials-companion-position-options {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
      }

      .materials-position-choice {
        min-height: 38px;
        padding: 0 12px;
        border: 1px solid var(--border);
        border-radius: 999px;
        background: rgba(255,255,255,.025);
        color: var(--muted);
        cursor: pointer;
        font: inherit;
        font-size: 12px;
        font-weight: 800;
        transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
      }

      .materials-position-choice:hover {
        border-color: rgba(254,233,147,.30);
        color: var(--text);
      }

      .materials-position-choice.selected {
        border-color: rgba(254,233,147,.48);
        background: var(--gold-faint);
        color: var(--gold);
      }

      .materials-companion-position-help {
        margin: 0;
        color: var(--soft);
        font-size: 11.5px;
        line-height: 1.55;
      }

      @media (max-width: 620px) {
        .materials-companion-position-options {
          display: grid;
          grid-template-columns: 1fr;
        }

        .materials-position-choice {
          width: 100%;
          min-height: 42px;
        }
      }



      /* ======================================================
         RESPONSIVE FOUNDATION
         Desktop behavior preserved. Mobile becomes a true
         off-canvas navigation experience.
      ====================================================== */

      :root {
        --mobile-page-gutter: 16px;
        --tablet-page-gutter: 22px;
      }

      html,
      body {
        width: 100%;
        max-width: 100%;
      }

      img,
      svg {
        max-width: 100%;
      }

      button,
      input,
      textarea,
      select {
        max-width: 100%;
      }

      textarea {
        overflow-wrap: anywhere;
      }

      .mobile-menu-toggle,
      .mobile-sidebar-close,
      .mobile-topbar-brand,
      .mobile-topbar-start,
      .mobile-sidebar-overlay {
        display: none;
      }

      /* ---------- AUTH / LOGIN / SIGNUP ---------- */

      @media (max-width: 640px) {
        body:not(.app-mode) {
          min-height: 100dvh;
          place-items: start center;
          padding:
            max(14px, env(safe-area-inset-top))
            12px
            max(18px, env(safe-area-inset-bottom));
        }

        body:not(.app-mode) .wrap {
          width: 100%;
          max-width: 540px;
          margin: auto 0;
        }

        body:not(.app-mode) .card {
          width: 100%;
          padding: 26px 20px;
          border-radius: 22px;
        }

        body:not(.app-mode) .header {
          grid-template-columns: 64px minmax(0, 1fr);
          gap: 14px;
          align-items: center;
        }

        body:not(.app-mode) .logo {
          width: 64px;
          height: 64px;
          border-radius: 15px;
        }

        body:not(.app-mode) h1 {
          font-size: clamp(26px, 8vw, 31px);
          line-height: 1.08;
        }

        body:not(.app-mode) .subtitle {
          margin-top: 7px;
          font-size: 14px;
          line-height: 1.52;
        }

        body:not(.app-mode) .form {
          gap: 16px;
          margin-top: 24px;
        }

        body:not(.app-mode) .field {
          gap: 7px;
        }

        body:not(.app-mode) .field label {
          font-size: 14px;
        }

        body:not(.app-mode) .field input,
        body:not(.app-mode) .field textarea,
        body:not(.app-mode) .field select {
          min-height: 52px;
          font-size: 16px; /* prevents iOS form zoom */
        }

        body:not(.app-mode) .submit,
        body:not(.app-mode) .silver-button,
        body:not(.app-mode) .secondary-button {
          width: 100%;
          min-height: 50px;
        }

        body:not(.app-mode) .auth-divider {
          margin: 22px 0;
        }

        body:not(.app-mode) .auth-switch {
          margin-top: 18px;
          font-size: 13px;
          line-height: 1.55;
        }

        body:not(.app-mode) .access-note {
          padding: 16px;
        }

        body:not(.app-mode) .status-view {
          padding-block: 8px;
        }

        body:not(.app-mode) .status-title {
          font-size: 22px;
        }

        body:not(.app-mode) .dialog-overlay {
          padding: 12px;
        }

        body:not(.app-mode) .dialog-content {
          width: min(100%, 520px);
          max-height: calc(100dvh - 24px);
          overflow-y: auto;
          padding: 22px 18px;
          border-radius: 18px;
        }
      }

      @media (max-width: 390px) {
        body:not(.app-mode) .card {
          padding: 22px 16px;
        }

        body:not(.app-mode) .header {
          grid-template-columns: 56px minmax(0, 1fr);
          gap: 12px;
        }

        body:not(.app-mode) .logo {
          width: 56px;
          height: 56px;
          border-radius: 13px;
        }

        body:not(.app-mode) h1 {
          font-size: 25px;
        }

        body:not(.app-mode) .subtitle {
          font-size: 13.5px;
        }
      }

      /* ---------- APP SHELL / MOBILE DRAWER ---------- */

      @media (max-width: 900px) {
        body.app-mode {
          min-height: 100dvh;
          overflow-x: hidden;
        }

        body.app-mode.mobile-nav-open {
          overflow: hidden;
          touch-action: none;
        }

        body.app-mode .wrap,
        body.app-mode .card,
        .app-shell,
        .app-shell.sidebar-collapsed {
          width: 100%;
          min-height: 100dvh;
        }

        .app-shell,
        .app-shell.sidebar-collapsed {
          display: block;
          grid-template-columns: none;
          --sidebar-width: 0px;
        }

        .app-main {
          width: 100%;
          min-width: 0;
          padding:
            0
            var(--tablet-page-gutter)
            calc(32px + env(safe-area-inset-bottom));
        }

        .app-topbar {
          position: sticky;
          top: 0;
          z-index: 70;
          min-height: 64px;
          margin:
            0
            calc(var(--tablet-page-gutter) * -1);
          padding:
            max(0px, env(safe-area-inset-top))
            var(--tablet-page-gutter)
            0;
          background: rgba(9,9,9,.91);
          border-bottom: 1px solid rgba(255,255,255,.075);
          backdrop-filter: blur(18px);
          -webkit-backdrop-filter: blur(18px);
        }

        .mobile-topbar-start {
          display: flex;
          align-items: center;
          gap: 10px;
          min-width: 0;
        }

        .mobile-menu-toggle {
          width: 42px;
          height: 42px;
          flex: 0 0 42px;
          display: grid;
          place-items: center;
          padding: 0;
          border: 1px solid rgba(255,255,255,.1);
          border-radius: 11px;
          background: rgba(255,255,255,.035);
          color: var(--text);
          cursor: pointer;
        }

        .mobile-menu-toggle svg,
        .mobile-sidebar-close svg {
          width: 20px;
          height: 20px;
          fill: none;
          stroke: currentColor;
          stroke-width: 1.8;
          stroke-linecap: round;
        }

        .mobile-topbar-brand {
          display: flex;
          align-items: center;
          gap: 8px;
          min-width: 0;
          color: var(--gold);
          font-size: 14px;
          font-weight: 800;
        }

        .mobile-topbar-logo {
          width: 30px;
          height: 30px;
          flex: 0 0 30px;
          overflow: hidden;
          border: 1px solid rgba(255,255,255,.08);
          border-radius: 9px;
          background: #171717;
        }

        .mobile-topbar-logo img {
          width: 100%;
          height: 100%;
          object-fit: cover;
          display: block;
        }

        .app-user {
          flex: 1 1 auto;
          min-width: 0;
          display: flex;
          justify-content: flex-end;
        }

        .app-user-email {
          max-width: min(30vw, 250px);
          overflow: hidden;
          text-overflow: ellipsis;
          white-space: nowrap;
          font-size: 11.5px;
        }

        .ghost-action.compact {
          min-width: 56px;
          min-height: 42px;
        }

        .mobile-sidebar-overlay {
          position: fixed;
          inset: 0;
          z-index: 90;
          display: block;
          background: rgba(0,0,0,.62);
          opacity: 0;
          visibility: hidden;
          transition:
            opacity .2s ease,
            visibility .2s ease;
          backdrop-filter: blur(2px);
          -webkit-backdrop-filter: blur(2px);
        }

        .mobile-sidebar-overlay[hidden] {
          display: block !important;
          pointer-events: none;
        }

        .app-shell.mobile-sidebar-open .mobile-sidebar-overlay {
          opacity: 1;
          visibility: visible;
          pointer-events: auto;
        }

        .app-sidebar {
          position: fixed;
          inset:
            0 auto 0 0;
          z-index: 100;
          width: min(330px, 88vw);
          height: 100dvh;
          min-height: 100dvh;
          padding:
            max(18px, env(safe-area-inset-top))
            16px
            max(24px, env(safe-area-inset-bottom));
          overflow-x: hidden;
          overflow-y: auto;
          overscroll-behavior: contain;
          border-right: 1px solid rgba(255,255,255,.09);
          border-bottom: 0;
          background: rgba(9,9,9,.985);
          transform: translateX(-104%);
          transition: transform .22s ease;
          box-shadow: 22px 0 55px rgba(0,0,0,.34);
          visibility: hidden;
        }

        .app-shell.mobile-sidebar-open .app-sidebar {
          transform: translateX(0);
          visibility: visible;
        }

        .app-brand {
          min-height: 62px;
          display: flex;
          align-items: center;
          justify-content: flex-start !important;
          gap: 12px !important;
          padding: 0 2px 18px;
        }

        .app-brand > div:not(.logo) {
          width: auto !important;
          min-width: 0;
          display: block !important;
          overflow: hidden;
          opacity: 1 !important;
        }

        .app-brand-title,
        .app-brand-copy,
        .app-nav-label,
        .nav-text {
          display: block !important;
          width: auto !important;
          opacity: 1 !important;
        }

        .app-brand-title {
          font-size: 16px;
        }

        .app-brand-copy {
          font-size: 11px;
        }

        .mobile-sidebar-close {
          width: 40px;
          height: 40px;
          flex: 0 0 40px;
          display: grid;
          place-items: center;
          margin-left: auto;
          padding: 0;
          border: 1px solid rgba(255,255,255,.09);
          border-radius: 11px;
          background: rgba(255,255,255,.025);
          color: var(--muted);
          cursor: pointer;
        }

        .sidebar-toggle {
          display: none !important;
        }

        .app-nav {
          display: grid;
          gap: 6px;
          margin-top: 14px;
          overflow: visible;
        }

        .app-nav-label {
          margin: 16px 10px 4px;
        }

        .app-nav-item,
        .app-shell.sidebar-collapsed .app-nav-item {
          width: 100%;
          min-height: 46px;
          justify-content: flex-start !important;
          padding: 0 12px !important;
          white-space: normal;
          text-align: left;
        }

        .agent-context-nav {
          display: grid;
          gap: 6px;
        }

        .agent-context-home {
          width: 100%;
          min-width: 0;
        }

        .agent-context-name {
          overflow-wrap: anywhere;
        }

        .app-shell.sidebar-collapsed .agent-context-home-label,
        .app-shell.sidebar-collapsed .agent-context-name,
        .app-shell.sidebar-collapsed .agent-context-home-arrow {
          display: initial !important;
          opacity: 1 !important;
        }
      }

      @media (max-width: 620px) {
        :root {
          --mobile-page-gutter: 14px;
        }

        .app-main {
          padding:
            0
            var(--mobile-page-gutter)
            calc(28px + env(safe-area-inset-bottom));
        }

        .app-topbar {
          min-height: 60px;
          margin:
            0
            calc(var(--mobile-page-gutter) * -1);
          padding:
            max(0px, env(safe-area-inset-top))
            var(--mobile-page-gutter)
            0;
          gap: 10px;
        }

        .mobile-menu-toggle {
          width: 40px;
          height: 40px;
          flex-basis: 40px;
        }

        .app-user-email {
          max-width: 23vw;
          font-size: 10.5px;
        }

        .ghost-action.compact {
          min-width: 52px;
          min-height: 40px;
          padding-inline: 11px;
          font-size: 12px;
        }
      }

      @media (max-width: 460px) {
        .app-user {
          display: none;
        }

        .mobile-topbar-start {
          flex: 1 1 auto;
        }
      }

      /* ---------- AGENT LIST ---------- */

      @media (max-width: 900px) {
        .agents-page {
          padding-top: 24px;
        }

        .agents-header {
          align-items: flex-start;
        }

        .agents-title {
          font-size: clamp(28px, 7vw, 34px);
        }

        .agents-copy {
          max-width: 620px;
          font-size: 13.5px;
        }

        .real-agent-grid {
          grid-template-columns: repeat(2, minmax(0, 1fr));
        }

        .real-agent-card {
          min-height: 235px;
        }
      }

      @media (max-width: 620px) {
        .agents-page {
          padding-top: 22px;
        }

        .agents-header {
          display: grid;
          gap: 16px;
          margin-bottom: 20px;
        }

        .small-primary {
          width: 100%;
          min-height: 46px;
        }

        .agents-toolbar {
          align-items: center;
          gap: 10px;
        }

        .agents-meta {
          min-width: 0;
          line-height: 1.4;
        }

        .refresh-agents {
          min-width: 84px;
          min-height: 40px;
        }

        .real-agent-grid {
          grid-template-columns: 1fr;
          gap: 12px;
        }

        .real-agent-card {
          min-height: 0;
          padding: 17px;
          border-radius: 16px;
        }

        .agent-avatar {
          width: 52px;
          height: 52px;
          flex-basis: 52px;
          border-radius: 14px;
        }

        .agent-name {
          font-size: 16px;
        }

        .agent-company {
          white-space: normal;
          overflow-wrap: anywhere;
        }

        .agent-slug {
          overflow-wrap: anywhere;
        }
      }

      /* ---------- AGENT WORKSPACE ---------- */

      @media (max-width: 900px) {
        .agent-workspace-page,
        .agent-section-page,
        .training-page {
          padding: 24px 0 48px;
        }

        .agent-workspace-inner,
        .agent-section-inner,
        .training-page-inner {
          width: 100%;
        }

        .agent-workspace-grid {
          grid-template-columns: repeat(2, minmax(0, 1fr));
        }

        .agent-workspace-card {
          min-height: 164px;
        }
      }

      @media (max-width: 620px) {
        .agent-workspace-page,
        .agent-section-page,
        .training-page {
          padding: 20px 0 42px;
        }

        .agent-workspace-hero {
          grid-template-columns: 52px minmax(0, 1fr);
          gap: 13px;
          margin-top: 18px;
          padding: 17px;
          border-radius: 18px;
        }

        .agent-workspace-avatar {
          width: 52px;
          height: 52px;
          border-radius: 14px;
          font-size: 17px;
        }

        .agent-workspace-kicker {
          font-size: 9.5px;
        }

        .agent-workspace-name {
          font-size: clamp(23px, 7vw, 29px);
          overflow-wrap: anywhere;
        }

        .agent-workspace-company,
        .agent-workspace-id {
          overflow-wrap: anywhere;
        }

        .agent-workspace-badges {
          grid-column: 1 / -1;
          justify-content: flex-start;
        }

        .agent-activation-notice {
          grid-template-columns: 42px minmax(0, 1fr);
          gap: 13px;
          padding: 16px;
        }

        .agent-activation-notice-title {
          font-size: 14.5px;
        }

        .agent-activation-notice-copy {
          font-size: 12px;
        }

        .agent-activation-notice-action {
          grid-column: 1 / -1;
          width: 100%;
          min-height: 45px;
        }

        .agent-workspace-grid {
          grid-template-columns: 1fr;
          gap: 11px;
          margin-top: 18px;
        }

        .agent-workspace-card {
          min-height: 0;
          padding: 17px;
        }

        .agent-workspace-card-icon {
          margin-bottom: 14px;
        }
      }

      /* ---------- TRAINING ---------- */

      @media (max-width: 900px) {
        .training-hero {
          grid-template-columns: 1fr;
          gap: 18px;
        }

        .training-status-panel {
          min-width: 0;
          width: 100%;
        }

        .training-agent-strip {
          align-items: flex-start;
        }

        .training-sections-nav {
          position: sticky;
          top: 64px;
          z-index: 6;
          width: 100%;
          max-width: 100%;
          margin: 22px 0 0;
          padding: 8px;
          overflow-x: auto;
          overflow-y: hidden;
          overscroll-behavior-x: contain;
          scroll-snap-type: x proximity;
          -webkit-overflow-scrolling: touch;
        }

        .training-section-tab {
          flex: 0 0 auto;
          min-height: 42px;
          scroll-snap-align: start;
        }

        .training-fields.two-columns,
        .training-advanced-content,
        .training-voice-grid,
        .closing-method-options {
          grid-template-columns: 1fr;
        }

        .training-card {
          padding: 22px;
        }

        .training-list-compose {
          grid-template-columns: minmax(0, 1fr) auto;
        }
      }

      @media (max-width: 620px) {
        .training-title {
          font-size: clamp(30px, 9vw, 38px);
        }

        .training-copy {
          font-size: 13.5px;
          line-height: 1.65;
        }

        .training-agent-strip {
          flex-direction: column;
          gap: 14px;
          padding: 15px;
        }

        .training-version-column {
          width: 100%;
          justify-items: stretch;
        }

        .training-version {
          text-align: left;
        }

        .training-history-button {
          width: 100%;
          min-height: 42px;
        }

        .training-sections-nav {
          top: 60px;
          margin-inline: -2px;
          width: calc(100% + 4px);
        }

        .training-card {
          padding: 18px 16px;
          border-radius: 18px;
        }

        .training-card-head {
          margin-bottom: 20px;
        }

        .training-card h2 {
          font-size: 20px;
        }

        .training-fields {
          gap: 18px;
        }

        .training-field input,
        .training-field textarea,
        .training-field select,
        .training-list-input {
          font-size: 16px; /* prevents iOS zoom */
        }

        .training-field textarea {
          min-width: 0;
          resize: vertical;
        }

        .training-list-compose {
          grid-template-columns: 1fr;
        }

        .training-list-add {
          width: 100%;
          min-height: 44px;
        }

        .training-choice {
          min-height: 42px;
        }

        .voice-picker-grid {
          grid-template-columns: 1fr;
        }

        .interest-training-grid {
          grid-template-columns: 1fr;
        }

        .interest-training-card textarea {
          min-height: 190px;
        }

        #trainingSectionLimits .handoff-builder {
          grid-template-columns: 1fr;
          grid-template-areas:
            "when"
            "category"
            "collect"
            "add";
        }

        .handoff-route-card {
          grid-template-columns: 1fr;
        }

        .training-footer {
          flex-direction: column;
          align-items: stretch;
          gap: 12px;
        }

        .training-publish {
          width: 100%;
          min-height: 52px;
        }
      }

      /* ---------- KNOWLEDGE ---------- */

      @media (max-width: 900px) {
        .knowledge-page {
          min-height: 0;
        }

        .knowledge-page-inner {
          width: 100%;
          padding: 24px 0 54px;
        }

        .knowledge-hero {
          grid-template-columns: 1fr;
          gap: 18px;
          margin-top: 14px;
        }

        .knowledge-status-card {
          width: 100%;
          min-width: 0;
        }

        .knowledge-agent-card {
          align-items: flex-start;
        }

        .knowledge-section-nav {
          width: 100%;
          overflow-x: auto;
          -webkit-overflow-scrolling: touch;
        }

        .knowledge-upload-box {
          grid-template-columns: auto minmax(0, 1fr);
        }

        .knowledge-upload-box .knowledge-primary-button {
          grid-column: 1 / -1;
          width: 100%;
          min-height: 44px;
        }

        .knowledge-file-card {
          min-width: 0;
        }
      }

      @media (max-width: 620px) {
        .knowledge-page-inner {
          width: 100%;
          padding: 20px 0 46px;
        }

        .knowledge-hero-copy h1 {
          font-size: clamp(30px, 9vw, 38px);
        }

        .knowledge-hero-copy > p:last-child {
          font-size: 13.5px;
        }

        .knowledge-agent-card {
          flex-direction: column;
          gap: 14px;
        }

        .knowledge-summary {
          width: 100%;
          display: grid;
          grid-template-columns: repeat(2, minmax(0, 1fr));
        }

        .knowledge-summary-item {
          width: 100%;
          min-width: 0;
        }

        .knowledge-upload-box {
          grid-template-columns: 1fr;
          gap: 13px;
          padding: 17px;
          text-align: left;
        }

        .knowledge-upload-icon {
          margin: 0;
        }

        .knowledge-primary-button,
        .knowledge-secondary-button,
        .knowledge-file-action {
          min-height: 44px;
        }

        .knowledge-file-card {
          grid-template-columns: 1fr;
          gap: 12px;
          padding: 15px;
        }

        .knowledge-file-icon {
          display: none;
        }

        .knowledge-file-name,
        .knowledge-file-error {
          overflow-wrap: anywhere;
        }

        .knowledge-file-actions {
          width: 100%;
          grid-column: auto;
          justify-content: stretch;
          display: grid;
          grid-template-columns: repeat(3, minmax(0, 1fr));
        }

        .knowledge-file-action {
          min-width: 0;
          padding-inline: 8px;
        }

        .knowledge-file-guidance {
          grid-template-columns: 42px minmax(0, 1fr);
          padding: 15px;
        }

        .knowledge-source-builder,
        .knowledge-domain-builder {
          grid-template-columns: 1fr;
        }

        .knowledge-add-source-button {
          width: 100%;
          min-height: 44px;
        }

        .knowledge-online-source-card {
          grid-template-columns: 1fr;
        }

        .knowledge-online-source-domain,
        .knowledge-online-source-main p {
          overflow-wrap: anywhere;
        }

        .knowledge-online-source-actions {
          width: 100%;
          justify-content: stretch;
        }

        .knowledge-online-source-actions button {
          flex: 1 1 0;
          min-height: 40px;
        }
      }

      /* ---------- MATERIALS ---------- */

      @media (max-width: 900px) {
        .materials-page {
          min-height: 0;
          padding: 0;
        }

        .materials-page-inner {
          width: 100%;
          padding: 24px 0 56px;
        }

        .materials-hero {
          grid-template-columns: 1fr;
          gap: 18px;
          margin: 16px 0 22px;
        }

        .materials-hero-summary {
          width: 100%;
          min-width: 0;
        }

        .materials-agent-card {
          align-items: flex-start;
        }

        .materials-form-grid {
          grid-template-columns: 1fr;
        }

        .materials-full-field {
          grid-column: auto;
        }

        .materials-upload-box {
          grid-template-columns: auto minmax(0, 1fr);
        }

        .materials-upload-box .knowledge-primary-button {
          grid-column: 1 / -1;
          width: 100%;
        }
      }

      @media (max-width: 620px) {
        .materials-page-inner {
          width: 100%;
          padding: 20px 0 48px;
        }

        .materials-hero-copy h1 {
          font-size: clamp(30px, 9vw, 38px);
        }

        .materials-hero-copy > p:last-child {
          font-size: 13.5px;
          line-height: 1.65;
        }

        .materials-guidance-card {
          grid-template-columns: 42px minmax(0, 1fr);
          padding: 15px;
        }

        .materials-section-card,
        .materials-editor-card {
          padding: 18px 16px;
          border-radius: 18px;
        }

        .materials-section-heading,
        .materials-editor-heading,
        .materials-files-heading {
          flex-direction: column;
          gap: 14px;
        }

        .materials-primary-action,
        .materials-secondary-action {
          width: 100%;
        }

        .materials-empty-state {
          grid-template-columns: 1fr;
          gap: 14px;
          padding: 17px;
        }

        .materials-upload-box {
          grid-template-columns: 1fr;
          gap: 13px;
          padding: 17px;
        }

        .materials-upload-box .knowledge-upload-icon {
          margin: 0;
        }

        .materials-form-grid input,
        .materials-form-grid textarea {
          font-size: 16px; /* prevents iOS zoom */
        }

        .materials-selected-file {
          grid-template-columns: 32px minmax(0, 1fr);
          gap: 10px;
        }

        .materials-file-type-icon {
          display: none;
        }

        .materials-file-copy {
          min-width: 0;
        }

        .materials-file-copy strong {
          white-space: normal;
          overflow-wrap: anywhere;
        }

        .materials-file-controls {
          grid-column: 1 / -1;
          justify-content: flex-end;
        }

        .materials-file-control {
          width: 40px;
          height: 40px;
        }

        .materials-editor-actions {
          flex-direction: column-reverse;
          align-items: stretch;
        }

        .materials-save-button,
        .materials-cancel-button {
          width: 100%;
          min-height: 50px;
        }

        .materials-card-top {
          display: grid;
          grid-template-columns: 1fr;
        }

        .materials-card-side {
          width: 100%;
          justify-content: space-between;
        }

        .materials-card-actions {
          margin-left: auto;
        }

        .materials-card-action {
          min-height: 40px;
        }

        .materials-card-file {
          max-width: 100%;
          overflow-wrap: anywhere;
        }
      }

      /* ---------- MODALS / OVERLAYS / GENERIC SAFETY ---------- */

      @media (max-width: 620px) {
        .training-history-overlay,
        .training-history-modal,
        .dialog-overlay {
          padding:
            max(12px, env(safe-area-inset-top))
            12px
            max(12px, env(safe-area-inset-bottom));
        }

        .training-history-dialog,
        .training-history-panel,
        .dialog-content {
          width: 100%;
          max-width: 100%;
          max-height: calc(100dvh - 24px);
          overflow-y: auto;
          border-radius: 18px;
        }

        button,
        [role="button"] {
          -webkit-tap-highlight-color: transparent;
        }
      }

      @media (prefers-reduced-motion: reduce) {
        .app-sidebar,
        .mobile-sidebar-overlay {
          transition: none !important;
        }
      }


      /* ======================================================
         AGENT HOME JOURNEY STATE
         Preparar → Ativar → Conectar → Operar
      ====================================================== */

      .agent-workspace-card {
        position: relative;
        isolation: isolate;
      }

      .agent-workspace-card-badge {
        position: absolute;
        top: 16px;
        right: 16px;
        z-index: 2;
        min-height: 25px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 0 9px;
        border: 1px solid rgba(254,233,147,.34);
        border-radius: 999px;
        background: rgba(254,233,147,.10);
        color: var(--gold);
        font-size: 9px;
        line-height: 1;
        font-weight: 900;
        letter-spacing: .075em;
        text-transform: uppercase;
        box-shadow:
          inset 0 1px 0 rgba(255,255,255,.035),
          0 0 16px rgba(254,233,147,.06);
      }

      .agent-workspace-card-badge[hidden] {
        display: none !important;
      }

      .agent-workspace-card.is-locked {
        opacity: .46;
        cursor: default !important;
        transform: none !important;
        border-color: rgba(255,255,255,.07);
        background:
          linear-gradient(180deg, rgba(22,22,22,.75), rgba(16,16,16,.75));
        box-shadow: none;
        filter: saturate(.72);
      }

      button.agent-workspace-card.is-locked:hover,
      a.agent-workspace-card.is-locked:hover {
        transform: none;
        border-color: rgba(255,255,255,.07);
        background:
          linear-gradient(180deg, rgba(22,22,22,.75), rgba(16,16,16,.75));
      }

      .agent-workspace-card.is-locked .agent-workspace-card-status {
        color: rgba(255,255,255,.72);
      }

      .agent-workspace-card.is-primary-cta {
        opacity: 1;
        border-color: rgba(254,233,147,.50);
        background:
          radial-gradient(circle at 12% 0%, rgba(254,233,147,.13), transparent 36%),
          linear-gradient(180deg, rgba(44,39,22,.93), rgba(23,21,16,.96));
        box-shadow:
          inset 0 1px 0 rgba(255,255,255,.04),
          0 0 0 1px rgba(254,233,147,.05),
          0 13px 34px rgba(0,0,0,.22),
          0 0 34px rgba(254,233,147,.075);
      }

      button.agent-workspace-card.is-primary-cta:hover,
      a.agent-workspace-card.is-primary-cta:hover {
        transform: translateY(-2px);
        border-color: rgba(254,233,147,.68);
        background:
          radial-gradient(circle at 12% 0%, rgba(254,233,147,.17), transparent 38%),
          linear-gradient(180deg, rgba(49,43,24,.95), rgba(24,22,17,.97));
      }

      .agent-workspace-card.is-primary-cta .agent-workspace-card-icon {
        border-color: rgba(254,233,147,.34);
        background: rgba(254,233,147,.11);
        box-shadow: 0 0 18px rgba(254,233,147,.055);
      }

      .agent-workspace-card.is-primary-cta .agent-workspace-card-status {
        min-height: 39px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        margin-top: auto;
        padding: 0 14px;
        border: 1px solid rgba(254,233,147,.55);
        border-radius: 10px;
        background:
          linear-gradient(180deg, rgba(254,233,147,.17), rgba(254,233,147,.09));
        color: var(--gold);
        box-shadow:
          inset 0 1px 0 rgba(255,255,255,.045),
          0 0 20px rgba(254,233,147,.065);
        animation: agentJourneyPulse 2.8s ease-in-out infinite;
      }

      .agent-workspace-card.is-primary-cta .agent-workspace-card-badge {
        animation: agentJourneyBadgePulse 2.8s ease-in-out infinite;
      }

      .app-nav-item.state-locked {
        opacity: .42;
        cursor: default !important;
        pointer-events: none;
      }

      @keyframes agentJourneyPulse {
        0%, 100% {
          transform: scale(1);
          box-shadow:
            inset 0 1px 0 rgba(255,255,255,.045),
            0 0 16px rgba(254,233,147,.045);
        }
        50% {
          transform: scale(1.018);
          box-shadow:
            inset 0 1px 0 rgba(255,255,255,.055),
            0 0 26px rgba(254,233,147,.11);
        }
      }

      @keyframes agentJourneyBadgePulse {
        0%, 100% {
          border-color: rgba(254,233,147,.34);
          box-shadow: 0 0 12px rgba(254,233,147,.04);
        }
        50% {
          border-color: rgba(254,233,147,.54);
          box-shadow: 0 0 20px rgba(254,233,147,.09);
        }
      }

      /* Materials  empty state*/
      .materials-empty-state {
        border-color: rgba(254,233,147,.28);
        background:
          linear-gradient(
            135deg,
            rgba(254,233,147,.085),
            rgba(254,233,147,.025) 52%,
            rgba(255,255,255,.012)
          );
        box-shadow:
          inset 0 1px 0 rgba(255,255,255,.025),
          0 0 0 1px rgba(254,233,147,.018);
      }

      .materials-empty-icon {
        border-color: rgba(254,233,147,.28);
        background: rgba(254,233,147,.075);
        color: var(--gold-soft);
      }

      .materials-empty-state strong {
        color: var(--gold-soft);
      }

      .materials-empty-state .materials-primary-action {
        border-color: rgba(254,233,147,.52);
        background: rgba(254,233,147,.13);
        color: var(--gold);
      }

      @media (max-width: 620px) {
        .agent-workspace-card-badge {
          top: 14px;
          right: 14px;
        }

        .agent-workspace-card.is-primary-cta .agent-workspace-card-status {
          width: 100%;
          min-height: 44px;
        }
      }

      @media (prefers-reduced-motion: reduce) {
        .agent-workspace-card.is-primary-cta .agent-workspace-card-status,
        .agent-workspace-card.is-primary-cta .agent-workspace-card-badge {
          animation: none !important;
        }
      }


      /* ======================================================
         AGENT HOME — CTA spacing
      ====================================================== */

      .agent-workspace-card.is-primary-cta .agent-workspace-card-status {
        margin-top: 18px;
      }

      @media (max-width: 620px) {
        .agent-workspace-card.is-primary-cta .agent-workspace-card-status {
          margin-top: 20px;
        }
      }


      /* ======================================================
         MONITORING HUB
      ====================================================== */

      .monitoring-page {
        min-width: 0;
        width: 100%;
        padding: 34px clamp(22px, 4vw, 56px) 72px;
      }

      .monitoring-page-inner {
        width: min(1120px, 100%);
        margin: 0 auto;
      }

      .monitoring-header {
        margin-top: 22px;
      }

      .monitoring-kicker {
        margin: 0 0 7px;
        color: var(--gold-soft);
        font-size: 11px;
        font-weight: 850;
        letter-spacing: .1em;
        text-transform: uppercase;
      }

      .monitoring-title {
        margin: 0;
        max-width: 760px;
        color: var(--text);
        font-size: clamp(30px, 4vw, 42px);
        line-height: 1.08;
        letter-spacing: -.04em;
      }

      .monitoring-copy {
        max-width: 760px;
        margin: 12px 0 0;
        color: var(--muted);
        font-size: 14.5px;
        line-height: 1.72;
      }

      .monitoring-chat-banner {
        position: relative;
        isolation: isolate;
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 28px;
        align-items: center;
        margin-top: 28px;
        padding: clamp(27px, 4vw, 42px);
        overflow: hidden;
        border: 1px solid rgba(254,233,147,.31);
        border-radius: 24px;
        background:
          radial-gradient(circle at 8% 12%, rgba(254,233,147,.15), transparent 31%),
          radial-gradient(circle at 92% 88%, rgba(254,233,147,.07), transparent 35%),
          linear-gradient(135deg, rgba(47,42,24,.96), rgba(24,22,16,.96) 45%, rgba(16,16,15,.98));
        box-shadow:
          0 22px 56px rgba(0,0,0,.26),
          inset 0 1px 0 rgba(255,255,255,.025);
      }

      .monitoring-chat-banner::after {
        content: "";
        position: absolute;
        z-index: -1;
        width: 280px;
        height: 280px;
        right: -96px;
        top: -118px;
        border: 1px solid rgba(254,233,147,.08);
        border-radius: 50%;
        box-shadow:
          0 0 0 42px rgba(254,233,147,.018),
          0 0 0 92px rgba(254,233,147,.012);
      }

      .monitoring-chat-badge {
        display: inline-flex;
        align-items: center;
        gap: 7px;
        width: fit-content;
        min-height: 26px;
        padding: 0 10px;
        border: 1px solid rgba(254,233,147,.28);
        border-radius: 999px;
        background: rgba(254,233,147,.075);
        color: var(--gold);
        font-size: 10px;
        font-weight: 850;
        letter-spacing: .07em;
        text-transform: uppercase;
      }

      .monitoring-chat-badge::before {
        content: "";
        width: 6px;
        height: 6px;
        border-radius: 50%;
        background: #9deab6;
        box-shadow: 0 0 10px rgba(157,234,182,.46);
      }

      .monitoring-chat-title {
        margin: 17px 0 0;
        max-width: 650px;
        color: var(--text);
        font-size: clamp(24px, 3vw, 32px);
        line-height: 1.14;
        letter-spacing: -.03em;
      }

      .monitoring-chat-copy {
        max-width: 670px;
        margin: 11px 0 0;
        color: rgba(244,244,242,.68);
        font-size: 14px;
        line-height: 1.7;
      }

      .monitoring-chat-action {
        min-width: 205px;
        min-height: 50px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 9px;
        padding: 0 20px;
        border: 1px solid rgba(254,233,147,.58);
        border-radius: 13px;
        background: linear-gradient(180deg, #d9c16a, #bca555);
        color: #15130b;
        font: inherit;
        font-size: 13.5px;
        font-weight: 900;
        cursor: pointer;
        box-shadow:
          0 9px 24px rgba(0,0,0,.2),
          0 0 22px rgba(254,233,147,.07);
        transition:
          transform 170ms ease,
          filter 170ms ease,
          box-shadow 170ms ease;
      }

      .monitoring-chat-action:hover:not(:disabled) {
        transform: translateY(-2px);
        filter: brightness(1.06);
        box-shadow:
          0 12px 28px rgba(0,0,0,.26),
          0 0 28px rgba(254,233,147,.11);
      }

      .monitoring-chat-action:disabled {
        cursor: wait;
        opacity: .72;
      }

      .monitoring-chat-action svg {
        width: 17px;
        height: 17px;
        fill: none;
        stroke: currentColor;
        stroke-width: 1.9;
        stroke-linecap: round;
        stroke-linejoin: round;
      }

      .monitoring-agent-strip {
        display: flex;
        align-items: center;
        gap: 11px;
        margin-top: 16px;
        color: rgba(244,244,242,.54);
        font-size: 12px;
      }

      .monitoring-agent-strip strong {
        color: rgba(244,244,242,.82);
        font-weight: 780;
      }

      .monitoring-agent-dot {
        width: 4px;
        height: 4px;
        border-radius: 50%;
        background: rgba(254,233,147,.48);
      }

      .monitoring-future-section {
        margin-top: 30px;
      }

      .monitoring-section-head {
        display: flex;
        align-items: end;
        justify-content: space-between;
        gap: 20px;
        margin-bottom: 14px;
      }

      .monitoring-section-title {
        margin: 0;
        color: var(--text);
        font-size: 19px;
        line-height: 1.35;
        font-weight: 850;
        letter-spacing: -.018em;
      }

      .monitoring-section-copy {
        max-width: 720px;
        margin: 5px 0 0;
        color: var(--soft);
        font-size: 12.5px;
        line-height: 1.65;
      }

      .monitoring-future-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px;
      }

      .monitoring-future-card {
        min-height: 154px;
        padding: 20px;
        border: 1px solid rgba(255,255,255,.075);
        border-radius: 18px;
        background:
          linear-gradient(180deg, rgba(28,28,28,.70), rgba(18,18,18,.70));
      }

      .monitoring-future-card-head {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 14px;
      }

      .monitoring-future-icon {
        width: 46px;
        height: 46px;
        display: grid;
        place-items: center;
        border: 1px solid rgba(254,233,147,.15);
        border-radius: 11px;
        background: rgba(254,233,147,.04);
        color: rgba(254,233,147,.72);
      }

      .monitoring-future-icon svg {
        width: 23px;
        height: 23px;
        fill: none;
        stroke: currentColor;
        stroke-width: 1.7;
        stroke-linecap: round;
        stroke-linejoin: round;
      }

      .monitoring-coming-badge {
        display: inline-flex;
        align-items: center;
        min-height: 23px;
        padding: 0 8px;
        border: 1px solid rgba(255,255,255,.075);
        border-radius: 999px;
        color: rgba(244,244,242,.34);
        font-size: 9px;
        font-weight: 850;
        letter-spacing: .06em;
        text-transform: uppercase;
      }

      .monitoring-future-card h3 {
        margin: 17px 0 0;
        color: rgba(244,244,242,.82);
        font-size: 15px;
        line-height: 1.4;
      }

      .monitoring-future-card p {
        margin: 6px 0 0;
        color: rgba(244,244,242,.40);
        font-size: 12px;
        line-height: 1.6;
      }

      @media (max-width: 820px) {
        .monitoring-chat-banner {
          grid-template-columns: 1fr;
          gap: 22px;
        }

        .monitoring-chat-action {
          width: fit-content;
        }
      }

      @media (max-width: 680px) {
        .monitoring-page {
          padding: 24px 16px 52px;
        }

        .monitoring-chat-banner {
          padding: 23px 20px;
          border-radius: 20px;
        }

        .monitoring-chat-action {
          width: 100%;
          min-width: 0;
        }

        .monitoring-future-grid {
          grid-template-columns: 1fr;
        }
      }


      /* ======================================================
         MONITORING DATA  — CRM + ANALYTICS
      ====================================================== */

      .monitoring-feature-card {
        width: 100%;
        color: inherit;
        text-align: left;
        font: inherit;
        cursor: pointer;
        transition: transform .18s ease, border-color .18s ease, background .18s ease;
      }
      .monitoring-feature-card:hover {
        transform: translateY(-2px);
        border-color: rgba(254,233,147,.30);
        background: linear-gradient(180deg,rgba(31,29,22,.96),rgba(17,17,17,.98));
      }
      .monitoring-feature-card .monitoring-coming-badge { color: var(--gold); }

      .monitoring-data-page {
        min-height: calc(100vh - 76px);
        padding: 28px 0 84px;
      }
      .monitoring-data-inner { width:min(1460px,100%); margin:0 auto; }
      .monitoring-data-page .agent-workspace-back { margin-bottom:20px; }
      .monitoring-data-hero {
        display:flex; align-items:flex-end; justify-content:space-between; gap:22px; margin-bottom:24px;
      }
      .monitoring-data-kicker { margin:0 0 7px; color:var(--gold); font-size:11px; font-weight:800; letter-spacing:.1em; text-transform:uppercase; }
      .monitoring-data-title { margin:0; color:var(--text); font-size:clamp(30px,4vw,42px); line-height:1.08; letter-spacing:-.04em; }
      .monitoring-data-copy { max-width:760px; margin:9px 0 0; color:var(--muted); font-size:14px; line-height:1.65; }
      .monitoring-data-actions { display:flex; gap:9px; flex-wrap:wrap; }
      .monitoring-data-button {
        min-height:42px; padding:0 14px; border:1px solid var(--border-strong); border-radius:11px;
        background:rgba(255,255,255,.035); color:var(--text); cursor:pointer; font:inherit; font-size:12px; font-weight:750;
      }
      .monitoring-data-button.primary { border-color:rgba(254,233,147,.35); background:rgba(254,233,147,.08); color:var(--gold); }
      .monitoring-data-button:disabled { opacity:.45; cursor:wait; }

      .monitoring-filterbar {
        display:grid; grid-template-columns:repeat(6,minmax(130px,1fr)); gap:10px; margin:18px 0;
        padding:14px; border:1px solid var(--border); border-radius:16px; background:rgba(255,255,255,.02);
      }
      .monitoring-filter { display:grid; gap:6px; min-width:0; }
      .monitoring-filter.search { grid-column:span 2; }
      .monitoring-filter label { color:var(--soft); font-size:10px; font-weight:800; letter-spacing:.06em; text-transform:uppercase; }
      .monitoring-filter input,.monitoring-filter select {
        width:100%; min-height:42px; padding:0 38px 0 11px; border:1px solid rgba(255,255,255,.11); border-radius:11px;
        outline:none; background:#101010; color:var(--text); font:inherit; font-size:11.5px; transition:border-color .16s ease,box-shadow .16s ease,background .16s ease;
      }
      .monitoring-filter input{padding-right:11px;}
      .monitoring-filter select{
        appearance:none; -webkit-appearance:none; -moz-appearance:none; cursor:pointer; color-scheme:dark;
        background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M2.5 4.5L6 8L9.5 4.5' stroke='%23F4F4F2' stroke-opacity='0.72' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
        background-repeat:no-repeat; background-position:right 12px center; background-size:12px 12px;
      }
      .monitoring-filter select option{background:#111; color:var(--text);}
      .monitoring-filter input::placeholder{color:rgba(244,244,242,.34);}
      .monitoring-filter input:focus,.monitoring-filter select:focus { border-color:rgba(254,233,147,.40); box-shadow:0 0 0 3px rgba(254,233,147,.045); background:#121212; }

      .crm-choice { position:relative; min-width:0; }
      .crm-choice > select.crm-choice-native { position:absolute!important; width:1px!important; height:1px!important; opacity:0!important; pointer-events:none!important; overflow:hidden!important; }
      .crm-choice-trigger { width:100%; min-height:42px; display:flex; align-items:center; justify-content:space-between; gap:10px; padding:0 11px; border:1px solid rgba(255,255,255,.11); border-radius:11px; background:#101010; color:var(--text); cursor:pointer; font:inherit; font-size:11.5px; font-weight:650; text-align:left; transition:border-color .16s ease,box-shadow .16s ease,background .16s ease; }
      .crm-choice-trigger:hover,.crm-choice.open .crm-choice-trigger { border-color:rgba(254,233,147,.40); background:#121212; box-shadow:0 0 0 3px rgba(254,233,147,.045); }
      .crm-choice-value { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
      .crm-choice-chevron { width:15px; height:15px; flex:0 0 15px; color:var(--muted); transition:transform .16s ease; }
      .crm-choice.open .crm-choice-chevron { transform:rotate(180deg); }
      .crm-choice-chevron svg { width:100%; height:100%; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
      .crm-choice-panel { position:absolute; left:0; right:0; top:calc(100% + 6px); z-index:120; max-height:250px; overflow:auto; padding:7px; border:1px solid rgba(254,233,147,.18); border-radius:12px; background:#111; box-shadow:0 18px 42px rgba(0,0,0,.48); scrollbar-width:thin; scrollbar-color:rgba(254,233,147,.30) transparent; }
      .crm-choice-panel::-webkit-scrollbar{width:7px;}
      .crm-choice-panel::-webkit-scrollbar-track{background:transparent;}
      .crm-choice-panel::-webkit-scrollbar-thumb{border-radius:999px;background:rgba(254,233,147,.30);}
      .crm-choice-option { width:100%; min-height:38px; display:flex; align-items:center; justify-content:space-between; gap:10px; padding:0 10px; border:1px solid transparent; border-radius:9px; background:transparent; color:var(--muted); cursor:pointer; font:inherit; font-size:11.5px; font-weight:650; text-align:left; transition:.14s ease; }
      .crm-choice-option:hover { border-color:rgba(254,233,147,.18); background:rgba(254,233,147,.045); color:var(--text); }
      .crm-choice-option.selected { border-color:rgba(254,233,147,.26); background:rgba(254,233,147,.07); color:var(--gold); }
      .crm-choice-check { width:14px; height:14px; opacity:0; fill:none; stroke:currentColor; stroke-width:2; }
      .crm-choice-option.selected .crm-choice-check { opacity:1; }

      .crm-summary { display:flex; align-items:center; justify-content:space-between; gap:14px; margin:12px 0; color:var(--soft); font-size:12px; }
      .crm-summary-actions { display:flex; align-items:center; justify-content:flex-end; gap:12px; min-width:0; }
      .crm-clear-filters { min-height:32px; padding:0 11px; border:1px solid rgba(255,255,255,.11); border-radius:9px; background:rgba(255,255,255,.025); color:var(--muted); cursor:pointer; font:inherit; font-size:10.5px; font-weight:750; transition:.15s ease; }
      .crm-clear-filters:hover { border-color:rgba(254,233,147,.26); background:rgba(254,233,147,.055); color:var(--gold); }
      .crm-board { display:grid; grid-template-columns:repeat(5,minmax(250px,1fr)); gap:12px; overflow-x:auto; padding:2px 2px 12px; }
      .crm-column { min-width:250px; border:1px solid var(--border); border-radius:17px; background:rgba(255,255,255,.018); overflow:hidden; }
      .crm-column-head { display:flex; align-items:center; justify-content:space-between; gap:10px; padding:14px 14px 12px; border-bottom:1px solid rgba(255,255,255,.06); }
      .crm-column-title { margin:0; color:var(--text); font-size:13px; font-weight:800; }
      .crm-column-count { min-width:27px; min-height:24px; display:grid; place-items:center; padding:0 7px; border:1px solid rgba(254,233,147,.16); border-radius:999px; background:rgba(254,233,147,.05); color:var(--gold); font-size:10px; font-weight:800; }
      .crm-column-body { display:grid; gap:9px; padding:10px; max-height:calc(100vh - 350px); overflow-y:auto; overscroll-behavior:contain; scrollbar-width:thin; scrollbar-color:rgba(254,233,147,.30) rgba(255,255,255,.03); }
      .crm-column-body::-webkit-scrollbar{ width:9px; }
      .crm-column-body::-webkit-scrollbar-track{ background:rgba(255,255,255,.025); }
      .crm-column-body::-webkit-scrollbar-thumb{ border:2px solid #151515; border-radius:999px; background:rgba(254,233,147,.30); }
      .crm-column-body::-webkit-scrollbar-thumb:hover{ background:rgba(254,233,147,.50); }
      .crm-card { width:100%; padding:13px; border:1px solid rgba(255,255,255,.08); border-radius:13px; background:linear-gradient(180deg,rgba(27,27,27,.96),rgba(18,18,18,.97)); color:inherit; text-align:left; cursor:pointer; font:inherit; transition:.16s ease; }
      .crm-card:hover { transform:translateY(-1px); border-color:rgba(254,233,147,.28); }
      .crm-card-head { display:flex; align-items:flex-start; justify-content:space-between; gap:8px; }
      .crm-card-name { margin:0; color:var(--text); font-size:14px; font-weight:800; overflow-wrap:anywhere; }
      .crm-card-phone { margin:4px 0 0; color:var(--soft); font-size:11px; }
      .crm-card-status-row { margin-top:7px; }
      .crm-card-summary { margin:10px 0 0; color:var(--muted); font-size:12px; line-height:1.5; display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical; overflow:hidden; }
      .crm-card-meta { display:flex; flex-wrap:wrap; gap:5px; margin-top:10px; }
      .crm-badge { display:inline-flex; align-items:center; justify-content:center; height:22px; min-height:22px; box-sizing:border-box; padding:1px 7px 0; border:1px solid var(--border); border-radius:999px; color:var(--soft); background:rgba(255,255,255,.025); font-size:10.5px; line-height:1; font-weight:800; vertical-align:middle; }
      .crm-badge.gold { color:var(--gold); border-color:rgba(254,233,147,.18); background:rgba(254,233,147,.045); }
      .crm-badge.good { color:#a9ebbd; border-color:rgba(111,220,145,.18); background:rgba(111,220,145,.05); }
      .crm-badge.state-active { color:#a9ebbd; border-color:rgba(111,220,145,.18); background:rgba(111,220,145,.05); }
      .crm-badge.state-closed { color:#ffb0b0; border-color:rgba(255,107,107,.2); background:rgba(255,107,107,.08); }
      .crm-badge.interest-low { color:#ffadad; border-color:rgba(236,104,104,.24); background:rgba(236,104,104,.075); }
      .crm-badge.interest-medium { color:#f2b879; border-color:rgba(230,149,71,.25); background:rgba(230,149,71,.075); }
      .crm-badge.interest-high { color:#9ee3b3; border-color:rgba(93,201,126,.24); background:rgba(93,201,126,.075); }
      .crm-detail-field .crm-badge { display:inline-flex; margin-top:5.5px; }
      .crm-card-time { margin:10px 0 0; color:rgba(244,244,242,.35); font-size:10px; }
      .crm-empty { padding:20px 10px; color:var(--soft); text-align:center; font-size:11px; line-height:1.5; }

      .crm-drawer-overlay { position:fixed; inset:0; z-index:170; background:rgba(0,0,0,.66); opacity:0; visibility:hidden; pointer-events:none; transition:.18s ease; overscroll-behavior:contain; }
      .crm-drawer-overlay.open { opacity:1; visibility:visible; pointer-events:auto; }
      body.crm-drawer-open { overflow:hidden; }
      .crm-drawer { position:absolute; top:0; right:0; width:min(610px,94vw); height:100%; overflow-y:auto; overflow-x:hidden; overscroll-behavior:contain; padding:24px; border-left:1px solid rgba(254,233,147,.18); background:#111; transform:translateX(104%); transition:.22s ease; box-shadow:-24px 0 70px rgba(0,0,0,.4); scrollbar-width:thin; scrollbar-color:rgba(254,233,147,.34) rgba(255,255,255,.025); }
      .crm-drawer::-webkit-scrollbar { width:9px; }
      .crm-drawer::-webkit-scrollbar-track { background:rgba(255,255,255,.025); border-left:1px solid rgba(255,255,255,.025); }
      .crm-drawer::-webkit-scrollbar-thumb { min-height:42px; border:2px solid #111; border-radius:999px; background:rgba(254,233,147,.34); }
      .crm-drawer::-webkit-scrollbar-thumb:hover { background:rgba(254,233,147,.54); }
      .crm-drawer::-webkit-scrollbar-corner { background:transparent; }
      .crm-drawer-overlay.open .crm-drawer { transform:translateX(0); }
      .crm-drawer-head { display:flex; justify-content:space-between; gap:16px; align-items:flex-start; }
      .crm-drawer-close { width:38px; height:38px; display:grid; place-items:center; padding:0; border:1px solid var(--border); border-radius:10px; background:rgba(255,255,255,.03); color:var(--muted); cursor:pointer; line-height:1; }
      .crm-drawer-close svg { width:15px; height:15px; display:block; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; }
      .crm-whatsapp-message { margin-top:14px; color:var(--muted); font-size:11.5px; line-height:1.58; overflow-wrap:anywhere; }
      .crm-whatsapp-message strong { color:rgba(244,244,242,.92); font-weight:800; }
      .crm-whatsapp-message em { font-style:italic; }
      .crm-whatsapp-message s { opacity:.72; }
      .crm-wa-inline,.crm-wa-code { font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace; color:rgba(244,244,242,.88); background:rgba(255,255,255,.055); border:1px solid rgba(255,255,255,.07); border-radius:5px; }
      .crm-wa-inline { padding:1px 4px; }
      .crm-wa-code { display:block; margin-top:6px; padding:8px 9px; white-space:pre-wrap; line-height:1.5; }
      .crm-detail-title { margin:0; color:var(--text); font-size:24px; letter-spacing:-.03em; }
      .crm-detail-subtitle { margin:5px 0 0; color:var(--soft); font-size:12px; }
      .crm-detail-section { margin-top:18px; padding:16px; border:1px solid var(--border); border-radius:14px; background:rgba(255,255,255,.018); }
      .crm-detail-section h3 { margin:0 0 11px; color:var(--gold); font-size:12px; text-transform:uppercase; letter-spacing:.07em; }
      .crm-detail-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); row-gap:12px; column-gap:14px; }
      .crm-detail-field span { display:block; color:var(--soft); font-size:9.5px; text-transform:uppercase; letter-spacing:.05em; }
      .crm-detail-field strong { display:block; margin-top:4.5px; color:var(--text); font-size:12.5px; overflow-wrap:anywhere; }
      .crm-history-item { padding:11px 0; border-top:1px solid rgba(255,255,255,.06); }
      .crm-history-item:first-child { border-top:0; padding-top:0; }
      .crm-history-item:last-child { padding-bottom:0; }
      .crm-history-item p { margin:6px 0 0; color:var(--muted); font-size:12px; line-height:1.58; }
      .crm-assessments-section h3 { font-size:12.5px; }
      .crm-assessments-section .crm-detail-subtitle { font-size:12.5px; }
      .crm-assessments-section .crm-history-item .crm-card-meta {
        margin-top:0;
        margin-bottom:10px;
      }
      .crm-assessments-section .crm-history-item p {
        margin-top:9px;
      }
      .crm-assessments-section .crm-history-item p + p {
        margin-top:10px;
      }
      .crm-assessments-section .crm-badge {
        height:23px;
        min-height:23px;
        padding:0 8px;
        font-size:11px;
        line-height:1;
        align-items:center;
        justify-content:center;
      }
      .crm-assessments-section .crm-history-item p .crm-badge {
        vertical-align:middle;
      }
      .crm-detail-badge-list {
        display:inline-flex;
        flex-wrap:wrap;
        align-items:center;
        gap:5px 6px;
        margin-left:4px;
        vertical-align:middle;
      }
      .crm-detail-badge-list .crm-badge {
        margin:0;
      }

      
      .analytics-filterbar{grid-template-columns:repeat(3,minmax(0,1fr))}
      .analytics-picker,.analytics-date-control{position:relative;min-width:0}
      .analytics-picker-trigger,.analytics-date-trigger{
        width:100%;min-height:46px;display:flex;align-items:center;justify-content:space-between;gap:12px;
        padding:0 13px;border:1px solid var(--border);border-radius:13px;background:rgba(8,8,8,.72);
        color:var(--text);cursor:pointer;font:inherit;font-size:12.5px;font-weight:750;text-align:left;
        transition:border-color 160ms ease,box-shadow 160ms ease,background 160ms ease
      }
      .analytics-picker-trigger:hover,.analytics-picker.open .analytics-picker-trigger,.analytics-date-trigger:hover{
        border-color:rgba(254,233,147,.46);background:rgba(11,11,11,.96);
        box-shadow:0 0 0 3px rgba(254,233,147,.045)
      }
      .analytics-picker-value{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
      .analytics-picker-chevron{width:16px;height:16px;flex:0 0 16px;display:grid;place-items:center;color:var(--soft);transition:transform 160ms ease}
      .analytics-picker-chevron svg{width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
      .analytics-picker.open .analytics-picker-chevron{transform:rotate(180deg)}
      .analytics-picker-panel{
        position:absolute;z-index:90;top:calc(100% + 8px);left:0;right:0;
        padding:9px;border:1px solid rgba(254,233,147,.22);border-radius:15px;background:#121212;
        box-shadow:0 22px 50px rgba(0,0,0,.55)
      }
      .analytics-picker-panel[hidden]{display:none}
      .analytics-picker-option{
        width:100%;min-height:42px;display:flex;justify-content:space-between;align-items:center;gap:10px;
        padding:0 11px;border:1px solid transparent;border-radius:10px;background:transparent;color:var(--muted);
        cursor:pointer;font:inherit;font-size:12px;font-weight:720;text-align:left;transition:150ms ease
      }
      .analytics-picker-option:hover{border-color:rgba(254,233,147,.24);background:rgba(254,233,147,.04);color:var(--text)}
      .analytics-picker-option.selected{border-color:rgba(254,233,147,.42);background:rgba(254,233,147,.07);color:var(--gold)}
      .analytics-picker-check{opacity:0;color:var(--gold);font-size:12px}.analytics-picker-option.selected .analytics-picker-check{opacity:1}
      .analytics-date-trigger svg{width:18px;height:18px;flex:0 0 18px;fill:none;stroke:var(--soft);stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
      .analytics-date-native{position:absolute!important;width:1px!important;height:1px!important;opacity:0!important;pointer-events:none!important;padding:0!important;border:0!important}
      .analytics-category-stack{display:grid;gap:12px;margin-top:12px}
      .analytics-category{
        padding:18px;border:1px solid var(--border);border-radius:16px;background:rgba(255,255,255,.018)
      }
      .analytics-category-head{display:flex;justify-content:space-between;gap:18px;align-items:flex-start;margin-bottom:13px}
      .analytics-category-head h3{margin:0;color:var(--text);font-size:15px}
      .analytics-category-head p{max-width:760px;margin:5px 0 0;color:var(--soft);font-size:10.5px;line-height:1.55}
      .analytics-category-metrics{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px}
      .analytics-derived-note{display:block;margin-top:5px;color:rgba(244,244,242,.38);font-size:9px;line-height:1.4}
      .analytics-chart{position:relative;width:100%;min-height:250px}
      .analytics-chart svg{width:100%;height:250px;display:block;overflow:visible}
      .analytics-chart-axis-label{fill:rgba(244,244,242,.38);font-size:10px;font-weight:650}
      .analytics-chart-grid{stroke:rgba(255,255,255,.065);stroke-width:1}
      .analytics-chart-line{fill:none;stroke:#fee993;stroke-width:3;vector-effect:non-scaling-stroke}
      .analytics-chart-point{fill:#fee993;stroke:#171717;stroke-width:2}
      .analytics-chart-hit{fill:transparent;cursor:crosshair}
      .analytics-chart-guide{stroke:rgba(254,233,147,.23);stroke-width:1;stroke-dasharray:4 5;opacity:0}
      .analytics-chart-tooltip{
        position:absolute;z-index:4;min-width:128px;pointer-events:none;transform:translate(-50%,-112%);
        padding:9px 10px;border:1px solid rgba(254,233,147,.25);border-radius:10px;background:#111;
        box-shadow:0 12px 30px rgba(0,0,0,.45);color:var(--text);font-size:10.5px;line-height:1.4
      }
      .analytics-chart-tooltip[hidden]{display:none}
      .analytics-chart-tooltip strong{display:block;color:var(--gold);font-size:13px;margin-top:2px}
      .analytics-chart-xlabels{display:flex;justify-content:space-between;gap:6px;margin:3px 18px 0 48px;color:rgba(244,244,242,.32);font-size:9px}
      .analytics-ai-highlight{
        border-color:rgba(254,233,147,.16);
        background:linear-gradient(180deg,rgba(254,233,147,.035),rgba(255,255,255,.012))
      }
      .analytics-subgrid{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-top:12px}
      @media(max-width:1100px){
        .analytics-category-metrics{grid-template-columns:repeat(2,minmax(0,1fr))}
        .analytics-subgrid{grid-template-columns:1fr}
      }
      @media(max-width:700px){
        .analytics-filterbar{grid-template-columns:1fr}
        .analytics-category-metrics{grid-template-columns:1fr 1fr}
      }

      /* Analytics  · hierarchy + proportional chart */
      .analytics-report-stack{display:grid;gap:18px;margin-top:18px}
      .analytics-report-section{padding:20px;border:1px solid var(--border);border-radius:18px;background:rgba(255,255,255,.016)}
      .analytics-report-section.primary{border-color:rgba(254,233,147,.16);background:linear-gradient(180deg,rgba(254,233,147,.028),rgba(255,255,255,.012))}
      .analytics-report-section-head{display:flex;align-items:flex-start;justify-content:space-between;gap:20px;margin-bottom:16px}
      .analytics-report-section-head h2{margin:0;color:var(--text);font-size:18px;letter-spacing:-.025em}
      .analytics-report-section-head p{max-width:820px;margin:6px 0 0;color:var(--soft);font-size:11px;line-height:1.6}
      .analytics-report-section-kicker{margin:0 0 6px;color:var(--gold);font-size:9.5px;font-weight:850;letter-spacing:.095em;text-transform:uppercase}
      .analytics-metric-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:9px}
      .analytics-metric-card{
        min-width:0;
        min-height:82px;
        display:flex;
        flex-direction:column;
        justify-content:center;
        align-items:flex-start;
        gap:7px;
        padding:11px 14px;
        border:1px solid rgba(255,255,255,.075);
        border-radius:13px;
        background:rgba(255,255,255,.02)
      }
      .analytics-metric-card.derived{background:rgba(254,233,147,.025);border-color:rgba(254,233,147,.10)}
      .analytics-metric-card span{
        display:block;
        margin:0;
        color:var(--soft);
        font-size:9.5px;
        font-weight:760;
        text-transform:uppercase;
        letter-spacing:.045em;
        line-height:1.35
      }
      .analytics-metric-card strong{
        display:block;
        margin:0;
        color:var(--text);
        font-size:20px;
        font-weight:780;
        line-height:1.08;
        letter-spacing:-.025em
      }
      .analytics-metric-card small{display:none!important}
      .analytics-section-grid{display:grid;grid-template-columns:minmax(0,1.55fr) minmax(310px,.75fr);gap:12px;margin-top:12px}
      .analytics-section-grid.equal{grid-template-columns:1fr 1fr}
      .analytics-section-panel{min-width:0;padding:17px;border:1px solid rgba(255,255,255,.07);border-radius:15px;background:rgba(0,0,0,.12)}
      .analytics-section-panel h3{margin:0;color:var(--text);font-size:13px}
      .analytics-section-panel p{margin:5px 0 14px;color:var(--soft);font-size:10px;line-height:1.5}
      .analytics-chart{position:relative;width:100%;max-width:1080px;margin:4px auto 0;min-height:0}
      .analytics-chart svg{width:100%;height:auto;aspect-ratio:1000/310;display:block;overflow:visible}
      .analytics-chart-axis-label{fill:rgba(244,244,242,.42);font-size:10px;font-weight:650}
      .analytics-chart-grid{stroke:rgba(255,255,255,.065);stroke-width:1}
      .analytics-chart-line{fill:none;stroke:#fee993;stroke-width:2.5;vector-effect:non-scaling-stroke}
      .analytics-chart-point{fill:#fee993;stroke:#171717;stroke-width:2;vector-effect:non-scaling-stroke}
      .analytics-chart-hit{fill:transparent;cursor:crosshair}
      .analytics-chart-guide{stroke:rgba(254,233,147,.25);stroke-width:1;stroke-dasharray:4 5;opacity:0;vector-effect:non-scaling-stroke}
      .analytics-chart-xlabels{display:flex;justify-content:space-between;gap:6px;margin:5px 12px 0 54px;color:rgba(244,244,242,.36);font-size:9.5px}
      .analytics-interest-summary{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin-bottom:12px}
      .analytics-interest-pill{padding:11px 10px;border:1px solid rgba(255,255,255,.07);border-radius:12px;background:rgba(255,255,255,.018)}
      .analytics-interest-pill span{display:block;color:var(--soft);font-size:9px;text-transform:uppercase;font-weight:780}
      .analytics-interest-pill strong{display:block;margin-top:5px;font-size:18px;color:var(--text)}
      .analytics-interest-pill.low{border-color:rgba(255,112,112,.14)}
      .analytics-interest-pill.medium{border-color:rgba(241,169,76,.16)}
      .analytics-interest-pill.high{border-color:rgba(111,220,145,.16)}
      .analytics-campaign-table-wrap{overflow:auto;margin-top:12px}
      .analytics-funnel-ratios{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin-top:10px}
      @media(max-width:1120px){.analytics-metric-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.analytics-section-grid,.analytics-section-grid.equal{grid-template-columns:1fr}}
      @media(max-width:680px){.analytics-metric-grid{grid-template-columns:1fr 1fr}.analytics-interest-summary,.analytics-funnel-ratios{grid-template-columns:1fr}.analytics-report-section{padding:15px}}


      /* Analytics  · date picker + typography + chart fit */
      #analyticsPage .monitoring-data-kicker{font-size:12px}
      #analyticsPage .monitoring-data-title{font-size:clamp(31px,4vw,43px)}
      #analyticsPage .monitoring-data-copy{font-size:15px}
      #analyticsPage .monitoring-data-button{font-size:13px}
      #analyticsPage .monitoring-filter label{font-size:11px}
      #analyticsPage .analytics-picker-trigger,
      #analyticsPage .analytics-date-trigger{font-size:13.5px}
      #analyticsPage .analytics-picker-option{font-size:13px}
      #analyticsPage .analytics-report-section-kicker{font-size:10.5px}
      #analyticsPage .analytics-report-section-head h2{font-size:19px}
      #analyticsPage .analytics-report-section-head p{font-size:12px}
      #analyticsPage .analytics-metric-card span{font-size:10.5px}
      #analyticsPage .analytics-metric-card strong{font-size:21px;line-height:1.08;margin:0}
      #analyticsPage .analytics-metric-card span{margin:0}
      #analyticsPage .analytics-metric-card small{display:none!important}
      #analyticsPage .analytics-section-panel h3{font-size:14px}
      #analyticsPage .analytics-section-panel p{font-size:11px}
      #analyticsPage .analytics-interest-pill span{font-size:10px}
      #analyticsPage .analytics-interest-pill strong{font-size:19px}
      #analyticsPage .analytics-funnel-step strong{font-size:22px}
      #analyticsPage .analytics-funnel-step span{font-size:10.5px}
      #analyticsPage .analytics-table td{font-size:12px}
      #analyticsPage .analytics-table th{font-size:10px}
      #analyticsPage .analytics-metric span{font-size:10.5px}
      #analyticsPage .analytics-metric strong{font-size:17px}
      #analyticsPage .analytics-chart-axis-label{font-size:11px}
      #analyticsPage .analytics-chart-xlabels{font-size:10.5px}
      #analyticsPage .analytics-chart-tooltip{font-size:11.5px}
      #analyticsPage .analytics-chart-tooltip strong{font-size:14px}
      #analyticsPage .crm-empty{font-size:12px}

      #analyticsPage .analytics-date-control.open .analytics-date-trigger{
        border-color:rgba(254,233,147,.46);
        background:rgba(11,11,11,.96);
        box-shadow:0 0 0 3px rgba(254,233,147,.045);
      }
      #analyticsPage .analytics-calendar-panel{
        position:absolute;z-index:140;top:calc(100% + 8px);left:0;width:320px;
        padding:12px;border:1px solid rgba(254,233,147,.22);border-radius:15px;background:#121212;
        box-shadow:0 22px 50px rgba(0,0,0,.58);
      }
      #analyticsPage .analytics-calendar-panel[hidden]{display:none}
      #analyticsPage .analytics-calendar-head{
        display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:10px;
      }
      #analyticsPage .analytics-calendar-month{
        color:var(--text);font-size:13px;font-weight:800;text-transform:capitalize;
      }
      #analyticsPage .analytics-calendar-nav{
        width:32px;height:32px;display:grid;place-items:center;padding:0;border:1px solid var(--border);
        border-radius:9px;background:rgba(255,255,255,.02);color:var(--muted);cursor:pointer;transition:.15s ease;
      }
      #analyticsPage .analytics-calendar-nav:hover{
        border-color:rgba(254,233,147,.28);background:rgba(254,233,147,.05);color:var(--gold);
      }
      #analyticsPage .analytics-calendar-nav svg{
        width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round;
      }
      #analyticsPage .analytics-calendar-weekdays,
      #analyticsPage .analytics-calendar-grid{
        display:grid;grid-template-columns:repeat(7,1fr);gap:4px;
      }
      #analyticsPage .analytics-calendar-weekdays{margin-bottom:5px}
      #analyticsPage .analytics-calendar-weekdays span{
        min-height:24px;display:grid;place-items:center;color:var(--soft);font-size:10px;font-weight:800;
      }
      #analyticsPage .analytics-calendar-day{
        height:34px;display:grid;place-items:center;padding:0;border:1px solid transparent;border-radius:9px;
        background:transparent;color:var(--muted);cursor:pointer;font:inherit;font-size:12px;font-weight:720;
        font-variant-numeric:tabular-nums;transition:.14s ease;
      }
      #analyticsPage .analytics-calendar-day:hover:not(:disabled){
        border-color:rgba(254,233,147,.22);background:rgba(254,233,147,.045);color:var(--text);
      }
      #analyticsPage .analytics-calendar-day.outside{color:rgba(244,244,242,.24)}
      #analyticsPage .analytics-calendar-day.today{
        border-color:rgba(254,233,147,.18);color:var(--gold);
      }
      #analyticsPage .analytics-calendar-day.selected{
        border-color:rgba(254,233,147,.52);background:rgba(254,233,147,.11);color:var(--gold);
        box-shadow:inset 0 0 0 1px rgba(254,233,147,.035);
      }
      #analyticsPage .analytics-calendar-day:disabled{opacity:.22;cursor:not-allowed}
      #analyticsPage .analytics-calendar-footer{
        display:flex;align-items:center;justify-content:space-between;gap:10px;margin-top:10px;padding-top:10px;
        border-top:1px solid rgba(255,255,255,.06);
      }
      #analyticsPage .analytics-calendar-link{
        padding:0;border:0;background:transparent;color:var(--gold);cursor:pointer;font:inherit;font-size:11px;font-weight:750;
      }

      /* Faz o SVG ocupar a largura inteira sem distorcer círculos ou texto. */
      #analyticsPage .analytics-chart{width:100%;max-width:none;margin:4px 0 0}
      #analyticsPage .analytics-chart svg{
        width:100%!important;height:auto!important;aspect-ratio:1200/280!important;display:block!important;overflow:visible;
      }
      #analyticsPage .analytics-chart-xlabels{margin-left:43px;margin-right:8px}

      .analytics-kpis { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; margin:18px 0; }
      .analytics-kpi { padding:15px; border:1px solid var(--border); border-radius:15px; background:linear-gradient(180deg,rgba(30,30,30,.88),rgba(18,18,18,.93)); }
      .analytics-kpi-label { margin:0; color:var(--soft); font-size:10px; font-weight:800; text-transform:uppercase; letter-spacing:.055em; }
      .analytics-kpi-value { margin:7px 0 0; color:var(--text); font-size:25px; font-weight:750; letter-spacing:-.03em; }
      .analytics-kpi-delta { margin:5px 0 0; color:var(--soft); font-size:10px; }
      .analytics-kpi-delta.up { color:#a9ebbd; } .analytics-kpi-delta.down { color:#ffb0b0; }
      .analytics-grid { display:grid; grid-template-columns:1.45fr 1fr; gap:12px; margin-top:12px; }
      .analytics-panel { min-width:0; padding:17px; border:1px solid var(--border); border-radius:16px; background:rgba(255,255,255,.018); }
      .analytics-panel.wide { grid-column:1 / -1; }
      .analytics-panel h3 { margin:0; color:var(--text); font-size:14px; }
      .analytics-panel-copy { margin:5px 0 14px; color:var(--soft); font-size:10.5px; line-height:1.5; }
      .analytics-chart { width:100%; min-height:220px; }
      .analytics-chart svg { width:100%; height:220px; display:block; overflow:visible; }
      .analytics-chart-labels { display:flex; justify-content:space-between; gap:6px; margin-top:7px; color:rgba(244,244,242,.32); font-size:9px; }
      .analytics-bars { display:grid; gap:10px; }
      .analytics-bar-row { display:grid; gap:5px; }
      .analytics-bar-head { display:flex; justify-content:space-between; gap:10px; color:var(--muted); font-size:11px; }
      .analytics-bar-track { height:8px; overflow:hidden; border-radius:999px; background:rgba(255,255,255,.055); }
      .analytics-bar-fill { height:100%; border-radius:999px; background:linear-gradient(90deg,#bca94f,#fee993); }
      .analytics-funnel { display:grid; grid-template-columns:repeat(4,1fr); gap:8px; }
      .analytics-funnel-step { padding:13px 10px; border:1px solid var(--border); border-radius:12px; background:rgba(255,255,255,.022); text-align:center; }
      .analytics-funnel-step strong { display:block; color:var(--gold); font-size:21px; }
      .analytics-funnel-step span { display:block; margin-top:4px; color:var(--soft); font-size:9.5px; line-height:1.35; }
      .analytics-table { width:100%; border-collapse:collapse; min-width:680px; }
      .analytics-table th,.analytics-table td { padding:11px 10px; border-bottom:1px solid rgba(255,255,255,.055); text-align:left; font-size:11px; }
      .analytics-table th { color:var(--soft); font-size:9px; text-transform:uppercase; letter-spacing:.055em; }
      .analytics-table td { color:var(--muted); }
      .analytics-table strong { color:var(--text); }
      .analytics-metrics { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:8px; }
      .analytics-metric { padding:12px; border:1px solid rgba(255,255,255,.065); border-radius:11px; background:rgba(255,255,255,.015); }
      .analytics-metric span { display:block; color:var(--soft); font-size:9.5px; line-height:1.35; }
      .analytics-metric strong { display:block; margin-top:5px; color:var(--text); font-size:16px; }
      .monitoring-data-loading { min-height:260px; display:grid; place-items:center; color:var(--muted); text-align:center; }

      @media (max-width:1100px){
        .monitoring-filterbar{grid-template-columns:repeat(3,minmax(0,1fr));}.monitoring-filter.search{grid-column:span 2;}
        .analytics-kpis{grid-template-columns:repeat(2,minmax(0,1fr));}.analytics-grid{grid-template-columns:1fr}.analytics-panel.wide{grid-column:auto}.analytics-metrics{grid-template-columns:repeat(3,minmax(0,1fr));}
      }
      @media (max-width:700px){
        .monitoring-data-page{padding:24px 0 60px}.monitoring-data-hero{align-items:flex-start;flex-direction:column}.monitoring-data-actions{width:100%}.monitoring-data-button{flex:1}
        .monitoring-filterbar{grid-template-columns:1fr}.monitoring-filter.search{grid-column:auto}.analytics-kpis{grid-template-columns:1fr 1fr}.analytics-funnel{grid-template-columns:1fr 1fr}.analytics-metrics{grid-template-columns:repeat(2,minmax(0,1fr));}
        .crm-detail-grid{grid-template-columns:1fr}.crm-drawer{padding:18px}
      }

      /* ======================================================
         CONNECTION  — WHATSAPP
      ====================================================== */

      .connection-page {
        min-height: calc(100vh - 76px);
      }

      .connection-page-inner {
        width: min(1120px, 100%);
        margin: 0 auto;
        padding: 28px 0 84px;
      }

      .connection-hero {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr) auto;
        gap: 18px;
        align-items: center;
        margin-top: 22px;
        padding: 24px;
        border: 1px solid var(--border);
        border-radius: 22px;
        background:
          radial-gradient(circle at 0 0, rgba(254,233,147,.07), transparent 34%),
          linear-gradient(180deg, rgba(255,255,255,.032), rgba(255,255,255,.016));
      }

      .connection-hero-icon {
        width: 58px;
        height: 58px;
        display: grid;
        place-items: center;
        border: 1px solid rgba(254,233,147,.26);
        border-radius: 17px;
        background: var(--gold-faint);
        color: var(--gold);
      }

      .connection-hero-icon svg,
      .connection-state-icon svg,
      .connection-guide-icon svg,
      .connection-button svg {
        fill: none;
        stroke: currentColor;
        stroke-width: 1.8;
        stroke-linecap: round;
        stroke-linejoin: round;
      }

      .connection-hero-icon svg {
        width: 27px;
        height: 27px;
      }

      .connection-kicker {
        margin: 0 0 5px;
        color: var(--gold-soft);
        font-size: 11px;
        font-weight: 800;
        letter-spacing: .1em;
        text-transform: uppercase;
      }

      .connection-title {
        margin: 0;
        color: var(--text);
        font-size: clamp(28px, 3.4vw, 38px);
        line-height: 1.08;
        letter-spacing: -.035em;
      }

      .connection-copy {
        max-width: 760px;
        margin: 8px 0 0;
        color: var(--muted);
        font-size: 14px;
        line-height: 1.65;
      }

      .connection-status-pill {
        min-height: 32px;
        display: inline-flex;
        align-items: center;
        gap: 7px;
        padding: 0 11px;
        border: 1px solid rgba(222,123,112,.25);
        border-radius: 999px;
        background: rgba(222,123,112,.07);
        color: #e5aaa2;
        font-size: 11px;
        font-weight: 850;
        white-space: nowrap;
      }

      .connection-status-pill::before {
        content: "";
        width: 7px;
        height: 7px;
        flex: 0 0 7px;
        border-radius: 999px;
        background: currentColor;
        box-shadow: 0 0 7px currentColor;
      }

      .connection-status-pill.connecting {
        border-color: rgba(245,189,92,.28);
        background: rgba(245,189,92,.075);
        color: #f2c779;
      }

      .connection-status-pill.connecting::before {
        animation: connection-dot-pulse 1.2s ease-in-out infinite;
      }

      .connection-status-pill.connected {
        border-color: rgba(96,218,133,.28);
        background: rgba(96,218,133,.085);
        color: #9deab6;
      }

      @keyframes connection-dot-pulse {
        0%, 100% { opacity: .38; transform: scale(.88); }
        50% { opacity: 1; transform: scale(1.08); }
      }

      .connection-grid {
        display: grid;
        grid-template-columns: minmax(0, 1.4fr) minmax(290px, .72fr);
        gap: 16px;
        align-items: stretch;
        margin-top: 18px;
      }

      .connection-card {
        border: 1px solid var(--border);
        border-radius: 20px;
        background:
          linear-gradient(180deg, rgba(28,28,28,.92), rgba(18,18,18,.94));
        box-shadow: 0 18px 46px rgba(0,0,0,.16);
      }

      .connection-main-card {
        min-height: 430px;
        display: grid;
        place-items: center;
        padding: 30px;
        text-align: center;
        position: relative;
        overflow: hidden;
      }

      .connection-main-card::before {
        content: "";
        position: absolute;
        inset: 0;
        pointer-events: none;
        background:
          radial-gradient(circle at 50% 16%, rgba(254,233,147,.055), transparent 39%);
      }

      .connection-state-content {
        position: relative;
        z-index: 1;
        width: min(100%, 610px);
      }

      .connection-state-icon {
        width: 66px;
        height: 66px;
        display: grid;
        place-items: center;
        margin: 0 auto 21px;
        border: 1px solid rgba(254,233,147,.26);
        border-radius: 20px;
        background: var(--gold-faint);
        color: var(--gold);
      }

      .connection-state-icon svg {
        width: 30px;
        height: 30px;
      }

      .connection-state-icon.success {
        border-color: rgba(96,218,133,.26);
        background: rgba(96,218,133,.075);
        color: #9deab6;
        box-shadow: 0 0 34px rgba(96,218,133,.06);
      }

      .connection-state-icon.error {
        border-color: rgba(222,123,112,.26);
        background: rgba(222,123,112,.07);
        color: #e5aaa2;
      }

      .connection-state-title {
        margin: 0;
        color: var(--text);
        font-size: 20px;
        line-height: 1.3;
        letter-spacing: -.025em;
      }

      .connection-state-copy {
        max-width: 550px;
        margin: 11px auto 0;
        color: var(--muted);
        font-size: 13px;
        line-height: 1.7;
      }

      .connection-qr-troubleshooting {
        width: min(550px, 100%);
        margin: 16px auto 0;
        padding: 15px 17px;
        border: 1px solid rgba(255,255,255,.075);
        border-radius: 12px;
        background: rgba(255,255,255,.022);
        text-align: left;
      }

      .connection-qr-error-label {
        display: block;
        margin: 0 0 7px;
        color: var(--text);
        font-size: 15px;
        line-height: 1.4;
        font-weight: 850;
      }

      .connection-qr-error-main {
        display: block;
        margin: 0;
        color: rgba(244,244,242,.82);
        font-size: 14px;
        line-height: 1.5;
        font-weight: 500;
      }

      .connection-qr-error-secondary {
        display: block;
        margin: 2px 0 0;
        color: var(--muted);
        font-size: 13px;
        line-height: 1.55;
      }

      .connection-qr-error-instruction {
        margin: 12px 0 0;
        padding-top: 11px;
        border-top: 1px solid rgba(255,255,255,.065);
        color: rgba(244,244,242,.66);
        font-size: 13px;
        line-height: 1.65;
      }

      .connection-primary-button,
      .connection-secondary-button {
        font: inherit;
        font-weight: 850;
        cursor: pointer;
        transition:
          transform 160ms ease,
          border-color 160ms ease,
          background 160ms ease,
          filter 160ms ease;
      }

      .connection-primary-button {
        min-height: 46px;
        margin-top: 24px;
        padding: 0 19px;
        border: 1px solid rgba(255,244,191,.72);
        border-radius: 12px;
        background: linear-gradient(180deg, #f8df78, #f2d66c);
        color: #1d1b13;
        font-size: 12.5px;
        box-shadow:
          inset 0 1px 0 rgba(255,255,255,.18),
          0 10px 24px rgba(254,233,147,.06);
      }

      .connection-primary-button:hover:not(:disabled) {
        transform: translateY(-1px);
        filter: brightness(1.035);
      }

      .connection-primary-button:disabled {
        opacity: .56;
        cursor: default;
      }

      .connection-button-row {
        display: flex;
        justify-content: center;
        flex-wrap: wrap;
        gap: 9px;
        margin-top: 19px;
      }

      .connection-secondary-button {
        min-height: 41px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        padding: 0 14px;
        border: 1px solid rgba(255,255,255,.13);
        border-radius: 11px;
        background: rgba(255,255,255,.035);
        color: var(--muted);
        font-size: 11.5px;
      }

      .connection-secondary-button:hover:not(:disabled) {
        border-color: rgba(254,233,147,.26);
        background: rgba(255,255,255,.055);
        color: var(--text);
      }

      .connection-secondary-button svg {
        width: 15px;
        height: 15px;
      }

      .connection-recovery-row {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        margin-top: 12px;
      }

      .connection-danger-button {
        min-height: 38px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        padding: 0 13px;
        border: 1px solid rgba(239, 92, 92, .42);
        border-radius: 10px;
        background: rgba(239, 68, 68, .075);
        color: #ff8c8c;
        font: inherit;
        font-size: 11.5px;
        font-weight: 820;
        cursor: pointer;
        transition: border-color 160ms ease, background 160ms ease, color 160ms ease, transform 160ms ease;
      }

      .connection-danger-button:hover:not(:disabled) {
        border-color: rgba(239, 92, 92, .72);
        background: rgba(239, 68, 68, .12);
        color: #ffabab;
        transform: translateY(-1px);
      }

      .connection-danger-button:disabled {
        opacity: .52;
        cursor: default;
      }

      .connection-recovery-info {
        position: relative;
        width: 20px;
        height: 20px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border: 1px solid rgba(255,255,255,.14);
        border-radius: 999px;
        color: rgba(244,244,242,.62);
        font-size: 11px;
        font-weight: 850;
        cursor: help;
        outline: none;
      }

      .connection-recovery-info::after {
        content: attr(data-tooltip);
        position: absolute;
        z-index: 30;
        left: 50%;
        bottom: calc(100% + 10px);
        width: max-content;
        max-width: 245px;
        padding: 8px 10px;
        border: 1px solid rgba(255,255,255,.1);
        border-radius: 9px;
        background: #151515;
        color: rgba(244,244,242,.82);
        box-shadow: 0 12px 30px rgba(0,0,0,.3);
        font-size: 11px;
        font-weight: 650;
        line-height: 1.45;
        text-align: left;
        transform: translate(-50%, 4px);
        opacity: 0;
        pointer-events: none;
        transition: opacity 140ms ease, transform 140ms ease;
      }

      .connection-recovery-info:hover::after,
      .connection-recovery-info:focus-visible::after {
        opacity: 1;
        transform: translate(-50%, 0);
      }

      .connection-spinner {
        width: 40px;
        height: 40px;
        margin: 0 auto 22px;
        border: 3px solid rgba(254,233,147,.13);
        border-top-color: var(--gold);
        border-radius: 50%;
        animation: connection-spin .8s linear infinite;
      }

      @keyframes connection-spin {
        to { transform: rotate(360deg); }
      }

      .connection-qr-shell {
        width: min(302px, 78vw);
        margin: 0 auto 18px;
        padding: 14px;
        border: 1px solid rgba(254,233,147,.42);
        border-radius: 19px;
        box-shadow:
          0 0 0 6px rgba(254,233,147,.035),
          0 18px 42px rgba(0,0,0,.28);
        transition: background 180ms ease, border-color 180ms ease;
      }

      .connection-qr-shell.styled {
        background: #050505;
        border-color: rgba(255,255,255,.18);
        box-shadow:
          0 0 0 6px rgba(255,255,255,.018),
          0 18px 42px rgba(0,0,0,.34);
      }

      .connection-qr-shell.plain {
        background: #fff;
        border-color: rgba(255,255,255,.56);
      }

      .connection-qr-shell img {
        width: 100%;
        aspect-ratio: 1;
        display: block;
        object-fit: contain;
        border-radius: 11px;
        image-rendering: pixelated;
        transition: filter 180ms ease, background 180ms ease, padding 180ms ease;
      }

      .connection-qr-shell.styled img {
        padding: 8px;
        background: #050505;
        filter: invert(1) grayscale(1) contrast(1.14) brightness(1.05);
      }

      .connection-qr-shell.plain img {
        padding: 8px;
        background: #fff;
        filter: none;
      }

      .connection-qr-style-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        margin-top: 10px;
        padding: 0;
        border: 0;
        background: transparent;
        color: rgba(244,244,242,.52);
        font: inherit;
        font-size: 11.5px;
        font-weight: 700;
        cursor: pointer;
        text-decoration: underline;
        text-underline-offset: 3px;
        transition: color 160ms ease;
      }

      .connection-qr-style-toggle:hover {
        color: var(--gold);
      }

      .connection-secondary-button:disabled {
        cursor: default;
        opacity: .62;
      }

      .connection-button-loading svg {
        animation: connection-spin .75s linear infinite;
      }

      .connection-waiting {
        margin-top: 14px;
        display: inline-flex;
        align-items: center;
        gap: 8px;
        color: var(--gold);
        font-size: 11px;
        font-weight: 850;
      }

      .connection-waiting::before {
        content: "";
        width: 7px;
        height: 7px;
        border-radius: 999px;
        background: var(--gold);
        box-shadow: 0 0 9px rgba(254,233,147,.55);
        animation: connection-dot-pulse 1.1s ease-in-out infinite;
      }

      .connection-error-code {
        max-width: 540px;
        margin: 14px auto 0;
        padding: 9px 11px;
        border: 1px solid rgba(222,123,112,.16);
        border-radius: 9px;
        background: rgba(222,123,112,.04);
        color: #c9948e;
        font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
        font-size: 10.5px;
        line-height: 1.5;
        overflow-wrap: anywhere;
      }

      .connection-guide {
        padding: 27px;
      }

      .connection-guide-head {
        display: flex;
        align-items: center;
        gap: 13px;
      }

      .connection-guide-icon {
        width: 43px;
        height: 43px;
        flex: 0 0 43px;
        display: grid;
        place-items: center;
        border: 1px solid rgba(254,233,147,.20);
        border-radius: 12px;
        background: rgba(254,233,147,.055);
        color: var(--gold);
      }

      .connection-guide-icon svg {
        width: 21px;
        height: 21px;
      }

      .connection-guide-title {
        margin: 0;
        color: var(--text);
        font-size: 17px;
        font-weight: 850;
        letter-spacing: -.015em;
      }

      .connection-guide-copy {
        margin: 5px 0 0;
        color: var(--soft);
        font-size: 13px;
        line-height: 1.55;
      }

      .connection-steps {
        display: grid;
        gap: 18px;
        margin: 25px 0 0;
        padding: 0;
        list-style: none;
      }

      .connection-step {
        display: grid;
        grid-template-columns: 31px minmax(0, 1fr);
        gap: 12px;
        align-items: start;
      }

      .connection-step-number {
        width: 31px;
        height: 31px;
        display: grid;
        place-items: center;
        margin: 0;
        border: 1px solid rgba(254,233,147,.22);
        border-radius: 9px;
        background: rgba(254,233,147,.055);
        color: var(--gold);
        font-size: 12px;
        line-height: 1;
        font-weight: 850;
        text-align: center;
      }

      .connection-step strong {
        display: block;
        margin-top: 1px;
        color: rgba(244,244,242,.92);
        font-size: 13px;
        line-height: 1.42;
      }

      .connection-step > div > span {
        display: block;
        margin-top: 4px;
        color: var(--soft);
        font-size: 12.2px;
        line-height: 1.58;
      }

      .connection-security {
        display: grid;
        justify-items: center;
        gap: 10px;
        margin-top: 24px;
        padding-top: 21px;
        border-top: 1px solid rgba(255,255,255,.07);
        color: var(--soft);
        font-size: 12.2px;
        line-height: 1.6;
        text-align: center;
      }

      .connection-security svg {
        width: 29px;
        height: 29px;
        fill: none;
        stroke: #9deab6;
        stroke-width: 1.7;
        stroke-linecap: round;
        stroke-linejoin: round;
        filter: drop-shadow(0 0 9px rgba(96,218,133,.18));
      }

      .connection-terms-panel {
        width: min(690px, 100%);
        margin: 0 auto;
        text-align: left;
      }

      .connection-terms-header {
        display: flex;
        align-items: center;
        gap: 14px;
        margin-bottom: 16px;
      }

      .connection-terms-icon {
        width: 46px;
        height: 46px;
        flex: 0 0 46px;
        display: grid;
        place-items: center;
        padding: 0;
        border: 1px solid rgba(254,233,147,.30);
        border-radius: 13px;
        background: rgba(254,233,147,.07);
        color: var(--gold);
        transform-origin: center;
        animation: connectionWarningPulse 2.35s ease-in-out infinite;
      }

      .connection-terms-icon svg {
        width: 25px;
        height: 25px;
        display: block;
        fill: none;
        stroke: currentColor;
        stroke-width: 1.8;
        stroke-linecap: round;
        stroke-linejoin: round;
      }

      @keyframes connectionWarningPulse {
        0%, 100% {
          transform: scale(1);
          box-shadow:
            0 0 0 0 rgba(254,233,147,0),
            inset 0 0 0 1px rgba(254,233,147,.02);
        }
        50% {
          transform: scale(1.045);
          box-shadow:
            0 0 0 7px rgba(254,233,147,.045),
            0 0 20px rgba(254,233,147,.10),
            inset 0 0 0 1px rgba(254,233,147,.05);
        }
      }

      @media (prefers-reduced-motion: reduce) {
        .connection-terms-icon {
          animation: none;
        }
      }

      .connection-terms-title {
        margin: 0;
        color: var(--text);
        font-size: 20px;
        line-height: 1.35;
        letter-spacing: -.018em;
      }

      .connection-terms-intro {
        margin: 6px 0 0;
        color: var(--muted);
        font-size: 14px;
        line-height: 1.62;
      }

      .connection-terms-copy {
        padding: 17px 18px;
        border: 1px solid rgba(255,255,255,.085);
        border-radius: 13px;
        background: rgba(255,255,255,.025);
        color: rgba(244,244,242,.74);
        font-size: 14px;
        line-height: 1.68;
      }

      .connection-terms-copy p {
        margin: 0;
      }

      .connection-terms-copy p + p {
        margin-top: 11px;
      }

      .connection-terms-check {
        display: flex;
        align-items: flex-start;
        gap: 11px;
        margin-top: 18px;
        padding: 14px 15px;
        border: 1px solid rgba(254,233,147,.17);
        border-radius: 11px;
        background: rgba(254,233,147,.035);
        color: rgba(244,244,242,.88);
        font-size: 13.5px;
        line-height: 1.5;
        cursor: pointer;
      }

      .connection-terms-check input {
        width: 17px;
        height: 17px;
        flex: 0 0 17px;
        margin: 1px 0 0;
        accent-color: #e7ca62;
        cursor: pointer;
      }

      .connection-terms-inline-read {
        display: inline-flex;
        margin-top: 12px;
        padding: 0;
        border: 0;
        background: transparent;
        color: var(--gold);
        font: inherit;
        font-size: 13.5px;
        font-weight: 800;
        cursor: pointer;
        transition: opacity 160ms ease;
      }

      .connection-terms-inline-read:hover {
        opacity: .78;
      }

      .connection-terms-actions {
        display: flex;
        justify-content: center;
        margin-top: 18px;
      }

      .connection-terms-actions .connection-primary-button {
        margin-top: 0;
      }

      .connection-terms-reread {
        margin-top: 17px;
        text-align: center;
      }

      .connection-terms-link {
        padding: 2px 0;
        border: 0;
        background: transparent;
        color: rgba(244,244,242,.58);
        font: inherit;
        font-size: 13.5px;
        font-weight: 800;
        cursor: pointer;
        text-decoration: underline;
        text-underline-offset: 4px;
        transition: color 160ms ease;
      }

      .connection-terms-link:hover {
        color: var(--gold);
      }

      .connection-terms-modal-backdrop {
        position: fixed;
        inset: 0;
        z-index: 9000;
        display: grid;
        place-items: center;
        padding: 22px;
        background: rgba(0,0,0,.74);
        backdrop-filter: blur(10px);
      }

      .connection-terms-modal {
        width: min(720px, 100%);
        max-height: min(760px, 88vh);
        overflow: auto;
        border: 1px solid rgba(255,255,255,.11);
        border-radius: 19px;
        background: linear-gradient(180deg, #1a1a19, #101010);
        box-shadow: 0 24px 70px rgba(0,0,0,.55);
      }

      .connection-terms-modal-head {
        position: sticky;
        top: 0;
        z-index: 2;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 16px;
        padding: 20px 22px;
        border-bottom: 1px solid rgba(255,255,255,.075);
        background: rgba(20,20,19,.96);
        backdrop-filter: blur(12px);
      }

      .connection-terms-modal-title {
        margin: 0;
        color: var(--text);
        font-size: 19px;
        line-height: 1.35;
      }

      .connection-terms-modal-close {
        width: 38px;
        height: 38px;
        display: grid;
        place-items: center;
        padding: 0;
        border: 1px solid rgba(255,255,255,.09);
        border-radius: 10px;
        background: rgba(255,255,255,.035);
        color: var(--muted);
        cursor: pointer;
      }

      .connection-terms-modal-close svg {
        width: 17px;
        height: 17px;
        display: block;
        fill: none;
        stroke: currentColor;
        stroke-width: 2;
        stroke-linecap: round;
      }

      .connection-terms-modal-close:hover {
        color: var(--text);
        border-color: rgba(255,255,255,.17);
      }

      .connection-terms-modal-body {
        padding: 24px;
        color: rgba(244,244,242,.76);
        font-size: 14.25px;
        line-height: 1.78;
      }

      .connection-terms-modal-body h3 {
        margin: 0 0 8px;
        color: var(--text);
        font-size: 15.5px;
        line-height: 1.4;
        font-weight: 850;
        letter-spacing: -.01em;
      }

      .connection-terms-modal-body h3:not(:first-child) {
        margin-top: 24px;
      }

      .connection-terms-modal-body p {
        margin: 0;
      }

      .connection-terms-modal-body p + p {
        margin-top: 14px;
      }

      .connection-footer-note {
        margin: 15px 2px 0;
        color: rgba(244,244,242,.34);
        font-size: 10.5px;
        line-height: 1.55;
      }

      @media (max-width: 960px) {
        .connection-grid {
          grid-template-columns: 1fr;
        }

        .connection-main-card {
          min-height: 390px;
        }
      }

      @media (max-width: 900px) {
        .connection-page-inner {
          width: 100%;
          padding: 24px 0 54px;
        }
      }

      @media (max-width: 620px) {
        .connection-page-inner {
          padding: 20px 0 46px;
        }

        .connection-hero {
          grid-template-columns: 50px minmax(0, 1fr);
          gap: 14px;
          margin-top: 18px;
          padding: 17px;
          border-radius: 18px;
        }

        .connection-hero-icon {
          width: 50px;
          height: 50px;
          border-radius: 14px;
        }

        .connection-title {
          font-size: clamp(25px, 7.5vw, 31px);
        }

        .connection-copy {
          font-size: 12.5px;
        }

        .connection-status-pill {
          grid-column: 1 / -1;
          width: fit-content;
        }

        .connection-main-card {
          min-height: 360px;
          padding: 24px 17px;
        }

        .connection-guide {
          padding: 21px;
        }

        .connection-guide-title {
          font-size: 16px;
        }

        .connection-guide-copy {
          font-size: 12.5px;
        }

        .connection-step strong {
          font-size: 12.8px;
        }

        .connection-step > div > span,
        .connection-security {
          font-size: 12px;
        }

        .connection-button-row {
          display: grid;
          grid-template-columns: 1fr;
        }

        .connection-primary-button,
        .connection-secondary-button {
          width: 100%;
          min-height: 46px;
        }

        .connection-terms-copy,
        .connection-terms-modal-body {
          font-size: 12.5px;
        }

        .connection-terms-actions {
          display: block;
        }

        .connection-terms-actions .connection-primary-button {
          width: 100%;
        }
      }

      @media (prefers-reduced-motion: reduce) {
        .connection-status-pill.connecting::before,
        .connection-waiting::before,
        .connection-spinner {
          animation: none;
        }
      }


      /* ======================================================
         AUTH VISUAL PARITY — 2026-08-26
         Login / solicitação de conta / signup / recovery.
         Uses the same surface language as .real-agent-card,
         while deliberately preserving the App's large card,
         spacing and typography scale.
      ====================================================== */

      body:not(.app-mode) .wrap {
        width: min(620px, 96vw);
      }

      body:not(.app-mode) .card {
        /* Keep the original large 620px experience and 40px padding. */
        padding: 40px;
        overflow: hidden;
        border: 1px solid rgba(254,233,147,.16);
        border-radius: 26px;
        background:
          linear-gradient(
            180deg,
            rgba(31,31,31,.94),
            rgba(18,18,18,.96)
          );
        box-shadow:
          inset 0 1px 0 rgba(255,255,255,.025),
          0 16px 38px rgba(0,0,0,.18),
          0 30px 80px rgba(0,0,0,.30);
        backdrop-filter: blur(15px);
        -webkit-backdrop-filter: blur(15px);
      }

      body:not(.app-mode) .card::before {
        content: "";
        position: absolute;
        inset: 0;
        pointer-events: none;
        background:
          radial-gradient(
            circle at 10% 0%,
            rgba(254,233,147,.038),
            transparent 34%
          ),
          linear-gradient(
            115deg,
            rgba(255,255,255,.018),
            transparent 32%
          );
      }

      /* Agent-card avatar language, but keep the existing large logo. */
      body:not(.app-mode) .logo {
        width: 88px;
        height: 88px;
        border: 1px solid rgba(254,233,147,.22);
        border-radius: 18px;
        background: #171717;
        box-shadow:
          inset 0 1px 0 rgba(255,255,255,.025);
      }

      /*
       * Same hierarchy used in the authenticated App:
       * white main title, gold reserved for accents and primary action.
       * Font sizes remain exactly in the existing App scale.
       */
      body:not(.app-mode) h1 {
        color: var(--text);
      }

      body:not(.app-mode) .subtitle {
        color: var(--muted);
      }

      body:not(.app-mode) .field input {
        border-color: rgba(255,255,255,.17);
        background: rgba(10,10,10,.82);
      }

      body:not(.app-mode) .field input:hover {
        border-color: rgba(255,255,255,.22);
        background: rgba(14,14,14,.94);
      }

      body:not(.app-mode) .field input:focus {
        border-color: rgba(254,233,147,.70);
        background: #101010;
        box-shadow:
          0 0 0 4px rgba(254,233,147,.07),
          inset 0 1px 0 rgba(255,255,255,.02);
      }

      /* The signup information block now feels like a sibling surface,
         instead of a second bright gold card inside the auth card. */
      body:not(.app-mode) .access-note {
        border: 1px solid rgba(254,233,147,.13);
        border-radius: 16px;
        background:
          linear-gradient(
            180deg,
            rgba(254,233,147,.045),
            rgba(255,255,255,.018)
          );
        box-shadow: inset 0 1px 0 rgba(255,255,255,.018);
      }

      body:not(.app-mode) .note-icon {
        border-color: rgba(254,233,147,.22);
        background: rgba(254,233,147,.075);
      }

      body:not(.app-mode) .note-title {
        color: var(--text);
      }

      /* Status screens (pending, existing, success, error) stay inside
         the same premium surface and retain their current large type. */
      body:not(.app-mode) .status-icon {
        border-color: rgba(254,233,147,.22);
        background: rgba(254,233,147,.075);
      }

      body:not(.app-mode) .status-title:not(.error) {
        color: var(--text);
      }

      body:not(.app-mode) .recovery-message {
        border-color: rgba(254,233,147,.13);
        background:
          linear-gradient(
            180deg,
            rgba(254,233,147,.04),
            rgba(255,255,255,.016)
          );
      }

      /* Dialogs follow the same quieter surface treatment. */
      body:not(.app-mode) dialog {
        border-color: rgba(254,233,147,.16);
        background:
          linear-gradient(
            180deg,
            rgba(31,31,31,.98),
            rgba(18,18,18,.99)
          );
        box-shadow:
          inset 0 1px 0 rgba(255,255,255,.025),
          0 24px 70px rgba(0,0,0,.58);
      }

      body:not(.app-mode) .dialog-title {
        color: var(--text);
      }

      /* Large mobile auth proportions are intentional: they preserve touch targets and readability while only changing surface styling. */
      @media (max-width: 640px) {
        body:not(.app-mode) .card {
          padding: 28px 22px;
          border-radius: 22px;
        }

        body:not(.app-mode) .logo {
          width: 76px;
          height: 76px;
          border-radius: 16px;
        }
      }

      @media (max-width: 390px) {
        body:not(.app-mode) .card {
          padding: 22px 16px;
        }

        body:not(.app-mode) .logo {
          width: 56px;
          height: 56px;
          border-radius: 13px;
        }
      }


      /* ======================================================
         AGENT CARD — COHERENT CONNECTION STATES
         Mirrors the canonical states supported by admin_control.agents:
         connected | connecting | disconnected | unknown.
      ====================================================== */

      .agent-badge.connecting {
        border-color: rgba(245,189,92,.22);
        background: rgba(245,189,92,.07);
        color: #f2c779;
      }

      .agent-badge.disconnected {
        border-color: rgba(222,123,112,.22);
        background: rgba(222,123,112,.06);
        color: #e5aaa2;
      }

      .agent-badge.unknown {
        border-color: rgba(255,255,255,.11);
        background: rgba(255,255,255,.03);
        color: var(--soft);
      }

    
.training-default-hint { color: var(--gold, #fee993); font-weight: 700; }

      /* ======================================================
         NAVIGATION  — native browser link behavior
         Middle-click, Ctrl/Cmd+click and context-menu open in new tab.
      ====================================================== */
      a.app-nav-item,
      a.agent-context-home {
        text-decoration: none;
      }

      a.app-nav-item:visited,
      a.agent-context-home:visited {
        color: inherit;
      }


      a.agent-workspace-card,
      a.manage-agent {
        text-decoration:none;
      }

      a.agent-workspace-card:visited,
      a.manage-agent:visited {
        color:inherit;
      }


/* AMPLIFY_AGENT_DELETION_V1 */
.manage-agent {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-decoration: none !important;
  line-height: 1 !important;
}
.real-agent-card.is-pending-deletion, .agent-card.is-pending-deletion { border-color: rgba(255,176,176,.20); }
.agent-deletion-pill {
  position:relative; display:inline-flex; align-items:center; min-height:32px; padding:0 11px;
  border:1px solid rgba(255,176,176,.22); border-radius:999px;
  background:rgba(255,96,96,.07); color:#ffc2c2; font-size:11px; font-weight:850;
  letter-spacing:.01em; box-shadow:inset 0 1px 0 rgba(255,255,255,.025);
}
.agent-deletion-pill.is-scheduled {
  animation:agentDeletionPulse 1.9s ease-in-out infinite;
}
@keyframes agentDeletionPulse {
  0%,100% {
    border-color:rgba(255,176,176,.22);
    background:rgba(255,96,96,.07);
    box-shadow:inset 0 1px 0 rgba(255,255,255,.025), 0 0 0 0 rgba(255,120,120,0);
  }
  50% {
    border-color:rgba(255,176,176,.46);
    background:rgba(255,96,96,.12);
    box-shadow:inset 0 1px 0 rgba(255,255,255,.035), 0 0 0 5px rgba(255,120,120,.055), 0 0 18px rgba(255,96,96,.12);
  }
}
@media (prefers-reduced-motion: reduce) {
  .agent-deletion-pill.is-scheduled { animation:none; }
}
.manage-agent.recover-agent {
  border-color:rgba(254,233,147,.38); background:rgba(254,233,147,.10); color:var(--gold);
}
.manage-agent.lifecycle-disabled { opacity:.55; cursor:default; pointer-events:none; }
.agent-deletion-copy { margin:10px 0 0; color:rgba(244,244,242,.55); font-size:11px; line-height:1.5; }
.agent-risk-zone {
  width:min(1120px,100%); position:relative; margin:44px auto 0; padding:24px; border:1px solid rgba(255,176,176,.16); border-radius:20px;
  background:linear-gradient(180deg,rgba(255,72,72,.035),rgba(20,20,20,.45));
}
.agent-risk-zone::before {
  content:""; position:absolute; left:0; right:0; top:-22px; height:1px;
  background:rgba(255,255,255,.08);
}
.agent-risk-zone-head { display:flex; align-items:center; justify-content:space-between; gap:20px; }
.agent-risk-zone h2 { margin:0; color:#f4f4f2; font-size:17px; line-height:1.2; }
.agent-risk-zone p { max-width:690px; margin:8px 0 0; color:rgba(244,244,242,.58); font-size:13px; line-height:1.6; }
.agent-danger-action {
  min-height:46px; padding:0 20px; display:inline-flex; align-items:center; justify-content:center;
  align-self:center; border:1px solid rgba(255,176,176,.28); border-radius:12px; background:rgba(255,70,70,.07);
  color:#ffc2c2; cursor:pointer; font-size:13px; font-weight:700; white-space:nowrap;
}
.agent-danger-action:hover { background:rgba(255,70,70,.12); border-color:rgba(255,176,176,.42); }
.agent-lifecycle-modal-backdrop {
  position:fixed; inset:0; z-index:5000; display:grid; place-items:center; padding:20px;
  background:rgba(0,0,0,.72); backdrop-filter:blur(8px);
}
.agent-lifecycle-modal {
  width:min(520px,94vw); padding:28px; border:1px solid rgba(255,176,176,.22); border-radius:22px;
  background:#181818; box-shadow:0 28px 80px rgba(0,0,0,.55);
}
.agent-lifecycle-modal h2 { margin:0; font-size:20px; }
.agent-lifecycle-modal p { margin:12px 0 0; color:rgba(244,244,242,.68); font-size:13px; line-height:1.65; }
.agent-lifecycle-warning {
  margin-top:18px; padding:14px; border:1px solid rgba(255,176,176,.15); border-radius:12px;
  background:rgba(255,80,80,.045); color:#ffd0d0; font-size:12px; line-height:1.55;
}
.agent-lifecycle-confirm { margin-top:18px; display:grid; gap:8px; }
.agent-lifecycle-confirm label { font-size:12px; color:rgba(244,244,242,.72); }
.agent-lifecycle-confirm input {
  width:100%; min-height:46px; padding:0 13px; border:1px solid rgba(255,255,255,.15);
  border-radius:11px; background:#0f0f0f; color:#f4f4f2; outline:none;
}
.agent-lifecycle-confirm input:focus { border-color:rgba(255,176,176,.48); }
.agent-lifecycle-actions { margin-top:22px; display:flex; justify-content:flex-end; gap:10px; }
.agent-lifecycle-cancel {
  min-height:40px; padding:0 14px; border:1px solid rgba(255,255,255,.12); border-radius:10px;
  background:#202020; color:#f4f4f2; cursor:pointer;
}
.agent-lifecycle-confirm-button {
  min-height:40px; padding:0 14px; border:1px solid rgba(255,176,176,.35); border-radius:10px;
  background:rgba(255,70,70,.12); color:#ffd0d0; cursor:pointer; font-weight:700;
}
.agent-lifecycle-confirm-button:disabled { opacity:.45; cursor:not-allowed; }
@media(max-width:720px) {
  .agent-risk-zone-head { display:grid; }
  .agent-danger-action { width:100%; }
}
