      :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 {
        width: 100%;
        text-align: left;
        background: transparent;
        color: #1d1433;
        border: 1px solid transparent;
        padding: 0.45rem 0.5rem;
        border-radius: 8px;
        font-weight: 600;
      }
      .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-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-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.6rem;
      }
      .concurrency-stat-card {
        background: rgba(23, 13, 59, 0.045);
        border: 1px solid var(--border-subtle);
        border-radius: 10px;
        padding: 0.6rem 0.8rem 0.55rem;
        min-width: 0;
      }
      .concurrency-stat-label {
        font-size: 0.75rem;
        font-weight: 600;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.05em;
        margin-bottom: 0.3rem;
      }
      .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;
      }
      .concurrency-stat-card: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 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-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;
      }

      .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 { -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%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%27M21%2015a2%202%200%200%201-2%202H7l-4%204V5a2%202%200%200%201%202-2h14a2%202%200%200%201%202%202z%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%27M21%2015a2%202%200%200%201-2%202H7l-4%204V5a2%202%200%200%201%202-2h14a2%202%200%200%201%202%202z%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: var(--bg-elevated);
      }
      .agent-sessions-head {
        display: flex;
        align-items: center;
        height: 56px;
        padding: 0 1.1rem;
        flex: 0 0 auto;
      }
      .agent-sessions-title {
        font-weight: 700;
        font-size: 0.9375rem;
        letter-spacing: -0.01em;
        color: var(--text-primary);
      }
      .agent-new-chat-wrap {
        padding: 0 0.75rem 0.75rem;
        border-bottom: 1px solid var(--border-subtle);
        flex: 0 0 auto;
      }
      /* Full-width primary CTA in the sidebar; the same class stays compact
         elsewhere (e.g. "New skill" in the Skills view). */
      .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: flex;
        align-items: center;
        justify-content: center;
        gap: 0.4rem;
        width: 100%;
        background: #1d1235;
        border-color: #1d1235;
        color: #ffffff;
        border-radius: 10px;
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
        box-shadow: 0 1px 2px rgba(23, 13, 59, 0.12);
      }
      .agent-new-chat-wrap .agent-new-chat-btn:hover {
        background: #2a1d4d;
        border-color: #2a1d4d;
      }
      .agent-new-chat-wrap .agent-new-chat-btn::before {
        content: "+";
        font-weight: 700;
        font-size: 1rem;
        line-height: 1;
      }
      .agent-session-list {
        flex: 1;
        overflow-y: auto;
        min-height: 0;
        padding: 0.5rem;
        display: flex;
        flex-direction: column;
        gap: 2px;
      }
      .agent-session-row {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        width: 100%;
        text-align: left;
        border: 0;
        background: transparent;
        border-radius: 9px;
        padding: 0.55rem 0.7rem;
        cursor: pointer;
        color: var(--text-secondary);
        font-size: 0.875rem;
        transition: background 0.12s ease, color 0.12s ease;
      }
      .agent-session-row:hover {
        background: var(--bg-hover);
        color: var(--text-primary);
      }
      .agent-session-row.active {
        background: #ede9fe;
        color: var(--text-primary);
        font-weight: 600;
      }
      .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 {
        background: transparent;
        border: 0;
        cursor: pointer;
      }
      .agent-sessions-more:hover {
        color: var(--text-primary);
      }
      .agent-sessions-foot {
        border-top: 1px solid var(--border-subtle);
        padding: 0.65rem 0.75rem;
        font-size: 0.75rem;
        color: var(--text-muted);
        background: var(--bg);
      }
      .agent-foot-btns {
        display: flex;
        gap: 0.4rem;
        margin-bottom: 0.45rem;
      }
      .agent-foot-btn {
        flex: 1;
        border: 1px solid var(--border-subtle);
        background: #ffffff;
        color: var(--text-secondary);
        border-radius: 8px;
        font-size: 0.75rem;
        font-weight: 600;
        padding: 0.35rem 0.6rem;
        cursor: pointer;
        transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
      }
      .agent-foot-btn:hover {
        border-color: var(--accent-tertiary);
        color: var(--accent-primary);
      }
      #agent-my-spend {
        display: block;
        padding: 0 0.15rem;
      }

      /* ---- 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;
      }
      /* 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-history {
        display: flex;
        align-items: flex-end;
        gap: 0.85rem;
        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: 1.1rem 1.25rem 0.9rem;
        margin: 0 0 1rem;
      }
      .agent-spend-history:empty {
        display: none;
      }
      .agent-spend-history-cell {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.3rem;
        flex: 1;
        max-width: 84px;
      }
      .agent-spend-history-cell .bar {
        position: relative;
        width: 100%;
        max-width: 44px;
        height: 64px;
        border-radius: 8px;
        background: var(--bg-hover);
        overflow: hidden;
      }
      .agent-spend-history-cell .bar i {
        position: absolute;
        inset: auto 0 0 0;
        background: linear-gradient(180deg, #c4b5fd, var(--accent-secondary));
        border-radius: 8px 8px 0 0;
        transition: height 0.25s ease;
      }
      .agent-spend-history-cell:last-child .bar i {
        background: linear-gradient(180deg, var(--accent-tertiary), var(--accent-primary));
      }
      .agent-spend-history-cell .amount {
        font-size: 0.75rem;
        font-weight: 600;
        color: var(--text-primary);
      }
      .agent-spend-history-cell .label {
        font-size: 0.6875rem;
        color: var(--text-muted);
      }
      .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);
      }

      /* 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-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;
      }

      /* 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-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 - placeholder for the upcoming file-upload feature. */
      .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-tooltip em {
        font-style: normal;
        margin-left: 0.4rem;
        font-weight: 600;
        color: #c4b5fd;
      }
      .agent-attach-btn:hover .agent-attach-tooltip,
      .agent-attach-btn:focus-visible .agent-attach-tooltip {
        opacity: 1;
        transform: translateY(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);
        }
        .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);
        }
      }

      /* ── 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; }
      }
