/* NatterNinja dashboard (new layout) */
:root {
  --nn-teal: #007F86;
  --nn-teal-dark: #00666c;
  --nn-teal-soft: #e6f3f4;
  --nn-pink: #D7266E;
  --nn-ink: #1f2d3d;
  --nn-muted: #6b7785;
  --nn-line: #e4e8ec;
  --nn-bg: #f5f7f9;
  --nn-side: 232px;
  --nn-top: 60px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font-family: 'Nunito', 'Segoe UI', Arial, sans-serif; color: var(--nn-ink); background: var(--nn-bg); font-size: 15.5px; }
[hidden] { display: none !important; }
a { color: var(--nn-teal); }
.brand-natter { color: var(--nn-teal); font-weight: 800; }
.brand-ninja { color: var(--nn-pink); font-weight: 800; }

.btn-primary { --bs-btn-bg: var(--nn-teal); --bs-btn-border-color: var(--nn-teal); --bs-btn-hover-bg: var(--nn-teal-dark); --bs-btn-hover-border-color: var(--nn-teal-dark); --bs-btn-active-bg: var(--nn-teal-dark); --bs-btn-active-border-color: var(--nn-teal-dark); --bs-btn-disabled-bg: var(--nn-teal); --bs-btn-disabled-border-color: var(--nn-teal); }
.btn-outline-primary { --bs-btn-color: var(--nn-teal); --bs-btn-border-color: var(--nn-teal); --bs-btn-hover-bg: var(--nn-teal); --bs-btn-hover-border-color: var(--nn-teal); --bs-btn-active-bg: var(--nn-teal); --bs-btn-active-border-color: var(--nn-teal); }
.form-control:focus, .form-select:focus, .form-check-input:focus { border-color: var(--nn-teal); box-shadow: 0 0 0 .2rem rgba(0,127,134,.15); }
.form-check-input:checked { background-color: var(--nn-teal); border-color: var(--nn-teal); }
.form-label { font-weight: 700; margin-bottom: .3rem; }
.form-text { color: var(--nn-muted); }

