/* Shared console foundation. The five --nv brand colors remain in app.css. */
:root {
    --nv-page: color-mix(in srgb, var(--nv-bg) 50%, black);
    --nv-panel: color-mix(in srgb, var(--nv-surface) 55%, black);
    --nv-panel-raised: color-mix(in srgb, var(--nv-surface) 70%, black);
    --nv-editor: color-mix(in srgb, var(--nv-bg) 32%, black);
    --nv-line: color-mix(in srgb, var(--nv-border) 42%, transparent);
    --nv-muted: #a8c2d9;
    --nv-ease: cubic-bezier(.2,0,0,1);
    --nv-motion-fast: 120ms;
    --nv-motion-enter: 160ms;
    --nv-motion-panel: 220ms;
    --nv-font-ui: 'IBM Plex Sans', 'Microsoft YaHei', 'PingFang SC', system-ui, sans-serif;
}
body { background: var(--nv-page); color: var(--nv-text); font-size: 14px; line-height: 1.6; }
* { scrollbar-color: var(--nv-border) var(--nv-page); }
:focus-visible { outline: 2px solid var(--nv-accent); outline-offset: 3px; }
.app-shell { min-height: 100dvh; }
.sidebar { width: 232px; background: var(--nv-editor); border-right: 1px solid var(--nv-line); }
.main-wrap { margin-left: 0; min-width: 0; }
.main-area { padding: 32px; padding-bottom: 32px; }
.page { max-width: 1600px; margin-inline: auto; min-width: 0; padding: 0; }
.main-area { background-image: none; }
.page-header { display: flex; align-items: flex-start; flex-wrap: wrap; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.page-heading { min-width: 0; flex: 1; }
.page-title { font-size: 24px; line-height: 1.35; font-weight: 600; letter-spacing: 0; overflow-wrap: anywhere; }
.page-meta { font-family: var(--nv-font-ui); font-size: 13px; line-height: 1.65; letter-spacing: 0; color: var(--nv-muted); }
.page-actions, .form-actions, .user-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.page-actions { margin-left: auto; }
.card, .mud-paper.card, .survey-list-row, .survey-block, .survey-edit-block, .survey-preview, .login-card {
    background: var(--nv-panel); border-color: var(--nv-line); border-radius: 8px; box-shadow: none;
}
.card { margin-bottom: 16px; }
.card-header { padding: 16px 20px; border-color: var(--nv-line); flex-wrap: wrap; }
.card-title, .stat-label { font-family: var(--nv-font-ui); font-size: 13px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--nv-muted); }
.card-body { padding: 20px; }
.stat-grid { gap: 12px; margin-bottom: 24px; grid-template-columns: repeat(auto-fit,minmax(160px,1fr)); }
.stat { padding: 16px 20px; border-top: 2px solid var(--nv-line); }
.stat-value { font-size: 28px; line-height: 1.25; color: var(--nv-text); font-variant-numeric: tabular-nums; }
.stat-hint, .stat-sub, .ll-ip, .survey-note { font-size: 13px; color: var(--nv-muted); }
.nav-label { font-family: var(--nv-font-ui); font-size: 12px; letter-spacing: .04em; margin-top: 16px; color: var(--nv-muted); }
.module-nav .mud-nav-link { padding: 10px 12px; border-radius: 6px; border-left: 2px solid transparent; }
.module-nav .mud-nav-link-icon { margin-right: 12px; }
.module-nav .mud-nav-link.active { border-left-color: var(--nv-accent); background: color-mix(in srgb,var(--nv-accent) 12%,transparent); }
.module-nav .mud-nav-link, .mud-button, .nv-material-table tr { transition: background-color 120ms var(--nv-ease), color 120ms var(--nv-ease), border-color 120ms var(--nv-ease); }
.brand { padding: 24px 20px; }
.brand-sub { letter-spacing: .16em; }
.sidebar-footer { flex-wrap: wrap; gap: 8px; padding: 16px; border-color: var(--nv-line); }
.nv-language-float { position: fixed; right: max(20px, env(safe-area-inset-right)); bottom: max(20px, env(safe-area-inset-bottom)); z-index: 1500; }
.nv-language-float .mud-button-root { min-width: 64px; min-height: 44px; box-shadow: 0 4px 16px rgba(0,0,0,.3); }
.auth-shell, .bare-shell { background: var(--nv-page); padding-bottom: 32px; }
.login-card { width: min(420px,100%); padding: 32px; border-top: 2px solid var(--nv-accent); }
.login-sub { color: var(--nv-muted); letter-spacing: 0; font-family: var(--nv-font-ui); }
.mud-input-control { min-width: 0; }
.mud-input-outlined .mud-input-outlined-border { border-color: var(--nv-line); }
.mud-button-root { text-transform: none; border-radius: 6px; letter-spacing: 0; }
.mud-button-filled-primary { color: var(--nv-editor); }
.form-row { gap: 12px; }
.form-row > label { color: var(--nv-muted); font-size: 13px; }
.nv-material-table { overflow-x: auto; }
.nv-material-table table { font-size: 14px; }
.nv-material-table th { background: var(--nv-editor); color: var(--nv-muted); font-size: 12px; }
.nv-material-table td, .nv-material-table th { padding: 12px 16px; border-color: var(--nv-line); }
.nv-material-table td .mono, .nv-material-table td.mono { font-size: 12px; }
.nv-material-table tr:hover td { background: color-mix(in srgb,var(--nv-accent) 6%,transparent); }
.nv-material-table tr.selected-row td, .nv-material-table tr.expanded td { background: color-mix(in srgb,var(--nv-accent) 12%,transparent); }
.log-table-wrap { overflow: hidden; }
.batch-bar { border: 1px solid var(--nv-line); border-radius: 6px; background: var(--nv-panel-raised); padding: 12px 16px; }
.nv-disclosure { border: 1px solid var(--nv-line); border-radius: 8px; background: var(--nv-panel); margin-bottom: 16px; }
.nv-disclosure > summary { padding: 12px 20px; cursor: pointer; color: var(--nv-muted); font-size: 13px; }
.nv-disclosure > .card { margin: 0; border: 0; }
.nv-disclosure[open] > :not(summary) { animation: nv-fade 180ms var(--nv-ease); }
.nv-state-panel { padding: 32px; border: 1px solid var(--nv-line); border-radius: 8px; background: var(--nv-panel); margin: 16px 0; }
.nv-state-panel h2 { margin: 12px 0 8px; font-size: 18px; }
.nv-state-description { color: var(--nv-muted); }
.nv-state-panel .mud-progress-linear { max-width: 240px; }
.nv-route { min-width: 0; }
@keyframes nv-page-in { from { opacity: .3; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes nv-fade { from { opacity: .3; } to { opacity: 1; } }
.nv-overlay { position: fixed; inset: 0; z-index: 1400; }
.nv-overlay-backdrop { position: absolute; inset: 0; background: rgba(0,8,18,.65); }
.nv-overlay-panel { position: absolute; right: 0; top: 0; height: 100dvh; width: min(880px,90vw); background: var(--nv-panel); border-left: 1px solid var(--nv-line); overflow-y: auto; }
.nv-overlay[data-closing=true] { pointer-events: none; }
.nv-overlay-open { overflow: hidden; }
.nv-modal { display: flex; align-items: center; justify-content: center; padding: 24px; }
.nv-modal .nv-overlay-panel { position: relative; inset: auto; width: min(640px,100%); max-height: calc(100dvh - 48px); height: auto; border: 1px solid var(--nv-line); border-radius: 8px; }
.nv-modal .card { border: 0; margin: 0; }
.nv-modal .card-header { justify-content: space-between; }
.log-drawer { animation: none; box-shadow: none; width: min(880px,90vw); }
.log-drawer-head { border-color: var(--nv-line); background: var(--nv-editor); padding: 16px 20px; }
.log-drawer-body { padding: 20px; min-height: 0; }
.log-detail-text, .monaco-host { background: var(--nv-editor); border-color: var(--nv-line); }
.drawer-close { flex-shrink: 0; }
.key-reveal { border: 1px solid var(--nv-accent); background: var(--nv-editor); border-radius: 6px; padding: 16px; overflow-wrap: anywhere; }
.key-value { overflow-wrap: anywhere; word-break: break-all; }
.perm-group { padding: 12px 0; border-bottom: 1px solid var(--nv-line); }
.perm-grid > .perm-group { grid-column: 1 / -1; }
.perm-group-title { color: var(--nv-accent); font-size: 13px; font-weight: 500; }
.chat-panel { display: flex; flex-direction: column; height: min(740px,calc(100dvh - 200px)); min-height: 360px; }
.chat-log { flex: 1; min-height: 0; height: auto; overflow-y: auto; padding: 16px 20px; overflow-anchor: auto; }
.chat-line { padding: 10px 0; border-bottom: 1px solid var(--nv-line); gap: 12px; }
.chat-nick { color: var(--nv-accent); font-family: var(--nv-font-ui); font-weight: 500; }
.chat-time, .chat-ip { font-size: 12px; color: var(--nv-muted); }
.chat-text { font-size: 14px; overflow-wrap: anywhere; }
.chat-compose { flex-shrink: 0; padding: 16px; border-top: 1px solid var(--nv-line); background: var(--nv-editor); }
.ticket-layout { grid-template-columns: minmax(0,1fr) 320px; gap: 20px; }
.ticket-note { border-left: 3px solid var(--nv-border); background: var(--nv-editor); }
.survey-reading { max-width: 760px; }
.survey-edit-workspace { display: grid; grid-template-columns: minmax(0,1fr) minmax(320px,.8fr); gap: 24px; align-items: start; }
.survey-edit-column { min-width: 0; }
.survey-edit-workspace .survey-preview { position: sticky; top: 24px; max-height: calc(100dvh - 48px); overflow: auto; margin-top: 0; }
.survey-preview-empty { padding: 24px; color: var(--nv-muted); border: 1px dashed var(--nv-line); border-radius: 8px; }
.survey-block, .survey-edit-block { padding: 20px; }
.survey-result-bar { background: var(--nv-accent); }
.chart-grid { stroke: var(--nv-line); }
.chart-value { fill: var(--nv-text); font-family: var(--nv-font-mono); font-size: 12px; }
.chart-label { fill: var(--nv-muted); font-family: var(--nv-font-ui); font-size: 12px; }
.nv-chart-line { stroke: var(--nv-accent); }
.nv-chart-dot { fill: var(--nv-accent); }
.nv-chart-area { fill: color-mix(in srgb,var(--nv-accent) 12%,transparent); }
.dev-tabs { gap: 8px; border-bottom: 1px solid var(--nv-line); overflow-x: auto; }
.mud-button.dev-tab { border-radius: 6px 6px 0 0; }
.nv-mobile-preview-tabs { display: none; }
.info-workspace { display: grid; grid-template-columns: minmax(200px,280px) minmax(0,1fr); gap: 20px; align-items: start; }
.info-entry-nav { position: sticky; top: 24px; max-height: calc(100dvh - 48px); overflow: auto; background: var(--nv-editor); border: 1px solid var(--nv-line); border-radius: 8px; padding: 8px; }
.info-entry-nav button { display: block; width: 100%; text-align: left; border: 0; border-left: 2px solid transparent; padding: 12px; background: transparent; color: var(--nv-muted); cursor: pointer; font: inherit; }
.info-entry-nav button.active { border-left-color: var(--nv-accent); color: var(--nv-text); background: var(--nv-panel-raised); }
.mobile-topbar { background: var(--nv-editor); border-color: var(--nv-line); }
.nv-module-links { display: flex; flex-wrap: wrap; gap: 12px; }
.nv-mobile-sidebar { left: 0; right: auto; width: 232px; display: flex; flex-direction: column; background: var(--nv-editor); border-left: 0; border-right: 1px solid var(--nv-line); }
.nv-nav-close { position: absolute; right: 4px; top: 4px; min-width: 40px; }
.module-nav { min-height: 0; overflow-y: auto; }
.mud-popover-open { z-index: 1600 !important; }
.ticket-msg-head, .ticket-msg-time { font-size: 12px; }
.ticket-msg-body { font-size: 14px; }
.ticket-msg-internal { border-left-color: var(--nv-status-warn); }
.draft-diff summary { cursor: pointer; padding: 12px; color: var(--nv-accent); }
.draft-body { font-size: 14px; }
@media (max-width: 1023px) {
    .ticket-layout, .survey-edit-workspace, .info-workspace { grid-template-columns: minmax(0,1fr); }
    .info-entry-nav { position: static; max-height: 220px; }
    .survey-edit-workspace .survey-preview { position: static; max-height: none; }
}
@media (max-width: 767px) {
    .nv-desktop-sidebar { display: none; }
    .main-wrap { margin-left: 0; }
    .main-area { padding: 20px 16px; }
    .mobile-topbar { display: flex; padding: 8px 12px; align-items: center; gap: 8px; }
    .page-title { font-size: 22px; }
    .page-header { gap: 12px; margin-bottom: 20px; }
    .card-body, .card-header { padding: 16px; }
    .mud-button-root, .mud-icon-button, .info-entry-nav button { min-height: 44px; }
    .mud-icon-button { min-width: 44px; }
    .form-row, .info-editor-row { flex-wrap: wrap; }
    .form-row > *, .info-editor-row > * { min-width: 0 !important; max-width: 100%; }
    .form-row > .mud-input-control { flex-basis: 100%; }
    .stat-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .stat { padding: 12px; }
    .nv-overlay-panel, .log-drawer { width: 100%; }
    .nv-modal { padding: 12px; }
    .nv-modal .nv-overlay-panel { max-height: calc(100dvh - 24px); }
    .chat-panel { height: calc(100dvh - 200px); }
    .chat-line { flex-wrap: wrap; }
    .chat-text { flex-basis: 100%; }
    .nv-mobile-preview-tabs { display: flex; gap: 8px; margin: 12px 0; }
    .survey-edit-workspace.nv-preview-mode > .survey-edit-column { display: none; }
    .survey-edit-workspace:not(.nv-preview-mode) > .survey-preview,
    .survey-edit-workspace:not(.nv-preview-mode) > .survey-preview-empty { display: none; }
    .brand { padding: 20px; }
    .login-card { padding: 24px; }
}
@media (min-width: 768px) { .mobile-topbar, .nv-mobile-nav { display: none; } }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
