/* ==========================================================================
   NecoArchitect IA — Digital Business Model Chatroom & Harness Stylesheet
   Strict Apple Light Mode (#ffffff / #f5f5f7 / #e5e5ea / #1d1d1f / #0071e3)
   Pure CSS Cascade · Zero Specificity Overrides · Zero Dark Base · Zero Gold
   ========================================================================== */

.ny-bizchat-root {
    --bc-bg: #ffffff;
    --bc-surface: #f5f5f7;
    --bc-surface-hover: #ececf0;
    --bc-border: #e5e5ea;
    --bc-border-strong: #d2d2d7;
    --bc-ink: #1d1d1f;
    --bc-muted: #86868b;
    --bc-accent: #0071e3;
    --bc-accent-hover: #0077ed;
    --bc-accent-soft: #eef6ff;
    --bc-success: #248a3d;
    --bc-success-bg: #eefaf1;
    --bc-warn: #b25000;
    --bc-warn-bg: #fff5eb;
    --bc-danger: #d70015;
    --bc-danger-bg: #fff0f1;
    --bc-radius: 18px;
    --bc-font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;

    font-family: var(--bc-font);
    color: var(--bc-ink);
    background-color: var(--bc-bg);
    padding: 28px 20px 64px;
    box-sizing: border-box;
}

.ny-bizchat-root *,
.ny-bizchat-root *::before,
.ny-bizchat-root *::after {
    box-sizing: border-box;
}

.ny-bizchat-shell {
    max-width: 1240px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

/* ── Left Rail: Director Orb + Telemetry + Tools ─────────────────────────── */
.ny-bizchat-rail {
    background: var(--bc-surface);
    border: 1px solid var(--bc-border);
    border-radius: var(--bc-radius);
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    position: sticky;
    top: 24px;
}

.ny-bizchat-director-card {
    background: var(--bc-bg);
    border: 1px solid var(--bc-border);
    border-radius: 14px;
    padding: 18px;
    text-align: center;
}

.ny-bizchat-orb-wrap {
    width: 88px;
    height: 88px;
    margin: 0 auto 12px;
    border-radius: 50%;
    background: var(--bc-surface);
    border: 1px solid var(--bc-border);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.ny-bizchat-orb-wrap[data-state="thinking"],
.ny-bizchat-orb-wrap[data-state="analyzing"] {
    border-color: var(--bc-accent);
    box-shadow: 0 0 0 6px rgba(0, 113, 227, 0.12);
}

.ny-bizchat-orb-wrap[data-state="completed"],
.ny-bizchat-orb-wrap[data-state="handoff_ready"] {
    border-color: var(--bc-success);
    box-shadow: 0 0 0 5px rgba(36, 138, 61, 0.12);
}

.ny-bizchat-orb-wrap[data-state="guardrail_warn"],
.ny-bizchat-orb-wrap[data-state="concerned"] {
    border-color: var(--bc-warn);
    box-shadow: 0 0 0 5px rgba(178, 80, 0, 0.12);
}

.ny-bizchat-orb-wrap[data-state="critical_alert"] {
    border-color: var(--bc-danger);
    box-shadow: 0 0 0 6px rgba(215, 0, 21, 0.14);
}

.ny-bizchat-orb-svg {
    width: 54px;
    height: 54px;
    transition: transform 0.35s ease;
}

.ny-bizchat-orb-wrap[data-state="thinking"] .ny-bizchat-orb-svg {
    animation: nyBizchatPulse 1.3s ease-in-out infinite;
}

@keyframes nyBizchatPulse {
    0%, 100% { transform: scale(0.95); opacity: 0.85; }
    50% { transform: scale(1.06); opacity: 1; }
}

.ny-bizchat-assistant-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--bc-ink);
    margin: 0 0 2px;
    letter-spacing: -0.02em;
}

.ny-bizchat-assistant-tagline {
    font-size: 12px;
    color: var(--bc-muted);
    margin: 0 0 10px;
}

.ny-bizchat-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 980px;
    background: var(--bc-surface);
    border: 1px solid var(--bc-border);
    color: var(--bc-ink);
}

.ny-bizchat-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--bc-success);
}

.ny-bizchat-director-note {
    font-size: 12px;
    color: var(--bc-muted);
    margin: 10px 0 0;
    line-height: 1.45;
}

/* Telemetry card */
.ny-bizchat-intel-box {
    background: var(--bc-bg);
    border: 1px solid var(--bc-border);
    border-radius: 14px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ny-bizchat-intel-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--bc-muted);
    margin: 0;
}

.ny-bizchat-intel-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    padding-top: 6px;
    border-top: 1px solid var(--bc-surface);
}

