/* NeuronVault experience layer: quiet second-brain workspace, not a KPI dashboard. */

:root {
  --bg-void: #f5f7f4;
  --bg-base: #ffffff;
  --bg-elevated: #f8faf8;
  --bg-overlay: #ffffff;
  --bg-card: #ffffff;
  --bg-muted: #edf1ed;
  --bg-hover: #e9efeb;
  --accent-emerald: #1d6f54;
  --accent-emerald-dim: #155c45;
  --accent-emerald-glow: #e5f1eb;
  --accent-emerald-border: #8bb8a5;
  --accent-amber: #9a6a13;
  --color-positive: #26765b;
  --color-negative: #b84d3b;
  --color-moderator: #9a6a13;
  --color-neutral: #6f7c75;
  --color-info: #386d83;
  --text-primary: #17211d;
  --text-secondary: #4f5f57;
  --text-muted: #718078;
  --text-code: #315f4e;
  --border-subtle: #e0e6e2;
  --border-default: #cbd5cf;
  --border-strong: #aebbb4;
  --shadow-card: 0 1px 2px rgba(23, 33, 29, 0.05);
  --shadow-elevated: 0 14px 34px rgba(23, 33, 29, 0.14);
  --font-sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sidebar-width: 224px;
}

[data-theme="dark"] {
  --bg-void: #141816;
  --bg-base: #181d1a;
  --bg-elevated: #202622;
  --bg-overlay: #202622;
  --bg-card: #1c221f;
  --bg-muted: #27302b;
  --bg-hover: #2b352f;
  --accent-emerald: #70c5a1;
  --accent-emerald-dim: #8bd4b4;
  --accent-emerald-glow: #233b31;
  --accent-emerald-border: #467a65;
  --accent-amber: #d4ae63;
  --color-positive: #70c5a1;
  --color-negative: #e18370;
  --color-moderator: #d4ae63;
  --color-neutral: #9ba9a1;
  --color-info: #82b6c8;
  --text-primary: #edf3ef;
  --text-secondary: #b7c4bd;
  --text-muted: #8c9b93;
  --text-code: #9acfb8;
  --border-subtle: #2e3933;
  --border-default: #3c4942;
  --border-strong: #526158;
  --shadow-card: none;
  --shadow-elevated: 0 18px 42px rgba(0, 0, 0, 0.35);
}

html {
  color-scheme: light;
}

[data-theme="dark"] {
  color-scheme: dark;
}

body {
  background: var(--bg-void);
  letter-spacing: 0;
}

button,
input,
textarea,
select {
  font: inherit;
  letter-spacing: 0;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent-emerald) 38%, transparent);
  outline-offset: 2px;
}

.nv-icon {
  display: block;
  flex: 0 0 auto;
}

#top-bar {
  height: 56px;
  padding: 0 18px;
  gap: 18px;
  background: color-mix(in srgb, var(--bg-void) 94%, var(--bg-base));
}

.top-bar-logo {
  min-width: calc(var(--sidebar-width) - 18px);
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
  color: inherit;
}

.logo-mark {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  background: var(--text-primary);
  color: var(--bg-base);
  box-shadow: none;
  font-size: 10px;
  font-weight: 750;
}

.logo-text {
  font-size: 14px;
  font-weight: 680;
  letter-spacing: 0;
}

.logo-text span {
  color: var(--text-secondary);
}

#search-bar {
  min-height: 34px;
  max-width: 520px;
  justify-content: flex-start;
  background: var(--bg-base);
  color: var(--text-muted);
  cursor: pointer;
  box-shadow: var(--shadow-card);
}

#search-bar:hover {
  color: var(--text-secondary);
  border-color: var(--border-default);
}

#search-bar:focus-visible {
  border-color: var(--accent-emerald);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-emerald) 18%, transparent);
}

.search-placeholder {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-bar-actions {
  min-width: 0;
}

.vault-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text-secondary);
  font-size: 12px;
  white-space: nowrap;
}

.status-dot.live {
  box-shadow: none;
}

.pulse {
  animation: none;
}

.lang-toggle {
  background: transparent;
}

.lang-btn {
  min-width: 34px;
  min-height: 30px;
}

.lang-btn.active {
  background: var(--text-primary);
  color: var(--bg-base);
}

.icon-btn {
  width: 34px;
  height: 34px;
  background: transparent;
  color: var(--text-secondary);
}

.sync-button {
  min-height: 34px;
}

#app {
  min-height: 0;
}

#sidebar {
  padding: 10px 8px 12px;
  background: var(--bg-void);
}

.sidebar-section {
  padding: 6px 0;
}