/* ---------- loading and sign in ---------- */
.nn-centre { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.nn-auth-card { width: 100%; max-width: 430px; background: #fff; border: 1px solid var(--nn-line); border-radius: 14px; padding: 32px; box-shadow: 0 8px 30px rgba(31,45,61,.06); }
.nn-auth-card.wide { max-width: 560px; }
.nn-auth-logo { height: 64px; display: block; margin: 0 auto 8px; }
.nn-switch { display: flex; background: var(--nn-bg); border-radius: 10px; padding: 4px; margin: 18px 0; }
.nn-switch button { flex: 1; border: 0; background: transparent; padding: 8px; border-radius: 8px; font-weight: 700; color: var(--nn-muted); }
.nn-switch button.active { background: #fff; color: var(--nn-ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.nn-divider { display: flex; align-items: center; gap: 12px; color: var(--nn-muted); font-size: .85rem; margin: 18px 0; }
.nn-divider::before, .nn-divider::after { content: ''; flex: 1; height: 1px; background: var(--nn-line); }
.nn-eye { border-color: var(--bs-border-color); background: #fff; color: var(--nn-muted); }

/* ---------- shell ---------- */
.nn-top { position: fixed; inset: 0 0 auto 0; height: var(--nn-top); background: #fff; border-bottom: 1px solid var(--nn-line); display: flex; align-items: center; gap: 14px; padding: 0 18px; z-index: 1030; }
.nn-top .nn-logo { height: 34px; }
.nn-top .nn-wordmark { font-size: 1.2rem; }
.nn-biz { margin-left: 18px; display: flex; align-items: center; gap: 8px; min-width: 0; }
.nn-biz label { color: var(--nn-muted); font-size: .85rem; margin: 0; white-space: nowrap; }
.nn-biz select { max-width: 280px; font-weight: 700; }
.nn-biz .nn-biz-single { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nn-top .spacer { flex: 1; }
.nn-menu-btn { display: none; border: 0; background: transparent; font-size: 1.25rem; color: var(--nn-ink); }

.nn-side { position: fixed; top: var(--nn-top); bottom: 0; left: 0; width: var(--nn-side); background: #fff; border-right: 1px solid var(--nn-line); padding: 14px 10px; overflow-y: auto; z-index: 1020; }
.nn-side a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 9px; color: var(--nn-ink); text-decoration: none; font-weight: 700; margin-bottom: 2px; }
.nn-side a i { width: 20px; text-align: center; color: var(--nn-muted); }
.nn-side a:hover { background: var(--nn-bg); }
.nn-side a.active { background: var(--nn-teal-soft); color: var(--nn-teal-dark); }
.nn-side a.active i { color: var(--nn-teal); }
.nn-side .nn-side-sep { height: 1px; background: var(--nn-line); margin: 10px 6px; }
.nn-side .nn-badge { margin-left: auto; background: var(--nn-pink); color: #fff; border-radius: 10px; font-size: .72rem; padding: 1px 7px; }

.nn-main { margin-left: var(--nn-side); padding: calc(var(--nn-top) + 26px) 30px 60px; }
.nn-page { max-width: 1080px; }
.nn-page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.nn-page-head h1 { font-size: 1.55rem; font-weight: 800; margin: 0 0 2px; }
.nn-page-head p { color: var(--nn-muted); margin: 0; max-width: 640px; }
.nn-backdrop { display: none; }

@media (max-width: 900px) {
  .nn-menu-btn { display: block; }
  .nn-side { transform: translateX(-100%); transition: transform .18s ease; box-shadow: 4px 0 20px rgba(0,0,0,.12); }
  body.nn-menu-open .nn-side { transform: none; }
  body.nn-menu-open .nn-backdrop { display: block; position: fixed; inset: var(--nn-top) 0 0 0; background: rgba(0,0,0,.3); z-index: 1010; }
  .nn-main { margin-left: 0; padding: calc(var(--nn-top) + 18px) 14px 50px; }
  .nn-top .nn-wordmark { display: none; }
  .nn-biz { margin-left: 4px; }
  .nn-biz label { display: none; }
  .nn-biz select { max-width: 46vw; }
}

/* ---------- building blocks ---------- */
.nn-card { background: #fff; border: 1px solid var(--nn-line); border-radius: 12px; padding: 20px; margin-bottom: 18px; }
.nn-card h2 { font-size: 1.08rem; font-weight: 800; margin: 0 0 4px; }
.nn-card .nn-sub { color: var(--nn-muted); margin: 0 0 14px; }
.nn-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.nn-card-head h2 { margin: 0; }
.nn-empty { text-align: center; color: var(--nn-muted); padding: 30px 12px; }
.nn-empty i { font-size: 1.8rem; display: block; margin-bottom: 8px; color: #c3cbd3; }
.nn-pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 20px; padding: 3px 11px; font-size: .82rem; font-weight: 700; }
.nn-pill.ok { background: #e3f6ea; color: #17804a; }
.nn-pill.warn { background: #fff4d6; color: #8a6100; }
.nn-pill.off { background: #eceff2; color: #56616d; }
.nn-pill.bad { background: #fde7ea; color: #b3261e; }
.nn-pill.lead { background: #fbe4ee; color: var(--nn-pink); }
.nn-loading { color: var(--nn-muted); padding: 22px 4px; }
.nn-loading .spinner-border { width: 1rem; height: 1rem; border-width: .15em; margin-right: 8px; color: var(--nn-teal); }
.nn-note { background: var(--nn-teal-soft); border-radius: 10px; padding: 12px 14px; color: #0d4a4e; }
.nn-note.warn { background: #fff7e0; color: #6d4d00; }
.table { --bs-table-bg: transparent; margin: 0; }
.table > :not(caption) > * > * { padding: .7rem .6rem; vertical-align: middle; }
.table thead th { color: var(--nn-muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; font-weight: 700; border-bottom-color: var(--nn-line); }
.nn-row-click { cursor: pointer; }
.nn-row-click:hover { background: var(--nn-bg); }
.nn-clip { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 0; }
.nn-savebar { position: sticky; bottom: 0; background: rgba(245,247,249,.94); backdrop-filter: blur(4px); padding: 12px 0; display: flex; gap: 10px; align-items: center; border-top: 1px solid var(--nn-line); margin-top: 6px; z-index: 5; }

/* ---------- home ---------- */
.nn-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.nn-stat { background: #fff; border: 1px solid var(--nn-line); border-radius: 12px; padding: 16px 18px; }
.nn-stat .n { font-size: 1.9rem; font-weight: 800; line-height: 1.1; }
.nn-stat .l { color: var(--nn-muted); font-size: .88rem; }
@media (max-width: 760px) { .nn-stats { grid-template-columns: repeat(2, 1fr); } }
.nn-steps { list-style: none; margin: 0; padding: 0; }
.nn-steps li { display: flex; align-items: center; gap: 14px; padding: 12px 6px; border-top: 1px solid var(--nn-line); cursor: pointer; border-radius: 8px; }
.nn-steps li:first-child { border-top: 0; }
.nn-steps li:hover { background: var(--nn-bg); }
.nn-steps .tick { width: 28px; height: 28px; border-radius: 50%; border: 2px solid #cfd6dd; display: flex; align-items: center; justify-content: center; color: transparent; flex: none; font-size: .8rem; }
.nn-steps li.done .tick { background: #17804a; border-color: #17804a; color: #fff; }
.nn-steps li.busy .tick { border-color: var(--nn-teal); color: var(--nn-teal); }
.nn-steps .t { font-weight: 700; }
.nn-steps .d { color: var(--nn-muted); font-size: .9rem; }
.nn-steps .go { margin-left: auto; color: var(--nn-muted); }

/* ---------- conversations ---------- */
.nn-convo { display: grid; grid-template-columns: 360px 1fr; gap: 18px; align-items: start; }
.nn-convo-list { background: #fff; border: 1px solid var(--nn-line); border-radius: 12px; overflow: hidden; max-height: calc(100vh - 220px); overflow-y: auto; }
.nn-convo-item { padding: 12px 14px; border-bottom: 1px solid var(--nn-line); cursor: pointer; }
.nn-convo-item:last-child { border-bottom: 0; }
.nn-convo-item:hover { background: var(--nn-bg); }
.nn-convo-item.active { background: var(--nn-teal-soft); }
.nn-convo-item .when { color: var(--nn-muted); font-size: .8rem; display: flex; justify-content: space-between; gap: 8px; }
.nn-convo-item .first { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nn-convo-detail { background: #fff; border: 1px solid var(--nn-line); border-radius: 12px; padding: 18px; min-height: 300px; }
.nn-msg { max-width: 78%; padding: 9px 13px; border-radius: 14px; margin-bottom: 9px; white-space: pre-wrap; word-wrap: break-word; }
.nn-msg.user { background: var(--nn-bg); margin-left: auto; border-bottom-right-radius: 4px; }
.nn-msg.bot { background: var(--nn-teal-soft); border-bottom-left-radius: 4px; }
.nn-msg .ts { display: block; font-size: .72rem; color: var(--nn-muted); margin-top: 3px; }
.nn-leadbox { border: 1px solid #f3c2d6; background: #fdf3f7; border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; }
.nn-back { display: none; }
@media (max-width: 900px) {
  .nn-convo { grid-template-columns: 1fr; }
  .nn-convo.showing-detail .nn-convo-list { display: none; }
  .nn-convo:not(.showing-detail) .nn-convo-detail { display: none; }
  .nn-back { display: inline-block; margin-bottom: 10px; }
}

/* ---------- personality ---------- */
.nn-trait { border: 1px solid var(--nn-line); border-radius: 10px; margin-bottom: 10px; background: #fff; }
.nn-trait-head { display: flex; align-items: center; gap: 12px; padding: 13px 16px; cursor: pointer; }
.nn-trait-head .name { font-weight: 800; }
.nn-trait-head .chosen { color: var(--nn-muted); }
.nn-trait-head .chev { margin-left: auto; color: var(--nn-muted); transition: transform .15s; }
.nn-trait-head .nn-pill { margin-left: auto; }
.nn-trait-head .nn-pill + .chev { margin-left: 12px; }
.nn-trait.open .chev { transform: rotate(180deg); }
.nn-trait-body { display: none; padding: 4px 16px 16px; }
.nn-trait.open .nn-trait-body { display: block; }
.nn-option { border: 1px solid var(--nn-line); border-radius: 10px; padding: 12px 14px; margin-top: 10px; cursor: pointer; }
.nn-option:hover { border-color: var(--nn-teal); }
.nn-option.selected { border-color: var(--nn-teal); background: var(--nn-teal-soft); }
.nn-option .lbl { font-weight: 800; }
.nn-option .desc { color: var(--nn-muted); font-size: .92rem; }
.nn-option details { margin-top: 6px; font-size: .9rem; }
.nn-option details summary { color: var(--nn-teal); cursor: pointer; }
.nn-option .preview { background: #fff; border: 1px dashed var(--nn-line); border-radius: 8px; padding: 10px; margin-top: 6px; max-height: 220px; overflow: auto; }

/* ---------- appearance ---------- */
.nn-appearance { display: grid; grid-template-columns: 1fr 320px; gap: 18px; align-items: start; }
@media (max-width: 1000px) { .nn-appearance { grid-template-columns: 1fr; } .nn-preview-wrap { display: none; } }
.nn-preview-wrap { position: sticky; top: calc(var(--nn-top) + 20px); }
.nn-preview { border-radius: 14px; overflow: hidden; border: 1px solid var(--nn-line); background: #fff; box-shadow: 0 10px 30px rgba(31,45,61,.1); }
.nn-preview .head { color: #fff; padding: 12px 14px; display: flex; align-items: center; gap: 10px; font-weight: 800; }
.nn-preview .head img { height: 26px; width: 26px; object-fit: contain; background: #fff; border-radius: 50%; }
.nn-preview .body { padding: 14px; min-height: 150px; }
.nn-preview .bubble { background: #eef1f4; border-radius: 12px; border-bottom-left-radius: 4px; padding: 9px 12px; display: inline-block; max-width: 90%; white-space: pre-wrap; }
.nn-preview .input { border-top: 1px solid var(--nn-line); padding: 10px 14px; color: var(--nn-muted); font-size: .9rem; }
.nn-preview.dark { background: #1f2630; }
.nn-preview.dark .bubble { background: #2e3845; color: #f1f3f5; }
.nn-preview.dark .input { border-top-color: #2e3845; }
.nn-launcher { margin-top: 14px; display: flex; }
.nn-launcher.right { justify-content: flex-end; }
.nn-launcher .dot { width: 54px; height: 54px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 1.3rem; box-shadow: 0 4px 14px rgba(0,0,0,.2); }
.nn-launcher .ask { border-radius: 26px; padding: 12px 20px; color: #fff; font-weight: 800; box-shadow: 0 4px 14px rgba(0,0,0,.2); }
.nn-logo-thumb { height: 44px; max-width: 120px; object-fit: contain; border: 1px solid var(--nn-line); border-radius: 8px; padding: 4px; background: #fff; }

/* ---------- install ---------- */
.nn-code { background: #1f2d3d; color: #e9eef3; border-radius: 10px; padding: 14px 16px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .86rem; white-space: pre-wrap; word-break: break-all; margin: 0; }
.accordion-button:not(.collapsed) { background: var(--nn-teal-soft); color: var(--nn-teal-dark); box-shadow: none; }
.accordion-button:focus { box-shadow: none; border-color: var(--nn-line); }
.accordion-button { font-weight: 700; }

/* ---------- toasts ---------- */
.nn-toasts { position: fixed; right: 18px; bottom: 18px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 36px)); }
.nn-toast { background: var(--nn-ink); color: #fff; border-radius: 10px; padding: 11px 15px; box-shadow: 0 8px 24px rgba(0,0,0,.2); display: flex; gap: 10px; align-items: flex-start; animation: nn-in .16s ease; }
.nn-toast.ok i { color: #6fe0a0; }
.nn-toast.bad { background: #b3261e; }
.nn-toast.info i { color: #9fd8dc; }
@keyframes nn-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- test your assistant ---------- */
.nn-testframe { background: #fff; border: 1px solid var(--nn-line); border-radius: 12px; overflow: hidden; height: calc(100vh - 290px); min-height: 520px; }
.nn-testframe iframe { width: 100%; height: 100%; border: 0; display: block; }
