.ns-admin-wrap { margin-right: 20px; }
.ns-frontend-wrap { width: min(100% - 32px, 1480px); margin: 28px auto 56px; }
.ns-frontend-wrap .ns-app { width: 100%; max-width: none; }
.ns-standalone { margin: 0; min-height: 100vh; background: #f6f3ee; }
.ns-standalone .ns-frontend-wrap { width: 100%; max-width: none; min-height: 100vh; margin: 0; padding: 16px clamp(12px, 3vw, 40px) 40px; }
.ns-standalone .ns-app { width: 100%; max-width: none; min-height: calc(100vh - 56px); }
.ns-standalone .ns-header { position: sticky; top: 0; z-index: 20; }
.ns-standalone .ns-page { width: 100%; max-width: none; }
.ns-app { --ink: #242322; --muted: #77736e; --line: #e7e2dc; --paper: #fffdfa; --wash: #f6f3ee; --accent: #724b3a; color: var(--ink); max-width: 1440px; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
.ns-app * { box-sizing: border-box; }
.ns-header { display: flex; align-items: center; gap: 34px; min-height: 70px; padding: 10px 30px; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; }
.ns-brand { display: flex; align-items: center; gap: 10px; min-width: 190px; font-weight: 700; font-size: 17px; letter-spacing: -.02em; }
.ns-brand-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--accent); color: white; font-family: Georgia, serif; }
.ns-top-nav { display: flex; gap: 5px; flex: 1; }
.ns-nav-button, .ns-subnav-button { border: 0; background: transparent; color: #706b66; border-radius: 7px; padding: 10px 15px; cursor: pointer; font: inherit; }
.ns-nav-button:hover, .ns-subnav-button:hover { background: var(--wash); color: var(--ink); }
.ns-nav-button.is-active, .ns-subnav-button.is-active { background: #f2ebe4; color: var(--accent); font-weight: 650; }
.ns-project-select { min-width: 150px; max-width: 220px; border: 1px solid var(--line); border-radius: 7px; padding: 8px 10px; background: white; }
.ns-page { padding: 36px 34px 54px; }
.ns-eyebrow { margin: 0 0 9px; color: var(--accent); font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.ns-page-title { margin: 0 0 28px; font-family: Georgia, "Noto Serif SC", serif; font-size: clamp(27px, 4vw, 38px); font-weight: 600; letter-spacing: -.035em; }
.ns-story-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(250px, .8fr); gap: 22px; }
.ns-card { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 24px; box-shadow: 0 5px 20px rgba(44, 35, 25, .025); }
.ns-card h2 { margin: 0 0 18px; font-family: Georgia, "Noto Serif SC", serif; font-size: 20px; font-weight: 600; }
.ns-prose { max-width: 760px; color: #4e4944; font-family: Georgia, "Noto Serif SC", serif; font-size: 17px; line-height: 1.85; white-space: pre-wrap; }
.ns-summary-meta { margin-top: 24px; color: var(--muted); font-size: 13px; }
.ns-recent-list { margin: 20px 0 4px; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.ns-recent-list li { display: flex; justify-content: space-between; gap: 16px; padding: 13px 2px; border-bottom: 1px solid var(--line); font-size: 14px; }
.ns-muted { color: var(--muted); font-size: 13px; }
.ns-small { color: var(--muted); font-size: 12px; line-height: 1.65; }
.ns-action-row { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 18px; }
.ns-button { appearance: none; border: 1px solid #d8d0c7; border-radius: 7px; background: white; color: #38332f; padding: 9px 14px; font: inherit; font-size: 13px; cursor: pointer; transition: background .15s ease, border-color .15s ease; }
.ns-button:hover { background: #f8f5f1; border-color: #bcae9f; }
.ns-button-primary { border-color: var(--accent); background: var(--accent); color: white; }
.ns-button-primary:hover { border-color: #5e3c2e; background: #5e3c2e; color: white; }
.ns-button-light { background: #f7f4f0; }
.ns-button-small { padding: 6px 10px; font-size: 12px; }
.ns-side-card { align-self: start; }
.ns-side-card hr { border: 0; border-top: 1px solid var(--line); margin: 22px 0; }
.ns-side-card h3 { margin: 0 0 10px; font-size: 14px; }
.ns-progress-number { font-family: Georgia, serif; color: var(--accent); font-size: 42px; }
.ns-status-pill { display: inline-flex; align-items: center; width: fit-content; min-height: 25px; padding: 3px 9px; border: 1px solid var(--line); border-radius: 20px; background: #f7f5f2; color: #65605b; font-size: 11px; white-space: nowrap; }
.ns-status-pending { border-color: #e6d7ba; background: #fbf5e8; color: #806c45; }
.ns-status-connected { border-color: #bad6c1; background: #eef8f0; color: #326343; }
.ns-button:disabled { opacity: .55; cursor: default; }
.ns-isqy-settings { margin-top: 24px; }
.ns-isqy-connection { padding-bottom: 18px; }
.ns-isqy-browser { border-top: 1px solid var(--line); padding-top: 18px; }
.ns-isqy-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin: 16px 0; }
.ns-isqy-controls input[type=search] { flex: 1 1 250px; width: auto; }
.ns-isqy-controls select { flex: 0 1 205px; width: auto; }
.ns-isqy-result { margin: 10px 0; border: 1px solid var(--line); border-radius: 8px; padding: 15px; font-size: 13px; line-height: 1.65; overflow-wrap: anywhere; }
.ns-isqy-result > p { margin: 6px 0; }
.ns-isqy-library { border: 1px solid var(--line); border-radius: 9px; padding: 16px; margin: 20px 0; background: var(--paper); }
.ns-isqy-library > summary, .ns-data-details > summary { cursor: pointer; font-size: 13px; font-weight: 600; }
.ns-isqy-library .ns-isqy-browser { margin-top: 15px; }
.ns-isqy-selected { margin: 25px 0; }
.ns-isqy-dialog { position: fixed; width: min(840px, 90vw); max-height: 86vh; padding: 28px; border: 1px solid #d8d0c7; border-radius: 12px; color: #38332f; background: #fffdfa; overflow-y: auto; }
.ns-isqy-dialog::backdrop { background: rgba(25, 20, 16, .4); }
.ns-dialog-close { float: right; position: sticky; top: 0; z-index: 1; }
.ns-isqy-dialog h2 { font-size: 24px; line-height: 1.5; margin-right: 65px; }
.ns-data-details { margin-top: 15px; padding: 13px 0; border-top: 1px solid #e4dfd8; }
.ns-data-json { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; line-height: 1.8; max-height: 420px; overflow-y: auto; padding: 12px; background: #f7f4f0; border-radius: 6px; }
.ns-source-link { overflow-wrap: anywhere; }
.ns-field-list { display: grid; grid-template-columns: minmax(90px, 150px) minmax(0, 1fr); gap: 12px 16px; font-size: 13px; line-height: 1.8; }
.ns-field-list dt { font-weight: 600; color: #766557; }
.ns-field-list dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.ns-page-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.ns-page-heading .ns-page-title { margin-bottom: 0; }
.ns-chapter-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 20px; min-height: max(610px, calc(100vh - 190px)); }
.ns-chapter-list { align-self: start; padding: 16px; }
.ns-card-title { margin: 3px 8px 14px !important; font-family: inherit !important; font-size: 13px !important; color: var(--muted); }
.ns-chapter-item { display: flex; width: 100%; align-items: center; gap: 12px; padding: 11px 9px; border: 0; border-radius: 8px; background: transparent; text-align: left; cursor: pointer; color: var(--ink); }
.ns-chapter-item:hover { background: var(--wash); }
.ns-chapter-item.is-selected { background: #f2ebe4; }
.ns-chapter-number { color: #a19a92; font-family: Georgia, serif; font-size: 17px; }
.ns-chapter-label { display: flex; min-width: 0; flex-direction: column; gap: 4px; }
.ns-chapter-label strong { overflow: hidden; font-size: 13px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.ns-chapter-label small { color: var(--muted); font-size: 11px; }
.ns-editor-panel { display: flex; min-width: 0; flex-direction: column; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.ns-editor-top { display: flex; align-items: center; gap: 12px; padding: 20px 24px 14px; }
.ns-chapter-title { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font-family: Georgia, "Noto Serif SC", serif; font-size: 24px; font-weight: 600; }
.ns-chapter-title:focus { box-shadow: 0 1px var(--accent); }
.ns-save-state { color: var(--muted); font-size: 11px; }
.ns-editor-tabs { display: flex; gap: 3px; padding: 0 20px; border-bottom: 1px solid var(--line); }
.ns-subnav-button { padding: 10px 13px; font-size: 12px; }
.ns-writing-area { flex: 1; width: 100%; min-height: 450px; resize: vertical; border: 0; outline: none; padding: 32px clamp(22px, 5vw, 72px); background: transparent; color: #302d2a; font-family: Georgia, "Noto Serif SC", serif; font-size: 17px; line-height: 2; }
.ns-writing-area::placeholder { color: #b0aaa3; }
.ns-editor-footer { display: flex; align-items: center; flex-wrap: wrap; gap: 15px; min-height: 56px; padding: 10px 20px; border-top: 1px solid var(--line); }
.ns-editor-footer .ns-button { margin-left: auto; }
.ns-editor-empty { display: grid; place-content: center; justify-items: center; min-height: 400px; text-align: center; }
.ns-empty-icon { display: grid; place-items: center; width: 54px; height: 54px; margin-bottom: 10px; border-radius: 50%; background: var(--wash); color: var(--accent); font-size: 25px; }
.ns-editor-empty h2 { margin: 8px 0; }
.ns-plan-editor, .ns-asset-review { padding: 24px clamp(20px, 4vw, 54px); }
.ns-plan-intro { margin: 0 0 22px; color: #605a54; font-size: 14px; line-height: 1.7; }
.ns-field-label { display: flex; flex-direction: column; gap: 7px; margin: 16px 0 7px; color: #48433e; font-size: 13px; font-weight: 650; }
.ns-field-label small { color: var(--muted); font-size: 11px; font-weight: 400; }
.ns-plan-input, .ns-text-input { width: 100%; border: 1px solid #ddd6cf; border-radius: 7px; background: white; padding: 11px 12px; color: var(--ink); font: inherit; font-size: 13px; line-height: 1.7; }
.ns-plan-input:focus, .ns-text-input:focus { border-color: #94705b; outline: 2px solid rgba(114, 75, 58, .12); }
.ns-ai-notice { margin: 18px 0; padding: 14px 16px; border-left: 3px solid #c5a66c; border-radius: 0 7px 7px 0; background: #faf6ee; color: #685b46; font-size: 12px; line-height: 1.7; }
.ns-ai-notice p { margin: 5px 0 0; }
.ns-asset-row { display: flex; align-items: center; gap: 8px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.ns-asset-row > div:first-child { display: flex; flex: 1; flex-direction: column; gap: 5px; }
.ns-asset-type { color: var(--muted); font-size: 11px; }
.ns-people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin-top: 22px; }
.ns-person-card h2 { margin: 14px 0 7px; }
.ns-person-card .ns-status-pill { float: right; }
.ns-uncertainty { color: #93713e; font-size: 12px; }
.ns-section-title { margin: 34px 0 12px; font-family: Georgia, serif; font-size: 21px; }
.ns-fact-row { margin: 9px 0; font-size: 12px; overflow-wrap: anywhere; }
.ns-settings-card, .ns-create-card { max-width: 760px; }
.ns-settings-card > .ns-button { margin-top: 18px; }
.ns-new-project { max-width: 800px; margin: 4vh auto; }
.ns-create-card { padding: 30px; }
.ns-toast { position: sticky; z-index: 10; top: 34px; margin: 12px 0; padding: 12px 16px; border-radius: 8px; font-size: 13px; }
.ns-toast-error { border: 1px solid #e6b9b2; background: #fff0ed; color: #823a2e; }
.ns-loading { padding: 60px; color: var(--muted); }
@media (max-width: 850px) {
	.ns-header { flex-wrap: wrap; gap: 12px; padding: 13px; }
	.ns-brand { min-width: auto; }
	.ns-top-nav { order: 3; flex-basis: 100%; overflow-x: auto; }
	.ns-project-select { margin-left: auto; }
	.ns-story-grid { grid-template-columns: 1fr; }
	.ns-chapter-layout { grid-template-columns: 1fr; }
	.ns-chapter-list { max-height: 230px; overflow: auto; }
}
@media (max-width: 520px) {
	.ns-admin-wrap { margin-right: 8px; }
	.ns-page { padding: 24px 12px 38px; }
	.ns-editor-top { flex-wrap: wrap; padding: 16px; }
	.ns-chapter-title { flex-basis: 100%; }
	.ns-writing-area { min-height: 360px; padding: 24px 18px; font-size: 16px; }
	.ns-recent-list li { flex-direction: column; gap: 5px; }
}