.sidebar-section-label {
  padding: 8px 10px 6px;
  font-size: 10px;
  letter-spacing: 0.08em;
}

.nav-item {
  width: 100%;
  min-height: 38px;
  border: 0;
  padding: 8px 10px;
  background: transparent;
  color: var(--text-secondary);
  text-align: left;
  font-weight: 520;
}

.nav-item.active {
  background: var(--accent-emerald-glow);
  color: var(--accent-emerald-dim);
  font-weight: 650;
}

.nav-item.active::before {
  display: none;
}

.nav-icon {
  width: 18px;
  display: grid;
  place-items: center;
}

.nav-badge {
  border-radius: 5px;
  background: transparent;
}

.sidebar-divider {
  margin: 8px 10px;
}

.sidebar-footer {
  margin-top: auto;
  padding: 12px 10px 4px;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.5;
}

.sidebar-footer strong {
  color: var(--text-secondary);
  font-weight: 650;
}

#main {
  min-width: 0;
  background: var(--bg-base);
  border-left: 1px solid var(--border-subtle);
}

.panel-header {
  min-height: 66px;
  padding: 12px 24px;
  background: var(--bg-base);
}

.panel-title h2,
.panel-title h1 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0;
}

.panel-title .panel-subtitle {
  display: block;
  margin-top: 2px;
  font-family: var(--font-sans);
  font-size: 12px;
}

.panel-controls {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.btn {
  min-height: 34px;
  border-radius: 6px;
  padding: 7px 11px;
  line-height: 1.2;
  box-shadow: none;
}

.btn:active {
  transform: none;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.btn-primary {
  background: var(--accent-emerald);
  color: #ffffff;
}

[data-theme="dark"] .btn-primary {
  color: #102019;
}

.btn-secondary {
  background: var(--bg-base);
}

.btn-quiet {
  border-color: transparent;
  background: transparent;
  color: var(--text-secondary);
}

.card,
.surface-section {
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: var(--bg-card);
  box-shadow: none;
}

.card:hover,
.glow-card:hover {
  border-color: var(--border-subtle);
  box-shadow: none;
}

.today-scroll {
  padding: 22px 24px 42px;
  background: var(--bg-void);
}

.today-layout {
  width: min(1180px, 100%);
  margin: 0 auto;
}

.today-status-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 16px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: var(--bg-card);
}

.today-status-item {
  min-width: 0;
  padding: 13px 16px;
}

.today-status-item + .today-status-item {
  border-left: 1px solid var(--border-subtle);
}

.today-status-label {
  color: var(--text-muted);
  font-size: 11px;
}

.today-status-value {
  margin-top: 3px;
  color: var(--text-primary);
  font-size: 20px;
  font-weight: 700;
}

.today-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(280px, 0.75fr);
  gap: 16px;
  align-items: start;
}

.today-column {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.surface-section {
  overflow: hidden;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px 13px;
  border-bottom: 1px solid var(--border-subtle);
}

.section-title-row {
  display: flex;
  gap: 10px;
  min-width: 0;
}

.section-title-row .nv-icon {
  margin-top: 1px;
  color: var(--text-secondary);
}

.section-heading h3 {
  font-size: 14px;
  font-weight: 700;
}

.section-heading p {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
}

.section-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.source-mode,
.state-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid var(--border-default);
  border-radius: 5px;
  padding: 3px 7px;
  color: var(--text-secondary);
  background: var(--bg-elevated);
  font-size: 10px;
  font-weight: 650;
  white-space: nowrap;
}

.source-mode.live,
.state-badge.changed {
  border-color: color-mix(in srgb, var(--color-positive) 45%, var(--border-subtle));
  color: var(--accent-emerald-dim);
  background: var(--accent-emerald-glow);
}

.state-badge.health {
  border-color: color-mix(in srgb, var(--accent-amber) 45%, var(--border-subtle));
  color: var(--accent-amber);
}

.state-badge.no-change {
  color: var(--text-muted);
}

.review-list,
.inbox-list,
.health-list {
  display: grid;
}

.review-item {
  padding: 15px 18px;
}

.review-item + .review-item,
.inbox-item + .inbox-item,
.health-row + .health-row {
  border-top: 1px solid var(--border-subtle);
}

.review-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--text-muted);
  font-size: 11px;
}

.review-title {
  margin-top: 8px;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 680;
  line-height: 1.4;
}

.review-detail {
  margin-top: 7px;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.55;
}

.review-detail li {
  margin-left: 18px;
}

