      :root {
        color-scheme: light;
        font-family: "Inter", "SF Pro Display", system-ui, -apple-system, "Segoe UI", sans-serif;
        line-height: 1.5;
        --sticky-header-offset: 3.5rem;
        --sticky-form-offset: 4.5rem;
        --sticky-panel-gap: 0rem;
        --bg: #f7f6fb;
        --bg-elevated: #ffffff;
        --bg-surface: #ffffff;
        --border-subtle: #ece9f4;
        --border-strong: #dcd6eb;
        --text-primary: #1d1433;
        --text-secondary: #544d6b;
        --text-muted: #6f6a80;
        --bg-hover: #f3f0fa;
        --accent: #6d28d9;
        --accent-primary: #6d28d9;
        --accent-secondary: #7c3aed;
        --accent-tertiary: #a855f7;
        --glow: 0 18px 45px rgba(124, 58, 237, 0.08);
        --panel-shadow: 0 1px 2px rgba(23, 13, 59, 0.04), 0 12px 32px rgba(23, 13, 59, 0.06);
        --api-log-label-width: 13.125rem;
        --api-log-meta-width: 16.5rem;
      }
      body {
        margin: 0;
        padding: 0;
        background: var(--bg);
        color: var(--text-primary);
        min-height: 100vh;
        position: relative;
        isolation: isolate;
        scroll-behavior: smooth;
      }
      body[data-authenticated="false"] #app-shell {
        display: none;
      }
      body[data-authenticated="false"] #top-tab-list {
        display: none;
      }
      body[data-authenticated="false"] #user-menu {
        display: none;
      }
      body[data-authenticated="true"] #auth-panel {
        display: none;
      }
      body > header {
        background: linear-gradient(180deg, #ffffff, #ffffff);
        border-bottom: 1px solid rgba(82, 63, 133, 0.132);
        position: sticky;
        top: 0;
        z-index: 10;
        backdrop-filter: blur(14px);
        box-shadow: 0 10px 24px rgba(23, 13, 59, 0.07);
        animation: headerDrop 0.6s ease;
      }
      .header-inner {
        max-width: 90vw;
        margin: 0 auto;
        padding: 0.65rem 1.5rem;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        flex-wrap: wrap;
      }
      .brand {
        display: flex;
        align-items: center;
        gap: 0.4rem;
      }
      .brand-link {
        color: inherit;
        text-decoration: none;
        display: inline-flex;
        align-items: center;
        gap: 0.55rem;
      }
      .brand-logo {
        width: 30px;
        height: 24px;
        flex: 0 0 auto;
      }
      .brand-link:hover .brand-title,
      .brand-link:focus-visible .brand-title {
        color: #5b21b6;
      }
      .brand-title {
        transition: color 0.2s ease;
      }
      .header-nav {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        gap: 0.75rem;
      }
      .header-auth {
        display: flex;
        align-items: center;
        gap: 0.65rem;
        flex-wrap: wrap;
      }
      .user-menu {
        position: relative;
        display: inline-flex;
        flex-direction: column;
      }
      .user-menu-button {
        display: inline-flex;
        align-items: center;
        gap: 0.45rem;
        padding: 0.4rem 0.8rem;
        border-radius: 999px;
        border: 1px solid var(--border-subtle);
        background: #ffffff;
        color: var(--text-primary);
        font-weight: 600;
        font-size: 0.875rem;
        transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
        box-shadow: 0 8px 18px rgba(23, 13, 59, 0.07);
      }
      .user-menu-button:hover,
      .user-menu-button:focus-visible {
        border-color: rgba(124, 58, 237, 0.5);
        transform: translateY(-1px);
      }
      .user-menu-button span {
        display: block;
      }
      .user-email {
        color: #6f6a80;
        font-weight: 500;
        font-size: 0.75rem;
      }
      .user-menu-icon {
        font-size: 0.75rem;
        opacity: 0.75;
      }
      .user-menu-panel {
        position: absolute;
        top: calc(100% + 0.45rem);
        right: 0;
        background: #ffffff;
        border: 1px solid var(--border-strong);
        border-radius: 12px;
        min-width: 200px;
        padding: 0.5rem;
        box-shadow: var(--panel-shadow);
        z-index: 20;
        animation: panelLift 0.25s ease;
      }
      .user-menu-panel[hidden] {
        display: none;
      }
      .user-menu-panel-header {
        display: grid;
        gap: 0.2rem;
        padding: 0.4rem 0.4rem 0.6rem;
        border-bottom: 1px solid #e7e3f2;
        margin-bottom: 0.4rem;
      }
      .discord-account-row {
        display: grid;
        gap: 0.15rem;
        padding: 0.4rem 0.4rem 0.2rem;
      }
      .user-menu-section-label {
        color: var(--text-primary);
        font-size: 0.75rem;
        font-weight: 700;
      }
      .user-menu-action {
        display: block;
        box-sizing: border-box;
        width: 100%;
        text-align: left;
        text-decoration: none;
        background: transparent;
        color: #1d1433;
        border: 1px solid transparent;
        padding: 0.45rem 0.5rem;
        border-radius: 8px;
        font-weight: 600;
        cursor: pointer;
      }
      .user-menu-action[hidden] {
        display: none;
      }
      .user-menu-action:hover {
        border-color: #e7e3f2;
        background: #f3f0fa;
      }
      h1 {
        margin: 0;
        font-size: 1.125rem;
        letter-spacing: 0.01em;
        font-weight: 700;
      }
      .subtitle {
        margin: 0.15rem 0 0;
        font-size: 0.8125rem;
        color: #6f6a80;
        font-weight: 500;
      }
      main {
        padding: 1.25rem;
        max-width: 90vw;
        margin: 0 auto;
      }
      .auth-panel {
        min-height: calc(100vh - 9rem);
        display: grid;
        place-items: center;
      }
      .auth-card {
        width: min(420px, 90vw);
        background: var(--bg-surface);
        border: 1px solid var(--border-subtle);
        border-radius: 16px;
        padding: 1.4rem 1.6rem;
        display: grid;
        gap: 0.85rem;
        text-align: center;
        box-shadow: var(--panel-shadow);
        animation: panelLift 0.6s ease;
      }
      .auth-title {
        margin: 0;
        font-size: 1.25rem;
      }
      .auth-subtitle {
        margin: 0;
        color: #6f6a80;
      }
      .auth-status {
        min-height: 1.2rem;
        font-weight: 600;
      }
      .auth-actions {
        display: grid;
        gap: 0.75rem;
        justify-items: center;
      }
      #google-signin-button {
        display: inline-flex;
        justify-content: center;
        align-items: center;
        padding: 0.15rem;
        border-radius: 999px;
        background: #ffffff;
        border: 1px solid var(--border-strong);
        box-shadow: 0 8px 20px rgba(23, 13, 59, 0.08);
      }
      #google-signin-button > div {
        border-radius: 999px !important;
        overflow: hidden;
      }
      form {
        background: var(--bg-surface);
        border: 1px solid var(--border-subtle);
        border-radius: 12px;
        padding: 0.9rem 1.1rem;
        display: grid;
        gap: 0.75rem;
        position: sticky;
        top: var(--sticky-header-offset);
        z-index: 9;
        box-shadow: var(--panel-shadow);
        animation: panelLift 0.5s ease;
      }
      .field-group {
        display: grid;
        gap: 0.35rem;
      }
      label {
        font-weight: 600;
      }
      input,
      select,
      button,
      textarea {
        font: inherit;
      }
      input,
      textarea {
        padding: 0.55rem 0.65rem;
        background: #ffffff;
        border: 1px solid var(--border-subtle);
        color: var(--text-primary);
        border-radius: 8px;
        transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
      }
      input:focus,
      textarea:focus {
        outline: none;
        border-color: rgba(124, 58, 237, 0.65);
        box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.22);
      }
      button {
        cursor: pointer;
        padding: 0.65rem 1rem;
        border-radius: 10px;
        border: 1px solid transparent;
        background: #1d1235;
        color: white;
        font-weight: 600;
        transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
        box-shadow: 0 1px 2px rgba(23, 13, 59, 0.12);
      }
      button:hover {
        /* No background override here: many buttons restyle their own background
           (tabs, chips, secondary), so a forced dark fill would hide their text. */
        box-shadow: 0 6px 18px rgba(23, 13, 59, 0.14);
        transform: translateY(-1px);
        filter: brightness(1.1);
      }
      button.secondary {
        background: #ffffff;
        color: var(--text-primary);
        border: 1px solid var(--border-strong);
        box-shadow: none;
      }
      button.secondary:hover {
        background: #f3f0fa;
        box-shadow: none;
      }
      .batch-results-tabs {
        display: flex;
        gap: 0;
        margin-bottom: 0;
        border-bottom: 1px solid var(--border-subtle);
        border-top: 1px solid rgba(82, 63, 133, 0.12);
        border-left: 1px solid rgba(82, 63, 133, 0.12);
        border-right: 1px solid rgba(82, 63, 133, 0.12);
        border-top-left-radius: 10px;
        border-top-right-radius: 10px;
        overflow: hidden;
        background: linear-gradient(180deg, rgba(23, 13, 59, 0.045), rgba(23, 13, 59, 0.025));
      }
      .batch-results-tab {
        border: 0;
        border-bottom: 2px solid transparent;
        background: transparent;
        color: var(--text-secondary);
        font-weight: 600;
        border-radius: 0;
        padding: 0.45rem 0.8rem;
        margin-bottom: -1px;
        box-shadow: none;
        transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
      }
      .batch-results-tab:hover {
        color: var(--text-primary);
        background: rgba(82, 63, 133, 0.06);
        transform: none;
      }
      .batch-results-tab[aria-selected="true"] {
        color: #5b21b6;
        border-bottom-color: #7c3aed;
        background: linear-gradient(180deg, rgba(124, 58, 237, 0.16), rgba(124, 58, 237, 0.06));
      }
      .actions {
        display: flex;
        gap: 0.75rem;
        flex-wrap: wrap;
      }
      #status {
        min-height: 1.25rem;
        font-weight: 600;
      }
      .toast-container {
        position: fixed;
        bottom: 1.5rem;
        right: 1.5rem;
        display: grid;
        gap: 0.5rem;
        z-index: 50;
        width: min(320px, 90vw);
        pointer-events: none;
      }
      .toast {
        border-radius: 12px;
        padding: 0.65rem 0.85rem;
        background: #ffffff;
        border: 1px solid var(--border-strong);
        box-shadow: var(--panel-shadow);
        opacity: 0;
        transform: translateY(6px);
        transition: opacity 0.25s ease, transform 0.25s ease;
        font-weight: 600;
        pointer-events: auto;
      }
      .toast.visible {
        opacity: 1;
        transform: translateY(0);
      }
      .toast-success {
        border-color: #16a34a;
        color: #16a34a;
      }
      .toast-info {
        border-color: #7c3aed;
        color: #332a4d;
      }
      .toast-error {
        border-color: #e11d48;
        color: #9f1239;
      }
      .top-tab-list {
        display: flex;
        gap: 0.5rem;
        padding: 0;
        background: transparent;
        border: none;
        flex-wrap: wrap;
      }
      .top-tab {
        border: 1px solid var(--border-subtle);
        background: #ffffff;
        color: var(--text-primary);
        padding: 0.36rem 0.82rem;
        border-radius: 9999px;
        cursor: pointer;
        font-size: 0.8125rem;
        font-weight: 600;
        letter-spacing: 0.01em;
        transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
      }
      .top-tab:hover {
        transform: translateY(-1px);
        border-color: rgba(124, 58, 237, 0.55);
        box-shadow: 0 0 0 1px rgba(124, 58, 237, 0.2) inset;
      }
      .top-tab[aria-selected="true"] {
        background: linear-gradient(120deg, #7c3aed, #7c3aed);
        border-color: rgba(124, 58, 237, 0.8);
        color: white;
      }
      .top-tab-panel {
        display: none;
        padding: 1.25rem;
      }
      .top-tab-panel.active {
        display: block;
        animation: panelIn 0.5s ease;
      }
      .tabs {
        margin-top: 1rem;
        border: 1px solid var(--border-subtle);
        border-radius: 12px;
        overflow: visible;
        background: #ffffff;
        box-shadow: var(--panel-shadow);
      }
      .tab-list {
        display: flex;
        gap: 0.35rem;
        padding: 0.65rem;
        background: #ffffff;
        border-bottom: 1px solid var(--border-subtle);
        position: sticky;
        top: calc(var(--sticky-header-offset) + var(--sticky-form-offset) + var(--sticky-panel-gap));
        z-index: 8;
        backdrop-filter: blur(14px);
      }
      .tab {
        border: 1px solid var(--border-subtle);
        background: rgba(23, 13, 59, 0.045);
        color: var(--text-primary);
        padding: 0.45rem 0.85rem;
        border-radius: 8px;
        cursor: pointer;
        font-weight: 700;
        transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
      }
      .tab:hover {
        transform: translateY(-1px);
        background: #ede9fe;
      }
      .tab[aria-selected="true"] {
        background: linear-gradient(120deg, #6d28d9, #9333ea);
        border-color: #6d28d9;
        color: white;
      }
      .tab-panel {
        display: none;
        padding: 1rem;
      }
      .tab-panel.log-panel {
        /* Expand log panels to use remaining viewport height under sticky header/form. */
        min-height: calc(
          100vh - var(--sticky-header-offset) - var(--sticky-form-offset) - 6rem
        );
      }
      .tab-panel.active {
        display: block;
        animation: panelIn 0.5s ease;
      }
      .error-sub-panel {
        display: none;
      }
      .error-sub-panel.active {
        display: block;
      }
      .error-sub-panel[hidden] {
        display: none !important;
      }
      .error-sub-tabs .tab-list {
        position: static;
        z-index: auto;
        backdrop-filter: none;
      }
      .settings-card {
        background: var(--bg-surface);
        border: 1px solid var(--border-subtle);
        border-radius: 14px;
        padding: 1.1rem;
        display: grid;
        gap: 0.9rem;
        box-shadow: var(--panel-shadow);
        transition: transform 0.2s ease, box-shadow 0.2s ease;
      }
      .settings-card + .settings-card {
        margin-top: 1rem;
      }
      .settings-cards-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
        gap: 1rem;
        margin-top: 1.25rem;
      }
      .settings-cards-grid .settings-card + .settings-card {
        margin-top: 0;
      }
      .settings-card-header {
        display: flex;
        align-items: center;
        gap: 0.6rem;
      }
      .settings-card-title {
        margin: 0;
        font-size: 1rem;
        font-weight: 700;
        color: var(--text-primary);
      }
      .settings-card-description {
        margin: 0.4rem 0 0;
        font-size: 0.875rem;
        color: #6f6a80;
      }
      .settings-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 22px 50px rgba(23, 13, 59, 0.11);
      }
      .settings-card-btn {
        all: unset;
        display: grid;
        gap: 0.9rem;
        cursor: pointer;
        width: 100%;
        box-sizing: border-box;
        background: var(--bg-surface);
        border: 1px solid var(--border-subtle);
        border-radius: 14px;
        padding: 1.1rem;
        box-shadow: var(--panel-shadow);
        transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.15s ease;
        text-align: left;
      }
      .settings-card-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 22px 50px rgba(23, 13, 59, 0.11);
        border-color: #6d28d9;
      }
      .settings-card-btn:focus-visible {
        outline: 2px solid #6d28d9;
        outline-offset: 2px;
      }

      /* ── Operations feature cards ── */
      .ops-features-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 1rem;
        margin-top: 1.25rem;
        margin-bottom: 0.5rem;
      }
      .ops-feature-card {
        all: unset;
        display: flex;
        flex-direction: column;
        gap: 0.65rem;
        cursor: pointer;
        width: 100%;
        min-height: 168px;
        box-sizing: border-box;
        position: relative;
        overflow: hidden;
        text-align: left;
        padding: 1.15rem 1.2rem 1rem;
        border-radius: 16px;
        border: 1px solid rgba(124, 58, 237, 0.42);
        background: linear-gradient(
          145deg,
          rgba(124, 58, 237, 0.2) 0%,
          rgba(124, 58, 237, 0.1) 55%,
          rgba(168, 85, 247, 0.07) 100%
        );
        box-shadow:
          0 0 0 1px rgba(124, 58, 237, 0.18),
          0 10px 36px rgba(124, 58, 237, 0.048),
          inset 0 1px 0 rgba(23, 13, 59, 0.07);
        transition:
          transform 0.2s ease,
          box-shadow 0.2s ease,
          border-color 0.15s ease,
          opacity 0.2s ease;
      }
      .ops-feature-card::before {
        content: "";
        position: absolute;
        inset: 0;
        background: linear-gradient(135deg, rgba(139, 92, 246, 0.14), transparent 62%);
        pointer-events: none;
      }
      .ops-feature-card > * {
        position: relative;
        z-index: 1;
      }
      .ops-feature-card:hover {
        transform: translateY(-3px);
        border-color: rgba(139, 92, 246, 0.72);
        box-shadow:
          0 0 0 1px rgba(139, 92, 246, 0.28),
          0 18px 52px rgba(124, 58, 237, 0.096),
          inset 0 1px 0 rgba(23, 13, 59, 0.09);
      }
      .ops-feature-card:focus-visible {
        outline: 2px solid #6d28d9;
        outline-offset: 2px;
      }
      .ops-feature-card-locked {
        opacity: 0.42;
        pointer-events: none;
        user-select: none;
        filter: saturate(0.65);
      }
      .ops-feature-card-top {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
      }
      .ops-feature-card-icon {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 2.35rem;
        height: 2.35rem;
        border-radius: 12px;
        font-size: 1.25rem;
        background: rgba(23, 13, 59, 0.035);
        border: 1px solid rgba(23, 13, 59, 0.08);
        box-shadow: inset 0 1px 0 rgba(23, 13, 59, 0.06);
        flex-shrink: 0;
      }
      .ops-feature-card-badge {
        font-size: 0.75rem;
        font-weight: 700;
        letter-spacing: 0.06em;
        text-transform: uppercase;
        color: #6d28d9;
        background: rgba(124, 58, 237, 0.22);
        border: 1px solid rgba(139, 92, 246, 0.35);
        border-radius: 999px;
        padding: 0.22rem 0.55rem;
        white-space: nowrap;
      }
      .ops-feature-card-title {
        margin: 0;
        font-size: 1.125rem;
        font-weight: 700;
        line-height: 1.35;
        letter-spacing: 0.01em;
        background: linear-gradient(90deg, #7c3aed, #7c3aed);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
      }
      .ops-feature-card-desc {
        margin: 0;
        flex: 1;
        font-size: 0.875rem;
        line-height: 1.55;
        color: #6d28d9;
      }
      .ops-feature-card-footer {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.4rem;
        margin-top: auto;
        padding-top: 0.35rem;
      }
      .ops-feature-card-meta {
        font-size: 0.75rem;
        font-weight: 600;
        color: #6f6a80;
      }
      .ops-feature-card-meta-ok {
        color: #15803d;
        background: rgba(34, 197, 94, 0.12);
        border: 1px solid rgba(34, 197, 94, 0.28);
        border-radius: 999px;
        padding: 0.18rem 0.5rem;
      }
      .ops-feature-card-meta-warn {
        color: #92400e;
        background: rgba(234, 179, 8, 0.12);
        border: 1px solid rgba(234, 179, 8, 0.3);
        border-radius: 999px;
        padding: 0.18rem 0.5rem;
      }
      .ops-feature-card[data-accent="dictionaries"] {
        border-color: rgba(251, 191, 36, 0.4);
        background: linear-gradient(145deg, rgba(245, 158, 11, 0.16), rgba(124, 58, 237, 0.1) 70%);
      }
      .ops-feature-card[data-accent="dictionaries"] .ops-feature-card-title {
        background: linear-gradient(90deg, #92400e, #b45309);
        -webkit-background-clip: text;
        background-clip: text;
      }
      .ops-feature-card[data-accent="dictionaries"] .ops-feature-card-badge {
        color: #854d0e;
        border-color: rgba(251, 191, 36, 0.35);
        background: rgba(245, 158, 11, 0.18);
      }
      .ops-feature-card[data-accent="compliance"] {
        border-color: rgba(124, 58, 237, 0.45);
      }
      .ops-feature-card[data-accent="access"] {
        border-color: rgba(168, 85, 247, 0.38);
        background: linear-gradient(145deg, rgba(168, 85, 247, 0.12), rgba(124, 58, 237, 0.12) 65%);
      }
      .ops-feature-card[data-accent="capacity"] {
        border-color: rgba(124, 58, 237, 0.42);
        background: linear-gradient(145deg, rgba(124, 58, 237, 0.14), rgba(124, 58, 237, 0.1) 65%);
      }
      .ops-feature-card[data-accent="telephony"] {
        border-color: rgba(52, 211, 153, 0.4);
        background: linear-gradient(145deg, rgba(16, 185, 129, 0.14), rgba(124, 58, 237, 0.08) 65%);
      }
      .ops-feature-card[data-accent="telephony"] .ops-feature-card-title {
        background: linear-gradient(90deg, #047857, #7c3aed);
        -webkit-background-clip: text;
        background-clip: text;
      }
      .ops-feature-card[data-accent="prefixes"] {
        border-color: rgba(124, 58, 237, 0.55);
        box-shadow:
          0 0 0 1px rgba(124, 58, 237, 0.2),
          0 12px 40px rgba(124, 58, 237, 0.066),
          inset 0 1px 0 rgba(23, 13, 59, 0.08);
      }

      .ops-back-btn {
        all: unset;
        cursor: pointer;
        display: inline-flex;
        align-items: center;
        gap: 0.4rem;
        font-size: 0.875rem;
        color: #6d28d9;
        margin-bottom: 1rem;
      }
      .ops-back-btn:hover { text-decoration: underline; }
      .ops-sub-panel[hidden] { display: none; }
      .ops-cards-grid-always {
        margin-bottom: 1rem;
      }
      /* legacy grid wrappers - prefer .ops-features-grid */
      .dict-settings-section {
        padding: 0;
      }
      .dict-settings-toolbar {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
        margin-bottom: 1rem;
      }
      .dict-settings-grid {
        display: flex;
        flex-direction: column;
        gap: 0.85rem;
      }
      .dict-setting-card {
        border: 1px solid var(--border-subtle);
        border-radius: 12px;
        background: #ffffff;
        overflow: hidden;
      }
      .dict-setting-card-header {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
        padding: 0.85rem 1rem;
        border-bottom: 1px solid var(--border-subtle);
        background: rgba(124, 58, 237, 0.06);
      }
      .dict-setting-key {
        font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
        font-size: 0.9375rem;
        font-weight: 600;
        color: #6d28d9;
        word-break: break-all;
      }
      .dict-setting-meta {
        display: flex;
        flex-wrap: wrap;
        gap: 0.4rem;
      }
      .dict-setting-pill {
        font-size: 0.75rem;
        color: var(--text-muted);
        background: rgba(82, 63, 133, 0.072);
        border: 1px solid var(--border-subtle);
        border-radius: 999px;
        padding: 0.2rem 0.55rem;
        white-space: nowrap;
      }
      .dict-table-wrap {
        padding: 0 1rem 1rem;
        overflow: auto;
        max-height: min(70vh, 900px);
      }
      .dict-table {
        width: 100%;
        border-collapse: collapse;
        font-size: 0.875rem;
      }
      .dict-table th,
      .dict-table td {
        border: 1px solid var(--border-subtle);
        padding: 0.55rem 0.75rem;
        text-align: left;
        vertical-align: top;
        word-break: break-word;
      }
      .dict-table th {
        position: sticky;
        top: 0;
        z-index: 1;
        background: #ffffff;
        color: #6d28d9;
        font-weight: 600;
        white-space: nowrap;
      }
      .dict-table tbody tr:nth-child(even) {
        background: rgba(82, 63, 133, 0.036);
      }
      .dict-table tbody tr:hover {
        background: rgba(124, 58, 237, 0.08);
      }
      .dict-table td:first-child {
        font-weight: 500;
        color: #241a3f;
      }
      .dict-table td:last-child {
        color: #544d6b;
      }
      .dict-table td.dict-actions-cell {
        width: 5.5rem;
        white-space: nowrap;
        text-align: right;
      }
      .dict-row-edit-btn {
        font-size: 0.8125rem;
        padding: 0.25rem 0.55rem;
        border-radius: 6px;
        border: 1px solid var(--border-subtle);
        background: rgba(124, 58, 237, 0.12);
        color: #6d28d9;
        cursor: pointer;
      }
      .dict-row-edit-btn:hover {
        background: rgba(124, 58, 237, 0.22);
      }
      .dict-add-row-btn {
        font-size: 0.8125rem;
        padding: 0.35rem 0.75rem;
        border-radius: 8px;
        border: 1px solid rgba(124, 58, 237, 0.35);
        background: rgba(124, 58, 237, 0.14);
        color: #6d28d9;
        cursor: pointer;
      }
      .dict-add-row-btn:hover {
        background: rgba(124, 58, 237, 0.24);
      }
      .dict-entry-form-field {
        display: flex;
        flex-direction: column;
        gap: 0.35rem;
        margin-bottom: 0.85rem;
      }
      .dict-entry-form-field label {
        font-size: 0.8125rem;
        color: var(--text-muted);
      }
      .dict-entry-form-field input {
        width: 100%;
        padding: 0.55rem 0.65rem;
        border-radius: 8px;
        border: 1px solid var(--border-subtle);
        background: rgba(23, 13, 59, 0.045);
        color: #241a3f;
        font-size: 0.9375rem;
      }
      .ops-cards-locked {
        /* legacy: locking is per-card via .ops-feature-card-locked */
      }

      .kyc-settings-layout {
        display: grid;
        gap: 1.25rem;
      }
      @media (min-width: 960px) {
        .kyc-settings-layout {
          grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
        }
      }
      .kyc-panel-card {
        border: 1px solid var(--border-subtle);
        border-radius: 12px;
        background: #ffffff;
        padding: 1rem 1.1rem;
      }
      .kyc-panel-card h4 {
        margin: 0 0 0.35rem;
        font-size: 1.125rem;
      }
      .kyc-panel-card p.kyc-panel-desc {
        margin: 0 0 1rem;
        font-size: 0.875rem;
        color: var(--text-muted);
      }
      .kyc-field {
        display: flex;
        flex-direction: column;
        gap: 0.35rem;
        margin-bottom: 0.85rem;
      }
      .kyc-field label {
        font-size: 0.8125rem;
        color: var(--text-muted);
      }
      .kyc-field select,
      .kyc-field input {
        width: 100%;
        box-sizing: border-box;
        padding: 0.55rem 0.65rem;
        border-radius: 8px;
        border: 1px solid var(--border-subtle);
        background: rgba(23, 13, 59, 0.045);
        color: #241a3f;
        font-size: 0.9375rem;
        font-family: inherit;
      }
      .kyc-field input[type="date"] {
        color-scheme: dark;
      }
      .kyc-field input:disabled,
      .kyc-field select:disabled {
        opacity: 0.55;
        cursor: not-allowed;
      }
      .kyc-field-hint {
        font-size: 0.75rem;
        color: var(--text-muted);
        margin: 0;
      }
      .kyc-divider {
        border-top: 1px solid var(--border-subtle);
        margin: 1rem 0;
        padding-top: 1rem;
      }
      .kyc-review-block {
        border: 1px solid var(--border-subtle);
        border-radius: 10px;
        padding: 0.75rem 0.9rem;
        margin-bottom: 0.65rem;
      }
      .kyc-review-label {
        font-size: 0.8125rem;
        color: var(--text-muted);
      }
      .kyc-review-value {
        margin-top: 0.25rem;
        font-size: 0.9375rem;
        font-weight: 500;
        word-break: break-word;
      }
      .kyc-status-pill {
        display: inline-flex;
        margin-top: 0.35rem;
        border-radius: 999px;
        border: 1px solid var(--border-subtle);
        padding: 0.2rem 0.65rem;
        font-size: 0.8125rem;
        font-weight: 600;
      }
      .kyc-status-verified {
        border-color: rgba(34, 197, 94, 0.35);
        background: rgba(34, 197, 94, 0.12);
        color: #15803d;
      }
      .kyc-status-not-requested {
        border-color: rgba(239, 68, 68, 0.35);
        background: rgba(239, 68, 68, 0.12);
        color: #b91c1c;
      }
      .kyc-status-pending {
        border-color: rgba(234, 179, 8, 0.35);
        background: rgba(234, 179, 8, 0.12);
        color: #854d0e;
      }
      .kyc-status-default {
        border-color: var(--border-subtle);
        background: rgba(82, 63, 133, 0.048);
        color: #241a3f;
      }
      .kyc-compliance-missing {
        font-size: 0.8125rem;
        color: #b91c1c;
        font-weight: 400;
        font-family: inherit;
      }

      .otp-bypass-panel {
        max-width: 640px;
        margin: 0 auto;
      }
      .otp-bypass-choice-row {
        display: flex;
        gap: 0.65rem;
        flex-wrap: wrap;
      }
      .otp-bypass-choice-btn {
        flex: 1;
        min-width: 140px;
        padding: 0.6rem 0.85rem;
        border-radius: 8px;
        border: 1px solid var(--border-subtle);
        background: rgba(23, 13, 59, 0.045);
        color: #241a3f;
        font-size: 0.875rem;
        cursor: pointer;
        transition: background 0.12s ease, border-color 0.12s ease;
      }
      .otp-bypass-choice-btn:hover:not(:disabled) {
        background: rgba(124, 58, 237, 0.12);
        border-color: rgba(124, 58, 237, 0.35);
      }
      .otp-bypass-choice-btn.selected-enable {
        background: rgba(34, 197, 94, 0.18);
        border-color: rgba(34, 197, 94, 0.45);
        color: #15803d;
      }
      .otp-bypass-choice-btn.selected-require {
        background: rgba(239, 68, 68, 0.14);
        border-color: rgba(239, 68, 68, 0.4);
        color: #b91c1c;
      }
      .otp-bypass-choice-btn:disabled {
        opacity: 0.55;
        cursor: not-allowed;
      }
      .otp-bypass-banner {
        padding: 0.85rem 1rem;
        border-radius: 8px;
        border: 1px solid var(--border-subtle);
        font-size: 0.9375rem;
      }
      .otp-bypass-banner-success {
        background: rgba(34, 197, 94, 0.12);
        border-color: rgba(34, 197, 94, 0.35);
        color: #15803d;
      }
      .otp-bypass-banner-error {
        background: rgba(239, 68, 68, 0.12);
        border-color: rgba(239, 68, 68, 0.35);
        color: #b91c1c;
      }

      .concurrency-panel {
        max-width: 100%;
        margin: 0 auto;
        display: flex;
        flex-direction: column;
        gap: 1.25rem;
      }
      .concurrency-sticky-header {
        position: sticky;
        top: 0;
        z-index: 12;
        margin: 0 -0.25rem;
        padding: 0.75rem 0.25rem;
        border-bottom: 1px solid var(--border-subtle);
        background: rgba(255, 255, 255, 0.96);
        backdrop-filter: blur(12px);
      }
      .concurrency-sticky-header .users-title { margin: 0; }
      .concurrency-sticky-header .settings-description { margin: 0.35rem 0 0; }
      .concurrency-header-actions {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        gap: 0.85rem;
        flex-wrap: wrap;
      }
      .concurrency-header-actions > p {
        margin: 0;
        color: var(--text-muted);
        font-size: 0.8125rem;
        white-space: nowrap;
      }
      .users-card > .concurrency-page {
        width: 100%;
        min-width: 0;
      }
      .users-card > .concurrency-page > .ops-back-btn {
        margin: 0 0 0.75rem;
      }
      .concurrency-hero {
        display: grid;
        grid-template-columns: minmax(280px, 1.25fr) minmax(250px, 0.75fr);
        gap: 1rem;
      }
      .concurrency-section-heading {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 1rem;
        margin-bottom: 0.9rem;
      }
      .concurrency-section-heading h4 { margin: 0 0 0.2rem; color: #241a3f; }
      .concurrency-section-heading p { margin: 0; color: var(--text-muted); font-size: 0.8125rem; }
      .concurrency-access-pill {
        flex: none;
        padding: 0.3rem 0.55rem;
        border-radius: 999px;
        background: rgba(124, 58, 237, 0.1);
        color: #6d28d9;
        font-size: 0.72rem;
        font-weight: 700;
      }
      .concurrency-global-control > label {
        display: block;
        margin-bottom: 0.35rem;
        font-size: 0.78rem;
        font-weight: 700;
        color: #4b4261;
      }
      .concurrency-input-action { display: flex; gap: 0.55rem; }
      .concurrency-input-action input {
        min-width: 0;
        flex: 1;
        padding: 0.7rem 0.8rem;
        border: 1px solid #d8d2e5;
        border-radius: 9px;
        font-size: 1.05rem;
        font-weight: 700;
      }
      .concurrency-input-action input:disabled { background: #f1eff5; color: #777083; }
      .concurrency-capacity-summary h4 { margin: 0 0 0.2rem; }
      .concurrency-summary-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.65rem;
      }
      .concurrency-workspaces { margin-top: 0; }
      .concurrency-empty { text-align: center !important; color: var(--text-muted); padding: 1.5rem !important; }
      .concurrency-toolbar {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
      }
      .concurrency-toolbar-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
      }
      .concurrency-global-layout {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.9rem;
        align-items: start;
        margin-top: 0.75rem;
      }
      @media (max-width: 560px) {
        .concurrency-global-layout {
          grid-template-columns: 1fr;
        }
      }
      .concurrency-stat-value {
        font-size: 2rem;
        font-weight: 700;
        color: #241a3f;
        line-height: 1.2;
      }
      .concurrency-metrics-row {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
        gap: 0.75rem;
        align-items: start;
      }
      .concurrency-metrics-row > * {
        min-width: 0;
      }
      .phone-ops-date-row {
        display: grid;
        grid-template-columns: 1fr auto 1fr;
        align-items: center;
        gap: 0.65rem;
        margin-bottom: 0.1rem;
      }
      .phone-ops-date-arrow {
        flex-shrink: 0;
        color: var(--text-muted);
        font-size: 1rem;
        padding-top: 1.4rem;
        text-align: center;
        user-select: none;
      }
      @media (max-width: 520px) {
        .phone-ops-date-row {
          grid-template-columns: 1fr;
        }
        .phone-ops-date-arrow {
          display: none;
        }
      }
      .concurrency-metric-box {
        border: 1px solid var(--border-subtle);
        border-radius: 8px;
        padding: 0.55rem 0.75rem;
        background: rgba(23, 13, 59, 0.035);
        min-height: 2.5rem;
        display: flex;
        align-items: center;
        font-weight: 600;
      }
      .concurrency-metric-box.negative {
        border-color: rgba(239, 68, 68, 0.4);
        background: rgba(239, 68, 68, 0.12);
        color: #b91c1c;
      }
      .concurrency-stat-value.negative {
        color: #b91c1c;
      }
      .kyc-review-block:has(.concurrency-stat-value.negative) {
        border-color: rgba(239, 68, 68, 0.4);
        background: rgba(239, 68, 68, 0.1);
      }
      .concurrency-table-wrap {
        overflow-x: auto;
        border: 1px solid var(--border-subtle);
        border-radius: 10px;
      }
      .concurrency-table {
        width: 100%;
        min-width: 760px;
        border-collapse: collapse;
        font-size: 0.875rem;
      }
      .concurrency-table th,
      .concurrency-table td {
        border-bottom: 1px solid var(--border-subtle);
        padding: 0.65rem 0.75rem;
        text-align: left;
        vertical-align: middle;
      }
      .concurrency-table th {
        background: #ffffff;
        color: #6d28d9;
        font-weight: 600;
      }
      .concurrency-table tfoot td { border-bottom: 0; background: #faf9fc; font-weight: 600; }
      .concurrency-table tfoot span { display: inline-block; margin-right: 1rem; color: var(--text-muted); font-weight: 500; }
      .concurrency-table tbody tr:hover {
        background: rgba(124, 58, 237, 0.06);
      }
      .concurrency-table input[type="number"] {
        width: 100%;
        max-width: 120px;
        padding: 0.45rem 0.55rem;
        border-radius: 6px;
        border: 1px solid var(--border-subtle);
        background: rgba(23, 13, 59, 0.045);
        color: #241a3f;
      }
      .concurrency-table input[type="number"]:focus {
        outline: none;
        border-color: #7c3aed;
        box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
        background: #fff;
      }
      .concurrency-edited-pill {
        font-size: 0.75rem;
        padding: 0.15rem 0.45rem;
        border-radius: 999px;
        background: rgba(234, 179, 8, 0.18);
        border: 1px solid rgba(234, 179, 8, 0.35);
        color: #854d0e;
        white-space: nowrap;
      }
      .concurrency-field-error {
        font-size: 0.8125rem;
        color: #b91c1c;
        margin-top: 0.25rem;
      }
      @media (max-width: 720px) {
        .concurrency-hero { grid-template-columns: 1fr; }
        .concurrency-sticky-header { align-items: stretch; flex-direction: column; }
        .concurrency-header-actions { align-items: stretch; flex-direction: column; }
        .concurrency-toolbar-actions { width: 100%; }
        .concurrency-toolbar-actions button { flex: 1; }
      }

      .integration-tools-panel {
        display: flex;
        flex-direction: column;
        gap: 1rem;
        max-width: 100%;
      }
      .integration-tools-filter-grid {
        display: grid;
        grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.2fr) auto;
        gap: 0.85rem 1rem;
        align-items: end;
      }
      @media (max-width: 900px) {
        .integration-tools-filter-grid {
          grid-template-columns: 1fr;
        }
      }
      .integration-tools-filter-grid .kyc-field {
        margin: 0;
      }
      .integration-tools-filter-grid input,
      .integration-tools-filter-grid select {
        width: 100%;
      }
      .integration-tools-filter-actions {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.5rem;
      }
      .integration-tools-segmented {
        display: inline-flex;
        padding: 0.2rem;
        border-radius: 10px;
        border: 1px solid var(--border-subtle);
        background: #ffffff;
        gap: 0.15rem;
      }
      .integration-tools-segment {
        border: 0;
        background: transparent;
        color: var(--text-muted);
        font-size: 0.8125rem;
        font-weight: 600;
        padding: 0.4rem 0.75rem;
        border-radius: 8px;
        cursor: pointer;
        transition: background 0.15s ease, color 0.15s ease;
      }
      .integration-tools-segment[aria-pressed="true"] {
        background: rgba(124, 58, 237, 0.22);
        color: #4c1d95;
        box-shadow: inset 0 0 0 1px rgba(124, 58, 237, 0.35);
      }
      .integration-tools-list-header {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
        margin-bottom: 0.85rem;
      }
      .integration-tools-list {
        display: flex;
        flex-direction: column;
        gap: 0.65rem;
      }
      .integration-tools-tool-card {
        display: grid;
        grid-template-columns: auto 1fr auto;
        align-items: start;
        gap: 0.9rem;
        padding: 1rem 1.1rem 1rem 0;
        border-radius: 14px;
        border: 1px solid var(--border-subtle);
        background: #ffffff;
        transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
        overflow: hidden;
        position: relative;
      }
      .integration-tools-tool-card::before {
        content: "";
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        width: 3px;
        background: rgba(82, 63, 133, 0.12);
        border-radius: 14px 0 0 14px;
        transition: background 0.18s ease;
      }
      .integration-tools-tool-card[data-enabled="true"]::before {
        background: linear-gradient(180deg, #7c3aed, #16a34a);
      }
      .integration-tools-tool-card:hover {
        border-color: rgba(124, 58, 237, 0.4);
        background: #ffffff;
        box-shadow: 0 8px 30px rgba(124, 58, 237, 0.036), 0 2px 8px rgba(23, 13, 59, 0.06);
        transform: translateY(-1px);
      }
      .integration-tools-tool-card:hover .integration-tools-tool-icon {
        box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.3);
      }
      .integration-tools-tool-icon {
        width: 2.6rem;
        height: 2.6rem;
        border-radius: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 0.9375rem;
        font-weight: 700;
        letter-spacing: -0.01em;
        color: #fff;
        flex-shrink: 0;
        margin-left: 1rem;
        margin-top: 0.1rem;
        background: linear-gradient(135deg, #6d28d9, #7c3aed);
        box-shadow: 0 4px 12px rgba(124, 58, 237, 0.105);
        transition: box-shadow 0.18s ease;
        user-select: none;
      }
      .integration-tools-tool-main {
        min-width: 0;
      }
      .integration-tools-tool-header {
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        gap: 0.5rem;
        margin-bottom: 0.15rem;
      }
      .integration-tools-tool-title {
        margin: 0;
        font-size: 1rem;
        font-weight: 650;
        line-height: 1.3;
        color: #241a3f;
      }
      .integration-tools-tool-source {
        display: inline-flex;
        align-items: center;
        gap: 0.25rem;
        padding: 0.15rem 0.5rem;
        border-radius: 6px;
        font-size: 0.75rem;
        font-weight: 600;
        letter-spacing: 0.04em;
        text-transform: uppercase;
        font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
        background: rgba(124, 58, 237, 0.15);
        border: 1px solid rgba(124, 58, 237, 0.3);
        color: #7c3aed;
      }
      .integration-tools-tool-key {
        margin: 0 0 0.45rem;
        font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
        font-size: 0.75rem;
        color: var(--text-muted);
        opacity: 0.7;
      }
      .integration-tools-tool-desc {
        margin: 0.45rem 0 0;
        font-size: 0.8125rem;
        color: #6f6a80;
        line-height: 1.5;
        max-width: 52rem;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
      }
      .integration-tools-tool-action {
        flex-shrink: 0;
        display: flex;
        align-items: flex-start;
        padding-right: 0.1rem;
      }
      .integration-tools-configure-btn {
        white-space: nowrap;
        font-size: 0.8125rem;
        padding: 0.38rem 0.85rem;
        border-radius: 8px;
        background: rgba(124, 58, 237, 0.15);
        border: 1px solid rgba(124, 58, 237, 0.35);
        color: #7c3aed;
        cursor: pointer;
        transition: background 0.15s, border-color 0.15s, color 0.15s;
        font-family: inherit;
        font-weight: 600;
      }
      .integration-tools-configure-btn:hover {
        background: rgba(124, 58, 237, 0.3);
        border-color: rgba(124, 58, 237, 0.6);
        color: #5b21b6;
      }
      .integration-tools-badges {
        display: flex;
        flex-wrap: wrap;
        gap: 0.3rem;
        margin-top: 0.4rem;
      }
      .integration-tools-badge {
        display: inline-flex;
        align-items: center;
        border-radius: 6px;
        border: 1px solid var(--border-subtle);
        padding: 0.15rem 0.55rem;
        font-size: 0.75rem;
        font-weight: 600;
        color: var(--text-muted);
        background: #ffffff;
      }
      .integration-tools-badge-on {
        border-color: rgba(74, 222, 128, 0.35);
        background: rgba(74, 222, 128, 0.1);
        color: #15803d;
      }
      .integration-tools-badge-warn {
        border-color: rgba(234, 179, 8, 0.35);
        background: rgba(234, 179, 8, 0.1);
        color: #854d0e;
      }
      .integration-tools-empty {
        text-align: center;
        padding: 2.5rem 1.25rem;
        border: 1px dashed var(--border-subtle);
        border-radius: 12px;
        color: var(--text-muted);
        background: rgba(23, 13, 59, 0.025);
      }
      .integration-tools-empty-title {
        font-size: 0.9375rem;
        font-weight: 600;
        color: #241a3f;
        margin-bottom: 0.35rem;
      }
      .integration-tools-pagination {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: 0.65rem;
        margin-top: 0.85rem;
        padding-top: 0.85rem;
        border-top: 1px solid var(--border-subtle);
      }
      .integration-tools-pagination-actions {
        display: flex;
        align-items: center;
        gap: 0.45rem;
      }
      .integration-tools-enable-row {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
        padding: 0.65rem 0.85rem;
        border-radius: 10px;
        border: 1px solid var(--border-subtle);
        background: rgba(23, 13, 59, 0.035);
        margin-top: 0.75rem;
      }
      .integration-tools-switch {
        position: relative;
        display: inline-flex;
        align-items: center;
        gap: 0.55rem;
        cursor: pointer;
        user-select: none;
      }
      .integration-tools-switch input {
        position: absolute;
        opacity: 0;
        width: 0;
        height: 0;
      }
      .integration-tools-switch-track {
        width: 2.5rem;
        height: 1.35rem;
        border-radius: 999px;
        background: rgba(82, 63, 133, 0.27);
        border: 1px solid var(--border-subtle);
        transition: background 0.15s ease;
        flex-shrink: 0;
      }
      .integration-tools-switch-thumb {
        display: block;
        width: 1rem;
        height: 1rem;
        margin: 0.12rem;
        border-radius: 50%;
        background: #1d1433;
        transition: transform 0.15s ease;
      }
      .integration-tools-switch input:checked + .integration-tools-switch-track {
        background: rgba(34, 197, 94, 0.55);
        border-color: rgba(34, 197, 94, 0.5);
      }
      .integration-tools-switch input:checked + .integration-tools-switch-track .integration-tools-switch-thumb {
        transform: translateX(1.1rem);
      }
      .integration-tools-switch input:disabled + .integration-tools-switch-track {
        opacity: 0.5;
        cursor: not-allowed;
      }
      .integration-tools-function-card {
        padding: 0.9rem 1rem;
        border-radius: 12px;
        border: 1px solid var(--border-subtle);
        background: rgba(23, 13, 59, 0.038);
      }
      .integration-tools-function-actions {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.5rem;
        flex-shrink: 0;
      }
      .integration-tools-readiness {
        margin-top: 0.65rem;
        padding: 0.65rem 0.75rem;
        border-radius: 8px;
        border: 1px dashed rgba(234, 179, 8, 0.35);
        background: rgba(234, 179, 8, 0.08);
        font-size: 0.8125rem;
        color: #854d0e;
        line-height: 1.4;
      }
      .integration-tools-function-editor {
        display: flex;
        flex-direction: column;
        gap: 0.85rem;
        max-height: min(70vh, 640px);
        overflow: auto;
        padding-right: 0.25rem;
      }
      .integration-tools-field-card {
        border: 1px solid var(--border-subtle);
        border-radius: 10px;
        padding: 0.85rem;
        background: rgba(23, 13, 59, 0.045);
      }
      .integration-tools-field-card h5 {
        margin: 0 0 0.65rem;
        font-size: 0.875rem;
        font-weight: 600;
      }
      .integration-tools-dialog::backdrop {
        background: rgba(23, 13, 59, 0.42);
      }
      .integration-tools-dialog {
        border: 1px solid var(--border-subtle);
        border-radius: 16px;
        padding: 0;
        width: min(920px, 96vw);
        max-height: 92vh;
        background: #f3f0fa;
        color: inherit;
        box-shadow: 0 24px 64px rgba(23, 13, 59, 0.09);
      }
      .integration-tools-dialog-inner {
        padding: 1.15rem 1.25rem 1.2rem;
        max-height: 92vh;
        display: flex;
        flex-direction: column;
      }
      .integration-tools-dialog-actions {
        display: flex;
        flex-wrap: wrap;
        justify-content: flex-end;
        gap: 0.5rem;
        padding-top: 0.85rem;
        border-top: 1px solid var(--border-subtle);
        margin-top: 0.85rem;
        flex-shrink: 0;
      }

      .phone-ops-status-pill {
        display: inline-flex;
        align-items: center;
        border-radius: 999px;
        border: 1px solid var(--border-subtle);
        padding: 0.2rem 0.55rem;
        font-size: 0.75rem;
        font-weight: 600;
        text-transform: capitalize;
      }
      .phone-ops-status-active {
        border-color: rgba(34, 197, 94, 0.35);
        background: rgba(34, 197, 94, 0.12);
        color: #15803d;
      }
      .phone-ops-status-pending {
        border-color: rgba(234, 179, 8, 0.35);
        background: rgba(234, 179, 8, 0.12);
        color: #854d0e;
      }
      .phone-ops-status-inactive,
      .phone-ops-status-expired {
        border-color: rgba(82, 63, 133, 0.21);
        background: rgba(82, 63, 133, 0.072);
        color: #544d6b;
      }
      .phone-ops-status-available {
        border-color: rgba(124, 58, 237, 0.35);
        background: rgba(124, 58, 237, 0.12);
        color: #7c3aed;
      }

      /* ── Phone number table & detail drawer ── */
      .pn-clickable-table tbody tr {
        cursor: pointer;
        transition: background 0.12s ease;
      }
      .pn-clickable-table tbody tr:hover {
        background: rgba(124, 58, 237, 0.07);
      }
      .pn-clickable-table tbody tr.pn-row-selected {
        background: rgba(124, 58, 237, 0.14);
        outline: 1px solid rgba(124, 58, 237, 0.35);
      }

      .pn-detail-drawer {
        margin-top: 1.25rem;
        border: 1px solid var(--border-subtle);
        border-radius: 14px;
        background: #ffffff;
        backdrop-filter: blur(8px);
        overflow: hidden;
        animation: pn-slide-in 0.2s ease;
      }
      @keyframes pn-slide-in {
        from { opacity: 0; transform: translateY(-8px); }
        to   { opacity: 1; transform: translateY(0); }
      }

      .pn-drawer-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        padding: 1rem 1.25rem 0.85rem;
        border-bottom: 1px solid var(--border-subtle);
      }
      .pn-drawer-title-group {
        display: flex;
        align-items: center;
        gap: 0.75rem;
      }
      .pn-drawer-flag {
        font-size: 2rem;
        line-height: 1;
      }
      .pn-drawer-number {
        margin: 0;
        font-size: 1.125rem;
        font-weight: 700;
        letter-spacing: 0.03em;
        color: var(--text-primary);
      }
      .pn-drawer-country {
        font-size: 0.8125rem;
        color: var(--text-muted);
      }
      .pn-drawer-close {
        all: unset;
        cursor: pointer;
        font-size: 1rem;
        color: var(--text-muted);
        padding: 4px 8px;
        border-radius: 6px;
        transition: color 0.15s, background 0.15s;
      }
      .pn-drawer-close:hover { color: var(--text-primary); background: rgba(82, 63, 133, 0.06); }

      .pn-info-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 0.65rem;
        padding: 1rem 1.25rem;
        border-bottom: 1px solid var(--border-subtle);
      }
      .pn-info-cell {
        display: flex;
        flex-direction: column;
        gap: 0.2rem;
      }
      .pn-info-label {
        font-size: 0.75rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.07em;
        color: var(--text-muted);
      }
      .pn-info-value {
        font-size: 0.875rem;
        color: var(--text-primary);
        font-weight: 500;
      }
      .pn-mono { font-family: monospace; font-size: 0.8125rem; word-break: break-all; }
      .pn-badge {
        display: inline-block;
        padding: 2px 9px;
        border-radius: 999px;
        font-size: 0.75rem;
        font-weight: 600;
      }
      .pn-badge-active    { background: rgba(34,197,94,0.18);  color: #16a34a; }
      .pn-badge-pending   { background: rgba(234,179,8,0.18);  color: #a16207; }
      .pn-badge-inactive  { background: rgba(82, 63, 133, 0.09); color: #6f6a80; }
      .pn-badge-expired   { background: rgba(239,68,68,0.15);  color: #dc2626; }
      .pn-badge-true      { background: rgba(124, 58, 237, 0.18);  color: #7c3aed; }
      .pn-badge-false     { background: rgba(82, 63, 133, 0.06);  color: #7a7490; }

      .pn-rules-section { padding: 1rem 1.25rem 1.25rem; }
      .pn-rules-heading {
        display: flex;
        align-items: baseline;
        gap: 1rem;
        margin-bottom: 0.85rem;
      }
      .pn-rules-title {
        margin: 0;
        font-size: 0.9375rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.08em;
        color: var(--text-muted);
      }
      .pn-rules-grid {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
      }

      /* ── Row-style expandable country rule panels (matches existing card vibe). ── */
      details.pn-rule-row {
        background: #ffffff;
        border: 1px solid rgba(82, 63, 133, 0.096);
        border-radius: 16px;
        overflow: hidden;
        transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
        box-shadow: 0 2px 12px rgba(23, 13, 59, 0.05);
      }
      details.pn-rule-row:hover {
        border-color: rgba(124, 58, 237, 0.4);
        box-shadow: 0 6px 28px rgba(23, 13, 59, 0.08), 0 0 0 1px rgba(124, 58, 237, 0.18);
        transform: translateY(-1px);
      }

      details.pn-rule-row > summary {
        list-style: none;
        cursor: pointer;
        user-select: none;
        position: relative;
      }
      details.pn-rule-row > summary::-webkit-details-marker { display: none; }
      details.pn-rule-row > summary::after {
        content: "▾";
        position: absolute;
        right: 1.1rem;
        top: 1.25rem;
        color: var(--text-muted);
        transform: rotate(-90deg);
        transition: transform 140ms ease;
      }
      details.pn-rule-row[open] > summary::after { transform: rotate(0deg); }

      .pn-rule-row-summary {
        display: flex;
        align-items: center;
        gap: 0.85rem;
        padding: 1.05rem 3rem 1.05rem 1.2rem; /* right pad for chevron */
        background: rgba(124, 58, 237, 0.04);
        border-bottom: 1px solid rgba(82, 63, 133, 0.06);
      }
      .pn-rule-badges {
        margin-left: auto;
        display: inline-flex;
        align-items: center;
        gap: 0.5rem;
        flex-shrink: 0;
      }
      .pn-rule-row-meta {
        display: flex;
        align-items: center;
        gap: 0.6rem;
        flex-wrap: wrap;
        justify-content: flex-end;
      }
      .pn-rule-row-pill {
        display: inline-flex;
        align-items: center;
        gap: 0.4rem;
        background: #ffffff;
        border: 1px solid rgba(82, 63, 133, 0.108);
        border-radius: 999px;
        padding: 3px 10px;
        font-size: 0.8125rem;
        color: var(--text-muted);
      }
      .pn-rule-row-pill strong {
        color: var(--text-primary);
        font-family: ui-monospace, monospace;
        font-weight: 700;
      }
      .pn-rule-row-body {
        padding: 0.85rem 0 0;
      }
      .pn-rule-row-actions {
        display: flex;
        gap: 0.5rem;
        margin-left: 0.25rem;
      }

      /* ── Grouping headers for country rules ── */
      /* ── Country rules search block ── */
      .pn-search-block {
        margin-top: 1rem;
        border: 1px solid rgba(124, 58, 237, 0.2);
        border-radius: 14px;
        background: linear-gradient(135deg, #ffffff, #ffffff);
        box-shadow: 0 4px 20px rgba(23, 13, 59, 0.05);
        overflow: hidden;
      }
      .pn-search-label-bar {
        display: flex;
        align-items: center;
        gap: 0.55rem;
        padding: 0.55rem 0.85rem 0.4rem;
        background: rgba(124, 58, 237, 0.05);
        border-bottom: 1px solid rgba(124, 58, 237, 0.12);
      }
      .pn-search-label-icon { font-size: 0.875rem; color: #6d28d9; }
      .pn-search-label-text {
        font-size: 0.75rem;
        font-weight: 700;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        color: #7a7490;
      }
      .pn-search-tags {
        display: flex;
        gap: 0.35rem;
        margin-left: auto;
        flex-wrap: wrap;
        align-items: center;
      }
      .pn-search-tag {
        font-size: 0.75rem;
        font-weight: 700;
        letter-spacing: 0.04em;
        padding: 2px 8px;
        border-radius: 999px;
        border: 1px solid rgba(124, 58, 237, 0.28);
        background: rgba(124, 58, 237, 0.08);
        color: #6d28d9;
      }
      .pn-search-input-row {
        display: flex;
        align-items: center;
        gap: 0.55rem;
        padding: 0.55rem 0.75rem;
      }
      .pn-search-icon { color: #7a7490; font-size: 1rem; flex-shrink: 0; user-select: none; }
      .pn-search-input {
        all: unset;
        flex: 1;
        font-size: 0.9375rem;
        color: var(--text-primary);
        caret-color: #6d28d9;
      }
      .pn-search-input::placeholder { color: #8a849c; }
      .pn-search-count {
        font-size: 0.75rem;
        font-weight: 600;
        color: #7c3aed;
        white-space: nowrap;
        font-family: ui-monospace, monospace;
        background: rgba(124, 58, 237, 0.12);
        border: 1px solid rgba(124, 58, 237, 0.25);
        border-radius: 999px;
        padding: 2px 10px;
        min-width: 2.5rem;
        text-align: center;
        transition: background 0.15s, color 0.15s;
      }
      .pn-search-clear {
        all: unset;
        cursor: pointer;
        font-size: 0.75rem;
        font-weight: 700;
        color: #7a7490;
        background: rgba(239,68,68,0.08);
        border: 1px solid rgba(239,68,68,0.22);
        border-radius: 7px;
        padding: 4px 10px;
        transition: background 0.15s, color 0.15s, border-color 0.15s;
        white-space: nowrap;
      }
      .pn-search-clear:not(:disabled):hover {
        background: rgba(239,68,68,0.18);
        border-color: rgba(239,68,68,0.5);
        color: #b91c1c;
      }
      .pn-search-clear:disabled { opacity: 0.35; cursor: not-allowed; }

      .pn-rules-group {
        border: 1px solid rgba(82, 63, 133, 0.072);
        border-radius: 14px;
        background: #ffffff;
        overflow: hidden;
      }
      .pn-rules-group + .pn-rules-group { margin-top: 0.85rem; }
      .pn-rules-group-header {
        display: flex;
        align-items: center;
        gap: 0.6rem;
        padding: 0.75rem 1rem;
        border-bottom: 1px solid rgba(82, 63, 133, 0.06);
        background: rgba(124, 58, 237, 0.03);
      }
      .pn-rules-group-title {
        margin: 0;
        font-size: 1rem;
        font-weight: 800;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        color: var(--text-muted);
      }
      .pn-rules-group-title strong {
        color: #6d28d9;
        font-family: ui-monospace, monospace;
        font-weight: 900;
        font-size: 1.02em;
      }
      .pn-rules-group-count {
        margin-left: auto;
        font-size: 0.75rem;
        font-weight: 700;
        background: rgba(124, 58, 237, 0.16);
        color: #7c3aed;
        border-radius: 999px;
        padding: 1px 10px;
        border: 1px solid rgba(124, 58, 237, 0.28);
        font-family: ui-monospace, monospace;
      }
      .pn-rules-group-body {
        display: flex;
        flex-direction: column;
        gap: 0.6rem;
        padding: 0.75rem;
      }
      .pn-rule-card {
        background: #ffffff;
        border: 1px solid rgba(82, 63, 133, 0.096);
        border-radius: 16px;
        padding: 0;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
        box-shadow: 0 2px 12px rgba(23, 13, 59, 0.05);
      }
      .pn-rule-card:hover {
        border-color: rgba(124, 58, 237, 0.4);
        box-shadow: 0 6px 28px rgba(23, 13, 59, 0.08), 0 0 0 1px rgba(124, 58, 237, 0.18);
        transform: translateY(-2px);
      }

      /* ── Card top band ── */
      .pn-rule-card-header {
        display: flex;
        align-items: center;
        gap: 0.85rem;
        padding: 1.1rem 1.2rem;
        background: rgba(124, 58, 237, 0.04);
        border-bottom: 1px solid rgba(82, 63, 133, 0.06);
      }
      .pn-rule-flag { font-size: 2.25rem; line-height: 1; flex-shrink: 0; }
      .pn-rule-country {
        display: inline-flex;
        align-items: center;
        width: fit-content;
        font-size: 1.125rem;
        font-weight: 700;
        color: #16a34a;
        letter-spacing: -0.01em;
        background: rgba(34, 197, 94, 0.14);
        border: 1px solid rgba(34, 197, 94, 0.28);
        padding: 2px 10px;
        border-radius: 8px;
      }
      .pn-rule-calling {
        font-size: 0.8125rem;
        color: #6d28d9;
        font-family: ui-monospace, monospace;
        font-weight: 600;
        margin-top: 2px;
      }
      .pn-rule-iso {
        font-size: 0.75rem;
        font-weight: 700;
        letter-spacing: 0.06em;
        color: #6d28d9;
        background: rgba(124, 58, 237, 0.12);
        border: 1px solid rgba(124, 58, 237, 0.28);
        border-radius: 6px;
        padding: 3px 9px;
        flex-shrink: 0;
      }
      .pn-rule-iso-yellow {
        color: #a16207;
        background: rgba(250, 204, 21, 0.14);
        border-color: rgba(250, 204, 21, 0.32);
      }

      /* Prefix editor selection + delete affordance */
      .pn-prefix-chip.pn-selected {
        background: rgba(239, 68, 68, 0.16);
        border-color: rgba(239, 68, 68, 0.55);
        color: #991b1b;
      }
      #pn-rule-prefix-delete-btn:disabled {
        opacity: 0.45;
        cursor: not-allowed;
      }
      #pn-rule-prefix-delete-btn.pn-delete-armed {
        background: rgba(239, 68, 68, 0.18);
        border-color: rgba(239, 68, 68, 0.6);
        color: #991b1b;
      }
      #pn-rule-prefix-delete-btn.pn-delete-armed:hover {
        background: rgba(239, 68, 68, 0.3);
        border-color: rgba(239, 68, 68, 0.8);
        color: #991b1b;
      }

      /* ── Meta info grid ── */
      .pn-rule-pills {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0;
        border-bottom: 1px solid rgba(82, 63, 133, 0.048);
      }
      .pn-rule-pill {
        display: flex;
        flex-direction: column;
        gap: 2px;
        padding: 0.65rem 1.2rem;
        border-right: 1px solid rgba(82, 63, 133, 0.048);
        font-size: 0.8125rem;
      }
      .pn-rule-pill:nth-child(even) { border-right: none; }
      .pn-rule-pill-key {
        font-size: 0.75rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        color: #7a7490;
      }
      .pn-rule-pill-val {
        color: var(--text-primary);
        font-weight: 700;
        font-family: ui-monospace, monospace;
        font-size: 0.875rem;
      }
      .pn-rule-pill-mode {
        grid-column: 1 / -1;
        display: flex;
        flex-direction: column;
        gap: 2px;
        padding: 0.6rem 1.2rem;
        border-top: 1px solid rgba(82, 63, 133, 0.048);
      }
      .pn-rule-pill-mode-key {
        font-size: 0.75rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        color: #7a7490;
      }
      .pn-rule-pill-mode-val {
        display: inline-block;
        background: rgba(124, 58, 237, 0.14);
        border: 1px solid rgba(124, 58, 237, 0.32);
        color: #7c3aed;
        font-weight: 700;
        font-size: 0.8125rem;
        padding: 2px 10px;
        border-radius: 6px;
        font-family: ui-monospace, monospace;
        width: fit-content;
      }

      /* ── Prefix section ── */
      .pn-prefix-section {
        padding: 0.85rem 1.2rem 1rem;
      }
      .pn-prefix-header {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        margin-bottom: 0.65rem;
      }
      .pn-prefix-label {
        font-size: 0.75rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.07em;
        color: #7a7490;
      }
      .pn-prefix-count {
        font-size: 0.75rem;
        font-weight: 700;
        background: rgba(124, 58, 237, 0.16);
        color: #7c3aed;
        border-radius: 999px;
        padding: 1px 8px;
        border: 1px solid rgba(124, 58, 237, 0.28);
      }
      .pn-prefix-toggle {
        all: unset;
        cursor: pointer;
        font-size: 0.75rem;
        color: #6d28d9;
        font-weight: 600;
        margin-left: auto;
        padding: 2px 6px;
        border-radius: 5px;
        transition: background 0.15s;
      }
      .pn-prefix-toggle:hover { background: rgba(124, 58, 237, 0.1); }

      .pn-prefix-disclaimer {
        display: flex;
        gap: 0.6rem;
        align-items: flex-start;
        background: rgba(124, 58, 237, 0.08);
        border: 1px solid rgba(124, 58, 237, 0.22);
        border-radius: 10px;
        padding: 0.65rem 0.85rem;
        margin-top: 0.4rem;
      }
      .pn-prefix-disclaimer-icon { font-size: 1rem; flex-shrink: 0; margin-top: 1px; }
      .pn-prefix-disclaimer-line {
        font-size: 0.8125rem;
        color: #6f6a80;
        margin: 0 0 0.25rem;
        line-height: 1.5;
      }
      .pn-prefix-disclaimer-line:last-child { margin-bottom: 0; }
      .pn-prefix-disclaimer-line code {
        font-family: ui-monospace, monospace;
        font-size: 0.8125rem;
        background: rgba(23, 13, 59, 0.07);
        border-radius: 4px;
        padding: 1px 5px;
        color: #7c3aed;
      }
      .pn-prefix-disclaimer-line strong { color: #6d28d9; font-weight: 700; }

      .pn-prefix-chips {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        overflow: hidden;
        transition: max-height 0.3s cubic-bezier(0.4,0,0.2,1);
      }
      .pn-prefix-chips.pn-collapsed { max-height: 80px; }
      .pn-prefix-chips.pn-expanded  { max-height: 2000px; }

      .pn-prefix-chip {
        display: inline-flex;
        align-items: center;
        background: #ffffff;
        border: 1px solid rgba(124, 58, 237, 0.3);
        border-radius: 6px;
        padding: 3px 10px;
        font-size: 0.8125rem;
        font-family: 'JetBrains Mono', 'Fira Code', ui-monospace, monospace;
        color: #6d28d9;
        cursor: pointer;
        transition: background 0.12s, border-color 0.12s, color 0.12s;
        user-select: text;
      }
      .pn-prefix-chip:hover {
        background: rgba(124, 58, 237, 0.2);
        border-color: rgba(139,92,246,0.55);
        color: #5b21b6;
      }
      .pn-prefix-chip.pn-copied {
        background: rgba(34,197,94,0.15);
        border-color: rgba(34,197,94,0.45);
        color: #16a34a;
      }

      /* ── Country rule card CRUD actions ── */
      .pn-crud-add-btn {
        all: unset;
        cursor: pointer;
        display: inline-flex;
        align-items: center;
        gap: 0.35rem;
        font-size: 0.8125rem;
        font-weight: 700;
        color: #6d28d9;
        background: rgba(124, 58, 237, 0.1);
        border: 1px solid rgba(124, 58, 237, 0.28);
        border-radius: 8px;
        padding: 6px 14px;
        transition: background 0.15s, color 0.15s;
      }
      .pn-crud-add-btn:hover { background: rgba(124, 58, 237, 0.2); color: #6d28d9; }

      .pn-card-actions {
        display: flex;
        gap: 0.5rem;
        padding: 0.65rem 1.2rem;
        border-top: 1px solid rgba(82, 63, 133, 0.048);
        justify-content: flex-end;
        background: rgba(23, 13, 59, 0.015);
      }
      .pn-card-btn {
        all: unset;
        cursor: pointer;
        font-size: 0.8125rem;
        font-weight: 600;
        padding: 5px 14px;
        border-radius: 7px;
        border: 1px solid transparent;
        transition: background 0.15s, border-color 0.15s, color 0.15s;
      }
      .pn-card-btn-edit {
        color: #6d28d9;
        background: rgba(124, 58, 237, 0.08);
        border-color: rgba(124, 58, 237, 0.25);
      }
      .pn-card-btn-edit:hover { background: rgba(124, 58, 237, 0.18); border-color: rgba(124, 58, 237, 0.5); }
      .pn-card-btn-delete {
        color: #dc2626;
        background: rgba(239,68,68,0.07);
        border-color: rgba(239,68,68,0.22);
      }
      .pn-card-btn-delete:hover { background: rgba(239,68,68,0.16); border-color: rgba(239,68,68,0.5); }

      /* Rule modal width: see `.modal-box.pn-rule-modal-box` after base `.modal-box`. */
      .pn-rule-form-field { display: flex; flex-direction: column; gap: 0.3rem; }
      .pn-rule-form-label { font-size: 0.8125rem; font-weight: 600; color: var(--text-muted); }
      .pn-rule-form-select,
      .pn-rule-form-input {
        appearance: none;
        background: linear-gradient(180deg, #ffffff, #ffffff);
        border: 1px solid rgba(82, 63, 133, 0.168);
        border-radius: 7px;
        color: var(--text-primary);
        font-size: 0.9375rem;
        padding: 0.62rem 0.9rem;
        transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
        width: 100%;
        box-sizing: border-box;
      }
      .pn-rule-form-select:focus,
      .pn-rule-form-input:focus {
        outline: none;
        border-color: rgba(124, 58, 237, 0.75);
        box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.18), 0 10px 24px rgba(23, 13, 59, 0.09);
      }
      .pn-rule-form-select:hover,
      .pn-rule-form-input:hover {
        border-color: rgba(124, 58, 237, 0.45);
        transform: translateY(-1px);
      }

      /* Custom dropdown arrow */
      .pn-rule-form-select {
        padding-right: 2.4rem;
        background-image:
          linear-gradient(45deg, transparent 50%, rgba(124, 58, 237, 0.95) 50%),
          linear-gradient(135deg, rgba(124, 58, 237, 0.95) 50%, transparent 50%),
          linear-gradient(to right, rgba(82, 63, 133, 0.15), rgba(82, 63, 133, 0.15));
        background-position:
          calc(100% - 1.25rem) 1.15rem,
          calc(100% - 1.05rem) 1.15rem,
          calc(100% - 2.1rem) 50%;
        background-size: 7px 7px, 7px 7px, 1px 1.4rem;
        background-repeat: no-repeat;
      }

      .pn-rule-form-hint { margin: 0; font-size: 0.75rem; color: var(--text-muted); }
      .pn-rule-form-select option { background: #ffffff; color: var(--text-primary); }
      .settings-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        flex-wrap: wrap;
      }
      .settings-label {
        font-weight: 700;
        margin: 0;
      }
      .settings-description {
        margin: 0.25rem 0 0;
        color: #6f6a80;
      }
      .settings-status {
        margin: 0;
        font-weight: 600;
      }
      .settings-status[data-state="enabled"] {
        color: #16a34a;
      }
      .settings-status[data-state="disabled"] {
        color: #241a3f;
      }
      .settings-status[data-state="unavailable"] {
        color: #b91c1c;
      }
      .settings-form {
        position: static;
        padding: 0;
        border: none;
        background: transparent;
        box-shadow: none;
      }
      .settings-form .settings-field {
        display: grid;
        gap: 0.35rem;
      }
      .settings-form textarea {
        resize: vertical;
        min-height: 110px;
      }
      .settings-actions {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.6rem;
      }
      .settings-form-status {
        font-weight: 600;
      }
      .settings-form-status[data-tone="success"] {
        color: #16a34a;
      }
      .settings-form-status[data-tone="error"] {
        color: #b91c1c;
      }
      .settings-table-wrapper {
        border: 1px solid var(--border-subtle);
        border-radius: 12px;
        overflow: hidden;
        background: rgba(23, 13, 59, 0.04);
      }
      .settings-table {
        width: 100%;
        border-collapse: collapse;
      }
      .settings-table th,
      .settings-table td {
        padding: 0.75rem 0.85rem;
        text-align: left;
        border-bottom: 1px solid var(--border-subtle);
        vertical-align: top;
      }
      .settings-table th {
        font-weight: 700;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.04em;
        font-size: 0.75rem;
      }
      .settings-table td textarea,
      .settings-table td input[type="text"] {
        width: 100%;
        min-width: 180px;
      }
      .settings-table td textarea {
        min-height: 64px;
      }
      .settings-table-actions {
        display: flex;
        gap: 0.5rem;
        flex-wrap: wrap;
      }
      .settings-status {
        margin-top: 0.5rem;
      }
      .switch {
        position: relative;
        display: inline-flex;
        align-items: center;
        width: 52px;
        height: 28px;
      }
      .switch input {
        opacity: 0;
        width: 0;
        height: 0;
      }
      .switch-slider {
        position: absolute;
        cursor: pointer;
        inset: 0;
        background-color: #dcd6eb;
        border-radius: 999px;
        transition: background-color 0.2s ease;
      }
      .switch-slider::before {
        content: "";
        position: absolute;
        height: 22px;
        width: 22px;
        left: 3px;
        top: 3px;
        background-color: white;
        border-radius: 50%;
        transition: transform 0.2s ease;
      }
      .switch input:checked + .switch-slider {
        background-color: #16a34a;
      }
      .switch input:checked + .switch-slider::before {
        transform: translateX(24px);
      }
      .switch input:disabled + .switch-slider {
        background-color: #8a849c;
        cursor: not-allowed;
        opacity: 0.6;
      }
      .tab-panel.log-panel .tab-content {
        display: flex;
        flex-direction: column;
        min-height: 100%;
      }
      .tab-panel[data-loading="true"] .tab-content {
        display: none;
      }
      .tab-panel[data-loading="true"] .tab-loading {
        display: flex;
      }

      /* Per-tab loader: each tab renders its own spinner and reveals content the
         moment its own data arrives, so one slow tab never blocks the others. */
      .tab-loading {
        display: none;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.75rem;
        min-height: 280px;
        padding: 2rem 1rem;
        color: var(--text-muted);
        font-size: 0.9375rem;
        text-align: center;
      }
      .tab-loading .section-loading-mark {
        width: 120px;
        height: 97px;
      }
      .api-status {
        color: #6f6a80;
        margin: 0.25rem 0 0.5rem;
      }
      .timeline {
        position: relative;
        padding-left: 0;
        padding-right: 0.75rem;
        border-left: none;
        display: grid;
        gap: 0.4rem;
        font-variant-numeric: tabular-nums;
        overflow: visible;
      }
      .timeline-row {
        display: grid;
        grid-template-columns: max-content 1fr;
        align-items: flex-start;
        column-gap: 0.6rem;
        position: relative;
      }
      .timeline-time {
        color: #6f6a80;
        font-size: 0.9375rem;
        padding-top: 0.2rem;
        text-align: right;
      }
      .timeline-item {
        position: relative;
        padding-left: 0.6rem;
        background: #ffffff;
        border: 1px solid var(--border-subtle);
        border-radius: 10px;
        padding: 0.4rem 0.55rem 0.45rem 0.8rem;
        box-shadow: 0 12px 28px rgba(23, 13, 59, 0.07);
        display: grid;
        gap: 0.25rem;
        min-height: 0;
        width: 100%;
        z-index: 1;
        animation: itemRise 0.4s ease;
        transition: transform 0.2s ease, box-shadow 0.2s ease;
      }
      .timeline-item:hover {
        transform: translateY(-2px);
        box-shadow: 0 16px 34px rgba(23, 13, 59, 0.09);
      }
      .timeline-dot {
        position: absolute;
        left: -0.45rem;
        top: 0.65rem;
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: linear-gradient(120deg, #6d28d9, #9333ea);
        border: 2px solid #ffffff;
        box-shadow: 0 0 0 2px rgba(147, 51, 234, 0.08);
        z-index: 2;
      }
      .binding-connector {
        position: absolute;
        left: -0.6rem;
        top: 0.85rem;
        width: 0.6rem;
        height: 2px;
        background: rgba(82, 63, 133, 0.27);
        display: none;
        z-index: 1;
        pointer-events: none;
      }
      .timeline-row.binding-linked .binding-connector {
        display: block;
      }
      .timeline-row.binding-highlight .binding-connector {
        background: #a855f7;
        box-shadow: 0 0 10px rgba(168, 85, 247, 0.35);
      }
      .timeline-row.binding-highlight .timeline-item {
        border-color: #7c3aed;
        border-width: 2px;
        box-shadow: 0 18px 38px rgba(168, 85, 247, 0.35), 0 0 0 3px rgba(168, 85, 247, 0.2);
        transform: translateY(-2px);
      }
      .timeline-row.binding-highlight .timeline-dot {
        width: 10px;
        height: 10px;
        border-width: 3px;
        box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.3);
      }
      .timeline-json-btn {
        position: absolute;
        top: 0.35rem;
        right: 0.35rem;
        padding: 0.15rem 0.35rem;
        font-size: 0.75rem;
        line-height: 1.1;
        border-radius: 8px;
        border: 1px solid #e7e3f2;
        background: #f3f0fa;
        color: #544d6b;
        cursor: pointer;
        opacity: 0.65;
        z-index: 3;
        transition: opacity 120ms ease, border-color 120ms ease, color 120ms ease;
      }
      .timeline-json-btn:hover,
      .timeline-json-btn:focus-visible {
        opacity: 1;
        color: #1d1433;
        border-color: #dcd6eb;
      }
      .timeline-audio-btn {
        position: absolute;
        top: 0.35rem;
        right: 2.5rem;
        padding: 0.32rem;
        border-radius: 8px;
        border: 1px solid #e7e3f2;
        background: #f3f0fa;
        color: #1d1433;
        cursor: pointer;
        opacity: 0.9;
        z-index: 3;
        transition: opacity 120ms ease, border-color 120ms ease, color 120ms ease;
        display: inline-flex;
        align-items: center;
        justify-content: center;
      }
      .timeline-audio-btn:hover,
      .timeline-audio-btn:focus-visible {
        opacity: 1;
        color: #1d1433;
        border-color: #dcd6eb;
      }
      .timeline-audio-btn svg {
        width: 16px;
        height: 16px;
        display: block;
      }
      .timeline-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.3rem;
        flex-wrap: wrap;
      }
      .timeline-meta {
        color: #6f6a80;
        font-size: 0.8125rem;
        display: inline-flex;
        align-items: center;
        gap: 0.25rem;
        flex-wrap: wrap;
      }
      .timeline-meta code {
        background: #ffffff;
        border: 1px solid #e7e3f2;
        padding: 0.1rem 0.35rem;
        border-radius: 6px;
        color: #544d6b;
      }
      .timeline-body {
        margin: 0;
        color: #1d1433;
        display: grid;
        align-items: flex-start;
        gap: 0.45rem;
        grid-template-columns: var(--api-log-meta-width) minmax(0, 1fr);
        white-space: pre-wrap;
        font-size: 0.9375rem;
        line-height: 1.35;
      }
      .timeline-audio {
        display: none;
      }
      .timeline-content {
        display: grid;
        gap: 0.2rem;
        min-width: 0;
      }
      .timeline-request-header {
        color: #544d6b;
        font-weight: 600;
        font-size: 0.9375rem;
      }
      .timeline-messages {
        display: grid;
        gap: 0.2rem;
      }
      .timeline-message {
        display: grid;
        grid-template-columns: var(--api-log-label-width) minmax(0, 1fr);
        gap: 0.35rem;
        align-items: flex-start;
      }
      #api-timeline .timeline-message {
        display: block;
      }
      #api-timeline .timeline-message .timeline-role {
        margin-right: 0.35rem;
      }
      #api-timeline .timeline-message .timeline-text {
        display: inline;
      }
      .timeline-message-section {
        grid-template-columns: auto;
      }
      .timeline-message-section .timeline-text {  
        display: none;
      }
      .timeline-message-section .timeline-role {
        justify-self: flex-start;
        width: fit-content;
      }
      .timeline-message-nested {
        padding-left: 1.1rem;
      }
      .timeline-role {
        display: inline-flex;
        align-items: center;
        justify-self: start;
        padding: 0.05rem 0.45rem;
        border-radius: 8px;
        background: #ffffff;
        border: 1px solid #e7e3f2;
        text-transform: capitalize;
        font-weight: 700;
        font-size: 0.8125rem;
        color: #544d6b;
        white-space: nowrap;
      }
      .timeline-role.role-system {
        color: #7c3aed;
        border-color: rgba(124, 58, 237, 0.45);
      }
      .timeline-role.role-user {
        color: #b45309;
        border-color: rgba(251, 191, 36, 0.45);
      }
      .timeline-role.role-assistant {
        color: #059669;
        border-color: rgba(52, 211, 153, 0.45);
      }
      .timeline-text {
        color: #1d1433;
        word-break: break-word;
      }
      .timeline-body.collapsed {
        max-height: var(--timeline-body-max, 80px);
        overflow: hidden;
        position: relative;
      }
      .timeline-body.collapsed::after {
        content: "";
        position: absolute;
        inset: auto 0 0 0;
        height: 2rem;
        background: linear-gradient(180deg, rgba(23, 13, 59, 0), #ffffff 55%);
      }
      .timeline-item.collapsible {
        gap: 0.25rem;
      }
      .timeline-expand {
        align-self: flex-start;
        background: none;
        color: #7c3aed;
        border: none;
        border-radius: 6px;
        padding: 0.1rem 0.25rem;
        font-weight: 600;
        font-size: 0.8125rem;
        cursor: pointer;
        opacity: 0;
        pointer-events: none;
        transition: opacity 120ms ease, color 120ms ease, transform 120ms ease;
      }
      .timeline-expand:hover {
        background: transparent;
        color: #6d28d9;
        opacity: 1;
        transform: translateY(-1px);
      }
      .timeline-item:hover .timeline-expand,
      .timeline-expand:focus-visible {
        opacity: 1;
        pointer-events: auto;
      }
      .json-overlay {
        position: fixed;
        inset: 0;
        background: rgba(23, 13, 59, 0.42);
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 1200;
      }
      .json-overlay.hidden {
        display: none;
      }
      .json-panel {
        background: #ffffff;
        border: 1px solid #e7e3f2;
        border-radius: 12px;
        box-shadow: 0 20px 45px rgba(23, 13, 59, 0.07);
        width: min(90vw, 860px);
        max-height: 85vh;
        display: grid;
        grid-template-rows: auto 1fr;
        overflow: hidden;
      }
      .json-panel-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        padding: 0.75rem 1rem;
        border-bottom: 1px solid #e7e3f2;
        color: #241a3f;
        font-weight: 600;
      }
      .json-panel-body {
        padding: 0.75rem 1rem 1rem;
        overflow: auto;
        background: radial-gradient(circle at 20% 20%, rgba(124, 58, 237, 0.05), transparent 35%),
          radial-gradient(circle at 80% 0%, rgba(52, 211, 153, 0.05), transparent 30%),
          #ffffff;
      }
      .json-panel-body pre {
        margin: 0;
        font-size: 0.875rem;
        line-height: 1.45;
        color: #241a3f;
        white-space: pre-wrap;
        word-break: break-word;
      }
      .json-actions {
        display: flex;
        align-items: center;
        gap: 0.5rem;
      }
      .json-close,
      .json-copy {
        background: none;
        color: #6f6a80;
        border: 1px solid #e7e3f2;
        padding: 0.2rem 0.55rem;
        border-radius: 8px;
        font-weight: 600;
        cursor: pointer;
        transition: color 120ms ease, border-color 120ms ease, background 120ms ease;
      }
      .json-close {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 1.75rem;
        height: 1.75rem;
        padding: 0;
        font-size: 0.9rem;
        line-height: 1;
      }
      .json-close:hover,
      .json-close:focus-visible,
      .json-copy:hover,
      .json-copy:focus-visible {
        color: #241a3f;
        border-color: #dcd6eb;
        background: #ffffff;
      }
      .json-copy.is-copied {
        color: #0f9d6b;
        border-color: #34d399;
        background: rgba(52, 211, 153, 0.12);
      }
      .timeline-type {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 0.1rem 0.55rem;
        border-radius: 8px;
        background: #ffffff;
        border: 1px solid #e7e3f2;
        text-transform: capitalize;
        font-weight: 700;
        font-size: 0.8125rem;
        color: #544d6b;
        flex-shrink: 0;
        justify-self: start;
      }

      .timeline-type.type-request {
        background: rgba(109, 40, 217, 0.15);
        border-color: rgba(109, 40, 217, 0.5);
        color: #6d28d9;
      }

      .timeline-type.type-chunk {
        background: rgba(34, 197, 94, 0.12);
        border-color: rgba(34, 197, 94, 0.4);
        color: #15803d;
      }

      .timeline-type.type-response {
        background: rgba(168, 85, 247, 0.12);
        border-color: rgba(168, 85, 247, 0.4);
        color: #7c3aed;
      }

      .timeline-type.type-event {
        background: rgba(82, 63, 133, 0.072);
        border-color: rgba(82, 63, 133, 0.21);
        color: #332a4d;
      }

      .timeline-type.type-custom {
        background: rgba(250, 204, 21, 0.12);
        border-color: rgba(250, 204, 21, 0.45);
        color: #854d0e;
      }
      .component-filter {
        display: inline-flex;
        align-items: center;
        gap: 0.35rem;
        flex-wrap: wrap;
      }
      .component-filter[hidden] {
        display: none;
      }
      .filter-label {
        color: #6f6a80;
        font-weight: 600;
      }
      .filter-chip {
        display: inline-flex;
        align-items: center;
        gap: 0.3rem;
        padding: 0.35rem 0.6rem;
        border-radius: 999px;
        border: 1px solid #e7e3f2;
        background: #ffffff;
        cursor: pointer;
        font-weight: 600;
      }
      .filter-chip input {
        accent-color: #6d28d9;
      }
      .source-row.api-controls-row {
        justify-content: flex-start;
        border-bottom: 1px solid #e7e3f2;
        padding-bottom: 0.6rem;
        margin-bottom: 0.4rem;
      }
      .api-search {
        position: relative;
        display: inline-flex;
        align-items: center;
        flex: 1 1 340px;
        max-width: 520px;
        min-width: 260px;
      }
      .api-search[hidden] {
        display: none;
      }
      #search-api-logs,
      #search-speech,
      #search-dashboard {
        width: 100%;
        max-width: none;
        height: 2.6rem;
        padding: 0 3rem 0 1rem;
        border-radius: 10px;
        border: 1px solid #e7e3f2;
        background: #ffffff;
        color: #1d1433;
        font-size: 0.9375rem;
        line-height: 2.6rem;
        outline: none;
        transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
      }
      #search-api-logs::placeholder,
      #search-speech::placeholder,
      #search-dashboard::placeholder {
        color: #6f6a80;
      }
      #search-api-logs:hover,
      #search-speech:hover,
      #search-dashboard:hover {
        border-color: #dcd6eb;
      }
      #search-api-logs:focus,
      #search-speech:focus,
      #search-dashboard:focus {
        border-color: #6d28d9;
        background: #ffffff;
        box-shadow: 0 0 0 3px rgba(109, 40, 217, 0.25);
      }
      /* Left-aligned controls row for speech/dashboard, mirroring API logs. */
      .source-row.log-controls-row {
        justify-content: flex-start;
        gap: 0.75rem;
        margin-bottom: 0.6rem;
      }
      .api-search-btn {
        position: absolute;
        right: 0.35rem;
        top: 50%;
        transform: translateY(-50%);
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 2rem;
        height: 2rem;
        padding: 0;
        border: none;
        border-radius: 8px;
        background: transparent;
        color: #6f6a80;
        cursor: pointer;
        box-shadow: none;
        transition: color 0.15s ease, background 0.15s ease;
      }
      .api-search-btn:hover {
        color: #6d28d9;
        background: rgba(109, 40, 217, 0.12);
        /* Keep the icon vertically centered; override the global button:hover lift. */
        transform: translateY(-50%);
        box-shadow: none;
      }
      .api-search-btn:active {
        background: rgba(109, 40, 217, 0.28);
        transform: translateY(-50%);
        box-shadow: none;
      }
      .api-search-btn svg {
        width: 1.05rem;
        height: 1.05rem;
      }
      .api-log-count {
        margin-left: auto;
        color: #6f6a80;
        font-size: 0.875rem;
        font-weight: 600;
        white-space: nowrap;
      }
      .api-log-count[hidden] {
        display: none;
      }
      .api-log-count strong {
        color: #2a2044;
        font-weight: 700;
      }
      .component-filter {
        position: relative;
      }
      .component-dropdown-toggle {
        display: inline-flex;
        align-items: center;
        gap: 0.35rem;
        padding: 0.4rem 0.7rem;
        border-radius: 8px;
        border: 1px solid #e7e3f2;
        background: #ffffff;
        color: #2a2044;
        font-weight: 600;
        cursor: pointer;
      }
      .component-dropdown-toggle:hover,
      .component-dropdown-toggle[aria-expanded="true"] {
        border-color: #6d28d9;
      }
      .component-dropdown-toggle svg {
        width: 0.85rem;
        height: 0.85rem;
      }
      .component-dropdown-menu {
        position: absolute;
        top: calc(100% + 0.35rem);
        left: 0;
        z-index: 20;
        display: flex;
        flex-direction: column;
        gap: 0.3rem;
        min-width: 12rem;
        padding: 0.5rem;
        background: #ffffff;
        border: 1px solid #e7e3f2;
        border-radius: 10px;
        box-shadow: 0 12px 32px rgba(23, 13, 59, 0.09);
      }
      .component-dropdown-menu[hidden] {
        display: none;
      }
      .component-dropdown-menu .filter-chip {
        border: none;
        background: transparent;
        padding: 0.25rem 0.35rem;
        border-radius: 6px;
      }
      .component-dropdown-menu .filter-chip:hover {
        background: rgba(109, 40, 217, 0.12);
      }
      #api-timeline mark.search-hit {
        background: rgba(250, 204, 21, 0.35);
        color: inherit;
        border-radius: 3px;
        padding: 0 1px;
      }
      .component-badge {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0.3rem;
        padding: 0.2rem 0.45rem;
        border-radius: 999px;
        border: 1px solid #e7e3f2;
        font-size: 0.8125rem;
        font-weight: 700;
        text-transform: capitalize;
        justify-self: start;
      }
      .component-transcriber {
        border-color: rgba(168, 85, 247, 0.45);
        background: rgba(168, 85, 247, 0.12);
        color: #5b21b6;
      }
      .component-llm {
        border-color: rgba(124, 58, 237, 0.5);
        background: rgba(124, 58, 237, 0.12);
        color: #5b21b6;
      }
      .component-synthesizer {
        border-color: rgba(52, 211, 153, 0.45);
        background: rgba(52, 211, 153, 0.12);
        color: #166534;
      }
      .component-custom {
        border-color: rgba(250, 204, 21, 0.45);
        background: rgba(250, 204, 21, 0.12);
        color: #854d0e;
      }
      .component-telephony {
        border-color: rgba(168, 85, 247, 0.45);
        background: rgba(168, 85, 247, 0.12);
        color: #ede9fe;
      }
      .timeline-item.component-transcriber {
        border-color: rgba(168, 85, 247, 0.45);
      }
      .timeline-item.component-llm {
        border-color: rgba(124, 58, 237, 0.45);
      }
      .timeline-item.component-synthesizer {
        border-color: rgba(52, 211, 153, 0.4);
      }
      .timeline-item.component-custom {
        border-color: rgba(250, 204, 21, 0.4);
        background: linear-gradient(120deg, rgba(250, 204, 21, 0.08), #ffffff);
      }
      .timeline-item.component-telephony {
        border-color: rgba(168, 85, 247, 0.4);
      }
      .timeline-dot.component-transcriber {
        background: linear-gradient(120deg, #9333ea, #a855f7);
      }
      .timeline-dot.component-llm {
        background: linear-gradient(120deg, #6d28d9, #7c3aed);
      }
      .timeline-dot.component-synthesizer {
        background: linear-gradient(120deg, #16a34a, #059669);
      }
      .timeline-dot.component-custom {
        background: linear-gradient(120deg, #a16207, #b45309);
      }
      .timeline-dot.component-telephony {
        background: linear-gradient(120deg, #a855f7, #7c3aed);
      }
      .file-statuses {
        display: flex;
        gap: 0.5rem;
        flex-wrap: wrap;
      }
      .file-chip {
        display: inline-flex;
        align-items: center;
        gap: 0.35rem;
        padding: 0.35rem 0.6rem;
        border-radius: 999px;
        border: 1px solid #e7e3f2;
        background: #ffffff;
        font-size: 0.9375rem;
      }
      .tab-meta {
        display: flex;
        align-items: center;
        justify-content: space-between;
        color: #6f6a80;
        font-size: 0.9375rem;
        margin-bottom: 0.5rem;
        gap: 0.75rem;
        flex-wrap: wrap;
      }
      .log-filters {
        display: flex;
        align-items: center;
        gap: 0.35rem;
        flex-wrap: wrap;
      }
      .log-filters[hidden] {
        display: none;
      }
      .log-filter-button {
        border: 1px solid #e7e3f2;
        background: #ffffff;
        color: #1d1433;
        padding: 0.2rem 0.5rem;
        border-radius: 999px;
        font-size: 0.8125rem;
        font-weight: 700;
        text-transform: uppercase;
        cursor: pointer;
        transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
      }
      .log-filter-button.is-active {
        border-color: rgba(34, 197, 94, 0.6);
        background: rgba(34, 197, 94, 0.18);
        color: #166534;
      }
      .log-filter-button.level-warning.is-active {
        border-color: rgba(250, 204, 21, 0.6);
        background: rgba(250, 204, 21, 0.18);
        color: #854d0e;
      }
      .log-filter-button.level-error.is-active {
        border-color: rgba(248, 113, 113, 0.6);
        background: rgba(248, 113, 113, 0.18);
        color: #991b1b;
      }
      .log-surface {
        background: #ffffff;
        border: 1px dashed var(--border-subtle);
        border-radius: 12px;
        padding: 0.85rem;
        white-space: pre-wrap;
        font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
        max-height: 420px;
        overflow: auto;
        box-shadow: inset 0 1px 0 rgba(23, 13, 59, 0.05);
        transition: border-color 0.2s ease, box-shadow 0.2s ease;
      }

      /* Invisible trailing marker used to lazy-load the next window of rows. */
      .lazy-load-sentinel {
        grid-column: 1 / -1;
        width: 100%;
        height: 1px;
        margin: 0;
        padding: 0;
        pointer-events: none;
      }
      .log-surface:focus-within {
        border-color: rgba(124, 58, 237, 0.55);
        box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.18);
      }
      .log-surface--tall {
        flex: 1;
        min-height: 320px;
        max-height: none;
      }
      .log-line {
        margin: 0.2rem 0;
        padding: 0.35rem;
        border-radius: 6px;
      }
      .log-line:nth-child(odd) {
        background: rgba(109, 40, 217, 0.1);
      }
      .log-line .timestamp {
        color: #6f6a80;
        margin-right: 0.4rem;
      }
      .helper-text {
        color: #6f6a80;
        font-size: 0.9375rem;
      }
      .source-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
        flex-wrap: wrap;
      }
      .api-stack {
        display: grid;
        gap: 0.75rem;
      }
      .api-section {
        display: grid;
        gap: 0.35rem;
      }
      .source-label {
        margin: 0;
        color: #6f6a80;
        font-weight: 600;
      }
      .chips {
        display: flex;
        gap: 0.5rem;
        flex-wrap: wrap;
        align-items: center;
      }
      .recording-card {
        background: #ffffff;
        border: 1px solid var(--border-subtle);
        border-radius: 12px;
        padding: 0.85rem;
        display: grid;
        gap: 0.5rem;
        box-shadow: var(--panel-shadow);
        animation: panelIn 0.5s ease;
      }
      .recording-status {
        color: #6f6a80;
      }
      .recording-call-uuid {
        margin: 0;
        font-size: 0.875rem;
      }
      .call-meta-bar {
        display: flex;
        flex-wrap: wrap;
        align-items: stretch;
        gap: 0.5rem 0;
        padding: 0.7rem 0.15rem;
        margin: 0.15rem 0 0.4rem;
        border-top: 1px solid var(--border-subtle);
        border-bottom: 1px solid var(--border-subtle);
      }
      .call-meta-bar[hidden] {
        display: none;
      }
      .cm-item {
        display: flex;
        flex-direction: column;
        gap: 4px;
        padding: 0 1.05rem;
        min-width: 0;
      }
      .cm-item + .cm-item {
        border-left: 1px solid var(--border-subtle);
      }
      .cm-k {
        font-size: 0.6875rem;
        font-weight: 600;
        letter-spacing: 0.05em;
        text-transform: uppercase;
        color: var(--text-muted);
        white-space: nowrap;
      }
      .cm-v {
        font-size: 0.875rem;
        font-weight: 600;
        color: var(--text-primary);
        line-height: 1.3;
        display: flex;
        align-items: center;
        gap: 0.35rem;
        white-space: nowrap;
      }
      .cm-v.cm-mono {
        font-family: "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace;
        font-weight: 500;
        letter-spacing: -0.01em;
      }
      .cm-v .cm-dir-icon {
        width: 14px;
        height: 14px;
        flex: none;
      }
      .cm-pill {
        display: inline-flex;
        align-items: center;
        padding: 0.15rem 0.55rem;
        border-radius: 999px;
        font-size: 0.75rem;
        font-weight: 700;
        border: 1px solid transparent;
        line-height: 1.35;
      }
      .cm-pill.tone-good {
        background: rgba(34, 197, 94, 0.15);
        border-color: rgba(34, 197, 94, 0.35);
        color: #16a34a;
      }
      .cm-pill.tone-neutral {
        background: rgba(82, 63, 133, 0.108);
        border-color: rgba(82, 63, 133, 0.24);
        color: #544d6b;
      }
      .cm-pill.tone-bad {
        background: rgba(239, 68, 68, 0.15);
        border-color: rgba(239, 68, 68, 0.35);
        color: #dc2626;
      }
      .cm-pill.tone-warn {
        background: rgba(161, 98, 7, 0.14);
        border-color: rgba(161, 98, 7, 0.3);
        color: #a16207;
      }
      .cm-sub {
        font-weight: 500;
        color: var(--text-muted);
        font-size: 0.6875rem;
      }
      @media (max-width: 640px) {
        .cm-item {
          padding: 0 0.75rem;
        }
        .cm-item + .cm-item {
          border-left: none;
        }
      }
      .player-shell {
        background: #ffffff;
        border: 1px solid var(--border-subtle);
        border-radius: 14px;
        padding: 0.55rem 0.75rem 0.6rem;
        display: grid;
        gap: 0.55rem;
        box-shadow: 0 18px 35px rgba(23, 13, 59, 0.07);
        transition: transform 0.2s ease;
      }
      .player-shell:hover {
        transform: translateY(-1px);
      }
      .player-body {
        display: grid;
        gap: 0.45rem;
      }
      /* Flex, not grid-with-auto-columns: in a width:100% grid, `auto` tracks
         absorb the leftover space and stretch every button to fill the bar. */
      .control-bar {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        background: #ffffff;
        border: 1px solid var(--border-subtle);
        border-radius: 12px;
        padding: 0.4rem 0.75rem;
        width: 100%;
        box-sizing: border-box;
        overflow: hidden;
        backdrop-filter: blur(12px);
      }
      .control-button {
        border: 1px solid transparent;
        background: #ffffff;
        color: #1d1433;
        border-radius: 10px;
        padding: 0.45rem;
        display: grid;
        place-items: center;
        transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
      }
      .control-button:hover {
        background: #ede9fe;
        border-color: #e7e3f2;
        transform: translateY(-1px);
      }
      .control-button svg {
        width: 18px;
        height: 18px;
        display: block;
      }
      .speed-controls {
        display: inline-flex;
        align-items: center;
        gap: 0.35rem;
        background: #ffffff;
        border: 1px solid #e7e3f2;
        border-radius: 999px;
        padding: 0.2rem 0.35rem;
        justify-self: start;
      }
      .speed-button {
        border: 1px solid transparent;
        background: #ede9fe;
        color: #1d1433;
        border-radius: 999px;
        width: 28px;
        height: 28px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.125rem;
        font-weight: 600;
        line-height: 1;
        transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
      }
      .speed-button span {
        display: inline-block;
        transform: translateY(-0.5px);
      }
      .speed-button:hover {
        background: #e4ddf6;
        border-color: #e7e3f2;
        transform: translateY(-1px);
      }
      .speed-button:disabled {
        opacity: 0.5;
        cursor: not-allowed;
        transform: none;
      }
      .speed-label {
        min-width: 46px;
        text-align: center;
        font-variant-numeric: tabular-nums;
        font-size: 0.875rem;
        color: #544d6b;
      }
      /* Full-width row under the waveform so the slider spans its whole length. */
      .scrub {
        display: grid;
        gap: 0.3rem;
        min-width: 0;
        width: 100%;
      }
      .scrub input[type="range"] {
        accent-color: #7c3aed;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        /* The global input rule adds padding/border; with content-box sizing
           that pushes width past 100% and out of the control bar. */
        box-sizing: border-box;
        padding: 0;
        border: none;
        background: transparent;
      }
      .time-row {
        display: flex;
        justify-content: space-between;
        font-variant-numeric: tabular-nums;
        color: #6f6a80;
        font-size: 0.9375rem;
      }

      .waveform {
        position: relative;
        border-radius: 10px;
        overflow: hidden;
        border: 1px solid #f3f0fa;
        background: linear-gradient(180deg, rgba(124, 58, 237, 0.1) 50%, rgba(168, 85, 247, 0.1) 50%);
        padding: 0.25rem;
      }
      .waveform-inner {
        border-radius: 8px;
        overflow: hidden;
        background: #ffffff;
      }
      .waveform .wave-channel { /* overlay the two channel canvases */
        position: absolute;
        inset: 0;
        pointer-events: none;
      }
      .transcript-list {
        overflow-y: auto;
        border-radius: 10px;
        border: 1px solid #e7e3f2;
        background: #ffffff;
        padding: 0.35rem;
        display: grid;
        gap: 0.25rem;
        max-height: 420px;
      }
      .transcript-line {
        display: grid;
        grid-template-columns: auto auto 1fr;
        gap: 0.5rem;
        padding: 0.55rem;
        border-radius: 8px;
        background: transparent;
        border: 1px solid transparent;
        text-align: left;
        color: inherit;
        cursor: pointer;
      }
      .transcript-line:hover {
        border-color: #6d28d9;
        background: rgba(109, 40, 217, 0.08);
      }
      .transcript-line.active {
        border-color: #a855f7;
        background: rgba(168, 85, 247, 0.12);
      }
      .transcript-time {
        font-variant-numeric: tabular-nums;
        color: #6f6a80;
      }
      .transcript-speaker {
        display: inline-flex;
        align-items: center;
        gap: 0.3rem;
        padding: 0.25rem 0.5rem;
        border-radius: 999px;
        font-size: 0.875rem;
        border: 1px solid #e7e3f2;
      }
      .transcript-speaker.user {
        color: #16a34a;
        border-color: rgba(34, 197, 94, 0.5);
        background: rgba(34, 197, 94, 0.1);
      }
      .transcript-speaker.agent {
        color: #7c3aed;
        border-color: rgba(124, 58, 237, 0.5);
        background: rgba(124, 58, 237, 0.1);
      }
      .transcript-text {
        color: #1d1433;
      }
      .dual-transcript-section {
        margin-top: 1.5rem;
        border: 1px solid var(--border-subtle);
        border-radius: 12px;
        background: #ffffff;
        padding: 1rem;
        box-shadow: var(--panel-shadow);
      }
      .dual-transcript-header {
        display: flex;
        align-items: baseline;
        justify-content: space-between;
        gap: 0.75rem;
        flex-wrap: wrap;
        margin-bottom: 0.85rem;
      }
      .dual-transcript-header h3 {
        margin: 0;
        color: var(--text-primary);
      }
      .dual-transcript-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1rem;
      }
      @media (max-width: 720px) {
        .dual-transcript-grid {
          grid-template-columns: 1fr;
        }
      }
      .dual-transcript-col {
        display: grid;
        gap: 0.4rem;
        min-width: 0;
      }
      .dual-transcript-col-head {
        display: flex;
        align-items: baseline;
        gap: 0.5rem;
        padding: 0 0.15rem;
      }
      .dual-transcript-col-title {
        font-size: 0.9375rem;
        font-weight: 600;
        color: var(--text-primary);
      }
      .dual-transcript-col-sub {
        font-size: 0.8125rem;
        color: var(--text-muted);
      }
      .dual-transcript-list {
        max-height: 360px;
      }
      .dual-transcript-list .transcript-empty {
        padding: 0.85rem;
        font-size: 0.875rem;
        color: var(--text-muted);
        text-align: center;
      }
      .chip {
        padding: 0.35rem 0.7rem;
        border-radius: 999px;
        border: 1px solid #e7e3f2;
        background: #ffffff;
        font-size: 0.9375rem;
        display: inline-flex;
        align-items: center;
        justify-content: center;
      }
      .search-box {
        min-width: 220px;
        display: inline-flex;
        align-items: center;
        gap: 0.35rem;
        color: #2a2044;
      }
      .search-box input {
        max-width: 260px;
      }


      /* Call quality tab styling */
      .quality-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        flex-wrap: wrap;
        margin-bottom: 0.65rem;
      }

      .quality-legend {
        display: inline-flex;
        gap: 0.5rem;
        align-items: center;
        flex-wrap: wrap;
      }

      .legend-chip {
        display: inline-flex;
        align-items: center;
        gap: 0.35rem;
        padding: 0.35rem 0.6rem;
        border-radius: 999px;
        border: 1px solid #e7e3f2;
        background: #ffffff;
        font-size: 0.9375rem;
      }

      .legend-dot {
        width: 10px;
        height: 10px;
        border-radius: 50%;
      }

      .quality-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.9rem;
        grid-auto-rows: auto;
        align-items: start;
      }

      .quality-summary-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
        gap: 0.75rem;
        margin-bottom: 1rem;
      }

      .quality-summary-card {
        border: 1px solid var(--border-subtle);
        border-radius: 12px;
        padding: 0.8rem 1rem;
        background: linear-gradient(120deg, rgba(124, 58, 237, 0.08), rgba(16, 185, 129, 0.04));
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.3rem;
        box-shadow: inset 0 1px 0 rgba(23, 13, 59, 0.04);
        transition: transform 0.2s ease, box-shadow 0.2s ease;
      }
      .quality-summary-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 18px 35px rgba(23, 13, 59, 0.08);
      }

      .summary-label {
        margin: 0;
        color: #544d6b;
        letter-spacing: 0.01em;
        font-weight: 500;
      }

      .summary-value {
        font-size: 1.125rem;
        font-weight: 700;
        color: #332a4d;
      }

      .quality-wrapper {
        margin-top: 1rem;
        border: 1px solid var(--border-subtle);
        border-radius: 14px;
        padding: 1rem;
        background: linear-gradient(140deg, #ffffff 0%, #ffffff 100%);
        box-shadow: var(--panel-shadow);
        position: relative;
        animation: panelIn 0.6s ease;
      }

      .quality-wrapper.loading {
        opacity: 0.7;
      }

      .quality-loading {
        position: absolute;
        inset: 0;
        background: #ffffff;
        border-radius: 14px;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.6rem;
        color: #544d6b;
        font-weight: 600;
        z-index: 5;
        pointer-events: none;
        opacity: 0;
        transition: opacity 120ms ease-in-out;
      }

      .quality-loading.active {
        opacity: 1;
        pointer-events: all;
      }

      .spinner {
        width: 64px;
        height: 50px;
        margin: 0 auto;
        border: none;
        border-radius: 0;
        background: url("data:image/svg+xml,%3Csvg%20width%3D%22480%22%20height%3D%22480%22%20viewBox%3D%2285%20115%20310%20250%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cstyle%3E.p%7Bfill%3A%2314003D%3Btransform-box%3Afill-box%3Btransform-origin%3Acenter%3Banimation%3AdnPulse%201.5s%20ease-in-out%20infinite%3B%7D%40keyframes%20dnPulse%7B0%25%7Btransform%3Ascale%280.9%29%3Bopacity%3A0.22%7D18%25%7Btransform%3Ascale%281.07%29%3Bopacity%3A1%7D40%25%7Btransform%3Ascale%280.9%29%3Bopacity%3A0.22%7D100%25%7Btransform%3Ascale%280.9%29%3Bopacity%3A0.22%7D%7D%3C%2Fstyle%3E%3Cg%20transform%3D%22rotate%280%20240%20240%29%22%3E%3Cellipse%20class%3D%22p%22%20cx%3D%22240%22%20cy%3D%22240%22%20rx%3D%2212.6%22%20ry%3D%2280.6%22%20style%3D%22animation-delay%3A-1.5s%22%2F%3E%3C%2Fg%3E%3Cg%20transform%3D%22rotate%280%20205.1%20240%29%22%3E%3Cellipse%20class%3D%22p%22%20cx%3D%22205.1%22%20cy%3D%22240%22%20rx%3D%2211%22%20ry%3D%2264%22%20style%3D%22animation-delay%3A-1.38s%22%2F%3E%3C%2Fg%3E%3Cg%20transform%3D%22rotate%280%20274.9%20240%29%22%3E%3Cellipse%20class%3D%22p%22%20cx%3D%22274.9%22%20cy%3D%22240%22%20rx%3D%2211%22%20ry%3D%2264%22%20style%3D%22animation-delay%3A-1.38s%22%2F%3E%3C%2Fg%3E%3Cg%20transform%3D%22rotate%280%20176.4%20240%29%22%3E%3Cellipse%20class%3D%22p%22%20cx%3D%22176.4%22%20cy%3D%22240%22%20rx%3D%226.4%22%20ry%3D%2232.7%22%20style%3D%22animation-delay%3A-1.26s%22%2F%3E%3C%2Fg%3E%3Cg%20transform%3D%22rotate%280%20303.6%20240%29%22%3E%3Cellipse%20class%3D%22p%22%20cx%3D%22303.6%22%20cy%3D%22240%22%20rx%3D%226.4%22%20ry%3D%2232.7%22%20style%3D%22animation-delay%3A-1.26s%22%2F%3E%3C%2Fg%3E%3Cg%20transform%3D%22rotate%2814%20332%20233%29%22%3E%3Cellipse%20class%3D%22p%22%20cx%3D%22332%22%20cy%3D%22233%22%20rx%3D%225.5%22%20ry%3D%2226%22%20style%3D%22animation-delay%3A-1.14s%22%2F%3E%3C%2Fg%3E%3Cg%20transform%3D%22rotate%28-14%20148%20233%29%22%3E%3Cellipse%20class%3D%22p%22%20cx%3D%22148%22%20cy%3D%22233%22%20rx%3D%225.5%22%20ry%3D%2226%22%20style%3D%22animation-delay%3A-1.14s%22%2F%3E%3C%2Fg%3E%3Cg%20transform%3D%22rotate%2828%20357%20222%29%22%3E%3Cellipse%20class%3D%22p%22%20cx%3D%22357%22%20cy%3D%22222%22%20rx%3D%224.8%22%20ry%3D%2219%22%20style%3D%22animation-delay%3A-1.02s%22%2F%3E%3C%2Fg%3E%3Cg%20transform%3D%22rotate%28-28%20123%20222%29%22%3E%3Cellipse%20class%3D%22p%22%20cx%3D%22123%22%20cy%3D%22222%22%20rx%3D%224.8%22%20ry%3D%2219%22%20style%3D%22animation-delay%3A-1.02s%22%2F%3E%3C%2Fg%3E%3Cg%20transform%3D%22rotate%2844%20379%20208%29%22%3E%3Cellipse%20class%3D%22p%22%20cx%3D%22379%22%20cy%3D%22208%22%20rx%3D%224%22%20ry%3D%2213%22%20style%3D%22animation-delay%3A-0.9s%22%2F%3E%3C%2Fg%3E%3Cg%20transform%3D%22rotate%28-44%20101%20208%29%22%3E%3Cellipse%20class%3D%22p%22%20cx%3D%22101%22%20cy%3D%22208%22%20rx%3D%224%22%20ry%3D%2213%22%20style%3D%22animation-delay%3A-0.9s%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E") center / contain no-repeat;
        animation: none;
      }

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

      .quality-card {
        background: radial-gradient(circle at 20% 20%, rgba(124, 58, 237, 0.05), transparent 35%),
          #ffffff;
        border: 1px solid var(--border-subtle);
        border-radius: 14px;
        padding: 1rem;
        display: grid;
        gap: 0.75rem;
        box-shadow: inset 0 1px 0 rgba(23, 13, 59, 0.02);
        height: 100%;
        max-height: 360px;
        overflow-y: auto;
        transition: transform 0.2s ease, box-shadow 0.2s ease;
      }
      .quality-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 20px 40px rgba(23, 13, 59, 0.1);
      }

      /* Row-style expandable quality panels (keeps existing card styling). */
      details.quality-row {
        background: radial-gradient(circle at 20% 20%, rgba(124, 58, 237, 0.05), transparent 35%),
          #ffffff;
        border: 1px solid var(--border-subtle);
        border-radius: 14px;
        box-shadow: inset 0 1px 0 rgba(23, 13, 59, 0.02);
        overflow: hidden;
        transition: transform 0.2s ease, box-shadow 0.2s ease;
      }

      details.quality-row:hover {
        transform: translateY(-1px);
        box-shadow: 0 18px 35px rgba(23, 13, 59, 0.09);
      }

      details.quality-row > summary {
        list-style: none;
        cursor: pointer;
        user-select: none;
        padding: 0.9rem 1rem;
        display: grid;
        gap: 0.35rem;
      }

      details.quality-row > summary::-webkit-details-marker {
        display: none;
      }

      details.quality-row > summary::after {
        content: "▾";
        position: absolute;
        right: 1rem;
        margin-top: 0.05rem;
        color: var(--text-muted);
        transform: rotate(-90deg);
        transition: transform 140ms ease;
      }

      details.quality-row[open] > summary::after {
        transform: rotate(0deg);
      }

      details.quality-row > summary {
        position: relative;
        padding-right: 2.4rem;
      }

      .quality-row-body {
        padding: 0 1rem 1rem;
        display: grid;
        gap: 0.65rem;
      }

      .quality-row-divider {
        height: 1px;
        background: rgba(23, 13, 59, 0.04);
        margin: 0 1rem;
      }

      .quality-card h3 {
        margin: 0;
        font-size: 1rem;
        letter-spacing: 0.01em;
      }

      .quality-title-row {
        display: flex;
        align-items: center;
        gap: 0.4rem;
      }

      .quality-card p {
        margin: 0;
        color: #6f6a80;
      }

      /* Metric tiles create small cards inside each quality panel for better readability */
      .latency-card,
      .metric-section {
        display: grid;
        gap: 0.65rem;
      }

      .metric-grid,
      .latency-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
        gap: 0.65rem;
      }

      .metric-tile {
        background: linear-gradient(120deg, rgba(109, 40, 217, 0.12), rgba(124, 58, 237, 0.05));
        border: 1px solid var(--border-subtle);
        border-radius: 12px;
        padding: 0.75rem 0.9rem;
        display: grid;
        gap: 0.2rem;
        box-shadow: inset 0 1px 0 rgba(23, 13, 59, 0.03);
        transition: transform 0.2s ease;
      }
      .metric-tile:hover {
        transform: translateY(-1px);
      }

      .metric-subtitle {
        color: #6f6a80;
        font-size: 0.9375rem;
        margin: 0;
      }

      .metric-emphasis {
        font-weight: 700;
        font-size: 1.125rem;
        color: #1d1433;
      }

      .latency-legend {
        display: inline-flex;
        gap: 0.4rem;
        align-items: center;
        color: #6f6a80;
        font-size: 0.9375rem;
      }

      .latency-legend strong {
        color: #1d1433;
      }

      .quality-meta {
        display: flex;
        gap: 0.5rem;
        align-items: center;
        flex-wrap: wrap;
        justify-content: space-between;
      }

      .info-icon {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 18px;
        height: 18px;
        border-radius: 50%;
        border: 1px solid #e7e3f2;
        background: #ffffff;
        color: #544d6b;
        font-size: 0.75rem;
        cursor: help;
      }

      .status-badge {
        display: inline-flex;
        align-items: center;
        gap: 0.35rem;
        padding: 0.25rem 0.55rem;
        border-radius: 999px;
        font-weight: 700;
        font-size: 0.9375rem;
        border: 1px solid transparent;
      }

      .tone-good {
        background: rgba(34, 197, 94, 0.15);
        border-color: rgba(34, 197, 94, 0.35);
        color: #16a34a;
      }

      .tone-neutral {
        background: rgba(82, 63, 133, 0.108);
        border-color: rgba(82, 63, 133, 0.24);
        color: #544d6b;
      }

      .tone-bad {
        background: rgba(239, 68, 68, 0.15);
        border-color: rgba(239, 68, 68, 0.35);
        color: #dc2626;
      }

      .metric-list {
        display: grid;
        gap: 0.45rem;
      }

      .metric-row {
        display: grid;
        grid-template-columns: 1fr auto;
        gap: 0.35rem;
        align-items: center;
        padding: 0.35rem 0.25rem;
        border-bottom: 1px solid rgba(23, 13, 59, 0.03);
      }

      .metric-row:last-of-type {
        border-bottom: none;
      }

      .metric-label-row {
        display: inline-flex;
        align-items: center;
        gap: 0.35rem;
      }

      .metric-label {
        color: #2a2044;
        font-weight: 700;
        font-size: 0.9375rem;
      }

      .metric-value {
        font-variant-numeric: tabular-nums;
        font-weight: 700;
        color: var(--text-primary);
      }

      .metric-value.tone-good {
        color: #16a34a;
      }

      .metric-value.tone-neutral {
        color: #544d6b;
      }

      .metric-value.tone-bad {
        color: #dc2626;
      }

      .link-button {
        background: none;
        border: none;
        padding: 0;
        color: #7c3aed;
        font-weight: 700;
        cursor: pointer;
        text-decoration: underline;
      }

      .link-button:hover {
        color: #7c3aed;
      }

      .quality-note {
        background: #ffffff;
        border: 1px dashed #e7e3f2;
        padding: 0.65rem;
        border-radius: 10px;
        color: #544d6b;
      }

      .placeholder {
        color: #6f6a80;
        font-style: italic;
      }
      .users-card {
        background: var(--bg-surface);
        border: 1px solid var(--border-subtle);
        border-radius: 12px;
        padding: 1rem 1.2rem;
        display: grid;
        gap: 1rem;
        box-shadow: var(--panel-shadow);
        animation: panelIn 0.6s ease;
      }
      .users-header {
        display: flex;
        flex-wrap: wrap;
        align-items: flex-start;
        justify-content: space-between;
        gap: 1rem;
      }
      .users-status {
        font-weight: 600;
        min-height: 1.2rem;
      }
      .users-table-wrapper {
        overflow-x: auto;
      }
      .users-table {
        width: 100%;
        border-collapse: collapse;
      }
      .users-table th,
      .users-table td {
        padding: 0.6rem 0.8rem;
        border-bottom: 1px solid #e7e3f2;
        text-align: left;
      }
      .users-table th {
        color: #544d6b;
        font-size: 0.875rem;
        text-transform: uppercase;
        letter-spacing: 0.05em;
      }
      .users-table tbody tr:hover {
        background: #f3f0fa;
      }
      /* The single Alfred column is set off from the core user columns by a
         divider rule + a subtle tint. */
      .users-table th.users-agent-col-start,
      .users-table td.users-agent-col-start {
        border-left: 2px solid #dcd6eb;
        background: rgba(124, 58, 237, 0.035);
      }
      .users-table td.users-agent-cell {
        white-space: nowrap;
      }
      .users-agent-configure {
        margin-left: 0.6rem;
      }
      .users-access-pill {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 0.2rem 0.6rem;
        border-radius: 999px;
        border: 1px solid #e7e3f2;
        font-weight: 700;
      }
      .users-access-pill.enabled {
        border-color: #16a34a;
        color: #16a34a;
      }
      .users-access-pill.disabled {
        border-color: #c2410c;
        color: #c2410c;
      }
      .users-form {
        display: grid;
        gap: 0.85rem;
      }
      .users-actions-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
      }
      .users-action-buttons {
        display: flex;
        align-items: center;
        gap: 0.5rem;
      }
      /* display:flex would defeat the hidden attribute (alfred sub-tab hides these). */
      .users-action-buttons[hidden] {
        display: none;
      }
      .users-actions-row .users-status {
        margin: 0;
      }
      .users-access-switch {
        display: flex;
        align-items: center;
        gap: 0.6rem;
        font-weight: 600;
        cursor: pointer;
      }
      .users-access-switch .switch {
        flex: 0 0 auto;
      }
      .modal-overlay {
        position: fixed;
        inset: 0;
        background: rgba(23, 13, 59, 0.42);
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 1.5rem;
        z-index: 30;
      }
      .modal-overlay[hidden] {
        display: none;
      }
      .modal-panel {
        width: min(90vw, 520px);
        background: var(--bg-surface);
        border: 1px solid var(--border-strong);
        border-radius: 16px;
        padding: 1.25rem;
        display: grid;
        gap: 0.75rem;
        box-shadow: var(--panel-shadow);
        animation: panelLift 0.35s ease;
      }
      .modal-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        padding-bottom: 0.5rem;
        border-bottom: 1px solid #e7e3f2;
      }
      .modal-title {
        margin: 0;
        font-size: 1.125rem;
      }
      .modal-box {
        width: min(92vw, 520px);
        background: linear-gradient(180deg, #ffffff, #ffffff);
        border: 1px solid rgba(82, 63, 133, 0.132);
        border-radius: 16px;
        padding: 1.1rem 1.1rem 1.05rem;
        box-shadow: 0 30px 70px rgba(23, 13, 59, 0.13), inset 0 1px 0 rgba(23, 13, 59, 0.04);
        animation: panelLift 0.35s ease;
        backdrop-filter: blur(14px);
      }

      /* Country rule add/edit: wide modal + scrollable prefix list */
      .modal-box.pn-rule-modal-box {
        width: max(50vw, min(94vw, 1280px));
        max-width: 94vw;
        box-sizing: border-box;
      }
      .modal-box.pn-rule-modal-box #pn-rule-prefixes-wrap {
        max-height: min(42vh, 28rem);
        overflow: auto;
        padding: 0.5rem 0.55rem;
        border-radius: 10px;
        border: 1px solid rgba(82, 63, 133, 0.108);
        background: rgba(23, 13, 59, 0.04);
        box-sizing: border-box;
      }
      .modal-box.pn-rule-modal-box #pn-rule-prefixes-wrap .pn-prefix-chip {
        word-break: break-all;
        white-space: normal;
        text-align: left;
      }
      .modal-close-btn {
        all: unset;
        cursor: pointer;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 34px;
        height: 34px;
        border-radius: 10px;
        border: 1px solid rgba(82, 63, 133, 0.132);
        background: rgba(23, 13, 59, 0.035);
        color: var(--text-primary);
        transition: background 0.15s, border-color 0.15s, transform 0.12s;
      }
      .modal-close-btn:hover {
        background: rgba(124, 58, 237, 0.12);
        border-color: rgba(124, 58, 237, 0.45);
        transform: translateY(-1px);
      }
      .modal-close-btn:focus-visible {
        outline: 2px solid rgba(124, 58, 237, 0.85);
        outline-offset: 2px;
      }

      /* Danger confirmation modal variant */
      .pn-danger-modal {
        border-color: rgba(239, 68, 68, 0.35);
        box-shadow: 0 30px 70px rgba(23, 13, 59, 0.13), 0 0 0 1px rgba(239, 68, 68, 0.18),
          inset 0 1px 0 rgba(23, 13, 59, 0.04);
      }
      .pn-danger-modal .modal-header {
        border-bottom-color: rgba(239, 68, 68, 0.18);
      }
      .pn-danger-modal .modal-title {
        background: linear-gradient(90deg, #991b1b, #dc2626);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
      }
      .pn-danger-banner {
        display: flex;
        gap: 0.65rem;
        align-items: flex-start;
        padding: 0.75rem 0.85rem;
        border-radius: 14px;
        border: 1px solid rgba(239, 68, 68, 0.28);
        background: rgba(239, 68, 68, 0.08);
      }
      .pn-danger-icon {
        flex: 0 0 auto;
        width: 34px;
        height: 34px;
        border-radius: 12px;
        display: grid;
        place-items: center;
        background: rgba(239, 68, 68, 0.14);
        border: 1px solid rgba(239, 68, 68, 0.3);
        color: #991b1b;
        font-weight: 800;
        line-height: 1;
      }
      .pn-danger-text p { margin: 0; }
      .pn-danger-title {
        font-weight: 800;
        color: #991b1b;
        margin-bottom: 0.1rem;
      }
      .pn-danger-sub {
        font-size: 0.875rem;
        color: rgba(84, 77, 107, 0.95);
      }
      .modal-close {
        border: 1px solid #e7e3f2;
        background: #ffffff;
        color: #241a3f;
        padding: 0.35rem 0.6rem;
        border-radius: 999px;
        cursor: pointer;
        font-weight: 600;
      }
      .modal-close:hover {
        border-color: #7a7490;
      }
      /* Entity autocomplete search widget */
      .entity-search-wrap {
        position: relative;
      }
      .entity-search-input {
        width: 100%;
        padding: 0.45rem 0.65rem;
        background: var(--bg-surface);
        border: 1px solid var(--border-strong);
        border-radius: 6px;
        color: var(--text-primary);
        font-size: 0.9375rem;
        box-sizing: border-box;
      }
      .entity-search-input:focus {
        outline: none;
        border-color: var(--accent);
      }
      .entity-search-results {
        position: fixed;
        z-index: 9999;
        background: var(--bg-surface);
        border: 1px solid var(--border-strong);
        border-radius: 6px;
        margin: 0;
        padding: 4px 0;
        list-style: none;
        max-height: 200px;
        overflow-y: auto;
        box-shadow: 0 4px 12px rgba(23, 13, 59, 0.08);
      }
      .entity-search-results li {
        padding: 8px 12px;
        cursor: pointer;
        font-size: 0.875rem;
        line-height: 1.3;
      }
      .entity-search-results li:hover {
        background: var(--bg-hover, rgba(23, 13, 59, 0.06));
      }
      .entity-search-results li .entity-name {
        font-weight: 500;
        color: var(--text-primary);
      }
      .entity-search-results li .entity-meta {
        font-size: 0.8125rem;
        color: var(--text-muted);
        margin-top: 1px;
      }
      .entity-search-selected {
        margin-top: 6px;
        padding: 6px 10px;
        background: rgba(124, 58, 237, 0.12);
        border: 1px solid rgba(124, 58, 237, 0.3);
        border-radius: 6px;
        font-size: 0.875rem;
        color: var(--text-primary);
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
      }
      .entity-search-clear {
        background: none;
        border: none;
        color: var(--text-muted);
        cursor: pointer;
        font-size: 1rem;
        padding: 0;
        line-height: 1;
      }
      .entity-search-clear:hover { color: var(--text-primary); }
      .pricing-sub-nav {
        display: flex;
        gap: 0;
        border-bottom: 1px solid #e7e3f2;
        margin: 1rem 0;
        flex-wrap: wrap;
      }
      .pricing-sub-tab {
        background: transparent;
        border: none;
        border-bottom: 2px solid transparent;
        color: #6f6a80;
        padding: 0.6rem 1.1rem;
        cursor: pointer;
        font-size: 0.875rem;
        font-weight: 500;
        margin-bottom: -1px;
        border-radius: 0;
        transition: color 0.15s, border-color 0.15s;
      }
      .pricing-sub-tab:hover { color: #241a3f; }
      .pricing-sub-tab[aria-selected="true"] {
        color: #6d28d9;
        border-bottom-color: #6d28d9;
      }
      .pricing-toolbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
        margin-bottom: 1rem;
        flex-wrap: wrap;
      }
      .pricing-search-input {
        flex: 1;
        min-width: 200px;
        padding: 0.45rem 0.75rem;
        border: 1px solid #e7e3f2;
        border-radius: 6px;
        background: #ffffff;
        color: #241a3f;
        font-size: 0.875rem;
      }
      .pricing-search-input::placeholder { color: #6f6a80; }
      /* Filter dropdowns (selects using the search-input style) get a black down caret that flips up when open. */
      select.pricing-search-input {
        appearance: none;
        -webkit-appearance: none;
        padding-right: 2rem;
        background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%272%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cpolyline%20points%3D%276%209%2012%2015%2018%209%27%2F%3E%3C%2Fsvg%3E");
        background-repeat: no-repeat;
        background-position: right 0.6rem center;
        background-size: 16px;
      }
      select.pricing-search-input:open {
        background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%272%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cpolyline%20points%3D%276%2015%2012%209%2018%2015%27%2F%3E%3C%2Fsvg%3E");
      }
      .pricing-action-card {
        border: 1px solid #e7e3f2;
        border-radius: 8px;
        padding: 1.25rem;
        margin-bottom: 1.25rem;
      }
      .pricing-action-card h3 { margin: 0 0 0.25rem; font-size: 1rem; }
      .pricing-action-card .settings-description { margin: 0 0 1rem; }
      .pricing-pagination {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        justify-content: center;
        padding: 0.75rem 0;
        font-size: 0.875rem;
        color: #6f6a80;
      }
      .pricing-form-status { margin-top: 0.5rem; font-size: 0.875rem; min-height: 1.25em; }
      .optional-label { font-size: 0.8em; color: #6f6a80; font-weight: normal; }
      .pricing-sub-panel[hidden] { display: none; }
      .modal-body {
        display: grid;
        gap: 0.85rem;
      }
      .modal-panel .actions {
        justify-content: flex-end;
      }
      .sr-only {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
      }
      @keyframes headerDrop {
        from {
          opacity: 0;
          transform: translateY(-12px);
        }
        to {
          opacity: 1;
          transform: translateY(0);
        }
      }
      @keyframes panelIn {
        from {
          opacity: 0;
          transform: translateY(12px);
        }
        to {
          opacity: 1;
          transform: translateY(0);
        }
      }
      @keyframes panelLift {
        from {
          opacity: 0;
          transform: translateY(8px) scale(0.98);
        }
        to {
          opacity: 1;
          transform: translateY(0) scale(1);
        }
      }
      @keyframes itemRise {
        from {
          opacity: 0;
          transform: translateY(10px);
        }
        to {
          opacity: 1;
          transform: translateY(0);
        }
      }
      @keyframes ambientGlow {
        from {
          opacity: 0.4;
          transform: scale(1);
        }
        to {
          opacity: 0.7;
          transform: scale(1.03);
        }
      }
      @media (prefers-reduced-motion: reduce) {
        * {
          animation: none !important;
          transition: none !important;
          scroll-behavior: auto !important;
        }
      }

      /* ─── Org Combobox ─────────────────────────────────────────────────── */
      .org-combo {
        position: relative;
        width: 100%;
      }
      .org-combo-trigger {
        display: flex;
        align-items: center;
        gap: 0.45rem;
        width: 100%;
        background: #ffffff;
        border: 1px solid var(--border-strong);
        border-radius: 0.5rem;
        padding: 0.55rem 0.7rem 0.55rem 0.75rem;
        color: var(--text-primary);
        cursor: pointer;
        min-height: 2.4rem;
        box-sizing: border-box;
        transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
        font-size: 0.875rem;
        user-select: none;
      }
      .org-combo-trigger:hover {
        background: #ffffff;
        border-color: rgba(82, 63, 133, 0.27);
      }
      .org-combo-trigger:focus-visible,
      .org-combo[data-open="true"] .org-combo-trigger {
        outline: none;
        border-color: var(--accent-primary);
        box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.22);
      }
      .org-combo-trigger-label {
        flex: 1;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        pointer-events: none;
      }
      .org-combo-trigger-label.ocp-placeholder {
        color: var(--text-muted);
      }
      .org-combo-chevron {
        flex-shrink: 0;
        width: 1rem;
        height: 1rem;
        color: var(--text-muted);
        pointer-events: none;
        transition: transform 0.2s ease;
      }
      .org-combo[data-open="true"] .org-combo-chevron {
        transform: rotate(180deg);
      }
      .org-combo-clear {
        flex-shrink: 0;
        width: 1.35rem;
        height: 1.35rem;
        border: none;
        background: rgba(82, 63, 133, 0.06);
        color: var(--text-muted);
        cursor: pointer;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        line-height: 1;
        transition: color 0.15s, background 0.15s;
      }
      .org-combo-clear:hover {
        color: #b91c1c;
        background: rgba(239, 68, 68, 0.15);
      }
      .org-combo-dropdown {
        position: absolute;
        top: calc(100% + 0.4rem);
        left: 0;
        right: 0;
        z-index: 500;
        background: #ffffff;
        border: 1px solid var(--border-strong);
        border-radius: 0.65rem;
        box-shadow: 0 24px 60px rgba(23, 13, 59, 0.14), 0 4px 16px rgba(23, 13, 59, 0.1);
        overflow: hidden;
        animation: orgComboSlideIn 0.14s cubic-bezier(0.22, 1, 0.36, 1);
        backdrop-filter: blur(20px);
      }
      @keyframes orgComboSlideIn {
        from { opacity: 0; transform: translateY(-8px) scale(0.97); }
        to   { opacity: 1; transform: translateY(0)   scale(1); }
      }
      .org-combo-search-wrap {
        padding: 0.6rem 0.7rem 0.5rem;
        border-bottom: 1px solid var(--border-subtle);
        display: flex;
        align-items: center;
        gap: 0.45rem;
      }
      .org-combo-search-wrap svg {
        flex-shrink: 0;
        color: var(--text-muted);
        width: 0.95rem;
        height: 0.95rem;
      }
      .org-combo-search {
        flex: 1;
        background: transparent;
        border: none;
        color: var(--text-primary);
        font-size: 0.875rem;
        font-family: inherit;
        outline: none;
        min-width: 0;
      }
      .org-combo-search::placeholder {
        color: var(--text-muted);
      }
      .org-combo-list {
        max-height: 15rem;
        overflow-y: auto;
        padding: 0.3rem 0;
        scrollbar-width: thin;
        scrollbar-color: rgba(82, 63, 133, 0.12) transparent;
      }
      .org-combo-option {
        display: flex;
        flex-direction: column;
        padding: 0.55rem 0.9rem;
        cursor: pointer;
        transition: background 0.1s;
        gap: 0.1rem;
      }
      .org-combo-option:hover,
      .org-combo-option[data-focused="true"] {
        background: rgba(124, 58, 237, 0.16);
      }
      .org-combo-option[data-selected="true"] {
        background: rgba(124, 58, 237, 0.24);
      }
      .org-combo-option-name {
        font-size: 0.875rem;
        color: var(--text-primary);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        display: flex;
        align-items: center;
        gap: 0.4rem;
      }
      .org-combo-option[data-selected="true"] .org-combo-option-name::after {
        content: "";
        display: inline-block;
        width: 0.65rem;
        height: 0.65rem;
        background: var(--accent-primary);
        border-radius: 50%;
        flex-shrink: 0;
      }
      .org-combo-option-id {
        font-size: 0.75rem;
        color: var(--text-muted);
        font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }
      .org-combo-none-option .org-combo-option-name {
        color: var(--text-muted);
        font-style: italic;
      }
      .org-combo-empty {
        padding: 1.1rem 0.9rem;
        color: var(--text-muted);
        font-size: 0.875rem;
        text-align: center;
      }
      .org-combo-footer {
        padding: 0.3rem 0.9rem 0.45rem;
        font-size: 0.75rem;
        color: var(--text-muted);
        border-top: 1px solid var(--border-subtle);
        display: flex;
        align-items: center;
        justify-content: space-between;
      }
      .org-combo[data-loading="true"] .org-combo-trigger {
        opacity: 0.6;
        pointer-events: none;
      }


      /* ============================================================
         Modern app shell: left sidebar navigation (DialNexa style).
         Pure presentation layer - same DOM, same IDs, same handlers.
         ============================================================ */
      .nav-section-label {
        display: none;
      }
      @media (min-width: 981px) {
        body > header {
          position: fixed;
          top: 0;
          left: 0;
          bottom: 0;
          width: 248px;
          height: 100vh;
          border-bottom: none;
          border-right: 1px solid var(--border-subtle);
          box-shadow: none;
          animation: none;
          overflow-y: auto;
          background: #ffffff;
        }
        .header-inner {
          flex-direction: column;
          align-items: stretch;
          flex-wrap: nowrap;
          height: 100%;
          max-width: none;
          padding: 1.1rem 0.85rem;
          gap: 1.4rem;
          box-sizing: border-box;
        }
        .brand {
          padding: 0 0.45rem;
        }
        .brand .subtitle {
          display: none;
        }
        .brand-title {
          font-size: 1.25rem;
          letter-spacing: -0.01em;
        }
        .header-nav {
          flex-direction: column;
          align-items: stretch;
          justify-content: flex-start;
          flex: 1;
          min-height: 0;
          gap: 1rem;
        }
        .top-tab-list {
          flex-direction: column;
          align-items: stretch;
          gap: 2px;
        }
        .nav-section-label {
          display: block;
          padding: 1rem 0.55rem 0.3rem;
          font-size: 0.75rem;
          font-weight: 700;
          letter-spacing: 0.08em;
          text-transform: uppercase;
          color: #a09aae;
        }
        .nav-section-label:first-child {
          padding-top: 0;
        }
        /* Hide the Operations group label unless at least one ops tab is visible. */
        .nav-section-label-ops {
          display: none;
        }
        .top-tab-list:has(#top-tab-workspaces:not([hidden])) .nav-section-label-ops,
        .top-tab-list:has(#top-tab-entities:not([hidden])) .nav-section-label-ops,
        .top-tab-list:has(#top-tab-operations:not([hidden])) .nav-section-label-ops,
        .top-tab-list:has(#top-tab-pricing:not([hidden])) .nav-section-label-ops {
          display: block;
        }
        /* Hide the Manage group label unless at least one manage tab is visible. */
        .nav-section-label-manage {
          display: none;
        }
        .top-tab-list:has(#top-tab-settings:not([hidden])) .nav-section-label-manage {
          display: block;
        }
        .top-tab[hidden] {
          display: none !important;
        }
        .top-tab {
          display: flex;
          align-items: center;
          gap: 0.65rem;
          width: 100%;
          justify-content: flex-start;
          text-align: left;
          background: transparent;
          border: 1px solid transparent;
          border-radius: 10px;
          padding: 0.55rem 0.6rem;
          color: var(--text-secondary);
          font-weight: 600;
          font-size: 0.9375rem;
          box-shadow: none;
        }
        .top-tab::before {
          content: "";
          flex: 0 0 auto;
          width: 18px;
          height: 18px;
          background-color: currentColor;
          -webkit-mask-repeat: no-repeat;
          mask-repeat: no-repeat;
          -webkit-mask-position: center;
          mask-position: center;
          -webkit-mask-size: contain;
          mask-size: contain;
          opacity: 0.85;
        }
        .top-tab:hover {
          background: #f3f0fa;
          border-color: transparent;
          color: var(--text-primary);
          transform: none;
          filter: none;
          box-shadow: none;
        }
        .top-tab[aria-selected="true"] {
          background: #ede9fe;
          border-color: transparent;
          color: #35246b;
        }
        .top-tab[aria-selected="true"]::before {
          background-color: #6d28d9;
          opacity: 1;
        }
        #top-tab-debugger::before { -webkit-mask-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%272%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cpath%20d%3D%27M22%2016.92v3a2%202%200%200%201-2.18%202%2019.79%2019.79%200%200%201-8.63-3.07%2019.5%2019.5%200%200%201-6-6A19.79%2019.79%200%200%201%202.08%204.18%202%202%200%200%201%204.06%202h3a2%202%200%200%201%202%201.72c.127.96.361%201.903.7%202.81a2%202%200%200%201-.45%202.11L8.09%209.91a16%2016%200%200%200%206%206l1.27-1.27a2%202%200%200%201%202.11-.45c.907.339%201.85.573%202.81.7A2%202%200%200%201%2022%2016.92z%27%2F%3E%3C%2Fsvg%3E"); mask-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%272%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cpath%20d%3D%27M22%2016.92v3a2%202%200%200%201-2.18%202%2019.79%2019.79%200%200%201-8.63-3.07%2019.5%2019.5%200%200%201-6-6A19.79%2019.79%200%200%201%202.08%204.18%202%202%200%200%201%204.06%202h3a2%202%200%200%201%202%201.72c.127.96.361%201.903.7%202.81a2%202%200%200%201-.45%202.11L8.09%209.91a16%2016%200%200%200%206%206l1.27-1.27a2%202%200%200%201%202.11-.45c.907.339%201.85.573%202.81.7A2%202%200%200%201%2022%2016.92z%27%2F%3E%3C%2Fsvg%3E"); }
        #top-tab-batch-analysis::before { -webkit-mask-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%272%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cpolygon%20points%3D%2712%202%202%207%2012%2012%2022%207%2012%202%27%2F%3E%3Cpolyline%20points%3D%272%2017%2012%2022%2022%2017%27%2F%3E%3Cpolyline%20points%3D%272%2012%2012%2017%2022%2012%27%2F%3E%3C%2Fsvg%3E"); mask-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%272%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cpolygon%20points%3D%2712%202%202%207%2012%2012%2022%207%2012%202%27%2F%3E%3Cpolyline%20points%3D%272%2017%2012%2022%2022%2017%27%2F%3E%3Cpolyline%20points%3D%272%2012%2012%2017%2022%2012%27%2F%3E%3C%2Fsvg%3E"); }
        #top-tab-settings::before { -webkit-mask-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%272%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cline%20x1%3D%274%27%20y1%3D%2721%27%20x2%3D%274%27%20y2%3D%2714%27%2F%3E%3Cline%20x1%3D%274%27%20y1%3D%2710%27%20x2%3D%274%27%20y2%3D%273%27%2F%3E%3Cline%20x1%3D%2712%27%20y1%3D%2721%27%20x2%3D%2712%27%20y2%3D%2712%27%2F%3E%3Cline%20x1%3D%2712%27%20y1%3D%278%27%20x2%3D%2712%27%20y2%3D%273%27%2F%3E%3Cline%20x1%3D%2720%27%20y1%3D%2721%27%20x2%3D%2720%27%20y2%3D%2716%27%2F%3E%3Cline%20x1%3D%2720%27%20y1%3D%2712%27%20x2%3D%2720%27%20y2%3D%273%27%2F%3E%3Cline%20x1%3D%271%27%20y1%3D%2714%27%20x2%3D%277%27%20y2%3D%2714%27%2F%3E%3Cline%20x1%3D%279%27%20y1%3D%278%27%20x2%3D%2715%27%20y2%3D%278%27%2F%3E%3Cline%20x1%3D%2717%27%20y1%3D%2716%27%20x2%3D%2723%27%20y2%3D%2716%27%2F%3E%3C%2Fsvg%3E"); mask-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%272%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cline%20x1%3D%274%27%20y1%3D%2721%27%20x2%3D%274%27%20y2%3D%2714%27%2F%3E%3Cline%20x1%3D%274%27%20y1%3D%2710%27%20x2%3D%274%27%20y2%3D%273%27%2F%3E%3Cline%20x1%3D%2712%27%20y1%3D%2721%27%20x2%3D%2712%27%20y2%3D%2712%27%2F%3E%3Cline%20x1%3D%2712%27%20y1%3D%278%27%20x2%3D%2712%27%20y2%3D%273%27%2F%3E%3Cline%20x1%3D%2720%27%20y1%3D%2721%27%20x2%3D%2720%27%20y2%3D%2716%27%2F%3E%3Cline%20x1%3D%2720%27%20y1%3D%2712%27%20x2%3D%2720%27%20y2%3D%273%27%2F%3E%3Cline%20x1%3D%271%27%20y1%3D%2714%27%20x2%3D%277%27%20y2%3D%2714%27%2F%3E%3Cline%20x1%3D%279%27%20y1%3D%278%27%20x2%3D%2715%27%20y2%3D%278%27%2F%3E%3Cline%20x1%3D%2717%27%20y1%3D%2716%27%20x2%3D%2723%27%20y2%3D%2716%27%2F%3E%3C%2Fsvg%3E"); }
        #top-tab-pricing::before { -webkit-mask-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%272%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cpath%20d%3D%27M20.59%2013.41l-7.17%207.17a2%202%200%200%201-2.83%200L2%2012V2h10l8.59%208.59a2%202%200%200%201%200%202.82z%27%2F%3E%3Cline%20x1%3D%277%27%20y1%3D%277%27%20x2%3D%277.01%27%20y2%3D%277%27%2F%3E%3C%2Fsvg%3E"); mask-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%272%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cpath%20d%3D%27M20.59%2013.41l-7.17%207.17a2%202%200%200%201-2.83%200L2%2012V2h10l8.59%208.59a2%202%200%200%201%200%202.82z%27%2F%3E%3Cline%20x1%3D%277%27%20y1%3D%277%27%20x2%3D%277.01%27%20y2%3D%277%27%2F%3E%3C%2Fsvg%3E"); }
        #top-tab-workspaces::before { -webkit-mask-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%272%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Crect%20x%3D%273%27%20y%3D%273%27%20width%3D%277%27%20height%3D%277%27%2F%3E%3Crect%20x%3D%2714%27%20y%3D%273%27%20width%3D%277%27%20height%3D%277%27%2F%3E%3Crect%20x%3D%2714%27%20y%3D%2714%27%20width%3D%277%27%20height%3D%277%27%2F%3E%3Crect%20x%3D%273%27%20y%3D%2714%27%20width%3D%277%27%20height%3D%277%27%2F%3E%3C%2Fsvg%3E"); mask-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%272%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Crect%20x%3D%273%27%20y%3D%273%27%20width%3D%277%27%20height%3D%277%27%2F%3E%3Crect%20x%3D%2714%27%20y%3D%273%27%20width%3D%277%27%20height%3D%277%27%2F%3E%3Crect%20x%3D%2714%27%20y%3D%2714%27%20width%3D%277%27%20height%3D%277%27%2F%3E%3Crect%20x%3D%273%27%20y%3D%2714%27%20width%3D%277%27%20height%3D%277%27%2F%3E%3C%2Fsvg%3E"); }
        #top-tab-entities::before { -webkit-mask-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%272%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cellipse%20cx%3D%2712%27%20cy%3D%275%27%20rx%3D%279%27%20ry%3D%273%27%2F%3E%3Cpath%20d%3D%27M21%2012c0%201.66-4%203-9%203s-9-1.34-9-3%27%2F%3E%3Cpath%20d%3D%27M3%205v14c0%201.66%204%203%209%203s9-1.34%209-3V5%27%2F%3E%3C%2Fsvg%3E"); mask-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%272%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cellipse%20cx%3D%2712%27%20cy%3D%275%27%20rx%3D%279%27%20ry%3D%273%27%2F%3E%3Cpath%20d%3D%27M21%2012c0%201.66-4%203-9%203s-9-1.34-9-3%27%2F%3E%3Cpath%20d%3D%27M3%205v14c0%201.66%204%203%209%203s9-1.34%209-3V5%27%2F%3E%3C%2Fsvg%3E"); }
        #top-tab-operations::before,
        #top-tab-tech-tasks::before { -webkit-mask-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%272%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cpath%20d%3D%27M14.7%206.3a1%201%200%200%200%200%201.4l1.6%201.6a1%201%200%200%200%201.4%200l3.77-3.77a6%206%200%200%201-7.94%207.94l-6.91%206.91a2.12%202.12%200%200%201-3-3l6.91-6.91a6%206%200%200%201%207.94-7.94l-3.76%203.76z%27%2F%3E%3C%2Fsvg%3E"); mask-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%272%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cpath%20d%3D%27M14.7%206.3a1%201%200%200%200%200%201.4l1.6%201.6a1%201%200%200%200%201.4%200l3.77-3.77a6%206%200%200%201-7.94%207.94l-6.91%206.91a2.12%202.12%200%200%201-3-3l6.91-6.91a6%206%200%200%201%207.94-7.94l-3.76%203.76z%27%2F%3E%3C%2Fsvg%3E"); }
        .header-auth {
          margin-top: auto;
          padding-top: 0.85rem;
          border-top: 1px solid var(--border-subtle);
        }
        body[data-authenticated="false"] .header-auth {
          border-top: none;
          padding-top: 0;
        }
        .user-menu {
          width: 100%;
        }
        .user-menu-button {
          width: 100%;
          justify-content: space-between;
          border-radius: 12px;
          padding: 0.55rem 0.7rem;
          box-shadow: none;
        }
        .user-menu-panel {
          top: auto;
          bottom: calc(100% + 0.45rem);
          left: 0;
          right: 0;
        }
        main {
          margin-left: 248px;
          max-width: none;
          padding: 1.5rem 2rem 2.5rem;
          box-sizing: border-box;
        }
      }

      /* ============================================================
         Modern content layer: command bar + segmented sub-tabs.
         ============================================================ */
      #log-form {
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        gap: 0.6rem;
        padding: 0.6rem 0.7rem;
        border-radius: 14px;
      }
      #log-form .field-group {
        flex: 1 1 320px;
        display: flex;
        align-items: center;
        position: relative;
        min-width: 0;
      }
      #log-form label[for="call_id"] {
        /* Visually hidden, still announced by screen readers. */
        position: absolute;
        width: 1px;
        height: 1px;
        margin: -1px;
        padding: 0;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
        border: 0;
      }
      #log-form .field-group::before {
        content: "";
        position: absolute;
        left: 0.75rem;
        width: 16px;
        height: 16px;
        background-color: #8d87a0;
        -webkit-mask-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%272%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Ccircle%20cx%3D%2711%27%20cy%3D%2711%27%20r%3D%278%27%2F%3E%3Cline%20x1%3D%2721%27%20y1%3D%2721%27%20x2%3D%2716.65%27%20y2%3D%2716.65%27%2F%3E%3C%2Fsvg%3E");
        mask-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%272%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Ccircle%20cx%3D%2711%27%20cy%3D%2711%27%20r%3D%278%27%2F%3E%3Cline%20x1%3D%2721%27%20y1%3D%2721%27%20x2%3D%2716.65%27%20y2%3D%2716.65%27%2F%3E%3C%2Fsvg%3E");
        -webkit-mask-repeat: no-repeat;
        mask-repeat: no-repeat;
        -webkit-mask-size: contain;
        mask-size: contain;
        pointer-events: none;
      }
      #call_id {
        flex: 1;
        min-width: 0;
        padding-left: 2.35rem;
        border-radius: 10px;
      }
      #log-form .actions {
        align-items: center;
        gap: 0.5rem;
      }
      #log-form #status {
        min-height: 0;
        font-size: 0.875rem;
      }
      /* Segmented control look for sub-tabs (lavender active pill). */
      .tab {
        border: 1px solid transparent;
        background: transparent;
        color: var(--text-secondary);
        font-weight: 600;
        padding: 0.5rem 0.9rem;
        border-radius: 9px;
      }
      .tab:hover {
        background: #f3f0fa;
        transform: none;
        filter: none;
        box-shadow: none;
      }
      .tab[aria-selected="true"] {
        background: #ede9fe;
        border-color: transparent;
        color: #4c1d95;
      }
      .tab-list {
        gap: 0.25rem;
        padding: 0.55rem 0.65rem;
      }

      /* Section loading overlay: radar-pulse loader over a blurred content card. */
      .tabs {
        position: relative;
      }
      .section-loading-overlay {
        position: absolute;
        inset: 0;
        z-index: 9;
        display: flex;
        align-items: flex-start;
        justify-content: center;
        padding-top: 7rem;
        border-radius: 12px;
        background: rgba(255, 255, 255, 0.5);
        backdrop-filter: blur(6px);
        -webkit-backdrop-filter: blur(6px);
      }
      .section-loading-overlay[hidden] {
        display: none;
      }
      .section-loading-mark {
        width: 170px;
        height: 137px;
        background: url("data:image/svg+xml,%3Csvg%20width%3D%22480%22%20height%3D%22480%22%20viewBox%3D%2285%20115%20310%20250%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cstyle%3E.p%7Bfill%3A%2314003D%3Btransform-box%3Afill-box%3Btransform-origin%3Acenter%3Banimation%3AdnPulse%201.5s%20ease-in-out%20infinite%3B%7D%40keyframes%20dnPulse%7B0%25%7Btransform%3Ascale%280.9%29%3Bopacity%3A0.22%7D18%25%7Btransform%3Ascale%281.07%29%3Bopacity%3A1%7D40%25%7Btransform%3Ascale%280.9%29%3Bopacity%3A0.22%7D100%25%7Btransform%3Ascale%280.9%29%3Bopacity%3A0.22%7D%7D%3C%2Fstyle%3E%3Cg%20transform%3D%22rotate%280%20240%20240%29%22%3E%3Cellipse%20class%3D%22p%22%20cx%3D%22240%22%20cy%3D%22240%22%20rx%3D%2212.6%22%20ry%3D%2280.6%22%20style%3D%22animation-delay%3A-1.5s%22%2F%3E%3C%2Fg%3E%3Cg%20transform%3D%22rotate%280%20205.1%20240%29%22%3E%3Cellipse%20class%3D%22p%22%20cx%3D%22205.1%22%20cy%3D%22240%22%20rx%3D%2211%22%20ry%3D%2264%22%20style%3D%22animation-delay%3A-1.38s%22%2F%3E%3C%2Fg%3E%3Cg%20transform%3D%22rotate%280%20274.9%20240%29%22%3E%3Cellipse%20class%3D%22p%22%20cx%3D%22274.9%22%20cy%3D%22240%22%20rx%3D%2211%22%20ry%3D%2264%22%20style%3D%22animation-delay%3A-1.38s%22%2F%3E%3C%2Fg%3E%3Cg%20transform%3D%22rotate%280%20176.4%20240%29%22%3E%3Cellipse%20class%3D%22p%22%20cx%3D%22176.4%22%20cy%3D%22240%22%20rx%3D%226.4%22%20ry%3D%2232.7%22%20style%3D%22animation-delay%3A-1.26s%22%2F%3E%3C%2Fg%3E%3Cg%20transform%3D%22rotate%280%20303.6%20240%29%22%3E%3Cellipse%20class%3D%22p%22%20cx%3D%22303.6%22%20cy%3D%22240%22%20rx%3D%226.4%22%20ry%3D%2232.7%22%20style%3D%22animation-delay%3A-1.26s%22%2F%3E%3C%2Fg%3E%3Cg%20transform%3D%22rotate%2814%20332%20233%29%22%3E%3Cellipse%20class%3D%22p%22%20cx%3D%22332%22%20cy%3D%22233%22%20rx%3D%225.5%22%20ry%3D%2226%22%20style%3D%22animation-delay%3A-1.14s%22%2F%3E%3C%2Fg%3E%3Cg%20transform%3D%22rotate%28-14%20148%20233%29%22%3E%3Cellipse%20class%3D%22p%22%20cx%3D%22148%22%20cy%3D%22233%22%20rx%3D%225.5%22%20ry%3D%2226%22%20style%3D%22animation-delay%3A-1.14s%22%2F%3E%3C%2Fg%3E%3Cg%20transform%3D%22rotate%2828%20357%20222%29%22%3E%3Cellipse%20class%3D%22p%22%20cx%3D%22357%22%20cy%3D%22222%22%20rx%3D%224.8%22%20ry%3D%2219%22%20style%3D%22animation-delay%3A-1.02s%22%2F%3E%3C%2Fg%3E%3Cg%20transform%3D%22rotate%28-28%20123%20222%29%22%3E%3Cellipse%20class%3D%22p%22%20cx%3D%22123%22%20cy%3D%22222%22%20rx%3D%224.8%22%20ry%3D%2219%22%20style%3D%22animation-delay%3A-1.02s%22%2F%3E%3C%2Fg%3E%3Cg%20transform%3D%22rotate%2844%20379%20208%29%22%3E%3Cellipse%20class%3D%22p%22%20cx%3D%22379%22%20cy%3D%22208%22%20rx%3D%224%22%20ry%3D%2213%22%20style%3D%22animation-delay%3A-0.9s%22%2F%3E%3C%2Fg%3E%3Cg%20transform%3D%22rotate%28-44%20101%20208%29%22%3E%3Cellipse%20class%3D%22p%22%20cx%3D%22101%22%20cy%3D%22208%22%20rx%3D%224%22%20ry%3D%2213%22%20style%3D%22animation-delay%3A-0.9s%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E") center / contain no-repeat;
      }
      /* All call-analysis tabs stay empty (no content, no filters) until a call is fetched. */
      body:not([data-call-fetched]) #panel-speech .tab-content,
      body:not([data-call-fetched]) #panel-dashboard .tab-content,
      body:not([data-call-fetched]) #panel-api-logs .tab-content,
      body:not([data-call-fetched]) #panel-recording .tab-content,
      body:not([data-call-fetched]) #panel-errors .tab-content {
        display: none !important;
      }
      body:not([data-call-fetched]) #top-panel-call-debugger .tab-panel.active::after {
        display: block;
        text-align: center;
        padding: 4.5rem 1rem;
        color: var(--text-muted);
        font-size: 0.9375rem;
      }
      body:not([data-call-fetched]) #panel-speech.active::after {
        content: "Enter a Call ID above and hit Fetch logs to view speech logs.";
      }
      body:not([data-call-fetched]) #panel-dashboard.active::after {
        content: "Enter a Call ID above and hit Fetch logs to view dashboard logs.";
      }
      body:not([data-call-fetched]) #panel-api-logs.active::after {
        content: "Enter a Call ID above and hit Fetch logs to view API logs.";
      }
      body:not([data-call-fetched]) #panel-recording.active::after {
        content: "Enter a Call ID above and hit Fetch logs to view call metrics.";
      }
      body:not([data-call-fetched]) #panel-errors.active::after {
        content: "Enter a Call ID above and hit Fetch logs to view error metrics.";
      }
      /* Collapsible sidebar (burger toggle). */
      .sidebar-toggle {
        display: none;
      }
      @media (min-width: 981px) {
        .brand {
          display: flex;
          align-items: center;
          justify-content: space-between;
          gap: 0.5rem;
        }
        .sidebar-toggle {
          display: inline-flex;
          align-items: center;
          justify-content: center;
          flex: 0 0 auto;
          width: 32px;
          height: 32px;
          padding: 0;
          border: 1px solid transparent;
          border-radius: 8px;
          background: transparent;
          color: var(--text-secondary);
          box-shadow: none;
        }
        .sidebar-toggle:hover {
          background: #f3f0fa;
          transform: none;
          filter: none;
          box-shadow: none;
        }
        .sidebar-toggle::before {
          content: "";
          width: 18px;
          height: 18px;
          background-color: currentColor;
          -webkit-mask: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%272%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cline%20x1%3D%273%27%20y1%3D%276%27%20x2%3D%2721%27%20y2%3D%276%27%2F%3E%3Cline%20x1%3D%273%27%20y1%3D%2712%27%20x2%3D%2721%27%20y2%3D%2712%27%2F%3E%3Cline%20x1%3D%273%27%20y1%3D%2718%27%20x2%3D%2721%27%20y2%3D%2718%27%2F%3E%3C%2Fsvg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%272%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cline%20x1%3D%273%27%20y1%3D%276%27%20x2%3D%2721%27%20y2%3D%276%27%2F%3E%3Cline%20x1%3D%273%27%20y1%3D%2712%27%20x2%3D%2721%27%20y2%3D%2712%27%2F%3E%3Cline%20x1%3D%273%27%20y1%3D%2718%27%20x2%3D%2721%27%20y2%3D%2718%27%2F%3E%3C%2Fsvg%3E") center / contain no-repeat;
        }
        body.sidebar-collapsed > header {
          width: 78px;
        }
        body.sidebar-collapsed main {
          margin-left: 78px;
        }
        body.sidebar-collapsed .header-inner {
          padding: 1.1rem 0.55rem;
        }
        body.sidebar-collapsed .brand {
          flex-direction: column;
          align-items: center;
          gap: 0.8rem;
          padding: 0;
        }
        body.sidebar-collapsed .brand-link div {
          display: none;
        }
        body.sidebar-collapsed .sidebar-toggle {
          display: none;
        }
        body.sidebar-collapsed .brand-link {
          cursor: e-resize;
        }
        body.sidebar-collapsed .nav-section-label {
          margin: 0.55rem 0.45rem;
          padding: 0;
          border-top: 1px solid var(--border-subtle);
          font-size: 0;
          line-height: 0;
        }
        body.sidebar-collapsed .top-tab {
          justify-content: center;
          padding: 0.6rem 0;
        }
        body.sidebar-collapsed .top-tab span {
          display: none;
        }
        body.sidebar-collapsed .user-menu-button {
          justify-content: center;
        }
        body.sidebar-collapsed .user-menu-button #header-user-name {
          display: none;
        }
        body.sidebar-collapsed .user-menu-panel {
          left: 0;
          right: auto;
          min-width: 210px;
        }
      }

      /* Pinned filter rows: stay reachable while scrolling long logs. */
      .tab-panel .tab-meta,
      .source-row.api-controls-row {
        position: sticky;
        top: calc(var(--sticky-header-offset) + var(--sticky-form-offset) + var(--sticky-panel-gap) + 3.55rem);
        z-index: 6;
        background: #ffffff;
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
      }
      /* Bleed over the panel padding so the pinned bar spans the card edge-to-edge. */
      #log-tabs .tab-panel .tab-meta,
      #log-tabs .source-row.api-controls-row {
        margin-left: -1rem;
        margin-right: -1rem;
        padding-left: 1rem;
        padding-right: 1rem;
      }
      /* Consistent page-title scale + users table sizing. */
      .top-tab-panel h2 {
        font-size: 1.25rem;
      }
      .users-table th,
      .users-table td {
        font-size: 0.875rem;
      }
      /* Modern selects: custom chevron, soft border, violet focus ring. */
      select {
        appearance: none;
        -webkit-appearance: none;
        padding: 0.5rem 2.2rem 0.5rem 0.7rem;
        background-color: #ffffff;
        background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%272%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cpolyline%20points%3D%276%209%2012%2015%2018%209%27%2F%3E%3C%2Fsvg%3E");
        background-repeat: no-repeat;
        background-position: right 0.65rem center;
        background-size: 16px;
        border: 1px solid var(--border-subtle);
        border-radius: 10px;
        color: var(--text-primary);
        transition: border-color 0.2s ease, box-shadow 0.2s ease;
      }
      select:focus {
        outline: none;
        border-color: rgba(124, 58, 237, 0.65);
        box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.18);
      }
      /* Caret flips to point up while the dropdown is open. */
      select:open {
        background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%272%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cpolyline%20points%3D%276%2015%2012%209%2018%2015%27%2F%3E%3C%2Fsvg%3E");
      }
      select:disabled {
        opacity: 0.65;
        background-color: #f7f6fb;
      }
      /* Inline radar-pulse loader on list-loading statuses. */
      .status-loading {
        display: flex;
        align-items: center;
        gap: 0.6rem;
      }
      .status-loading::before {
        content: "";
        flex: 0 0 auto;
        width: 56px;
        height: 44px;
        background: url("data:image/svg+xml,%3Csvg%20width%3D%22480%22%20height%3D%22480%22%20viewBox%3D%2285%20115%20310%20250%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cstyle%3E.p%7Bfill%3A%2314003D%3Btransform-box%3Afill-box%3Btransform-origin%3Acenter%3Banimation%3AdnPulse%201.5s%20ease-in-out%20infinite%3B%7D%40keyframes%20dnPulse%7B0%25%7Btransform%3Ascale%280.9%29%3Bopacity%3A0.22%7D18%25%7Btransform%3Ascale%281.07%29%3Bopacity%3A1%7D40%25%7Btransform%3Ascale%280.9%29%3Bopacity%3A0.22%7D100%25%7Btransform%3Ascale%280.9%29%3Bopacity%3A0.22%7D%7D%3C%2Fstyle%3E%3Cg%20transform%3D%22rotate%280%20240%20240%29%22%3E%3Cellipse%20class%3D%22p%22%20cx%3D%22240%22%20cy%3D%22240%22%20rx%3D%2212.6%22%20ry%3D%2280.6%22%20style%3D%22animation-delay%3A-1.5s%22%2F%3E%3C%2Fg%3E%3Cg%20transform%3D%22rotate%280%20205.1%20240%29%22%3E%3Cellipse%20class%3D%22p%22%20cx%3D%22205.1%22%20cy%3D%22240%22%20rx%3D%2211%22%20ry%3D%2264%22%20style%3D%22animation-delay%3A-1.38s%22%2F%3E%3C%2Fg%3E%3Cg%20transform%3D%22rotate%280%20274.9%20240%29%22%3E%3Cellipse%20class%3D%22p%22%20cx%3D%22274.9%22%20cy%3D%22240%22%20rx%3D%2211%22%20ry%3D%2264%22%20style%3D%22animation-delay%3A-1.38s%22%2F%3E%3C%2Fg%3E%3Cg%20transform%3D%22rotate%280%20176.4%20240%29%22%3E%3Cellipse%20class%3D%22p%22%20cx%3D%22176.4%22%20cy%3D%22240%22%20rx%3D%226.4%22%20ry%3D%2232.7%22%20style%3D%22animation-delay%3A-1.26s%22%2F%3E%3C%2Fg%3E%3Cg%20transform%3D%22rotate%280%20303.6%20240%29%22%3E%3Cellipse%20class%3D%22p%22%20cx%3D%22303.6%22%20cy%3D%22240%22%20rx%3D%226.4%22%20ry%3D%2232.7%22%20style%3D%22animation-delay%3A-1.26s%22%2F%3E%3C%2Fg%3E%3Cg%20transform%3D%22rotate%2814%20332%20233%29%22%3E%3Cellipse%20class%3D%22p%22%20cx%3D%22332%22%20cy%3D%22233%22%20rx%3D%225.5%22%20ry%3D%2226%22%20style%3D%22animation-delay%3A-1.14s%22%2F%3E%3C%2Fg%3E%3Cg%20transform%3D%22rotate%28-14%20148%20233%29%22%3E%3Cellipse%20class%3D%22p%22%20cx%3D%22148%22%20cy%3D%22233%22%20rx%3D%225.5%22%20ry%3D%2226%22%20style%3D%22animation-delay%3A-1.14s%22%2F%3E%3C%2Fg%3E%3Cg%20transform%3D%22rotate%2828%20357%20222%29%22%3E%3Cellipse%20class%3D%22p%22%20cx%3D%22357%22%20cy%3D%22222%22%20rx%3D%224.8%22%20ry%3D%2219%22%20style%3D%22animation-delay%3A-1.02s%22%2F%3E%3C%2Fg%3E%3Cg%20transform%3D%22rotate%28-28%20123%20222%29%22%3E%3Cellipse%20class%3D%22p%22%20cx%3D%22123%22%20cy%3D%22222%22%20rx%3D%224.8%22%20ry%3D%2219%22%20style%3D%22animation-delay%3A-1.02s%22%2F%3E%3C%2Fg%3E%3Cg%20transform%3D%22rotate%2844%20379%20208%29%22%3E%3Cellipse%20class%3D%22p%22%20cx%3D%22379%22%20cy%3D%22208%22%20rx%3D%224%22%20ry%3D%2213%22%20style%3D%22animation-delay%3A-0.9s%22%2F%3E%3C%2Fg%3E%3Cg%20transform%3D%22rotate%28-44%20101%20208%29%22%3E%3Cellipse%20class%3D%22p%22%20cx%3D%22101%22%20cy%3D%22208%22%20rx%3D%224%22%20ry%3D%2213%22%20style%3D%22animation-delay%3A-0.9s%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E") center / contain no-repeat;
      }

      /* Alfred nav icon (chat styles live in 09-alfred.css) */
      @media (min-width: 981px) {
        #top-tab-alfred::before {
          -webkit-mask-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%274.5%203.5%2015%2016%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%271.8%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cpath%20d%3D%27M9%207a3%203%200%200%201%206%200v1%27%2F%3E%3Cpath%20d%3D%27M5.5%208h13%27%2F%3E%3Cpath%20d%3D%27M8%208v1.5a4%204%200%200%200%208%200V8%27%2F%3E%3Ccircle%20cx%3D%2710.5%27%20cy%3D%2710.8%27%20r%3D%271%27%20fill%3D%27black%27%20stroke%3D%27none%27%2F%3E%3Ccircle%20cx%3D%2713.5%27%20cy%3D%2710.8%27%20r%3D%271%27%20fill%3D%27black%27%20stroke%3D%27none%27%2F%3E%3Cpath%20d%3D%27M12%2017l-3.2-1.7v3.4Z%27%2F%3E%3Cpath%20d%3D%27M12%2017l3.2-1.7v3.4Z%27%2F%3E%3C%2Fsvg%3E");
          mask-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%274.5%203.5%2015%2016%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%271.8%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cpath%20d%3D%27M9%207a3%203%200%200%201%206%200v1%27%2F%3E%3Cpath%20d%3D%27M5.5%208h13%27%2F%3E%3Cpath%20d%3D%27M8%208v1.5a4%204%200%200%200%208%200V8%27%2F%3E%3Ccircle%20cx%3D%2710.5%27%20cy%3D%2710.8%27%20r%3D%271%27%20fill%3D%27black%27%20stroke%3D%27none%27%2F%3E%3Ccircle%20cx%3D%2713.5%27%20cy%3D%2710.8%27%20r%3D%271%27%20fill%3D%27black%27%20stroke%3D%27none%27%2F%3E%3Cpath%20d%3D%27M12%2017l-3.2-1.7v3.4Z%27%2F%3E%3Cpath%20d%3D%27M12%2017l3.2-1.7v3.4Z%27%2F%3E%3C%2Fsvg%3E");
        }
      }
      /* User avatar in the account button */
      .user-avatar {
        flex: 0 0 auto;
        width: 26px;
        height: 26px;
        border-radius: 50%;
        background: #ede9fe;
        position: relative;
      }
      .user-avatar::before {
        content: "";
        position: absolute;
        inset: 5px;
        background-color: #6d28d9;
        -webkit-mask: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%272%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cpath%20d%3D%27M20%2021v-2a4%204%200%200%200-4-4H8a4%204%200%200%200-4%204v2%27%2F%3E%3Ccircle%20cx%3D%2712%27%20cy%3D%277%27%20r%3D%274%27%2F%3E%3C%2Fsvg%3E") center / contain no-repeat;
        mask: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%272%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cpath%20d%3D%27M20%2021v-2a4%204%200%200%200-4-4H8a4%204%200%200%200-4%204v2%27%2F%3E%3Ccircle%20cx%3D%2712%27%20cy%3D%277%27%20r%3D%274%27%2F%3E%3C%2Fsvg%3E") center / contain no-repeat;
      }
      .user-menu-button {
        align-items: center;
      }
      /* Metric tiles: keep titles, quieter values */
      .metric-value {
        font-size: 0.875rem;
        font-weight: 500;
        color: var(--text-secondary);
      }
      /* Sign-in page: plain top header, no side rail */
      @media (min-width: 981px) {
        body[data-authenticated="false"] > header {
          position: sticky;
          top: 0;
          left: auto;
          bottom: auto;
          width: auto;
          height: auto;
          border-right: none;
          border-bottom: 1px solid var(--border-subtle);
          overflow: visible;
        }
        body[data-authenticated="false"] .header-inner {
          flex-direction: row;
          align-items: center;
          height: auto;
          padding: 0.65rem 1.5rem;
        }
        body[data-authenticated="false"] .brand .subtitle {
          display: block;
        }
        body[data-authenticated="false"] main {
          margin-left: 0;
        }
        body[data-authenticated="false"] .sidebar-toggle {
          display: none;
        }
      }
      /* Settings → Connectors sub-tab */
      .connector-name {
        font-weight: 600;
        display: flex;
        align-items: center;
        gap: 0.5rem;
      }
      .connector-custom-badge {
        font-size: 0.7rem;
        font-weight: 700;
        letter-spacing: 0.04em;
        text-transform: uppercase;
        color: #6d28d9;
        background: #ede9fe;
        border-radius: 999px;
        padding: 0.1rem 0.5rem;
      }
      .connector-managed-badge {
        color: #075985;
        background: #e0f2fe;
      }
      .connector-description {
        color: var(--text-secondary);
        font-size: 0.85rem;
        max-width: 34rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
      .connector-inline-links,
      .connector-config-links {
        display: flex;
        flex-wrap: wrap;
        gap: 0.75rem;
        margin-top: 0.25rem;
        font-size: 0.8rem;
      }
      .connector-inline-links a,
      .connector-config-links a {
        color: var(--primary);
        text-decoration: none;
      }
      .connector-inline-links a:hover,
      .connector-config-links a:hover {
        text-decoration: underline;
      }
      .connector-roles-group {
        border: 1px solid var(--border-subtle);
        border-radius: 10px;
        padding: 0.6rem 0.8rem;
      }
      .connector-roles-group legend {
        font-size: 0.85rem;
        font-weight: 600;
        padding: 0 0.25rem;
      }
      .connector-role-checks {
        display: flex;
        gap: 1rem;
        flex-wrap: wrap;
        margin-top: 0.5rem;
      }
      .connector-role-check {
        display: inline-flex;
        align-items: center;
        gap: 0.4rem;
        font-size: 0.9rem;
      }
      .connector-role-check input {
        width: auto;
        margin: 0;
      }
      .connector-validation-status {
        margin: 0.65rem 0 0;
      }
      .connector-config-modal-panel {
        width: min(94vw, 620px);
        max-height: calc(100dvh - 2rem);
        padding: 0;
        grid-template-rows: auto minmax(0, 1fr);
        overflow: hidden;
      }
      .connector-config-modal-panel > .modal-header {
        padding: 1rem 1.25rem 0.75rem;
      }
      .connector-config-modal-body {
        min-height: 0;
        overflow-y: auto;
        overscroll-behavior: contain;
        padding: 0 1.25rem 1.25rem;
        scrollbar-gutter: stable;
      }
      .connector-config-modal-body .agent-config-actions {
        position: sticky;
        bottom: -1.25rem;
        z-index: 2;
        margin-left: -1.25rem;
        margin-right: -1.25rem;
        padding: 0.85rem 1.25rem 1.1rem;
        border-top: 1px solid var(--border-subtle);
        background: var(--bg-surface);
        box-shadow: 0 -10px 20px rgba(23, 13, 59, 0.05);
      }
      .connector-managed-note {
        border: 1px solid #c4b5fd;
        border-radius: 10px;
        padding: 0.7rem 0.85rem;
        background: #f5f3ff;
        color: var(--text-secondary);
        font-size: 0.85rem;
      }
      .connector-auth-fields {
        display: grid;
        gap: 0.85rem;
      }
      .connector-auth-fields[hidden] {
        display: none;
      }
      .connector-oauth-button {
        justify-self: start;
      }
      @media (max-height: 560px), (max-width: 640px) {
        .connector-config-modal-overlay {
          align-items: stretch;
          padding: 0.5rem;
        }
        .connector-config-modal-panel {
          width: 100%;
          max-height: calc(100dvh - 1rem);
          border-radius: 12px;
        }
      }
      .connector-validation-status.validation-success {
        color: var(--success, #15803d);
      }
      .connector-validation-status.validation-error {
        color: var(--danger, #b91c1c);
      }

      /* ============ Alfred (full-bleed panel) ============ */
      /* Several alfred elements set display:flex/grid, which would beat the
         HTML hidden attribute - make hidden always win inside this panel. */
      #top-panel-alfred [hidden] {
        display: none !important;
      }
      /* Neutralize main's padding/max-width while the chat tab is open; the
         sidebar margin from 07-app-shell-sidebar.css is re-applied below. */
      body.alfred-open main {
        padding: 0;
        max-width: none;
        margin: 0;
      }
      @media (min-width: 981px) {
        body.alfred-open main {
          margin-left: 248px;
        }
        body.alfred-open.sidebar-collapsed main {
          margin-left: 78px;
        }
      }
      body.alfred-open #top-panel-alfred {
        padding: 0;
      }
      body.alfred-open {
        overflow: hidden; /* panes scroll internally, never the page */
      }

      /* Thin, theme-matched scrollbars for every internally scrolling pane. */
      .agent-session-list,
      .alfred-scroll,
      .agent-activity-rows,
      .agent-subview {
        scrollbar-width: thin;
        scrollbar-color: var(--border-strong) transparent;
      }
      .agent-session-list::-webkit-scrollbar,
      .alfred-scroll::-webkit-scrollbar,
      .agent-activity-rows::-webkit-scrollbar,
      .agent-subview::-webkit-scrollbar {
        width: 8px;
      }
      .agent-session-list::-webkit-scrollbar-thumb,
      .alfred-scroll::-webkit-scrollbar-thumb,
      .agent-activity-rows::-webkit-scrollbar-thumb,
      .agent-subview::-webkit-scrollbar-thumb {
        background: var(--border-strong);
        border-radius: 999px;
      }

      .alfred-gate {
        height: calc(100dvh - var(--sticky-header-offset, 0px));
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        text-align: center;
        padding: 2rem;
      }
      .alfred-gate h2 {
        margin: 0.4rem 0 0;
        font-size: 1.25rem;
        color: var(--text-primary);
      }
      .alfred-gate p {
        margin: 0;
        color: var(--text-secondary);
        font-size: 0.9375rem;
        line-height: 1.6;
      }

      .alfred-layout {
        display: grid;
        grid-template-columns: 288px minmax(0, 1fr);
        height: calc(100dvh - var(--sticky-header-offset, 0px));
        background: var(--bg);
      }

      /* ---- Sessions sidebar ---- */
      .agent-sessions {
        display: flex;
        flex-direction: column;
        min-height: 0;
        border-right: 1px solid var(--border-subtle);
        background: #f8f8fa;
      }
      .agent-sessions-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        min-height: 64px;
        box-sizing: border-box;
        padding: 0.75rem 0.9rem;
        flex: 0 0 auto;
      }
      .agent-sessions-brand {
        display: flex;
        align-items: center;
        gap: 0.65rem;
        min-width: 0;
      }
      .agent-sessions-mark {
        display: grid;
        place-items: center;
        flex: 0 0 32px;
        width: 32px;
        height: 32px;
        border-radius: 10px;
        background: linear-gradient(145deg, #7c3aed, #5b21b6);
        color: #ffffff;
        font-size: 0.875rem;
        font-weight: 800;
        box-shadow: 0 4px 12px rgba(91, 33, 182, 0.2);
      }
      .agent-sessions-mark svg {
        width: 20px;
        height: 20px;
      }
      .agent-sessions-brand-copy {
        display: flex;
        flex-direction: column;
        gap: 0.05rem;
        min-width: 0;
      }
      .agent-sessions-title {
        font-weight: 700;
        font-size: 0.9rem;
        letter-spacing: -0.01em;
        color: var(--text-primary);
      }
      .agent-sessions-subtitle {
        color: var(--text-muted);
        font-size: 0.65rem;
        font-weight: 500;
        letter-spacing: 0.01em;
      }
      .agent-sessions-close {
        display: none;
        align-items: center;
        justify-content: center;
        flex: 0 0 32px;
        width: 32px;
        height: 32px;
        border: 1px solid var(--border-subtle);
        border-radius: 8px;
        background: #ffffff;
        color: var(--text-muted);
        font: inherit;
        font-size: 1.15rem;
        line-height: 1;
        cursor: pointer;
        box-shadow: 0 1px 2px rgba(23, 13, 59, 0.04);
      }
      .agent-sessions-close:hover {
        background: var(--bg-hover);
        color: var(--text-primary);
      }
      .agent-sidebar-label {
        padding: 0.15rem 1rem 0.35rem;
        color: var(--text-muted);
        font-size: 0.625rem;
        font-weight: 700;
        letter-spacing: 0.075em;
        text-transform: uppercase;
      }
      .agent-section-nav {
        display: flex;
        flex-direction: column;
        gap: 3px;
        padding: 0 0.65rem 0.75rem;
      }
      .agent-section-nav-item {
        display: flex;
        align-items: center;
        gap: 0.65rem;
        width: 100%;
        min-height: 40px;
        box-sizing: border-box;
        border: 1px solid transparent;
        border-radius: 10px;
        background: transparent;
        color: var(--text-secondary);
        padding: 0.5rem 0.7rem;
        text-align: left;
        font: inherit;
        font-size: 0.8375rem;
        font-weight: 600;
        box-shadow: none;
        cursor: pointer;
        transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease, color 140ms ease, transform 140ms ease;
      }
      .agent-section-nav-item:hover {
        background: rgba(255, 255, 255, 0.72);
        color: var(--text-primary);
      }
      .agent-section-nav-item.active {
        border-color: rgba(23, 13, 59, 0.08);
        background: #ffffff;
        color: var(--text-primary);
        box-shadow: 0 1px 2px rgba(23, 13, 59, 0.05), 0 4px 12px rgba(23, 13, 59, 0.035);
      }
      .agent-section-nav-icon {
        flex: none;
        width: 17px;
        height: 17px;
        color: var(--text-muted);
      }
      .agent-section-nav-item:hover .agent-section-nav-icon,
      .agent-section-nav-item.active .agent-section-nav-icon {
        color: inherit;
      }
      .agent-section-nav-item.active .agent-section-nav-icon {
        color: #6d28d9;
      }
      .agent-chats-section {
        display: flex;
        flex: 1;
        min-height: 0;
        flex-direction: column;
        border-top: 1px solid rgba(23, 13, 59, 0.06);
        background: rgba(255, 255, 255, 0.26);
      }
      .agent-new-chat-wrap {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        padding: 0.75rem 0.65rem 0.55rem;
        flex: 0 0 auto;
      }
      .agent-new-chat-btn {
        border: 1px solid var(--border-strong);
        background: #ffffff;
        color: var(--accent-primary);
        font-weight: 600;
        font-size: 0.8125rem;
        border-radius: 9px;
        padding: 0.35rem 0.7rem;
        cursor: pointer;
        transition: background 0.12s ease, border-color 0.12s ease;
      }
      .agent-new-chat-btn:hover {
        background: var(--bg-hover);
        border-color: var(--accent-tertiary);
      }
      .agent-new-chat-wrap .agent-new-chat-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0.45rem;
        flex: 1;
        min-height: 40px;
        box-sizing: border-box;
        border: 1px solid #6d28d9;
        background: linear-gradient(145deg, #7c3aed, #6d28d9);
        color: #ffffff;
        border-radius: 10px;
        padding: 0.5rem 0.75rem;
        font-size: 0.8125rem;
        box-shadow: 0 2px 5px rgba(91, 33, 182, 0.18);
      }
      .agent-new-chat-wrap .agent-new-chat-btn:hover {
        border-color: #5b21b6;
        background: linear-gradient(145deg, #6d28d9, #5b21b6);
        color: #ffffff;
      }
      .agent-new-chat-wrap .agent-new-chat-btn svg {
        width: 15px;
        height: 15px;
      }
      .agent-new-folder-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 40px;
        width: 40px;
        height: 40px;
        box-sizing: border-box;
        border: 1px solid var(--border-subtle);
        background: #ffffff;
        color: var(--text-secondary);
        border-radius: 10px;
        padding: 0;
        font: inherit;
        box-shadow: 0 1px 2px rgba(23, 13, 59, 0.04);
        cursor: pointer;
        transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
      }
      .agent-new-folder-btn:hover {
        border-color: rgba(109, 40, 217, 0.3);
        background: #faf8ff;
        color: #6d28d9;
      }
      .agent-new-folder-btn svg {
        width: 17px;
        height: 17px;
      }
      .agent-new-folder-form {
        display: flex;
        gap: 0.3rem;
        padding: 0 0.65rem 0.65rem;
      }
      .agent-new-folder-form input {
        min-width: 0;
        flex: 1;
        border: 1px solid var(--border-strong);
        border-radius: 8px;
        padding: 0.4rem 0.55rem;
        font: inherit;
        font-size: 0.8125rem;
      }
      .agent-folder-form-save,
      .agent-folder-form-cancel {
        border: 0;
        border-radius: 8px;
        cursor: pointer;
        font-size: 0.75rem;
        font-weight: 600;
      }
      .agent-folder-form-save {
        background: #1d1235;
        color: #ffffff;
        padding: 0.35rem 0.55rem;
      }
      .agent-folder-form-cancel {
        background: transparent;
        color: var(--text-muted);
        padding: 0.35rem 0.4rem;
      }
      .agent-session-list {
        flex: 1;
        overflow-y: auto;
        min-height: 0;
        padding: 0.15rem 0.55rem 0.75rem;
        display: flex;
        flex-direction: column;
        gap: 4px;
      }
      .agent-folder-group {
        display: flex;
        flex-direction: column;
        gap: 2px;
        border: 1px solid transparent;
        border-radius: 9px;
        transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
      }
      .agent-folder-group.drop-target {
        border-color: rgba(124, 58, 237, 0.42);
        background: rgba(124, 58, 237, 0.07);
        box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.08);
      }
      .agent-folder-head-row {
        display: flex;
        align-items: center;
        gap: 2px;
      }
      .agent-folder-head {
        display: flex;
        align-items: center;
        gap: 0.4rem;
        flex: 1;
        min-width: 0;
        border: 0;
        background: transparent;
        color: var(--text-muted);
        border-radius: 9px;
        padding: 0.5rem 0.55rem;
        cursor: pointer;
        text-align: left;
        font-size: 0.8125rem;
        font-weight: 600;
        box-shadow: none;
      }
      .agent-folder-head:hover,
      .agent-folder-head.active {
        color: var(--text-primary);
        background: rgba(255, 255, 255, 0.7);
      }
      .agent-folder-chevron {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 16px;
        color: var(--text-muted);
        font-size: 0.8rem;
        transition: transform 150ms ease;
      }
      .agent-folder-group.open .agent-folder-chevron {
        transform: rotate(90deg);
      }
      .agent-folder-name {
        flex: 1;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
      .agent-folder-count {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 auto;
        min-width: 22px;
        height: 20px;
        box-sizing: border-box;
        border-radius: 999px;
        background: rgba(23, 13, 59, 0.055);
        color: var(--text-muted);
        padding: 0 0.35rem;
        font-size: 0.6875rem;
        font-weight: 600;
      }
      .agent-folder-delete {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 30px;
        width: 30px;
        height: 30px;
        margin-right: 0.2rem;
        box-sizing: border-box;
        padding: 0;
        border: 0;
        border-radius: 7px;
        background: transparent;
        color: var(--text-muted);
        box-shadow: none;
        cursor: pointer;
        opacity: 0;
        transition: background 140ms ease, color 140ms ease, opacity 140ms ease;
      }
      .agent-folder-head-row:hover .agent-folder-delete,
      .agent-folder-head-row:focus-within .agent-folder-delete {
        opacity: 1;
      }
      .agent-folder-delete:hover,
      .agent-folder-delete:focus-visible {
        background: rgba(220, 38, 38, 0.09);
        color: #b91c1c;
      }
      .agent-folder-delete:disabled {
        cursor: wait;
        opacity: 0.45;
      }
      .agent-folder-delete svg {
        display: block;
        flex: 0 0 14px;
        width: 14px;
        height: 14px;
      }
      .agent-folder-sessions {
        display: none;
        flex-direction: column;
        gap: 1px;
        padding: 0 0.2rem 0.35rem 0.6rem;
      }
      .agent-folder-group.open .agent-folder-sessions,
      /* Collapsed folder holding the chat you're reading: the list stays mounted
         so that single row shows, while the chevron reads as collapsed. */
      .agent-folder-group.collapsed-active .agent-folder-sessions {
        display: flex;
      }
      .agent-folder-sessions .agent-session-row {
        padding: 0.48rem 0.65rem;
      }
      .agent-session-row {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        width: 100%;
        text-align: left;
        background: transparent;
        border: 1px solid transparent;
        border-radius: 9px;
        padding: 0.52rem 0.7rem;
        cursor: pointer;
        color: var(--text-secondary);
        font-size: 0.8125rem;
        box-shadow: none;
        transition:
          background 140ms ease,
          color 140ms ease,
          opacity 140ms ease,
          transform 140ms ease,
          box-shadow 140ms ease;
      }
      .agent-session-row:hover {
        background: rgba(255, 255, 255, 0.72);
        color: var(--text-primary);
      }
      .agent-session-row.active {
        border-color: rgba(109, 40, 217, 0.12);
        background: #ffffff;
        color: var(--text-primary);
        font-weight: 600;
        box-shadow: 0 1px 2px rgba(23, 13, 59, 0.04);
      }
      .agent-session-row[data-session-id] {
        cursor: grab;
      }
      .agent-session-row.dragging {
        opacity: 0.48;
        transform: scale(0.985);
        box-shadow: 0 5px 16px rgba(23, 13, 59, 0.12);
        cursor: grabbing;
      }
      .agent-session-row-title {
        flex: 1;
        min-width: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }
      /* Pulsing dot on chats with a run in flight, so parallel chats are easy
         to keep track of from the sidebar. */
      .agent-session-run-dot {
        flex: 0 0 auto;
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: #7c3aed;
        animation: agent-run-pulse 1.4s ease-in-out infinite;
      }
      .agent-session-unread-dot {
        flex: 0 0 auto;
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: #2563eb;
        box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
      }
      .agent-session-row.unread .agent-session-row-title {
        color: var(--text-primary);
        font-weight: 600;
      }
      @keyframes agent-run-pulse {
        0%,
        100% {
          opacity: 1;
          transform: scale(1);
        }
        50% {
          opacity: 0.35;
          transform: scale(0.75);
        }
      }
      .agent-sessions-empty,
      .agent-sessions-more {
        color: var(--text-muted);
        font-size: 0.8125rem;
        text-align: center;
        padding: 0.75rem;
      }
      .agent-sessions-empty {
        margin-top: 1rem;
      }
      .agent-sessions-more {
        display: none;
      }
      .agent-folder-more {
        width: 100%;
        border: 0;
        border-radius: 8px;
        background: transparent;
        color: var(--text-muted);
        padding: 0.4rem 0.65rem;
        text-align: left;
        font: inherit;
        font-size: 0.75rem;
        font-weight: 600;
        box-shadow: none;
        cursor: pointer;
        transition: background 140ms ease, color 140ms ease;
      }
      .agent-folder-more:hover {
        background: rgba(23, 13, 59, 0.055);
        color: var(--text-primary);
      }
      .agent-sessions-foot {
        border-top: 1px solid var(--border-subtle);
        padding: 0.65rem;
        font-size: 0.75rem;
        color: var(--text-muted);
        background: #f8f8fa;
      }
      .agent-foot-btns {
        display: flex;
        gap: 0.35rem;
        margin-bottom: 0.6rem;
      }
      .agent-foot-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0.4rem;
        flex: 1;
        min-height: 36px;
        border: 1px solid transparent;
        background: transparent;
        color: var(--text-secondary);
        border-radius: 9px;
        font-size: 0.75rem;
        font-weight: 600;
        padding: 0.4rem 0.55rem;
        cursor: pointer;
        transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
      }
      .agent-foot-btn:hover {
        border-color: rgba(23, 13, 59, 0.07);
        background: #ffffff;
        color: var(--accent-primary);
      }
      .agent-foot-btn svg {
        width: 15px;
        height: 15px;
      }
      .agent-sidebar-budget {
        display: flex;
        flex-direction: column;
        /* Two stacked gauges: today above the month, so whichever cap is the one
           actually blocking a send is visible without opening the Spend view. */
        gap: 0.55rem;
        border: 1px solid rgba(23, 13, 59, 0.075);
        border-radius: 10px;
        background: #ffffff;
        padding: 0.65rem 0.7rem;
        box-shadow: 0 1px 2px rgba(23, 13, 59, 0.035);
      }
      .agent-sidebar-budget-copy {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
        margin-bottom: 0.3rem;
        color: var(--text-muted);
        font-size: 0.65rem;
        font-weight: 600;
      }
      #agent-my-spend,
      #agent-my-day-spend {
        overflow: hidden;
        color: var(--text-secondary);
        font-variant-numeric: tabular-nums;
        text-align: right;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
      .agent-sidebar-budget-track {
        overflow: hidden;
        height: 5px;
        border-radius: 999px;
        background: rgba(23, 13, 59, 0.08);
      }
      .agent-sidebar-budget-bar {
        display: block;
        width: 0;
        height: 100%;
        border-radius: inherit;
        background: linear-gradient(90deg, #8b5cf6, #6d28d9);
        transition: width 220ms ease;
      }
      .agent-sidebar-budget-bar.hot {
        background: linear-gradient(90deg, #f59e0b, #dc2626);
      }
      /* A spent cap reads as solid red, so when sends are frozen the gauge that
         caused it is unambiguous rather than just "nearly full". */
      .agent-sidebar-budget-bar.full {
        background: linear-gradient(90deg, #dc2626, #b91c1c);
      }
      .agent-sidebar-gauge.exhausted .agent-sidebar-budget-copy {
        color: #b91c1c;
      }
      .agent-sidebar-gauge.exhausted .agent-sidebar-budget-copy span {
        color: inherit;
      }

      /* ---- Personal connectors subview ---- */
      #agent-view-connectors {
        max-width: 960px;
        padding-top: 2.25rem;
      }
      .agent-connectors-head {
        margin-bottom: 0.45rem;
      }
      .agent-connectors-head h2 {
        font-size: 1.55rem;
        letter-spacing: -0.025em;
      }
      .agent-connectors-intro {
        max-width: 680px;
        margin-bottom: 1.75rem;
        font-size: 0.875rem;
        line-height: 1.55;
      }
      .agent-connectors-grid {
        display: grid;
        gap: 1rem;
      }
      .agent-connector-card {
        overflow: hidden;
        border: 1px solid rgba(23, 13, 59, 0.1);
        border-radius: 16px;
        background: #ffffff;
        box-shadow: 0 1px 2px rgba(23, 13, 59, 0.035), 0 10px 30px rgba(23, 13, 59, 0.035);
      }
      .agent-connector-provider {
        display: flex;
        align-items: flex-start;
        gap: 1rem;
        padding: 1.25rem;
      }
      .agent-connector-provider-icon {
        flex: none;
        width: 44px;
        height: 44px;
        display: grid;
        place-items: center;
        margin-top: 0.1rem;
        border-radius: 12px;
        border: 1px solid rgba(109, 40, 217, 0.12);
        color: #6d28d9;
        background: linear-gradient(145deg, #f6f2ff, #fbfaff);
      }
      .agent-connector-provider-icon svg {
        width: 21px;
        height: 21px;
      }
      .agent-connector-provider-icon-gmail {
        border-color: rgba(37, 99, 235, 0.12);
        color: #2563eb;
        background: linear-gradient(145deg, #eff6ff, #f8fbff);
      }
      .agent-connector-provider-icon-github {
        border-color: rgba(36, 41, 47, 0.14);
        color: #24292f;
        background: linear-gradient(145deg, #f3f4f6, #fbfbfc);
      }
      .agent-connector-provider-info {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        flex: 1;
        min-width: 0;
      }
      .agent-connector-kind {
        margin-bottom: 0.3rem;
        color: var(--text-muted);
        font-size: 0.625rem;
        font-weight: 700;
        letter-spacing: 0.075em;
        line-height: 1;
        text-transform: uppercase;
      }
      .agent-connector-provider-info .name {
        margin: 0;
        color: var(--text-primary);
        font-weight: 700;
        font-size: 1rem;
        letter-spacing: -0.012em;
        line-height: 1.3;
      }
      .agent-connector-provider-info .desc {
        max-width: 600px;
        margin: 0.32rem 0 0;
        color: var(--text-secondary);
        font-size: 0.8125rem;
        line-height: 1.5;
      }
      .agent-connector-unavailable {
        margin-top: 0.55rem;
        font-size: 0.75rem;
        color: #b25e09;
      }
      .agent-connector-status {
        display: inline-flex;
        align-items: center;
        gap: 0.4rem;
        margin-top: 0.55rem;
        font-size: 0.75rem;
        font-weight: 600;
        color: var(--text-muted);
      }
      .agent-connector-status::before {
        content: "";
        flex: none;
        width: 7px;
        height: 7px;
        border-radius: 50%;
        background: currentColor;
        box-shadow: 0 0 0 3px rgba(107, 114, 128, 0.1);
      }
      .agent-connector-status.available {
        color: #1a7f42;
      }
      .agent-connector-status.unavailable {
        color: #b25e09;
      }
      .agent-connector-button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex: none;
        min-height: 36px;
        box-sizing: border-box;
        border: 1px solid transparent;
        border-radius: 9px;
        padding: 0.45rem 0.8rem;
        font: inherit;
        font-size: 0.8125rem;
        font-weight: 700;
        line-height: 1;
        text-decoration: none;
        cursor: pointer;
        transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease, color 140ms ease, transform 140ms ease;
      }
      .agent-connector-button-primary {
        border-color: #6d28d9;
        background: #6d28d9;
        color: #ffffff;
        box-shadow: 0 1px 2px rgba(76, 29, 149, 0.18);
      }
      .agent-connector-button-primary:hover {
        border-color: #5b21b6;
        background: #5b21b6;
        transform: translateY(-1px);
      }
      .agent-connector-button-secondary {
        border-color: var(--border-strong);
        background: #ffffff;
        color: var(--text-secondary);
        box-shadow: 0 1px 2px rgba(23, 13, 59, 0.05);
      }
      .agent-connector-button-secondary:hover {
        border-color: rgba(109, 40, 217, 0.35);
        background: #faf8ff;
        color: #6d28d9;
      }
      .agent-connector-button:focus-visible {
        outline: none;
        box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.16);
      }
      .agent-connector-button:disabled {
        cursor: not-allowed;
        opacity: 0.48;
        transform: none;
      }
      .agent-browser-connector-setup {
        box-sizing: border-box;
        margin: 0 1.25rem 1.15rem;
        padding: 1rem 1.05rem;
        border: 1px solid rgba(109, 40, 217, 0.12);
        border-radius: 11px;
        background: #faf8ff;
      }
      .agent-browser-connector-setup-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
      }
      .agent-browser-connector-setup-head h4 {
        margin: 0;
        font-size: 0.875rem;
      }
      .agent-browser-connector-setup-head p {
        margin: 0.25rem 0 0;
        color: var(--text-muted);
        font-size: 0.75rem;
      }
      .agent-browser-connector-download {
        flex: none;
      }
      .agent-browser-connector-steps {
        margin: 1rem 0 0;
        padding-left: 1.2rem;
        color: var(--text-secondary);
        font-size: 0.78rem;
        line-height: 1.55;
      }
      .agent-browser-connector-steps li + li {
        margin-top: 0.45rem;
      }
      .agent-browser-connector-steps code,
      .agent-browser-connector-update-note code {
        padding: 0.1rem 0.28rem;
        border-radius: 4px;
        background: #eef1f5;
        color: var(--text-primary);
      }
      .agent-browser-connector-update-note {
        margin: 0.9rem 0 0;
        color: var(--text-muted);
        font-size: 0.75rem;
        line-height: 1.5;
      }
      .agent-browser-connector-privacy {
        display: inline-block;
        margin-top: 0.75rem;
        color: var(--accent-primary);
        font-size: 0.75rem;
        font-weight: 600;
        text-decoration: none;
      }
      .agent-browser-connector-privacy:hover {
        text-decoration: underline;
      }
      .agent-connector-list-title {
        margin: 0;
        padding: 0 1.25rem 0.5rem;
        color: var(--text-muted);
        font-size: 0.6875rem;
        font-weight: 700;
        letter-spacing: 0.055em;
        text-transform: uppercase;
      }
      .agent-connectors-list {
        display: flex;
        flex-direction: column;
        margin: 0 1.25rem 1.15rem;
        overflow: hidden;
        border: 1px solid var(--border-subtle);
        border-radius: 11px;
        background: #fafbfc;
      }
      .agent-connectors-list:empty {
        display: none;
      }
      .agent-connector-row {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        min-height: 58px;
        box-sizing: border-box;
        padding: 0.65rem 0.85rem;
        background: transparent;
      }
      .agent-connector-row + .agent-connector-row {
        border-top: 1px solid var(--border-subtle);
      }
      .agent-connector-dot {
        flex: none;
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: #1a7f42;
        box-shadow: 0 0 0 3px rgba(26, 127, 66, 0.1);
      }
      .agent-connector-dot.warn {
        background: #b25e09;
        box-shadow: 0 0 0 3px rgba(178, 94, 9, 0.1);
      }
      .agent-connector-info {
        display: flex;
        flex-direction: column;
        gap: 0.1rem;
        flex: 1;
        min-width: 0;
      }
      .agent-connector-info .name {
        font-weight: 600;
        font-size: 0.85rem;
        overflow: hidden;
        text-overflow: ellipsis;
      }
      .agent-connector-info .meta {
        font-size: 0.72rem;
        color: var(--text-muted);
      }
      .agent-connector-info .meta.warn {
        color: #b25e09;
      }
      .agent-connector-actions {
        display: flex;
        gap: 0.4rem;
        flex: none;
      }
      .agent-connector-actions .agent-back-btn {
        min-height: 32px;
        padding: 0.32rem 0.65rem;
        background: #ffffff;
      }
      .agent-connectors-list > .agent-subview-sub {
        margin: 0;
        padding: 0.85rem;
        line-height: 1.45;
      }
      .agent-connectors-list > .agent-subview-loading {
        padding: 1.15rem;
      }
      .agent-connectors-list > .agent-subview-loading .section-loading-mark {
        display: none;
      }
      @media (max-width: 760px) {
        #agent-view-connectors {
          padding: 1.25rem 1rem 2rem;
        }
        .agent-connector-provider {
          display: grid;
          grid-template-columns: 44px minmax(0, 1fr);
          padding: 1rem;
        }
        .agent-connector-provider .agent-connector-button {
          grid-column: 1 / -1;
          width: 100%;
        }
        .agent-connector-row,
        .agent-browser-connector-setup-head {
          align-items: stretch;
          flex-direction: column;
        }
        .agent-browser-connector-setup,
        .agent-connectors-list {
          margin-right: 1rem;
          margin-left: 1rem;
        }
        .agent-connector-list-title {
          padding-right: 1rem;
          padding-left: 1rem;
        }
        .agent-connector-row {
          align-items: flex-start;
        }
        .agent-connector-actions {
          flex-wrap: wrap;
          width: 100%;
        }
        .agent-connector-actions .agent-back-btn {
          flex: 1;
        }
        .agent-browser-connector-download {
          width: 100%;
        }
      }

      /* ---- Main pane: one visible view at a time ---- */
      .agent-main {
        display: grid;
        grid-template-rows: minmax(0, 1fr);
        min-height: 0;
      }
      .agent-view {
        min-height: 0;
      }
      .agent-view-chat {
        display: grid;
        grid-template-rows: auto minmax(0, 1fr) auto auto;
      }
      /* Same reading-column width as the chat thread so all three views
         (chat, skills, spend) fill the pane consistently. */
      .agent-subview {
        overflow-y: auto;
        padding: 1.5rem 1.75rem 2.5rem;
        max-width: 1120px;
        width: 100%;
        box-sizing: border-box; /* no global reset - width:100% must include padding */
        margin: 0 auto;
      }
      .agent-subview-head {
        display: flex;
        align-items: center;
        gap: 0.8rem;
        margin-bottom: 0.35rem;
      }
      .agent-subview-head h2 {
        margin: 0;
        font-size: 1.25rem;
        letter-spacing: -0.01em;
        color: var(--text-primary);
        flex: 1;
      }
      .agent-back-btn {
        border: 1px solid var(--border-strong);
        background: #ffffff;
        color: var(--text-secondary);
        border-radius: 8px;
        font-size: 0.8125rem;
        font-weight: 600;
        padding: 0.35rem 0.7rem;
        cursor: pointer;
        transition: background 0.12s ease, color 0.12s ease;
      }
      .agent-back-btn:hover {
        background: var(--bg-hover);
        color: var(--text-primary);
      }
      .agent-subview-sub {
        color: var(--text-muted);
        font-size: 0.8125rem;
        margin: 0 0 1.25rem;
      }

      /* Repeat view */
      .agent-repeat-ledger {
        margin: 0 0 1rem;
        padding: 0.85rem;
        border: 1px solid var(--border-subtle);
        border-radius: 12px;
        background: var(--bg-hover);
      }
      .agent-repeat-ledger-head {
        display: flex;
        justify-content: space-between;
        gap: 1rem;
      }
      .agent-repeat-ledger-head .agent-folder-head {
        flex: 1;
      }
      /* Collapsed by default: the body and the blurb only exist once opened,
         matching how Repeat sections and chat folders behave. */
      .agent-repeat-ledger-sub,
      .agent-repeat-ledger-list {
        display: none;
      }
      .agent-repeat-ledger.open .agent-repeat-ledger-sub {
        display: block;
        margin: 0.5rem 0 0.65rem;
        color: var(--text-muted);
        font-size: 0.75rem;
      }
      .agent-repeat-ledger.open .agent-repeat-ledger-list {
        display: grid;
        gap: 0.45rem;
      }
      .agent-repeat-ledger-row {
        display: grid;
        gap: 0.18rem;
        padding: 0.6rem;
        border: 1px solid var(--border-subtle);
        border-radius: 9px;
        background: var(--bg-elevated);
      }
      .agent-repeat-ledger-row a {
        color: var(--accent-primary);
        overflow-wrap: anywhere;
      }
      .agent-repeat-ledger-row span,
      .agent-repeat-ledger-row small {
        color: var(--text-muted);
      }
      .agent-repeat-list {
        display: flex;
        flex-direction: column;
        gap: 0.1rem;
        margin-bottom: 1.25rem;
      }
      .agent-repeat-head-actions {
        display: flex;
        align-items: center;
        gap: 0.4rem;
      }
      /* Section chrome is the chat folder tree's: .agent-folder-group/-head/
         -chevron/-name/-count/-delete already style the header and drive the
         collapse, so only the body and the rename tint are new here. */
      .agent-repeat-section {
        gap: 0;
      }
      /* The chat tree lives in a narrow sidebar, where a full-width head is right.
         This panel is ~3x wider, so the head hugs chevron+name+count instead -
         stretched, the count drifted far from the name it belongs to and the hover
         state became a panel-wide slab. */
      .agent-repeat-section .agent-folder-head-row {
        gap: 0.1rem;
      }
      .agent-repeat-section .agent-folder-head {
        flex: 0 0 auto;
        gap: 0.5rem;
        font-size: 0.875rem;
      }
      .agent-repeat-section .agent-folder-name {
        flex: 0 1 auto;
      }
      .agent-repeat-section-rename:hover,
      .agent-repeat-section-rename:focus-visible {
        background: rgba(124, 58, 237, 0.09);
        color: var(--accent-primary);
      }
      /* Same borrowed-from-the-sidebar problem as the section head: the shared
         .agent-new-folder-form stretches its input with flex:1, which is right in a
         240px sidebar and absurd in a panel this wide. Cap it and drop the sidebar's
         gutter padding so it lines up with the section list under it. */
      .agent-repeat-section-form {
        /* The global `form` rule in 01-tokens-and-base.css turns every form into a
           sticky, shadowed surface card. .agent-new-folder-form only overrides
           display/gap/padding, so the rest leaked in here as a stray slab behind the
           field - and sticky would have pinned it over the list while it scrolled.
           This is a bare inline row, so neutralize all of it. */
        position: static;
        z-index: auto;
        background: none;
        border: 0;
        border-radius: 0;
        box-shadow: none;
        animation: none;
        align-items: center;
        gap: 0.35rem;
        max-width: 380px;
        padding: 0.1rem 0 0.7rem 0.15rem;
      }
      .agent-repeat-section-form input {
        flex: 1 1 auto;
        padding: 0.45rem 0.6rem;
      }
      .agent-repeat-section-form .agent-folder-form-save,
      .agent-repeat-section-form .agent-folder-form-cancel {
        flex: 0 0 auto;
        padding: 0.45rem 0.7rem;
      }
      .agent-repeat-section-body {
        display: none;
        flex-direction: column;
        gap: 0.4rem;
        padding: 0.2rem 0 0.5rem 1.55rem;
      }
      .agent-folder-group.open > .agent-repeat-section-body {
        display: flex;
      }
      .agent-repeat-section-empty {
        margin: 0;
        padding: 0.3rem 0;
        color: var(--text-muted);
        font-size: 0.8125rem;
      }
      .agent-repeat-field-hint {
        display: block;
        margin-top: 0.25rem;
        color: var(--text-muted);
        font-size: 0.72rem;
        font-weight: 400;
        text-transform: none;
        letter-spacing: 0;
      }
      .agent-repeat-empty {
        display: flex;
        min-height: min(520px, 58vh);
        flex-direction: column;
        align-items: center;
        justify-content: center;
        max-width: 620px;
        margin: 0 auto;
        padding: 2.5rem 1.5rem;
        text-align: center;
      }
      .agent-repeat-empty-kicker {
        margin: 0 0 0.7rem;
        color: var(--accent-primary);
        font-size: 0.75rem;
        font-weight: 700;
        letter-spacing: 0.07em;
        text-transform: uppercase;
      }
      .agent-repeat-empty h3 {
        margin: 0;
        color: var(--text-primary);
        font-size: clamp(1.45rem, 2.6vw, 2rem);
        letter-spacing: -0.025em;
      }
      .agent-repeat-empty > p:not(.agent-repeat-empty-kicker) {
        max-width: 520px;
        margin: 0.8rem 0 0;
        color: var(--text-secondary);
        font-size: 0.9375rem;
        line-height: 1.65;
      }
      .agent-repeat-empty-examples {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.45rem;
        margin: 1.15rem 0 1.35rem;
      }
      .agent-repeat-empty-examples span {
        border: 1px solid var(--border-subtle);
        border-radius: 999px;
        background: var(--bg-elevated);
        color: var(--text-muted);
        padding: 0.35rem 0.65rem;
        font-size: 0.75rem;
      }
      .agent-repeat-card {
        border: 1px solid var(--border-subtle);
        border-radius: 10px;
        background: var(--bg-elevated);
        padding: 0.6rem 0.75rem;
        cursor: pointer;
        text-align: left;
        color: var(--text-primary);
        box-shadow: 0 1px 2px rgba(23, 13, 59, 0.04);
        transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
      }
      .agent-repeat-card:hover {
        border-color: var(--accent-tertiary);
        box-shadow: 0 5px 16px rgba(23, 13, 59, 0.07);
        transform: translateY(-1px);
      }
      .agent-repeat-card-head {
        display: flex;
        align-items: center;
        gap: 0.55rem;
        margin-bottom: 0.2rem;
      }
      .agent-repeat-card-name {
        flex: 1;
        font-weight: 700;
      }
      .agent-repeat-status {
        border-radius: 999px;
        padding: 0.12rem 0.48rem;
        font-size: 0.6875rem;
        font-weight: 700;
        background: rgba(22, 163, 74, 0.1);
        color: #15803d;
      }
      .agent-repeat-status.paused {
        background: var(--bg-hover);
        color: var(--text-muted);
      }
      /* One wrapping row, dot-separated, so a card is two lines instead of five. */
      .agent-repeat-card-meta {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.1rem 0.4rem;
        color: var(--text-muted);
        font-size: 0.75rem;
      }
      .agent-repeat-card-meta span + span::before {
        content: "·";
        margin-right: 0.4rem;
        color: var(--border-strong, var(--border-subtle));
      }
      .agent-repeat-goal-progress {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 0.3rem 0.65rem;
        align-items: center;
        margin-top: 0.35rem;
      }
      .agent-repeat-goal-progress strong {
        color: var(--text-secondary);
        font-size: 0.75rem;
      }
      .agent-repeat-goal-progress span {
        color: var(--text-muted);
        font-size: 0.6875rem;
        font-variant-numeric: tabular-nums;
      }
      .agent-repeat-goal-track {
        grid-column: 1 / -1;
        height: 7px;
        overflow: hidden;
        border-radius: 999px;
        background: var(--bg-hover);
      }
      .agent-repeat-goal-track i {
        display: block;
        height: 100%;
        border-radius: inherit;
        background: linear-gradient(90deg, #a78bfa, #16a34a);
      }
      body.agent-modal-open {
        overflow: hidden;
      }
      .agent-repeat-modal {
        position: fixed;
        inset: 0;
        z-index: 1000;
        display: flex;
        align-items: center;
        justify-content: center;
        box-sizing: border-box;
        padding: 1.5rem;
      }
      .agent-repeat-modal-backdrop {
        position: absolute;
        inset: 0;
        background: rgba(23, 13, 59, 0.46);
        backdrop-filter: blur(2px);
      }
      .agent-repeat-editor {
        position: relative;
        z-index: 1;
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(220px, 0.45fr);
        gap: 0.9rem 1rem;
        box-sizing: border-box;
        width: min(860px, 100%);
        max-height: calc(100dvh - 3rem);
        overflow-y: auto;
        overscroll-behavior: contain;
        border: 1px solid var(--border-subtle);
        border-radius: 16px;
        background: var(--bg-elevated);
        padding: 1.15rem;
        box-shadow: 0 24px 64px rgba(23, 13, 59, 0.24);
      }
      .agent-repeat-editor-heading,
      .agent-repeat-editor > label:nth-of-type(n + 3),
      .agent-repeat-config-section,
      .agent-repeat-schedule-grid,
      .agent-repeat-editor-actions {
        grid-column: 1 / -1;
      }
      .agent-repeat-editor-heading {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
      }
      .agent-repeat-editor-heading h3 {
        margin: 0;
        font-size: 1.125rem;
      }
      .agent-repeat-editor-heading p {
        margin: 0.25rem 0 0;
        color: var(--text-muted);
        font-size: 0.8125rem;
        font-weight: 400;
        line-height: 1.45;
      }
      .agent-repeat-editor-heading-actions {
        display: flex;
        align-items: center;
        gap: 0.65rem;
        flex: 0 0 auto;
      }
      .agent-repeat-enabled {
        position: relative;
        display: inline-flex !important;
        flex-direction: row !important;
        align-items: center;
        gap: 0.45rem !important;
        min-height: 32px;
        box-sizing: border-box;
        border: 1px solid var(--border-subtle);
        border-radius: 999px;
        background: #f8f7fb;
        padding: 0.3rem 0.6rem 0.3rem 0.4rem;
        cursor: pointer;
      }
      .agent-repeat-enabled input {
        position: absolute;
        width: 1px;
        height: 1px;
        margin: -1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        clip-path: inset(50%);
        white-space: nowrap;
      }
      .agent-repeat-enabled-track {
        position: relative;
        flex: 0 0 auto;
        width: 30px;
        height: 18px;
        box-sizing: border-box;
        border: 1px solid #b8b1c8;
        border-radius: 999px;
        background: #dcd8e5;
        transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
      }
      .agent-repeat-enabled-thumb {
        position: absolute;
        top: 2px;
        left: 2px;
        width: 12px;
        height: 12px;
        border-radius: 50%;
        background: #ffffff;
        box-shadow: 0 1px 2px rgba(23, 13, 59, 0.22);
        transition: transform 0.15s ease;
      }
      .agent-repeat-enabled input:checked + .agent-repeat-enabled-track {
        border-color: #16a34a;
        background: #16a34a;
      }
      .agent-repeat-enabled input:checked + .agent-repeat-enabled-track .agent-repeat-enabled-thumb {
        transform: translateX(12px);
      }
      .agent-repeat-enabled input:focus-visible + .agent-repeat-enabled-track {
        box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.18);
      }
      .agent-repeat-enabled-state {
        min-width: 3.25rem;
        color: var(--text-muted);
        font-size: 0.75rem;
        font-weight: 700;
        line-height: 1;
      }
      .agent-repeat-enabled-state-active {
        display: none;
        color: #15803d;
      }
      .agent-repeat-enabled input:checked ~ .agent-repeat-enabled-state-active {
        display: inline;
      }
      .agent-repeat-enabled input:checked ~ .agent-repeat-enabled-state-inactive {
        display: none;
      }
      .agent-repeat-editor label {
        display: flex;
        flex-direction: column;
        gap: 0.35rem;
        color: var(--text-secondary);
        font-size: 0.75rem;
        font-weight: 700;
      }
      .agent-repeat-editor input:not([type="checkbox"]),
      .agent-repeat-editor select,
      .agent-repeat-editor textarea {
        box-sizing: border-box;
        width: 100%;
        border: 1px solid var(--border-strong);
        border-radius: 9px;
        background: #ffffff;
        color: var(--text-primary);
        padding: 0.55rem 0.65rem;
        font: inherit;
        font-size: 0.875rem;
      }
      .agent-repeat-editor textarea {
        resize: vertical;
        line-height: 1.5;
      }
      .agent-repeat-config-section {
        margin: 0;
        border: 1px solid var(--border-subtle);
        border-radius: 12px;
        background: #fbfaff;
        padding: 0.85rem;
      }
      .agent-repeat-config-section legend {
        padding: 0 0.3rem;
        color: var(--text-primary);
        font-size: 0.8125rem;
        font-weight: 750;
      }
      .agent-repeat-config-section > p {
        margin: 0.55rem 0 0;
        color: var(--text-muted);
        font-size: 0.72rem;
        line-height: 1.45;
      }
      .agent-repeat-config-grid,
      .agent-repeat-goal-fields {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 0.7rem;
      }
      .agent-repeat-goal-fields {
        margin-top: 0.7rem;
      }
      .agent-repeat-editor input:not([type="checkbox"]):focus,
      .agent-repeat-editor select:focus,
      .agent-repeat-editor textarea:focus {
        outline: none;
        border-color: var(--accent-secondary);
        box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
      }
      .agent-repeat-schedule-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
        gap: 0.75rem;
      }
      /* The weekday picker spans the schedule grid: seven day toggles never
         fit one auto-fit column. */
      .agent-repeat-weekdays {
        grid-column: 1 / -1;
        margin: 0;
        padding: 0.5rem 0.75rem 0.7rem;
        border: 1px solid var(--border-subtle);
        border-radius: 10px;
        background: var(--bg-subtle);
      }
      .agent-repeat-weekdays legend {
        padding: 0 0.35rem;
        color: var(--text-secondary);
        font-size: 0.75rem;
        font-weight: 600;
        letter-spacing: 0.02em;
        text-transform: uppercase;
      }
      .agent-repeat-weekday-row {
        display: flex;
        flex-wrap: wrap;
        gap: 0.4rem;
      }
      .agent-repeat-weekday-row label {
        display: inline-flex !important;
        flex-direction: row !important;
        align-items: center;
        gap: 0;
        margin: 0;
        cursor: pointer;
      }
      .agent-repeat-weekday-row input {
        position: absolute;
        opacity: 0;
        width: 0;
        height: 0;
      }
      .agent-repeat-weekday-row span {
        display: inline-block;
        padding: 0.35rem 0.7rem;
        border: 1px solid var(--border-subtle);
        border-radius: 999px;
        background: var(--bg-elevated);
        color: var(--text-secondary);
        font-size: 0.8125rem;
        font-weight: 500;
        transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
      }
      .agent-repeat-weekday-row input:checked + span {
        border-color: #4c1d95;
        background: #4c1d95;
        color: #ffffff;
      }
      .agent-repeat-weekday-row input:focus-visible + span {
        outline: 2px solid #7c3aed;
        outline-offset: 2px;
      }
      .agent-repeat-delivery-report {
        display: flex !important;
        flex-direction: row !important;
        align-items: center;
        gap: 0.5rem;
        grid-column: 1 / -1;
        color: var(--text-secondary);
        font-size: 0.8125rem;
      }
      .agent-repeat-delivery-report input {
        width: auto;
        margin: 0;
      }
      .agent-repeat-time-label {
        position: relative;
      }
      .agent-time-picker {
        position: relative;
        width: 100%;
      }
      .agent-time-trigger {
        display: flex;
        align-items: center;
        gap: 0.55rem;
        box-sizing: border-box;
        width: 100%;
        min-height: 40px;
        border: 1px solid var(--border-strong);
        border-radius: 10px;
        background:
          linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(249, 248, 252, 0.96));
        color: var(--text-primary);
        padding: 0.5rem 0.65rem;
        font: inherit;
        font-size: 0.875rem;
        font-weight: 650;
        cursor: pointer;
        box-shadow: 0 1px 2px rgba(23, 13, 59, 0.04);
        transition:
          border-color 150ms ease,
          box-shadow 150ms ease,
          background 150ms ease,
          transform 150ms ease;
      }
      .agent-time-trigger:hover {
        border-color: rgba(124, 58, 237, 0.42);
        background: #ffffff;
        box-shadow: 0 4px 12px rgba(23, 13, 59, 0.08);
        transform: translateY(-1px);
      }
      .agent-time-trigger:focus-visible,
      .agent-time-picker.open .agent-time-trigger {
        outline: none;
        border-color: var(--accent-secondary);
        box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.11);
      }
      .agent-time-trigger-clock {
        width: 17px;
        height: 17px;
        color: var(--accent-primary);
        flex: 0 0 auto;
      }
      .agent-time-trigger-chevron {
        width: 15px;
        height: 15px;
        margin-left: auto;
        color: var(--text-muted);
        transition: transform 160ms ease;
      }
      .agent-time-picker.open .agent-time-trigger-chevron {
        transform: rotate(180deg);
      }
      .agent-time-popover {
        position: absolute;
        right: 0;
        bottom: calc(100% + 0.55rem);
        z-index: 12;
        box-sizing: border-box;
        width: min(332px, calc(100vw - 3rem));
        border: 1px solid rgba(124, 58, 237, 0.2);
        border-radius: 14px;
        background: rgba(255, 255, 255, 0.98);
        padding: 0.85rem;
        box-shadow:
          0 20px 44px rgba(23, 13, 59, 0.18),
          0 4px 12px rgba(23, 13, 59, 0.08);
        backdrop-filter: blur(18px);
        transform-origin: bottom right;
        animation: agent-time-popover-in 150ms ease-out;
      }
      @keyframes agent-time-popover-in {
        from {
          opacity: 0;
          transform: translateY(6px) scale(0.98);
        }
        to {
          opacity: 1;
          transform: translateY(0) scale(1);
        }
      }
      .agent-time-popover-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
        margin-bottom: 0.7rem;
        color: var(--text-secondary);
        font-size: 0.75rem;
        font-weight: 700;
      }
      .agent-time-preview {
        border-radius: 999px;
        background: rgba(124, 58, 237, 0.09);
        color: var(--accent-primary);
        padding: 0.22rem 0.55rem;
        font-size: 0.75rem;
        font-variant-numeric: tabular-nums;
      }
      .agent-time-wheels {
        display: grid;
        grid-template-columns: minmax(58px, 1fr) auto minmax(68px, 1fr) minmax(72px, 0.9fr);
        align-items: end;
        gap: 0.4rem;
      }
      .agent-time-wheel {
        display: flex;
        min-width: 0;
        flex-direction: column;
        gap: 0.3rem;
      }
      .agent-time-wheel > span {
        color: var(--text-muted);
        font-size: 0.625rem;
        font-weight: 700;
        letter-spacing: 0.055em;
        text-align: center;
        text-transform: uppercase;
      }
      .agent-time-separator {
        align-self: center;
        color: var(--text-muted);
        font-size: 1rem;
        font-weight: 800;
        transform: translateY(10px);
      }
      .agent-time-list,
      .agent-time-period-list {
        height: 148px;
        overflow-y: auto;
        border: 1px solid var(--border-subtle);
        border-radius: 10px;
        background: #f8f7fa;
        padding: 0.25rem;
        scrollbar-width: thin;
        scrollbar-color: rgba(124, 58, 237, 0.25) transparent;
      }
      .agent-time-list:focus-visible,
      .agent-time-period-list:focus-visible {
        outline: none;
        border-color: var(--accent-secondary);
        box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
      }
      .agent-time-list button,
      .agent-time-period-list button {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        min-height: 32px;
        border: 0;
        border-radius: 7px;
        background: transparent;
        color: var(--text-secondary);
        padding: 0.25rem;
        font: inherit;
        font-size: 0.8125rem;
        font-weight: 650;
        font-variant-numeric: tabular-nums;
        cursor: pointer;
        transition: background 120ms ease, color 120ms ease, box-shadow 120ms ease;
      }
      .agent-time-list button:hover,
      .agent-time-period-list button:hover {
        background: rgba(124, 58, 237, 0.08);
        color: var(--accent-primary);
      }
      .agent-time-list button.selected,
      .agent-time-period-list button.selected {
        background: var(--accent-primary);
        color: #ffffff;
        box-shadow: 0 3px 8px rgba(82, 37, 145, 0.24);
      }
      .agent-time-period-list {
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 0.35rem;
      }
      .agent-time-popover-actions {
        display: flex;
        justify-content: space-between;
        gap: 0.5rem;
        margin-top: 0.7rem;
      }
      .agent-time-secondary-btn,
      .agent-time-done-btn {
        border-radius: 8px;
        padding: 0.4rem 0.75rem;
        font: inherit;
        font-size: 0.75rem;
        font-weight: 700;
        cursor: pointer;
        transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
      }
      .agent-time-secondary-btn {
        border: 1px solid var(--border-subtle);
        background: #ffffff;
        color: var(--text-secondary);
      }
      .agent-time-done-btn {
        border: 1px solid var(--accent-primary);
        background: var(--accent-primary);
        color: #ffffff;
        box-shadow: 0 3px 8px rgba(82, 37, 145, 0.2);
      }
      .agent-time-secondary-btn:hover,
      .agent-time-done-btn:hover {
        transform: translateY(-1px);
      }
      .agent-repeat-interval-control {
        display: flex;
        align-items: center;
        gap: 0.4rem;
      }
      .agent-repeat-interval-control input {
        width: 72px;
      }
      .agent-repeat-interval-control span {
        color: var(--text-muted);
        font-weight: 500;
        white-space: nowrap;
      }
      .agent-repeat-editor-actions {
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        gap: 0.6rem;
        padding-top: 0.15rem;
      }
      .agent-repeat-editor-actions .agent-subview-sub {
        margin: 0;
      }
      /* Shared card container for subview content blocks */
      .agent-card {
        border: 1px solid var(--border-subtle);
        border-radius: 14px;
        background: var(--bg-elevated);
        box-shadow: 0 1px 2px rgba(23, 13, 59, 0.04);
        padding: 1rem 1.15rem;
      }
      .agent-card-caption {
        margin: 0 0 0.75rem;
        font-size: 0.75rem;
        font-weight: 700;
        letter-spacing: 0.05em;
        text-transform: uppercase;
        color: var(--text-muted);
      }

      /* Skills view */
      .agent-skills-shared-note {
        margin: -0.75rem 0 1.25rem;
        border: 1px solid #fcd34d;
        background: #fffbeb;
        color: #92400e;
        border-radius: 10px;
        font-size: 0.8125rem;
        line-height: 1.5;
        padding: 0.55rem 0.85rem;
      }
      .agent-skills-list {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        margin-bottom: 1.25rem;
      }
      .agent-skill-row {
        display: flex;
        align-items: baseline;
        gap: 0.7rem;
        border: 1px solid var(--border-subtle);
        border-radius: 12px;
        background: var(--bg-elevated);
        box-shadow: 0 1px 2px rgba(23, 13, 59, 0.04);
        padding: 0.7rem 0.95rem;
        cursor: pointer;
        text-align: left;
        width: 100%;
        transition: border-color 0.12s ease, transform 0.12s ease;
      }
      .agent-skill-row:hover {
        border-color: var(--accent-tertiary);
        transform: translateY(-1px);
      }
      .agent-skill-row .name {
        font-weight: 600;
        font-size: 0.875rem;
        color: var(--accent-primary);
        font-family: ui-monospace, Menlo, monospace;
      }
      .agent-skill-row .desc {
        flex: 1;
        color: var(--text-secondary);
        font-size: 0.8125rem;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
      }
      .agent-skill-editor {
        display: flex;
        flex-direction: column;
        gap: 0.6rem;
        border-top: 1px solid var(--border-subtle);
        padding-top: 1.25rem;
      }
      .agent-skill-editor-row {
        display: grid;
        grid-template-columns: 240px minmax(0, 1fr);
        gap: 0.6rem;
      }
      .agent-skill-editor input,
      .agent-skill-editor textarea {
        border: 1px solid var(--border-strong);
        border-radius: 10px;
        font: inherit;
        font-size: 0.875rem;
        padding: 0.5rem 0.75rem;
        color: var(--text-primary);
        background: #ffffff;
        transition: border-color 0.12s ease, box-shadow 0.12s ease;
      }
      .agent-skill-editor input:focus,
      .agent-skill-editor textarea:focus {
        outline: none;
        border-color: var(--accent-secondary);
        box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
      }
      .agent-skill-editor textarea {
        min-height: 46vh;
        font-family: ui-monospace, Menlo, monospace;
        font-size: 0.8125rem;
        resize: vertical;
      }
      .agent-skill-editor-actions {
        display: flex;
        align-items: center;
        gap: 0.6rem;
      }
      .agent-skill-editor-actions button:disabled {
        opacity: 0.55;
        cursor: wait;
      }
      .agent-skill-editor input:disabled,
      .agent-skill-editor textarea:disabled {
        background: var(--bg-hover);
        color: var(--text-muted);
      }
      #agent-skill-editor-status.error {
        color: #b91c1c;
        font-weight: 600;
      }
      #agent-skill-editor-status.ok {
        color: #15803d;
        font-weight: 600;
      }
      .agent-subview-error {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        border: 1px solid #fecaca;
        background: #fef2f2;
        color: #b91c1c;
        border-radius: 12px;
        font-size: 0.8125rem;
        padding: 0.7rem 0.95rem;
      }

      /* Spend view */
      .agent-spend-table {
        border: 1px solid var(--border-subtle);
        border-radius: 14px;
        background: var(--bg-elevated);
        box-shadow: 0 1px 2px rgba(23, 13, 59, 0.04);
        padding: 0.35rem 1.15rem;
        overflow-x: auto;
      }
      .agent-spend-table:empty {
        display: none;
      }
      .agent-spend-table table {
        width: 100%;
        border-collapse: collapse;
        font-size: 0.875rem;
      }
      .agent-spend-table th,
      .agent-spend-table td {
        text-align: left;
        padding: 0.65rem 0.65rem;
        border-bottom: 1px solid var(--border-subtle);
      }
      .agent-spend-table tbody tr:last-child td {
        border-bottom: 0;
      }
      .agent-spend-table th {
        color: var(--text-muted);
        font-size: 0.6875rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.05em;
      }
      .agent-spend-bar {
        position: relative;
        height: 7px;
        border-radius: 999px;
        background: var(--bg-hover);
        min-width: 120px;
        overflow: hidden;
      }
      .agent-spend-bar i {
        position: absolute;
        inset: 0 auto 0 0;
        border-radius: 999px;
        background: linear-gradient(90deg, #c4b5fd, var(--accent-secondary));
        transition: width 0.25s ease;
      }
      .agent-spend-bar.hot i {
        background: linear-gradient(90deg, #fca5a5, #dc2626);
      }
      .agent-spend-usage {
        display: flex;
        align-items: center;
        gap: 0.5rem;
      }
      .agent-spend-usage .agent-spend-bar {
        flex: 1;
      }
      .agent-spend-pct {
        flex-shrink: 0;
        min-width: 2.5em;
        text-align: right;
        font-size: 0.75rem;
        font-weight: 600;
        color: var(--text-muted);
        font-variant-numeric: tabular-nums;
      }
      .agent-spend-pct.hot {
        color: #dc2626;
      }

      /* Alfred per-user config modal (Users tab) */
      .agent-config-user {
        margin: 0 0 1rem;
        font-weight: 600;
        color: var(--text-primary, #1d1433);
      }
      .agent-config-switch {
        margin-bottom: 1rem;
      }
      .agent-config-usage {
        border: 1px solid var(--border-subtle);
        border-radius: 10px;
        background: rgba(124, 58, 237, 0.05);
        padding: 0.6rem 0.85rem;
        font-size: 0.85rem;
        color: var(--text-muted);
        margin-bottom: 1.15rem;
      }
      .agent-config-form .field-group {
        margin-bottom: 1rem;
      }
      .agent-config-hint {
        display: block;
        margin-top: 0.3rem;
        font-size: 0.75rem;
        color: var(--text-muted);
      }
      .agent-config-actions {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        gap: 0.75rem;
        margin-top: 1.4rem;
      }
      .agent-config-remove {
        margin-right: auto;
      }

      /* Report download card */
      .agent-report-card {
        align-self: flex-start;
        display: flex;
        align-items: center;
        gap: 0.75rem;
        border: 1px solid var(--border-subtle);
        border-radius: 14px;
        background: var(--bg-elevated);
        box-shadow: 0 1px 2px rgba(23, 13, 59, 0.04);
        padding: 0.7rem 0.95rem;
      }
      .agent-report-card .icon {
        font-size: 1.3rem;
      }
      .agent-report-card .meta {
        display: flex;
        flex-direction: column;
      }
      .agent-report-card .title {
        font-weight: 600;
        font-size: 0.875rem;
        color: var(--text-primary);
      }
      .agent-report-card .sub {
        color: var(--text-muted);
        font-size: 0.75rem;
      }
      .agent-report-card .agent-send-btn {
        padding: 0.35rem 0.75rem;
        font-size: 0.8125rem;
      }
      .agent-report-view-btn {
        border: 1px solid var(--border-strong);
        border-radius: 10px;
        background: transparent;
        color: var(--text-primary);
        font-weight: 600;
        font-size: 0.8125rem;
        padding: 0.35rem 0.75rem;
        cursor: pointer;
        transition: background 0.12s ease;
      }
      .agent-report-view-btn:hover {
        background: var(--bg-hover, rgba(23, 13, 59, 0.05));
      }

      /* ---- Clarifying question card (ask_user) ---- */
      .agent-question-card {
        align-self: stretch;
        display: flex;
        flex-direction: column;
        gap: 0.6rem;
        border: 1px solid var(--border-strong);
        border-radius: 14px;
        background: var(--bg-elevated);
        box-shadow: 0 1px 2px rgba(23, 13, 59, 0.04);
        padding: 1rem 1.1rem;
        margin: 0.25rem 0;
      }
      .agent-question-card.answered {
        opacity: 0.6;
      }
      .agent-question-title {
        font-weight: 600;
        font-size: 0.95rem;
        color: var(--text-primary);
        line-height: 1.4;
      }
      .agent-question-hint {
        font-size: 0.75rem;
        color: var(--text-muted);
        margin-top: -0.3rem;
      }
      .agent-question-options {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
      }
      .agent-question-option {
        display: flex;
        flex-direction: column;
        gap: 0.15rem;
        text-align: left;
        width: 100%;
        border: 1px solid var(--border-subtle);
        border-radius: 10px;
        background: var(--bg);
        padding: 0.6rem 0.8rem;
        cursor: pointer;
        transition: border-color 0.12s ease, background 0.12s ease;
      }
      .agent-question-option:hover:not(:disabled) {
        border-color: var(--accent-tertiary);
        background: var(--bg-hover);
      }
      .agent-question-option.selected {
        border-color: var(--accent-primary);
        background: var(--bg-hover);
      }
      .agent-question-option:disabled {
        cursor: default;
      }
      .agent-question-option .opt-label {
        font-weight: 550;
        font-size: 0.875rem;
        color: var(--text-primary);
      }
      .agent-question-option .opt-desc {
        font-size: 0.78rem;
        color: var(--text-secondary);
        line-height: 1.35;
      }
      .agent-question-custom {
        display: flex;
      }
      .agent-question-custom-input {
        width: 100%;
        resize: vertical;
        min-height: 2.2rem;
        border: 1px solid var(--border-subtle);
        border-radius: 10px;
        background: var(--bg);
        color: var(--text-primary);
        font: inherit;
        font-size: 0.875rem;
        padding: 0.5rem 0.7rem;
      }
      .agent-question-custom-input:focus {
        outline: none;
        border-color: var(--accent-primary);
      }
      .agent-question-submit.agent-send-btn {
        align-self: flex-end;
        padding: 0.4rem 1rem;
        font-size: 0.8125rem;
      }

      /* ---- Topbar ---- */
      .alfred-topbar {
        display: flex;
        align-items: center;
        gap: 0.6rem;
        height: 56px; /* matches .agent-sessions-head so the border lines meet */
        padding: 0 1.25rem;
        border-bottom: 1px solid var(--border-subtle);
        background: var(--bg-elevated);
      }
      .agent-sessions-toggle {
        display: none;
        border: 1px solid var(--border-strong);
        background: #ffffff;
        border-radius: 8px;
        width: 32px;
        height: 32px;
        cursor: pointer;
      }
      .alfred-title {
        font-weight: 600;
        font-size: 0.9375rem;
        letter-spacing: -0.01em;
        color: var(--text-primary);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }
      .agent-folder-select {
        max-width: 180px;
        min-width: 110px;
        border: 1px solid var(--border-subtle);
        border-radius: 8px;
        background-color: var(--bg);
        color: var(--text-secondary);
        padding: 0.3rem 1.6rem 0.3rem 0.5rem;
        font-size: 0.75rem;
        cursor: pointer;
      }
      #top-panel-alfred .agent-modern-select {
        appearance: none;
        -webkit-appearance: none;
        border: 1px solid var(--border-strong);
        border-radius: 10px;
        background-color: #ffffff;
        background-image:
          linear-gradient(45deg, transparent 50%, #7c6f91 50%),
          linear-gradient(135deg, #7c6f91 50%, transparent 50%),
          linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(249, 248, 252, 0.98));
        background-position:
          calc(100% - 14px) calc(50% - 1px),
          calc(100% - 10px) calc(50% - 1px),
          0 0;
        background-repeat: no-repeat;
        background-size: 4px 4px, 4px 4px, 100% 100%;
        color: var(--text-primary);
        padding-right: 2rem;
        cursor: pointer;
        box-shadow: 0 1px 2px rgba(23, 13, 59, 0.04);
        transition:
          border-color 150ms ease,
          box-shadow 150ms ease,
          background-color 150ms ease,
          transform 150ms ease;
      }
      #top-panel-alfred .agent-modern-select:hover {
        border-color: rgba(124, 58, 237, 0.42);
        background-color: #ffffff;
        box-shadow: 0 4px 12px rgba(23, 13, 59, 0.07);
        transform: translateY(-1px);
      }
      #top-panel-alfred .agent-modern-select:focus-visible {
        outline: none;
        border-color: var(--accent-secondary);
        box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.11);
      }
      #top-panel-alfred .agent-modern-select:disabled {
        opacity: 0.55;
        cursor: not-allowed;
        transform: none;
        box-shadow: none;
      }
      .agent-topbar-spacer {
        flex: 1;
      }
      .agent-icon-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border: 0;
        background: transparent;
        color: var(--text-muted);
        border-radius: 8px;
        width: 32px;
        height: 32px;
        padding: 0;
        cursor: pointer;
        flex: 0 0 auto;
        transition: background 0.12s ease, color 0.12s ease;
      }
      .agent-icon-btn svg {
        width: 15px;
        height: 15px;
        display: block;
      }
      .agent-icon-btn:hover {
        background: var(--bg-hover);
        color: var(--accent-primary);
      }
      .agent-icon-btn:disabled {
        cursor: not-allowed;
        opacity: 0.42;
      }
      .agent-icon-btn:disabled:hover {
        background: transparent;
        color: var(--text-muted);
      }
      .agent-title-edit {
        border: 1px solid var(--accent-secondary);
        border-radius: 8px;
        font: inherit;
        font-weight: 600;
        font-size: 0.9375rem;
        color: var(--text-primary);
        padding: 0.2rem 0.5rem;
        min-width: 220px;
        outline: none;
        box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
      }
      .agent-archived {
        border-top: 1px solid var(--border-subtle);
        padding: 0.25rem 0.5rem;
        flex: 0 0 auto;
      }
      .agent-archived summary {
        cursor: pointer;
        list-style: none;
        color: var(--text-muted);
        font-size: 0.6875rem;
        font-weight: 700;
        letter-spacing: 0.05em;
        text-transform: uppercase;
        padding: 0.45rem 0.6rem;
        border-radius: 8px;
        user-select: none;
      }
      .agent-archived summary:hover {
        background: var(--bg-hover);
      }
      .agent-archived summary::before {
        content: "▸";
        display: inline-block;
        margin-right: 0.4rem;
        transition: transform 0.12s ease;
      }
      .agent-archived[open] summary::before {
        transform: rotate(90deg);
      }
      .agent-archived-list {
        padding: 0.15rem 0 0.3rem;
        max-height: 30vh;
      }
      .agent-archived-list .agent-session-row {
        color: var(--text-muted);
      }
      .agent-model-chip {
        font-size: 0.625rem;
        font-weight: 700;
        letter-spacing: 0.04em;
        text-transform: uppercase;
        color: #6d28d9;
        background: rgba(124, 58, 237, 0.12);
        border-radius: 999px;
        padding: 0.14rem 0.55rem;
      }

      /* ---- Chat scroll area ---- */
      .alfred-scroll {
        overflow-y: auto;
        min-height: 0;
        padding: 1.5rem 1.5rem 0.75rem;
        scroll-behavior: smooth;
      }
      /* One reading-column width, shared by the thread, composer and banners so
         they line up. Wide enough to use the right-hand space (tables, SQL, logs)
         while still capping line length on very wide monitors. */
      /* Host for the per-session thread containers: parallel chats each keep
         their own container so a background run can keep rendering off-screen. */
      .agent-thread-host {
        display: contents;
      }
      .alfred-thread {
        max-width: 1120px;
        margin: 0 auto;
        display: flex;
        flex-direction: column;
        gap: 1.1rem;
        width: 100%;
      }
      .alfred-thread[hidden] {
        display: none;
      }

      /* Bubble + meta footer, aligned to one side */
      .agent-msg-group {
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
        min-width: 0;
        max-width: 100%;
      }
      .agent-msg-group.user {
        align-self: flex-end;
        align-items: flex-end;
        max-width: 80%;
      }
      .agent-msg-group.assistant {
        align-self: stretch;
        align-items: stretch;
      }
      .agent-msg-meta {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        padding: 0 0.35rem;
        font-size: 0.6875rem;
        color: var(--text-muted);
      }
      .agent-msg-meta.user {
        justify-content: flex-end;
      }
      .agent-msg-meta .cost {
        font-weight: 600;
        color: #6d28d9;
        background: rgba(124, 58, 237, 0.12);
        border-radius: 999px;
        padding: 0.05rem 0.45rem;
      }
      /* Whole-message copy, sharing the meta row with the timestamp and cost.
         Borderless and small so it does not outweigh 11px muted text. */
      .agent-msg-copy {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 20px;
        height: 20px;
        padding: 0;
        border: 0;
        border-radius: 5px;
        background: none;
        color: inherit;
        cursor: pointer;
        opacity: 0.6;
        transition: opacity 0.12s ease, color 0.12s ease, background 0.12s ease;
      }
      .agent-msg-group:hover .agent-msg-copy,
      .agent-msg-copy:focus-visible,
      .agent-msg-copy.copied {
        opacity: 1;
      }
      .agent-msg-copy:hover {
        color: var(--accent-primary);
        background: rgba(124, 58, 237, 0.1);
      }
      .agent-msg-copy.copied {
        color: #15803d;
      }
      .agent-msg-copy svg {
        width: 13px;
        height: 13px;
        fill: none;
        stroke: currentColor;
        stroke-width: 1.5;
        stroke-linecap: round;
        stroke-linejoin: round;
      }

      /* Empty state */
      .alfred-empty {
        max-width: 640px;
        margin: 14vh auto 0;
        text-align: center;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
      }
      .agent-empty-mark {
        width: 52px;
        height: 52px;
        border-radius: 16px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: linear-gradient(135deg, rgba(168, 85, 247, 0.16), rgba(109, 40, 217, 0.1));
        color: var(--accent-primary);
        margin-bottom: 0.35rem;
      }
      .agent-empty-mark svg {
        width: 26px;
        height: 26px;
      }
      .alfred-empty h2 {
        margin: 0.4rem 0 0;
        font-size: 1.25rem;
        letter-spacing: -0.01em;
        color: var(--text-primary);
      }
      .alfred-empty p {
        margin: 0;
        color: var(--text-secondary);
        font-size: 0.9375rem;
        line-height: 1.6;
      }
      .agent-empty-prompts {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.6rem;
        margin-top: 1.1rem;
      }
      .agent-empty-prompt {
        border: 1px solid var(--border-subtle);
        background: #ffffff;
        color: var(--text-secondary);
        border-radius: 12px;
        font-size: 0.8125rem;
        padding: 0.55rem 0.95rem;
        cursor: pointer;
        box-shadow: 0 1px 2px rgba(23, 13, 59, 0.04);
        transition: border-color 0.12s ease, color 0.12s ease, transform 0.12s ease;
      }
      .agent-empty-prompt:hover {
        border-color: var(--accent-tertiary);
        color: var(--accent-primary);
        transform: translateY(-1px);
      }

      /* Messages */
      @keyframes agentMsgIn {
        from {
          opacity: 0;
          transform: translateY(4px);
        }
        to {
          opacity: 1;
          transform: translateY(0);
        }
      }
      .agent-msg {
        max-width: 100%;
        padding: 0.7rem 1rem;
        border-radius: 16px;
        font-size: 0.9375rem;
        line-height: 1.55;
        overflow-wrap: break-word;
        animation: agentMsgIn 0.18s ease;
      }
      @media (prefers-reduced-motion: reduce) {
        .agent-msg,
        .agent-activity,
        .agent-report-card {
          animation: none;
        }
      }
      .agent-msg.user {
        align-self: flex-end;
        background: #1d1235;
        color: #ffffff;
        border-bottom-right-radius: 5px;
        white-space: pre-wrap;
        box-shadow: 0 2px 6px rgba(23, 13, 59, 0.16);
      }
      .agent-msg.assistant {
        align-self: flex-start;
        background: var(--bg-elevated);
        color: var(--text-primary);
        border: 1px solid var(--border-subtle);
        border-bottom-left-radius: 5px;
        box-shadow: 0 1px 2px rgba(23, 13, 59, 0.04);
      }
      .agent-msg.assistant.failed {
        border-color: #fca5a5;
      }
      .agent-msg-md p {
        margin: 0 0 0.6rem;
      }
      .agent-msg-md p:last-child {
        margin-bottom: 0;
      }
      .agent-msg-md pre {
        background: #faf9fd;
        border: 1px solid var(--border-subtle);
        border-radius: 10px;
        padding: 0.65rem 0.8rem;
        overflow-x: auto;
        font-size: 0.8125rem;
      }
      .agent-code-block {
        position: relative;
        margin: 0 0 0.6rem;
      }
      .agent-code-block:last-child {
        margin-bottom: 0;
      }
      .agent-code-block > pre {
        margin: 0;
        padding-right: 2.4rem;
      }
      .agent-code-copy {
        position: absolute;
        top: 6px;
        right: 6px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 26px;
        height: 26px;
        padding: 0;
        border: 1px solid var(--border-subtle);
        border-radius: 7px;
        background: var(--bg-elevated);
        color: var(--text-secondary);
        cursor: pointer;
        /* Always present so it is discoverable, dimmed until the block is
           hovered or the button is focused. */
        opacity: 0.55;
        transition: opacity 0.12s ease, color 0.12s ease, border-color 0.12s ease;
      }
      .agent-code-block:hover .agent-code-copy,
      .agent-code-copy:focus-visible,
      .agent-code-copy.copied {
        opacity: 1;
      }
      .agent-code-copy:hover {
        color: var(--accent-primary);
        border-color: var(--accent-primary);
      }
      .agent-code-copy.copied {
        color: #15803d;
        border-color: #86efac;
      }
      .agent-code-copy svg {
        width: 14px;
        height: 14px;
        fill: none;
        stroke: currentColor;
        stroke-width: 1.5;
        stroke-linecap: round;
        stroke-linejoin: round;
      }
      .agent-msg-md code {
        font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
        font-size: 0.85em;
        background: rgba(124, 58, 237, 0.08);
        border-radius: 5px;
        padding: 0.08em 0.3em;
      }
      .agent-msg-md pre code {
        background: transparent;
        padding: 0;
      }
      .agent-msg-md table {
        border-collapse: collapse;
        margin: 0.5rem 0;
        font-size: 0.8125rem;
      }
      .agent-msg-md th,
      .agent-msg-md td {
        border: 1px solid var(--border-strong);
        padding: 0.35rem 0.6rem;
        text-align: left;
      }
      .agent-msg-md th {
        background: var(--bg-hover);
      }
      .agent-msg-md ul,
      .agent-msg-md ol {
        margin: 0.25rem 0 0.6rem;
        padding-left: 1.4rem;
      }

      /* Typing indicator */
      .agent-typing {
        align-self: flex-start;
        display: inline-flex;
        gap: 4px;
        padding: 0.8rem 1rem;
      }
      .agent-typing i {
        width: 6px;
        height: 6px;
        border-radius: 50%;
        background: var(--accent-tertiary);
        animation: agentTypingPulse 1.2s ease-in-out infinite;
      }
      .agent-typing i:nth-child(2) {
        animation-delay: 0.15s;
      }
      .agent-typing i:nth-child(3) {
        animation-delay: 0.3s;
      }
      @keyframes agentTypingPulse {
        0%, 60%, 100% {
          opacity: 0.25;
          transform: translateY(0);
        }
        30% {
          opacity: 1;
          transform: translateY(-3px);
        }
      }

      /* Activity feed (collapsible tool progress) */
      .agent-activity {
        align-self: stretch;
        max-width: 100%;
        border: 1px solid var(--border-subtle);
        border-radius: 12px;
        background: var(--bg-elevated);
        box-shadow: 0 1px 2px rgba(23, 13, 59, 0.04);
        font-size: 0.8125rem;
        animation: agentMsgIn 0.18s ease;
      }
      .agent-activity summary {
        cursor: pointer;
        padding: 0.55rem 0.85rem;
        color: var(--text-muted);
        font-weight: 600;
        user-select: none;
        list-style: none;
        border-radius: 12px;
        transition: color 0.12s ease;
      }
      .agent-activity summary:hover {
        color: var(--text-primary);
      }
      .agent-activity summary::before {
        content: "▸";
        display: inline-block;
        margin-right: 0.45rem;
        color: var(--accent-tertiary);
        transition: transform 0.12s ease;
      }
      .agent-activity[open] summary::before {
        transform: rotate(90deg);
      }
      .agent-activity[open] summary {
        border-bottom: 1px solid var(--border-subtle);
        border-radius: 12px 12px 0 0;
      }
      .agent-activity-rows {
        max-height: 260px;
        overflow-y: auto;
        padding: 0.5rem 0.85rem 0.6rem;
        display: flex;
        flex-direction: column;
        gap: 0.35rem;
      }
      .agent-activity-row {
        display: flex;
        align-items: baseline;
        gap: 0.5rem;
        color: var(--text-secondary);
      }
      .agent-activity-row .marker {
        flex: 0 0 auto;
        width: 14px;
        text-align: center;
      }
      .agent-activity-row.live .marker {
        display: inline-block;
        width: 8px;
        height: 8px;
        margin: 0 3px;
        border-radius: 50%;
        background: var(--accent-secondary);
        animation: agentTypingPulse 1.2s ease-in-out infinite;
      }
      .agent-activity-row.done .marker::before {
        content: "✓";
        color: #16a34a;
        font-weight: 700;
      }
      .agent-activity-row.error .marker::before {
        content: "✕";
        color: #dc2626;
        font-weight: 700;
      }
      .agent-activity-row.escalation {
        background: rgba(124, 58, 237, 0.1);
        color: #6d28d9;
        border-radius: 8px;
        padding: 0.25rem 0.45rem;
      }
      .agent-activity-row .detail {
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
      }

      /* Jump-to-latest pill */
      .agent-jump-latest {
        position: sticky;
        bottom: 0.5rem;
        align-self: center;
        border: 1px solid var(--border-subtle);
        background: #ffffff;
        color: var(--text-secondary);
        border-radius: 999px;
        font-size: 0.75rem;
        font-weight: 600;
        padding: 0.35rem 0.9rem;
        cursor: pointer;
        box-shadow: var(--panel-shadow);
      }
      .agent-jump-latest:hover {
        color: var(--accent-primary);
      }

      /* Budget banner */
      .agent-budget-banner {
        margin: 0 auto 0.5rem;
        max-width: 1120px;
        width: calc(100% - 3rem);
        border: 1px solid #fcd34d;
        background: #fffbeb;
        color: #92400e;
        border-radius: 12px;
        font-size: 0.8125rem;
        padding: 0.6rem 0.9rem;
        text-align: center;
      }

      /* Composer */
      .agent-composer {
        display: flex;
        align-items: flex-end;
        gap: 0.6rem;
        padding: 0.5rem 1.5rem 1.15rem;
        background: var(--bg);
      }
      .agent-composer-inner {
        display: flex;
        align-items: flex-end;
        gap: 0.6rem;
        width: 100%;
        max-width: 1120px;
        margin: 0 auto;
        border: 1px solid var(--border-strong);
        border-radius: 16px;
        background: #ffffff;
        padding: 0.6rem 0.6rem 0.6rem 1rem;
        box-shadow: 0 1px 2px rgba(23, 13, 59, 0.04), 0 8px 24px rgba(23, 13, 59, 0.05);
        transition: border-color 0.12s ease, box-shadow 0.12s ease;
      }
      .agent-composer-inner:focus-within {
        border-color: var(--accent-secondary);
        box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12), 0 8px 24px rgba(23, 13, 59, 0.05);
      }
      #agent-composer-input {
        flex: 1;
        border: 0;
        outline: none;
        resize: none;
        font: inherit;
        font-size: 0.9375rem;
        line-height: 1.45;
        color: var(--text-primary);
        background: transparent;
        max-height: 11rem;
        align-self: center;
      }
      #agent-composer-input::placeholder {
        color: var(--text-muted);
      }
      #agent-composer-input:disabled {
        color: var(--text-muted);
      }
      .agent-send-btn,
      .agent-stop-btn {
        border: 0;
        border-radius: 10px;
        font-weight: 600;
        font-size: 0.875rem;
        padding: 0.5rem 1.05rem;
        cursor: pointer;
        transition: background 0.12s ease, opacity 0.12s ease;
      }
      .agent-send-btn {
        background: #1d1235;
        color: #ffffff;
      }
      .agent-send-btn:hover:not(:disabled) {
        background: #2a1d4d;
      }
      .agent-send-btn:disabled {
        opacity: 0.45;
        cursor: default;
      }
      .agent-stop-btn {
        background: #fee2e2;
        color: #b91c1c;
      }
      .agent-stop-btn:hover {
        background: #fecaca;
      }

      /* Attach ("+") button opens the composer's hidden file input. */
      .agent-attach-btn {
        position: relative;
        flex: 0 0 auto;
        align-self: flex-end;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 34px;
        height: 34px;
        border: 1px solid var(--border-strong);
        background: #ffffff;
        color: var(--text-muted);
        border-radius: 10px;
        cursor: pointer;
        transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
      }
      .agent-attach-btn svg {
        flex: 0 0 auto;
        width: 16px;
        height: 16px;
        display: block;
      }
      .agent-attach-btn:hover {
        background: var(--bg-hover);
        color: var(--accent-primary);
        border-color: var(--accent-tertiary);
      }
      .agent-attach-tooltip {
        position: absolute;
        bottom: calc(100% + 8px);
        left: 0;
        white-space: nowrap;
        background: #1d1235;
        color: #ffffff;
        font-size: 0.75rem;
        padding: 0.35rem 0.6rem;
        border-radius: 8px;
        box-shadow: var(--panel-shadow);
        opacity: 0;
        pointer-events: none;
        transform: translateY(3px);
        transition: opacity 0.12s ease, transform 0.12s ease;
      }
      .agent-attach-btn:hover .agent-attach-tooltip,
      .agent-attach-btn:focus-visible .agent-attach-tooltip {
        opacity: 1;
        transform: translateY(0);
      }

      /* Staged attachments shown as removable chips above the composer row. */
      .agent-attach-chips {
        display: flex;
        flex-wrap: wrap;
        gap: 0.35rem;
        padding: 0 0.25rem 0.4rem;
      }
      .agent-attach-chip {
        display: inline-flex;
        align-items: center;
        gap: 0.3rem;
        max-width: 240px;
        border: 1px solid var(--border-strong);
        background: #ffffff;
        border-radius: 999px;
        padding: 0.2rem 0.3rem 0.2rem 0.6rem;
        font-size: 0.78rem;
        color: var(--text-muted);
      }
      .agent-attach-chip-name {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
      .agent-attach-chip-remove {
        flex: 0 0 auto;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 18px;
        height: 18px;
        border: none;
        border-radius: 50%;
        background: transparent;
        color: var(--text-muted);
        font-size: 0.9rem;
        line-height: 1;
        cursor: pointer;
      }
      .agent-attach-chip-remove:hover {
        background: var(--bg-hover);
        color: var(--accent-primary);
      }

      /* Attachment chips inside a sent user bubble (filename only, no bytes). */
      .agent-msg-attachments {
        display: flex;
        flex-wrap: wrap;
        gap: 0.3rem;
        margin-bottom: 0.35rem;
      }
      .agent-msg-attachment {
        display: inline-flex;
        align-items: center;
        max-width: 240px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        border-radius: 999px;
        padding: 0.15rem 0.55rem;
        font-size: 0.75rem;
        background: rgba(255, 255, 255, 0.18);
      }
      .agent-msg-attachments:last-child {
        margin-bottom: 0;
      }

      /* Loading states reuse the DialNexa pulsing-mark loader
         (.section-loading-mark, defined in 08-modern-content.css). */
      .agent-sessions-loading {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.25rem;
        padding: 1.5rem 0.75rem;
        color: var(--text-muted);
        font-size: 0.8125rem;
      }
      .agent-sessions-loading .section-loading-mark {
        width: 72px;
        height: 58px;
      }
      .agent-thread-loading {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 14vh 0;
      }
      .agent-thread-loading .section-loading-mark {
        width: 140px;
        height: 113px;
      }

      /* Skills / Spend subview loaders */
      .agent-subview-loading {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.6rem;
        padding: 2.5rem 0;
        color: var(--text-muted);
        font-size: 0.8125rem;
      }
      .agent-subview-loading .section-loading-mark {
        width: 96px;
        height: 78px;
      }

      /* Interrupted-turn resume card */
      .agent-resume-card {
        align-self: flex-start;
        display: flex;
        align-items: center;
        gap: 0.75rem;
        border: 1px solid var(--border-subtle);
        border-left: 3px solid var(--accent-primary);
        border-radius: 14px;
        background: var(--bg-elevated);
        box-shadow: 0 1px 2px rgba(23, 13, 59, 0.04);
        padding: 0.7rem 0.95rem;
      }
      .agent-resume-card .agent-resume-text {
        color: var(--text-secondary);
        font-size: 0.8125rem;
      }
      .agent-resume-card .agent-send-btn {
        padding: 0.35rem 0.75rem;
        font-size: 0.8125rem;
        flex: 0 0 auto;
      }

      /* ---- Mobile: sessions list becomes an off-canvas drawer ---- */
      @media (max-width: 760px) {
        .alfred-layout {
          grid-template-columns: minmax(0, 1fr);
        }
        .agent-sessions {
          position: fixed;
          top: var(--sticky-header-offset, 0px);
          bottom: 0;
          left: 0;
          width: min(320px, 85vw);
          z-index: 40;
          transform: translateX(-100%);
          transition: transform 0.18s ease;
          box-shadow: 0 12px 40px rgba(23, 13, 59, 0.18);
        }
        .alfred-layout.sessions-open .agent-sessions {
          transform: translateX(0);
        }
        .alfred-layout.sessions-open::after {
          content: "";
          position: fixed;
          inset: var(--sticky-header-offset, 0px) 0 0;
          z-index: 30;
          background: rgba(23, 13, 59, 0.2);
          backdrop-filter: blur(1px);
          pointer-events: none;
        }
        .agent-sessions-close {
          display: inline-flex;
        }
        .agent-sessions-toggle {
          display: inline-flex;
          align-items: center;
          justify-content: center;
        }
        .alfred-scroll {
          padding: 1rem 1rem 0.5rem;
        }
        .agent-composer {
          padding: 0.5rem 1rem 1rem;
        }
        .agent-budget-banner {
          width: calc(100% - 2rem);
        }
        .agent-folder-select {
          max-width: 120px;
          min-width: 80px;
        }
        .agent-repeat-editor {
          grid-template-columns: 1fr;
          width: 100%;
          max-height: 92dvh;
          border-radius: 16px 16px 0 0;
        }
        .agent-repeat-modal {
          align-items: flex-end;
          padding: 0;
        }
        .agent-repeat-editor-heading {
          align-items: flex-start;
        }
        .agent-repeat-editor-heading-actions {
          flex-direction: column-reverse;
          align-items: flex-end;
        }
        .agent-repeat-editor > label {
          grid-column: 1 / -1;
        }
        .agent-repeat-schedule-grid {
          grid-template-columns: 1fr;
        }
        .agent-time-popover {
          right: auto;
          left: 0;
          width: 100%;
          min-width: 0;
          transform-origin: bottom left;
        }
      }

      /* ── Users tab → Alfred sub-tab (leaderboard + analytics) ── */
      .users-agent-toolbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
        margin-bottom: 0.5rem;
        flex-wrap: wrap;
      }
      .users-agent-toolbar .settings-description { margin: 0; }
      /* Leaderboard rows open a per-user analytics popup: give them a clear
         clickable affordance - pointer cursor plus a hover tint stronger than
         the generic table hover, with an accent bar on the leading edge. */
      .users-agent-row { cursor: pointer; }
      .users-agent-row td { transition: background-color 0.12s ease; }
      .users-agent-row:hover td,
      .users-agent-row:focus-visible td {
        background: #ede9fe;
      }
      .users-agent-row:hover td:first-child,
      .users-agent-row:focus-visible td:first-child {
        box-shadow: inset 3px 0 0 var(--accent-primary, #6d28d9);
      }
      .users-agent-row:focus-visible { outline: none; }
      .users-agent-rank {
        color: var(--text-muted);
        font-variant-numeric: tabular-nums;
        width: 2rem;
      }
      .users-agent-override-pill {
        display: inline-block;
        margin-left: 0.5rem;
        padding: 0.05rem 0.45rem;
        border: 1px solid var(--border-strong);
        border-radius: 999px;
        font-size: 0.7rem;
        color: var(--text-muted);
        vertical-align: middle;
      }
      .users-agent-consumption { min-width: 10rem; }
      .users-agent-amount {
        font-weight: 600;
        font-variant-numeric: tabular-nums;
      }
      .users-agent-limit {
        color: var(--text-muted);
        font-size: 0.8rem;
      }
      .users-agent-meter {
        height: 5px;
        margin-top: 4px;
        border-radius: 3px;
        background: var(--border-subtle);
        overflow: hidden;
        max-width: 12rem;
      }
      .users-agent-meter-fill {
        height: 100%;
        border-radius: 3px;
        background: var(--accent-primary);
      }
      .users-agent-meter-fill.warn { background: #d97706; }
      .users-agent-meter-fill.over { background: #dc2626; }
      /* Per-user analytics popup: wider than the default modal so the chart
         and the two side-by-side tables fit; scrolls when content is tall. */
      .users-agent-modal-panel {
        width: min(94vw, 920px);
        max-height: 88vh;
        overflow-y: auto;
      }
      .users-agent-stat-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
        gap: 0.75rem;
        margin-bottom: 1.25rem;
      }
      .users-agent-stat {
        border: 1px solid var(--border-subtle);
        border-radius: 8px;
        padding: 0.75rem 1rem;
        background: var(--bg-surface);
      }
      .users-agent-stat-label {
        font-size: 0.75rem;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.04em;
      }
      .users-agent-stat-value {
        font-size: 1.25rem;
        font-weight: 600;
        font-variant-numeric: tabular-nums;
        margin-top: 0.15rem;
      }
      .users-agent-stat-hint {
        font-size: 0.8rem;
        color: var(--text-secondary);
        margin-top: 0.15rem;
      }
      .users-agent-section-title {
        margin: 0 0 0.5rem;
        font-size: 0.9rem;
      }
      .users-agent-chart {
        display: flex;
        align-items: flex-end;
        gap: 2px;
        height: 120px;
        padding: 0.25rem 0;
        margin-bottom: 1.25rem;
        border-bottom: 1px solid var(--border-subtle);
      }
      .users-agent-chart-bar {
        flex: 1;
        min-width: 3px;
        border-radius: 2px 2px 0 0;
        background: var(--accent-tertiary);
      }
      .users-agent-chart-bar.zero { background: var(--border-subtle); }
      .users-agent-detail-columns {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1.25rem;
      }
      @media (max-width: 900px) {
        .users-agent-detail-columns { grid-template-columns: 1fr; }
      }
.agent-memory-section {
  margin-top: 24px;
}

.agent-memory-section > h3 {
  margin: 0 0 10px;
  font-size: 14px;
}

.agent-memory-section .agent-skill-row > div {
  min-width: 0;
  flex: 1;
}

.agent-memory-section .agent-skill-row p {
  margin: 4px 0 0;
  color: var(--text-muted);
  white-space: pre-wrap;
}

      /* ── Tech › Tasks: Latency Infra wizard ──
         Native 4-step wizard (Discovery → Select → Deploy → Test). The card grid
         entry reuses .ops-* styles from 02-operations.css; these rules cover the
         wizard itself, translated to the DialNexa light theme. */
      #top-panel-tech-tasks,
      #top-panel-tech-tasks .users-card,
      #tech-sub-panel-latency-infra,
      .li-wizard,
      .li-panel,
      .li-step-body {
        box-sizing: border-box;
        min-width: 0;
        max-width: 100%;
      }
      .li-wizard { position: relative; display: flex; flex-direction: column; gap: 1rem; }

      /* Stepper */
      .li-stepper {
        list-style: none;
        margin: 0;
        padding: 0;
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 0.6rem;
      }
      .li-stepper > li { min-width: 0; }
      .li-step {
        box-sizing: border-box;
        min-width: 0;
        width: 100%;
        display: flex;
        align-items: flex-start;
        gap: 0.6rem;
        text-align: left;
        padding: 0.7rem 0.8rem;
        border: 1px solid var(--border-subtle);
        border-radius: 12px;
        background: var(--bg-surface);
        cursor: pointer;
        transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
      }
      .li-step:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(17,12,46,0.06); }
      .li-step:disabled { opacity: 0.55; cursor: not-allowed; }
      .li-step.is-active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
      .li-step-index {
        flex: 0 0 auto;
        width: 1.6rem; height: 1.6rem;
        display: grid; place-items: center;
        border-radius: 999px;
        background: var(--bg-hover);
        color: var(--text-muted);
        font-weight: 700; font-size: 0.85rem;
      }
      .li-step.is-active .li-step-index { background: var(--accent); color: #fff; }
      .li-step.is-complete .li-step-index { background: #16a34a; color: #fff; }
      .li-step-text { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
      .li-step-title { font-weight: 600; font-size: 0.9rem; overflow-wrap: anywhere; }
      .li-step-sub { font-size: 0.75rem; color: var(--text-muted); overflow-wrap: anywhere; }

      /* Panel head + control bar */
      .li-panel-head {
        display: flex; align-items: flex-start; justify-content: space-between;
        gap: 0.75rem; flex-wrap: wrap; margin-bottom: 0.75rem;
      }
      .li-controlbar { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
      .li-danger { border-color: rgba(239,68,68,0.45) !important; color: #b91c1c !important; }

      .li-status {
        margin: 0 0 0.75rem;
        padding: 0.55rem 0.75rem;
        border-radius: 10px;
        font-size: 0.85rem;
        border: 1px solid var(--border-subtle);
        background: var(--bg-hover);
      }
      .li-status.is-error { border-color: rgba(239,68,68,0.4); background: rgba(239,68,68,0.08); color: #991b1b; }
      .li-status.is-success { border-color: rgba(22,163,74,0.4); background: rgba(22,163,74,0.08); color: #166534; }
      .li-status.is-warning { border-color: rgba(217,119,6,0.4); background: rgba(217,119,6,0.08); color: #92400e; }

      .li-empty {
        padding: 1.5rem; text-align: center; color: var(--text-muted);
        border: 1px dashed var(--border-strong); border-radius: 12px; font-size: 0.9rem;
      }

      /* Region grid */
      .li-regions-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
        gap: 0.6rem;
      }
      .li-regions-grid--inline { margin-top: 0.6rem; }
      .li-region-card {
        display: flex; align-items: center; justify-content: space-between; gap: 0.6rem;
        padding: 0.65rem 0.8rem;
        border: 1px solid var(--border-subtle);
        border-radius: 10px;
        background: var(--bg-surface);
        cursor: pointer;
      }
      .li-region-card.is-selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
      .li-region-name { font-weight: 600; font-size: 0.9rem; }
      .li-region-code { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
      .li-region-card input { width: 1.05rem; height: 1.05rem; accent-color: var(--accent); }

      /* Selection summary + chips */
      .li-summary { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 0.85rem; }
      .li-summary-badge {
        font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700;
        color: var(--accent); background: rgba(109,40,217,0.08);
        padding: 0.2rem 0.55rem; border-radius: 999px;
      }
      .li-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
      .li-chip {
        font-size: 0.78rem; padding: 0.2rem 0.55rem; border-radius: 999px;
        background: var(--bg-hover); border: 1px solid var(--border-subtle);
      }
      .li-editor { margin-bottom: 0.85rem; }
      .li-editor > summary { cursor: pointer; font-size: 0.85rem; color: var(--accent); font-weight: 600; }

      /* Jobs list */
      .li-jobs-head { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.5rem; }
      .li-jobs-list { display: flex; flex-direction: column; gap: 0.5rem; max-height: 420px; overflow-y: auto; }
      .li-job {
        display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
        padding: 0.6rem 0.8rem; border: 1px solid var(--border-subtle);
        border-radius: 10px; background: var(--bg-surface);
      }
      .li-job-main { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
      .li-job-region { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
      .li-job-name { font-weight: 600; font-size: 0.88rem; word-break: break-all; }
      .li-job-endpoint { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.78rem; }
      .li-job-endpoint a { color: var(--accent); text-decoration: none; }
      .li-chip-state { font-size: 0.75rem; padding: 0.22rem 0.55rem; border-radius: 999px; white-space: nowrap; }
      .li-chip-state.is-ready { background: rgba(22,163,74,0.1); color: #166534; }
      .li-chip-state.is-error { background: rgba(239,68,68,0.1); color: #991b1b; }
      .li-chip-state.is-pending { background: rgba(217,119,6,0.1); color: #92400e; }

      /* Results table */
      .li-results-scroll {
        box-sizing: border-box;
        width: 100%;
        min-width: 0;
        max-width: 100%;
        overflow-x: auto;
        border: 1px solid var(--border-subtle);
        border-radius: 12px;
      }
      .li-results-table {
        width: 100%;
        min-width: 1080px;
        table-layout: fixed;
        border-collapse: collapse;
        font-size: 0.85rem;
      }
      .li-results-table th, .li-results-table td {
        padding: 0.55rem 0.7rem; text-align: left; border-bottom: 1px solid var(--border-subtle); white-space: nowrap;
      }
      .li-results-table th:first-child { width: 22%; }
      .li-results-table th, .li-results-table td:nth-child(7) { white-space: normal; }
      .li-results-table thead th { background: var(--bg-hover); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
      .li-results-table th button {
        background: none; border: 0; padding: 0; cursor: pointer; font: inherit;
        text-transform: inherit; letter-spacing: inherit; color: inherit; display: inline-flex; align-items: center; gap: 0.25rem;
      }
      .li-sort-arrow { font-size: 0.7rem; }
      .li-metric-value { font-variant-numeric: tabular-nums; font-weight: 600; }
      .li-metric-cell.is-error .li-metric-value { color: #991b1b; }
      .li-metric-cell.is-pending .li-metric-value { color: var(--text-muted); }
      .li-metric-sub { display: block; font-size: 0.72rem; color: var(--text-muted); font-weight: 400; white-space: normal; max-width: 260px; }
      .li-region-cell-primary { font-weight: 600; }
      .li-region-cell-sub { font-size: 0.72rem; color: var(--text-muted); white-space: normal; overflow-wrap: anywhere; }

      /* Loader uses Batman's shared .section-loading-overlay / .section-loading-mark
         (08-modern-content.css). Center the mark within the shorter wizard panel. */
      #li-loader.section-loading-overlay { align-items: center; padding-top: 0; }

      @media (max-width: 720px) {
        .li-stepper { grid-template-columns: 1fr; }
        .li-controlbar { width: 100%; }
      }