.ny-bizchat-intel-row span:first-child {
    color: var(--bc-muted);
}

.ny-bizchat-intel-row strong {
    color: var(--bc-ink);
    font-weight: 600;
    text-align: right;
}

/* Tool buttons in left rail */
.ny-bizchat-tools {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ny-bizchat-tool-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bc-bg);
    border: 1px solid var(--bc-border);
    border-radius: 12px;
    color: var(--bc-ink);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    text-decoration: none;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.ny-bizchat-tool-btn:hover {
    border-color: var(--bc-border-strong);
    background: #fafafa;
}

.ny-bizchat-tool-btn i {
    width: 16px;
    text-align: center;
    color: var(--bc-accent);
}

.ny-bizchat-tool-btn.ny-primary-cta {
    background: var(--bc-ink);
    border-color: var(--bc-ink);
    color: #ffffff;
}

.ny-bizchat-tool-btn.ny-primary-cta i {
    color: #ffffff;
}

.ny-bizchat-tool-btn.ny-primary-cta:hover {
    background: #000000;
}

/* ── Main Chatroom Canvas ────────────────────────────────────────────────── */
.ny-bizchat-stage {
    background: var(--bc-bg);
    border: 1px solid var(--bc-border);
    border-radius: var(--bc-radius);
    display: flex;
    flex-direction: column;
    min-height: 680px;
    box-shadow: 0 6px 28px rgba(0, 0, 0, 0.03);
    overflow: hidden;
}

.ny-bizchat-topbar {
    padding: 18px 24px;
    border-bottom: 1px solid var(--bc-border);
    background: var(--bc-bg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.ny-bizchat-topbar h1 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--bc-ink);
    margin: 0 0 3px;
}

.ny-bizchat-topbar p {
    font-size: 13px;
    color: var(--bc-muted);
    margin: 0;
}

.ny-bizchat-topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ny-bizchat-icon-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: 980px;
    border: 1px solid var(--bc-border);
    background: var(--bc-surface);
    color: var(--bc-ink);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.18s ease, border-color 0.18s ease;
}

.ny-bizchat-icon-btn:hover {
    background: var(--bc-surface-hover);
    border-color: var(--bc-border-strong);
}

.ny-bizchat-icon-btn.is-active {
    background: var(--bc-accent-soft);
    border-color: var(--bc-accent);
    color: var(--bc-accent);
}

/* Inline alert banner (Zero native alert()) */
.ny-bizchat-banner {
    display: none;
    margin: 14px 24px 0;
    padding: 11px 14px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.ny-bizchat-banner.is-visible {
    display: flex;
}

.ny-bizchat-banner.is-error {
    background: var(--bc-danger-bg);
    border: 1px solid #ffc9ce;
    color: var(--bc-danger);
}

.ny-bizchat-banner.is-success {
    background: var(--bc-success-bg);
    border: 1px solid #b9e6c4;
    color: var(--bc-success);
}

.ny-bizchat-banner.is-info {
    background: var(--bc-accent-soft);
    border: 1px solid #c7e0fc;
    color: var(--bc-accent);
}

/* Message stream */
.ny-bizchat-messages {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    max-height: 540px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: var(--bc-bg);
}

.ny-bizchat-welcome {
    background: var(--bc-surface);
    border: 1px solid var(--bc-border);
    border-radius: 16px;
    padding: 20px;
}

.ny-bizchat-welcome h2 {
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 6px;
    color: var(--bc-ink);
}

.ny-bizchat-welcome p {
    font-size: 13.5px;
    color: var(--bc-muted);
    margin: 0 0 16px;
    line-height: 1.5;
}

.ny-bizchat-quick-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.ny-bizchat-quick-card {
    background: var(--bc-bg);
    border: 1px solid var(--bc-border);
    border-radius: 12px;
    padding: 12px 14px;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.ny-bizchat-quick-card:hover {
    border-color: var(--bc-accent);
    transform: translateY(-1px);
}

.ny-bizchat-quick-card strong {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    color: var(--bc-ink);
    margin-bottom: 3px;
}

.ny-bizchat-quick-card strong i {
    color: var(--bc-accent);
}

.ny-bizchat-quick-card span {
    display: block;
    font-size: 12px;
    color: var(--bc-muted);
    line-height: 1.35;
}

/* Bubbles */
.ny-bizchat-msg {
    display: flex;
    flex-direction: column;
    max-width: 88%;
    gap: 6px;
}

.ny-bizchat-msg.is-user {
    align-self: flex-end;
    align-items: flex-end;
}

.ny-bizchat-msg.is-assistant {
    align-self: flex-start;
    align-items: flex-start;
}

.ny-bizchat-bubble {
    padding: 14px 18px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.6;
    word-wrap: break-word;
}

.ny-bizchat-msg.is-user .ny-bizchat-bubble {
    background: var(--bc-ink);
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

.ny-bizchat-msg.is-assistant .ny-bizchat-bubble {
    background: var(--bc-surface);
    border: 1px solid var(--bc-border);
    color: var(--bc-ink);
    border-bottom-left-radius: 4px;
}

.ny-bizchat-bubble h3,
.ny-bizchat-bubble h4 {
    font-size: 15px;
    font-weight: 700;
    margin: 0 0 8px;
    color: var(--bc-ink);
}

.ny-bizchat-bubble p {
    margin: 0 0 10px;
}

.ny-bizchat-bubble p:last-child {
    margin-bottom: 0;
}

.ny-bizchat-bubble ol,
.ny-bizchat-bubble ul {
    margin: 6px 0 10px 20px;
    padding: 0;
}

.ny-bizchat-bubble li {
    margin-bottom: 5px;
}

.ny-bizchat-bubble blockquote {
    margin: 10px 0 0;
    padding: 10px 12px;
    border-left: 3px solid var(--bc-accent);
    background: var(--bc-bg);
    border-radius: 8px;
    font-size: 13px;
}

.ny-bizchat-bubble code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 12.5px;
    background: rgba(29, 29, 31, 0.06);
    padding: 1px 5px;
    border-radius: 5px;
}

.ny-bizchat-meta {
    font-size: 11px;
    color: var(--bc-muted);
    display: flex;
    align-items: center;
    gap: 10px;
}

.ny-bizchat-actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}

.ny-bizchat-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 13px;
    border-radius: 980px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid var(--bc-border-strong);
    background: var(--bc-bg);
    color: var(--bc-ink);
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.18s ease, border-color 0.18s ease;
}