.review-links {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.path-button {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-copy {
  padding: 22px 18px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
}

.section-body {
  padding: 15px 18px;
}

.field-row {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
}

.field-row > * {
  min-width: 0;
  flex: 1 1 150px;
}

.field,
.section-body input,
.section-body textarea,
.section-body select,
.section-toolbar input {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--border-default);
  border-radius: 6px;
  padding: 8px 10px;
  background: var(--bg-base);
  color: var(--text-primary);
}

.section-body textarea {
  min-height: 88px;
  resize: vertical;
}

.quick-actions {
  display: grid;
  gap: 8px;
}

.quick-action-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.quick-action-row .btn {
  flex: 1 1 110px;
  justify-content: center;
}

.today-note {
  margin-top: 11px;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.5;
}

.inbox-item,
.health-row {
  padding: 12px 16px;
}

.inbox-copy {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.55;
}

.inbox-actions,
.health-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 9px;
}

.health-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.health-copy {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--text-secondary);
  font-size: 12px;
}

.health-actions {
  margin-top: 0;
}

.notice {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  margin-bottom: 14px;
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--accent-amber);
  border-radius: 6px;
  padding: 11px 13px;
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.45;
}

.result-details {
  border-top: 1px solid var(--border-subtle);
}

.result-details summary {
  padding: 12px 16px;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 12px;
}

.result-content {
  padding: 0 16px 16px;
  color: var(--text-secondary);
  font-size: 12px;
}

.result-content pre {
  max-height: 260px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: var(--font-mono);
  font-size: 11px;
}

#search-overlay,
#command-overlay,
#settings-overlay {
  background: rgba(15, 22, 18, 0.56);
  backdrop-filter: none;
}

.search-modal {
  width: min(640px, calc(100% - 28px));
  border-radius: 8px;
  background: var(--bg-overlay);
  box-shadow: var(--shadow-elevated);
}

.search-result {
  width: 100%;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  text-align: left;
}

.settings-modal {
  width: min(480px, calc(100% - 28px));
}

.toast {
  border-radius: 7px;
  background: var(--bg-overlay);
  backdrop-filter: none;
}

@media (max-width: 980px) {
  :root {
    --sidebar-width: 190px;
  }

  .vault-status,
  .sync-button {
    display: none;
  }

  .today-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  body {
    height: 100dvh;
  }

  #top-bar {
    height: 52px;
    padding: 0 12px;
    gap: 10px;
  }

  .top-bar-logo {
    min-width: auto;
  }

  .logo-text,
  .lang-toggle,
  #settings-btn,
  .search-hint {
    display: none;
  }

  .top-bar-center {
    justify-content: stretch;
  }

  #search-bar {
    max-width: none;
  }

  #app {
    position: relative;
    padding-bottom: 58px;
  }

  #sidebar {
    position: fixed;
    z-index: 400;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 58px;
    padding: 5px 7px calc(5px + env(safe-area-inset-bottom));
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
    overflow-y: hidden;
    border-top: 1px solid var(--border-subtle);
    border-right: 0;
    background: var(--bg-card);
  }

  #sidebar .sidebar-section:first-child {
    display: flex;
    gap: 3px;
    width: max-content;
    padding: 0;
  }

  #sidebar .sidebar-section:not(:first-child),
  #sidebar .sidebar-divider,
  #sidebar .sidebar-section-label,
  #sidebar .sidebar-footer {
    display: none;
  }

  .nav-item {
    width: auto;
    min-width: 70px;
    min-height: 46px;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    padding: 5px 8px;
    font-size: 10px;
  }

  .nav-icon {
    width: auto;
  }

  #main {
    border-left: 0;
  }

  .panel-header {
    min-height: 58px;
    padding: 10px 14px;
  }

  .panel-title .panel-subtitle {
    display: none;
  }

  .panel-controls {
    max-width: 50%;
  }

  .today-scroll {
    padding: 14px 12px 30px;
  }

  .today-status-strip {
    grid-template-columns: 1fr;
  }

  .today-status-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 13px;
  }

  .today-status-item + .today-status-item {
    border-top: 1px solid var(--border-subtle);
    border-left: 0;
  }

  .today-status-value {
    margin-top: 0;
    font-size: 17px;
  }

  .section-heading {
    padding: 14px;
  }

  .review-item {
    padding: 14px;
  }

  .health-row {
    grid-template-columns: 1fr;
  }

  .health-actions {
    justify-content: flex-start;
  }

  #toast-container {
    right: 12px;
    bottom: 72px;
    left: 12px;
  }

  .toast {
    min-width: 0;
  }
}

@media (max-width: 460px) {
  .top-bar-actions {
    gap: 4px;
  }

  #theme-toggle-btn {
    display: none;
  }

  .nav-item {
    min-width: 62px;
  }

  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .section-toolbar {
    justify-content: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
