/* Shared surface hierarchy. Lines identify data, boundaries and focus;
   ordinary controls and content groups use tone and spacing instead. */
:root {
 --ui-field:color-mix(in srgb,var(--ink) 5%,var(--surface));
 --ui-field-hover:color-mix(in srgb,var(--ink) 8%,var(--surface));
 --ui-raised:var(--paper);
 --ui-elevation:0 10px 32px var(--shadow-color);
}
.monochrome-shell,.adm,body.admin-mode,dialog,.auth-premium {
 --ui-field:color-mix(in srgb,var(--ink) 5%,var(--surface));
 --ui-field-hover:color-mix(in srgb,var(--ink) 8%,var(--surface));
}
.monochrome-shell {--ui-raised:color-mix(in srgb,var(--ink) 4%,var(--ref-canvas))}
.adm,body.admin-mode {--ui-field:color-mix(in srgb,var(--ink) 5%,var(--paper));--ui-field-hover:color-mix(in srgb,var(--ink) 8%,var(--paper))}

/* Main entry points: a single quiet surface, with no nested icon frames. */
.monochrome-shell .sidebar-new-row {border:0;background:var(--ref-control);border-radius:14px;min-height:48px}
.monochrome-shell .sidebar-new,html[data-theme=light] .monochrome-shell .sidebar-new {min-height:48px;padding:8px 10px;gap:10px}
.monochrome-shell .sidebar-new>svg {background:transparent;color:var(--ink);padding:3px;width:22px;height:22px;border-radius:0}
.monochrome-shell .sidebar-new-modes {border-left:0;margin-right:6px}
.monochrome-shell .sidebar-new-modes summary {width:36px;height:36px;border-radius:9px}
.monochrome-shell .sidebar-new-modes>div {border:0;box-shadow:var(--ui-elevation)}
.monochrome-shell .workspace-rail .workspace-nav-link.active>svg {border-color:transparent}
.monochrome-shell .workspace-rail .workspace-nav-link.active:before,
.monochrome-shell .workspace-sidebar .session-card.selected:before {display:none}
.monochrome-shell .sidebar-avatar-trigger .avatar {border:0}
.monochrome-shell .sidebar-membership .membership-mini {border:0;background:var(--ref-selected)}
.monochrome-shell .history-search {border-color:transparent}
.monochrome-shell .history-search:focus-within {border-color:transparent;outline:2px solid var(--accent);outline-offset:2px}
.monochrome-shell .history-search>kbd {border:0;background:color-mix(in srgb,var(--ink) 7%,transparent)}