.ny-bizchat-chip:hover {
    border-color: var(--bc-accent);
    color: var(--bc-accent);
}

.ny-bizchat-chip.is-primary {
    background: var(--bc-accent);
    border-color: var(--bc-accent);
    color: #ffffff;
}

.ny-bizchat-chip.is-primary:hover {
    background: var(--bc-accent-hover);
    color: #ffffff;
}

/* ── Security Gate (Terms + Drag-and-Fit Captcha) ────────────────────────── */
.ny-bizchat-gate {
    margin: 0 24px 16px;
    padding: 16px 18px;
    background: var(--bc-surface);
    border: 1px solid var(--bc-border);
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.ny-bizchat-gate.is-hidden {
    display: none;
}

.ny-bizchat-terms-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 12.5px;
    color: var(--bc-ink);
    line-height: 1.45;
}

.ny-bizchat-terms-row input[type="checkbox"] {
    margin-top: 3px;
    accent-color: var(--bc-accent);
}

.ny-bizchat-terms-row a {
    color: var(--bc-accent);
    text-decoration: underline;
}

/* Drag and Fit Track */
.ny-captcha-box {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ny-captcha-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--bc-muted);
}

.ny-captcha-track {
    position: relative;
    height: 44px;
    background: var(--bc-bg);
    border: 1px solid var(--bc-border-strong);
    border-radius: 980px;
    overflow: hidden;
    user-select: none;
    touch-action: none;
}

.ny-captcha-target {
    position: absolute;
    top: 4px;
    width: 36px;
    height: 34px;
    border-radius: 980px;
    border: 2px dashed var(--bc-accent);
    background: var(--bc-accent-soft);
    transform: translateX(-50%);
    pointer-events: none;
}

.ny-captcha-fill {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0;
    background: rgba(0, 113, 227, 0.12);
    pointer-events: none;
}

.ny-captcha-label {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--bc-muted);
    pointer-events: none;
}

.ny-captcha-handle {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 38px;
    height: 36px;
    border-radius: 980px;
    background: var(--bc-ink);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.14);
}

.ny-captcha-handle:active {
    cursor: grabbing;
}

.ny-captcha-box.is-verified .ny-captcha-track {
    border-color: var(--bc-success);
    background: var(--bc-success-bg);
}

.ny-captcha-box.is-verified .ny-captcha-handle {
    background: var(--bc-success);
}

.ny-captcha-box.is-verified .ny-captcha-label {
    color: var(--bc-success);
}

/* ── Composer Input Bar ──────────────────────────────────────────────────── */
.ny-bizchat-composer {
    padding: 16px 24px 20px;
    border-top: 1px solid var(--bc-border);
    background: var(--bc-bg);
}

.ny-bizchat-attachment-pill {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: var(--bc-accent-soft);
    border: 1px solid #c7e0fc;
    color: var(--bc-accent);
    padding: 7px 12px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 10px;
}

.ny-bizchat-attachment-pill.is-visible {
    display: flex;
}

.ny-bizchat-input-row {
    display: flex;
    align-items: flex-end;
    gap: 10px;
}

.ny-bizchat-textarea {
    flex: 1;
    min-height: 48px;
    max-height: 140px;
    resize: vertical;
    padding: 12px 14px;
    border: 1px solid var(--bc-border-strong);
    border-radius: 14px;
    background: var(--bc-bg);
    color: var(--bc-ink);
    font-family: inherit;
    font-size: 14px;
    line-height: 1.45;
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.ny-bizchat-textarea:focus {
    border-color: var(--bc-accent);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.14);
}

.ny-bizchat-send-btn {
    height: 48px;
    padding: 0 20px;
    border-radius: 980px;
    border: none;
    background: var(--bc-ink);
    color: #ffffff;
    font-size: 13.5px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: background-color 0.18s ease, opacity 0.18s ease;
}

.ny-bizchat-send-btn:hover {
    background: #000000;
}

.ny-bizchat-send-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* ── Modals (Calculators, Scanner, Blueprint, Lead) ──────────────────────── */
.ny-bizchat-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(29, 29, 31, 0.45);
    backdrop-filter: blur(4px);
    z-index: 9500;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.ny-bizchat-modal-backdrop.is-open {
    display: flex;
}

.ny-bizchat-modal {
    width: 100%;
    max-width: 780px;
    max-height: 90vh;
    overflow-y: auto;
    background: var(--bc-bg);
    border: 1px solid var(--bc-border);
    border-radius: 20px;
    padding: 26px 28px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.18);
}

.ny-bizchat-modal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--bc-border);
    margin-bottom: 18px;
}

.ny-bizchat-modal-head h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--bc-ink);
}

.ny-bizchat-close-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--bc-border);
    background: var(--bc-surface);
    color: var(--bc-ink);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.ny-calc-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
}

.ny-calc-tab {
    padding: 7px 12px;
    border-radius: 980px;
    border: 1px solid var(--bc-border);
    background: var(--bc-surface);
    color: var(--bc-ink);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.ny-calc-tab.is-active {
    background: var(--bc-ink);
    border-color: var(--bc-ink);
    color: #ffffff;
}

.ny-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.ny-field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--bc-ink);
    margin-bottom: 5px;
}

.ny-field input,
.ny-field select,
.ny-field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--bc-border-strong);
    border-radius: 10px;
    background: var(--bc-bg);
    color: var(--bc-ink);
    font-size: 13.5px;
    font-family: inherit;
}

.ny-kpi-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.ny-kpi-card {
    background: var(--bc-surface);
    border: 1px solid var(--bc-border);
    border-radius: 12px;
    padding: 12px 14px;
}

.ny-kpi-card span {
    display: block;
    font-size: 11px;
    color: var(--bc-muted);
    margin-bottom: 4px;
}

.ny-kpi-card strong {
    font-size: 18px;
    font-weight: 700;
    color: var(--bc-ink);
}

/* ── Floating Mini Copilot ───────────────────────────────────────────────── */
.ny-mini-copilot {
    position: fixed;
    bottom: 22px;
    right: 22px;
    z-index: 8800;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
}

.ny-mini-copilot.pos-left {
    right: auto;
    left: 22px;
}

.ny-mini-launcher {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 12px 18px;
    border-radius: 980px;
    background: #1d1d1f;
    color: #ffffff;
    border: 1px solid #1d1d1f;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.16);
}

.ny-mini-drawer {
    display: none;
    width: 350px;
    max-width: calc(100vw - 32px);
    background: #ffffff;
    border: 1px solid #e5e5ea;
    border-radius: 18px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.16);
    margin-bottom: 12px;
    overflow: hidden;
}

.ny-mini-drawer.is-open {
    display: block;
}

/* Spotlight Joyride Tour */
.ny-tour-overlay {
    position: fixed;
    inset: 0;
    background: rgba(29, 29, 31, 0.5);
    z-index: 9800;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.ny-tour-overlay.is-open {
    display: flex;
}

.ny-tour-card {
    background: #ffffff;
    border: 1px solid #e5e5ea;
    border-radius: 18px;
    padding: 24px;
    max-width: 460px;
    width: 100%;
    box-shadow: 0 20px 54px rgba(0, 0, 0, 0.2);
}

@media (max-width: 960px) {
    .ny-bizchat-shell {
        grid-template-columns: 1fr;
    }
    .ny-bizchat-rail {
        position: static;
    }
    .ny-bizchat-quick-grid,
    .ny-form-grid,
    .ny-kpi-grid {
        grid-template-columns: 1fr;
    }
}