/* Home, conversations and image creation share the same input material. */
.monochrome-shell :is(.home-view,.model-chat-view) .composer,
.monochrome-shell .image-studio-composer {
 border:0;border-radius:22px;background:var(--ui-raised);
 box-shadow:0 4px 20px color-mix(in srgb,var(--ink) 5%,transparent);
}
.monochrome-shell :is(.home-view,.model-chat-view) .composer:focus-within,
.monochrome-shell .image-studio-composer:focus-within {border:0;box-shadow:0 4px 20px color-mix(in srgb,var(--ink) 5%,transparent)}
/* One fine edge defines the chat field; the soft shadow only lifts it slightly. */
.monochrome-shell :is(.home-view,.model-chat-view) .composer,
.monochrome-shell :is(.home-view,.model-chat-view) .composer:focus-within {
 --chat-composer-edge:color-mix(in srgb,var(--ink) 13%,transparent);
 --chat-composer-shadow:0 2px 6px -2px rgb(0 0 0 / .08),0 8px 20px -8px rgb(0 0 0 / .07);
 box-shadow:inset 0 0 0 1px var(--chat-composer-edge),var(--chat-composer-shadow);
}
html[data-theme=dark] .monochrome-shell :is(.home-view,.model-chat-view) .composer,
html[data-theme=dark] .monochrome-shell :is(.home-view,.model-chat-view) .composer:focus-within {
 --chat-composer-edge:color-mix(in srgb,var(--ink) 17%,transparent);
 --chat-composer-shadow:0 2px 8px -2px rgb(0 0 0 / .18),0 8px 20px -8px rgb(0 0 0 / .16);
}
html[data-theme=light] .monochrome-shell :is(.home-view,.model-chat-view) .composer {
 --chat-composer-edge:color-mix(in srgb,var(--ink) 9%,transparent);
 background:var(--surface);
}
/* Typing uses the caret as its focus cue; keyboard toolbar actions retain theirs. */
.monochrome-shell :is(.home-view,.model-chat-view) .composer:has(:focus-visible:not(textarea)),
.monochrome-shell .image-studio-composer:has(:focus-visible:not(textarea)) {outline:2px solid var(--accent);outline-offset:3px}
.monochrome-shell :is(.home-view,.model-chat-view) .composer textarea {background:transparent;caret-color:var(--accent)}
.monochrome-shell :is(.home-view,.model-chat-view) .composer textarea:focus-visible {outline:0;box-shadow:none}
.monochrome-shell .composer-model {border:0;background:color-mix(in srgb,var(--ink) 5%,transparent)}
.monochrome-shell .chat-mode-switch {border:0;background:color-mix(in srgb,var(--ink) 5%,transparent)}
.monochrome-shell .home-shortcut.active {border-color:transparent;background:var(--ref-control)}
.monochrome-shell .home-model-icon {border:0}
.monochrome-shell .home-rail-arrow {border:0;background:var(--paper);box-shadow:0 3px 12px var(--shadow-color)}
.monochrome-shell .model-chat-view .message.user .markdown {border:0}
.monochrome-shell .image-studio-suggestions>button {border:0;background:var(--ui-field)}
.monochrome-shell .image-studio-suggestions>button:hover {background:var(--ui-field-hover)}
.monochrome-shell :is(.image-studio-model-avatar,.image-studio-model-option-icon,.image-studio-welcome-mark) {border:0}
.monochrome-shell .image-studio-more {border:0;background:var(--ui-field)}
.monochrome-shell :is(.image-studio-model-trigger,.image-studio-size-trigger):hover,
.monochrome-shell .image-studio-size-option.is-selected {border-color:transparent}
.monochrome-shell :is(.image-studio-model-popover,.image-studio-size-popover) {border:0;box-shadow:var(--ui-elevation)}
.monochrome-shell .image-studio-custom-fields input {border:0;background:var(--ui-field)}
.monochrome-shell .image-studio-custom-fields input[aria-invalid=true] {outline:2px solid var(--danger);outline-offset:2px}

/* Standard form controls; compound search fields keep only their outer fill. */
:is(.monochrome-shell,.adm,dialog) .field :is(input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=range]):not([type=color]),textarea,select),
:is(.adm,body.admin-mode dialog) :is(.message-field,.storage-field) :is(input,textarea,select),
.adm .model-filters select {
 border:var(--admin-control-border,0);background:var(--admin-control-fill,var(--ui-field));border-radius:12px;box-shadow:var(--admin-control-shadow,none);
}
:is(.monochrome-shell,.adm,dialog) .field :is(input,textarea,select):hover:not(:disabled) {background:var(--ui-field-hover)}
:is(.monochrome-shell,.adm,dialog) .field :is(input,textarea,select):focus-visible {outline:2px solid var(--accent);outline-offset:2px;box-shadow:none}
:is(.monochrome-shell,.adm,dialog) .field :is(input,textarea,select)[aria-invalid=true] {outline:2px solid var(--danger);outline-offset:2px}
.adm :is(.search-box,.drawing-search,.gallery-search,.user-search,.file-icon-search) {border:0;background:var(--ui-field);border-radius:10px}
.adm :is(.search-box,.drawing-search,.gallery-search,.user-search,.file-icon-search) input {background:transparent;border:0}
:is(.monochrome-shell,.adm,body.admin-mode dialog,dialog) .btn.secondary {border-color:transparent;background:var(--ui-field)}
:is(.monochrome-shell,.adm,body.admin-mode dialog,dialog) .btn.secondary:hover:not(:disabled) {border-color:transparent;background:var(--ui-field-hover)}
:is(.monochrome-shell,.adm,body.admin-mode dialog,dialog) .btn.danger {border-color:transparent;color:var(--danger);background:var(--danger-soft)}
:is(.monochrome-shell,.adm,body.admin-mode dialog) .model-picker-trigger {border:0;border-radius:12px;background:var(--ui-field);box-shadow:none}
:is(.monochrome-shell,.adm,body.admin-mode dialog) .model-picker-trigger:hover:not(:disabled) {background:var(--ui-field-hover)}
:is(.monochrome-shell,.adm) .model-picker-popover {border:0;box-shadow:var(--ui-elevation)}

/* Content surfaces retain distinct membership colors and table separators. */
.monochrome-shell :is(.panel,.notice-article,.membership-usage-card,.membership-cards,.membership-usage-records,.membership-reset-card) {border:0;background:var(--ui-raised);box-shadow:none}
.monochrome-shell :is(.membership-tier-card,.membership-tier-symbol,.membership-tier-badge,.upgrade-card,.upgrade-card-symbol,.upgrade-type,.upgrade-quota) {border-color:transparent}
.monochrome-shell .upgrade-card.is-selected {outline:2px solid var(--membership-accent);outline-offset:3px;box-shadow:none}
.monochrome-shell .subscription-periods {border:0}
.monochrome-shell :is(.notice-bar,.nv-notice) {border:0;background:var(--ui-field)}
.monochrome-shell .notice-bar.error {background:var(--danger-soft);color:var(--danger)}
dialog:not(.auth-dialog),body.admin-mode dialog {border:0;box-shadow:var(--admin-shadow-raised,var(--ui-elevation))}
.monochrome-shell .sidebar-user-menu {border:0;box-shadow:var(--ui-elevation)}

/* Writing tools: manuscript stays open; settings and assistant controls match. */
.novels-main,.nv-dialog {--ui-field:color-mix(in srgb,var(--ink) 5%,var(--nv-canvas,var(--surface)));--ui-field-hover:color-mix(in srgb,var(--ink) 8%,var(--nv-canvas,var(--surface)))}
.novels-main .nv-book {border:0;background:var(--ui-field);border-radius:16px;transition:background-color .16s}
.novels-main .nv-book:hover {background:var(--ui-field-hover)}
.novels-main :is(.nv-book-settings,.sc-book-settings) {border:0;background:transparent;border-radius:8px}
.novels-main :is(.nv-book-settings,.sc-book-settings):hover {background:var(--nv-selection)}
.novels-main .nv-button:not(.nv-primary),.nv-dialog .nv-button:not(.nv-primary) {border-color:transparent;background:var(--ui-field)}
.novels-main .nv-button:not(.nv-primary):hover:not(:disabled),.nv-dialog .nv-button:not(.nv-primary):hover:not(:disabled) {background:var(--ui-field-hover)}
.novels-main :is(.nv-empty,.sc-empty) {border:0;background:var(--ui-field);border-radius:16px}
.novels-main .nv-chapter.selected {border-color:transparent}
.novels-main :is(.nv-assistant,.nv-outline-row) :is(input,textarea),.nv-dialog :is(input:not([type=radio]):not([type=checkbox]):not([type=file]),textarea,select) {border:0;background:var(--ui-field);border-radius:12px;box-shadow:none}
.novels-main :is(.nv-assistant,.nv-outline-row) :is(input,textarea):focus-visible,.nv-dialog :is(input,textarea,select):focus-visible {outline:2px solid var(--nv-accent,var(--accent));outline-offset:2px;box-shadow:none}
.novels-main [data-model-picker-variant=novel] .model-picker-trigger {border:0;background:var(--ui-field)}
.novels-main [data-model-picker-variant=novel] .model-picker-trigger:hover:not(:disabled) {background:var(--ui-field-hover)}
.novels-main [data-model-picker-variant=novel] .model-picker-popover {border:0}
.novels-main [data-model-picker-variant=novel] .model-picker-search {border:0;border-radius:10px;background:var(--ui-field)}
.novels-main :is(.nv-live,.nv-memory-warning) {border:0}
.novels-main .nv-document-context :is(.nv-chapter-brief p,.nv-thinking pre,.nv-result-preview) {border:0;background:var(--nv-tool);box-shadow:var(--ui-elevation)}
.scripts-main :is(.sc-guide,.sc-guide-details,.sc-sample) {border:0}
.scripts-main .sc-guide-details {background:var(--nv-tool)}
.scripts-main .sc-guide {background:transparent}
.scripts-main .sc-guide blockquote {border-left:0;border-radius:10px}
.nv-dialog .sc-export-option {border:0;background:var(--ui-field)}
.nv-dialog .sc-export-option:has(input:checked) {background:var(--nv-selection,var(--accent-soft));outline:1px solid var(--nv-accent,var(--accent))}

/* Admin preserves the active neutral-dark / light palette without nested outlined boxes. */
.adm :is(.panel,.member-admin-table,.user-table-wrap,.conversation-table-scroll,.drawing-table-scroll,.registry-manager,.channel-directory,.channel-editor,.overview-comparison,.overview-activity,.plan-card,.message-card,.storage-panel,.file-icon-card,.system-settings,.member-admin-empty) {border:0}
.adm :is(.settings-nav,.category-card,.category-icon,.settings-section-icon,.payment-channel-card,.menu-order-row,.settings-save,.file-icon-savebar,.overview-period-tabs,.overview-total,.overview-total-icon,.member-admin-stats,.coding-model-admin-row,.coding-default-model,.plan-sale) {border:0}
.adm .settings-nav {background:var(--hover)}
.adm .brand-preview-wrap {border:0;background:var(--ui-field)}
.adm :is(.category-model,.settings-form .switch-field,.coding-enable) {border:0;background:var(--ui-field)}
.adm .settings-section-icon {background:transparent;color:var(--accent)}
.adm .overview-shortcut {border-color:transparent;background:var(--paper)}
.adm .adm-nav-link.active {box-shadow:none}
.adm .member-admin-search {border:0}
.adm .coding-admin-page .panel.coding-admin-panel {border:0!important}
.adm .adm-top .theme-trigger,body .theme-switcher .theme-trigger {border:0;box-shadow:none}

/* Login's own palette remains isolated; fields use its existing soft material. */
.auth-premium .auth-form-wrap {border:0}
.auth-premium .field input,html[data-theme=dark] .auth-premium .field input {border:0;box-shadow:none}
.auth-premium .field input:focus {box-shadow:none}
.auth-premium .field input:focus-visible {outline:2px solid var(--accent);outline-offset:3px}

@media(max-width:760px) {
 .monochrome-shell :is(.home-view,.model-chat-view) .composer,.monochrome-shell .image-studio-composer {border-radius:18px}
 .monochrome-shell .sidebar-new-modes summary {height:44px;min-width:44px}
 .monochrome-shell .sidebar-new-row,.monochrome-shell .sidebar-new,html[data-theme=light] .monochrome-shell .sidebar-new {min-height:48px}
}
@media(prefers-contrast:more) {
 :is(.monochrome-shell,.adm,dialog) .field :is(input,textarea,select),
 .monochrome-shell :is(.home-view,.model-chat-view) .composer,
 .monochrome-shell .image-studio-composer,
 .novels-main .nv-assistant :is(input,textarea),.nv-dialog :is(input,textarea,select) {outline:1px solid var(--muted);outline-offset:0}
}
