/* ==========================================================================
   InfinityN∞tes - Theme & Layout
   ========================================================================== */

/* ------------------------------------
   Design Tokens (colors, fonts, sizes)
   ------------------------------------ */
:root {
  --bg-dark: #07090e;
  --bg-card: rgba(16, 21, 31, 0.75);
  --bg-card-solid: #10151f;
  --bg-input: #0b0e14;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(0, 229, 255, 0.4);

  --accent-cyan: #00e5ff;
  --accent-purple: #9d4edd;
  --accent-magenta: #f72585;
  --accent-green: #10b981;
  --accent-amber: #f59e0b;
  --accent-red: #ef4444;

  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'Fira Code', monospace;

  --sidebar-width: 260px;
  --topbar-height: 64px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ------------------------------------
   Base reset & page background
   ------------------------------------ */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-sans);
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  /* subtle glow spots */
  background-image:
    radial-gradient(circle at 15% 15%, rgba(0, 229, 255, 0.03) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(157, 78, 221, 0.03) 0%, transparent 40%);
  background-attachment: fixed;
}

/* ------------------------------------
   Sidebar – fixed left navigation
   ------------------------------------ */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-card-solid);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transition: var(--transition);
}

.brand {
  padding: 24px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-color);
}

.brand-logo {
  color: var(--accent-cyan);
  filter: drop-shadow(0 0 6px rgba(0, 229, 255, 0.5));
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
}

.infinity-symbol {
  color: var(--accent-cyan);
}

.brand-tagline {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* --- nav buttons --- */
.nav-menu {
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.nav-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  width: 100%;
}

.nav-icon {
  width: 18px;
  height: 18px;
  fill: currentColor;
  opacity: 0.7;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
}

.nav-btn.active {
  background: rgba(0, 229, 255, 0.08);
  color: var(--accent-cyan);
  border-left: 3px solid var(--accent-cyan);
}

.nav-btn.active .nav-icon {
  fill: var(--accent-cyan);
  opacity: 1;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-color);
}

.privacy-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--text-dim);
}

.badge-icon {
  width: 14px;
  height: 14px;
  fill: var(--accent-green);
}

/* ------------------------------------
   Mobile top bar (hidden on desktop)
   ------------------------------------ */
.mobile-header {
  display: none;
  height: 56px;
  background: var(--bg-card-solid);
  border-bottom: 1px solid var(--border-color);
  padding: 0 16px;
  align-items: center;
  justify-content: space-between;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 110;
}

.mobile-nav-toggle {
  background: none;
  border: none;
  color: var(--text-main);
  cursor: pointer;
}

/* ------------------------------------
   Main content area
   ------------------------------------ */
.main-viewport {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* --- top bar (search + quick note) --- */
.top-bar {
  height: var(--topbar-height);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  background: rgba(7, 9, 14, 0.8);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 90;
}

.global-search-wrapper {
  position: relative;
  width: 380px;
  max-width: 100%;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  fill: var(--text-dim);
}

.global-search-wrapper input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  padding: 8px 36px 8px 36px;
  border-radius: 20px;
  color: var(--text-main);
  font-size: 0.85rem;
  transition: var(--transition);
}

.global-search-wrapper input:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.15);
}

.clear-search-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
}

/* ------------------------------------
   Tab views – only active is visible
   ------------------------------------ */
.content-container {
  padding: 32px;
  flex: 1;
}

.tab-view {
  display: none;
  animation: fadeIn 0.25s ease;
}

.tab-view.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.view-header {
  margin-bottom: 24px;
}

.view-header h2 {
  font-size: 1.6rem;
  font-weight: 700;
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 4px;
}

/* ------------------------------------
   Buttons
   ------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn-block {
  width: 100%;
}

.btn-accent {
  background: var(--accent-cyan);
  color: #000;
  font-weight: 600;
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.2);
}

.btn-accent:hover {
  background: #33ebff;
  box-shadow: 0 0 18px rgba(0, 229, 255, 0.4);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-color);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btn-outline {
  background: transparent;
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.btn-outline:hover {
  background: rgba(0, 229, 255, 0.1);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
  color: var(--accent-red);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.2);
}

.btn-text-link {
  background: none;
  border: none;
  color: var(--accent-cyan);
  font-size: 0.75rem;
  cursor: pointer;
  text-decoration: underline;
}

.btn-icon {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* ------------------------------------
   Empty state (shown when no notes)
   ------------------------------------ */
.empty-state-card {
  background: var(--bg-card);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-lg);
  padding: 48px 24px;
  text-align: center;
  max-width: 520px;
  margin: 40px auto;
}

.empty-icon {
  font-size: 3rem;
  color: var(--accent-cyan);
  margin-bottom: 12px;
}

.empty-state-card h3 {
  font-size: 1.25rem;
  margin-bottom: 8px;
}

.empty-state-card p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 24px;
}

/* ------------------------------------
   Dashboard – metrics grid + charts
   ------------------------------------ */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px;
  backdrop-filter: blur(10px);
}

.metric-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.metric-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: #fff;
  margin: 6px 0 2px;
  font-family: var(--font-mono);
}

.metric-sub {
  font-size: 0.75rem;
  color: var(--accent-cyan);
}

/* --- chart cards --- */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  width: 100%;
}

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  backdrop-filter: blur(10px);

  min-width: 0;
  overflow: hidden;
}

.chart-card.wide {
  grid-column: span 2;
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.chart-header h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
}

.chart-body {
  position: relative;
  width: 100%;
  min-width: 0;
  height: 220px;
  display: block;
  align-items: center;
  justify-content: center;
}

.chart-body canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-width: 100%;
}

.chart-body.donut-body {
  display: flex;
  gap: 20px;
}

.chart-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.8rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-color {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

/* ------------------------------------
   Form elements
   ------------------------------------ */
.input-select,
.input-text,
textarea {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  padding: 10px 12px;
  font-size: 0.875rem;
  font-family: var(--font-sans);
  width: 100%;
  transition: var(--transition);
}

.input-select-sm {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 0.75rem;
}

.input-select:focus,
.input-text:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent-cyan);
}

/* ------------------------------------
   Archive filters bar
   ------------------------------------ */
.filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 24px;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.filter-group select {
  width: auto;
}

/* --- note cards (grid) --- */
.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.note-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.note-card:hover {
  border-color: var(--accent-cyan);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.note-card-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 8px;
}

.note-card-meta {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 0.75rem;
}

.badge-style {
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.06);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 229, 255, 0.2);
}

.note-card-summary {
  font-size: 0.85rem;
  color: var(--text-main);
  font-weight: 500;
  margin-bottom: 10px;
}

.note-card-preview {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 14px;
}

.note-card-footer {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-dim);
  border-top: 1px solid var(--border-color);
  padding-top: 10px;
  margin-top: auto;
}

/* ------------------------------------
   Note editor – two‑column layout (form + metadata)
   ------------------------------------ */
.note-editor-card {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 24px;
}

.editor-main {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.editor-label-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 0.85rem;
}

.telemetry-counter {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* --- AI summary box --- */
.ai-summary-box {
  background: rgba(157, 78, 221, 0.05);
  border: 1px solid rgba(157, 78, 221, 0.3);
  border-radius: var(--radius-md);
  padding: 16px;
}

.ai-box-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.ai-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-purple);
}

.ai-spark-icon {
  width: 16px;
  height: 16px;
  fill: var(--accent-purple);
}

.ai-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 8px;
}

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(157, 78, 221, 0.3);
  border-top-color: var(--accent-purple);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* --- metadata sidebar --- */
.editor-sidebar-metadata {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: fit-content;
}

.editor-sidebar-metadata h3 {
  font-size: 0.95rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 10px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.datetime-display-box {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent-cyan);
  background: var(--bg-input);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.form-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

/* ------------------------------------
   Detail view – main + sidebar
   ------------------------------------ */
.detail-container {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 24px;
}

.detail-main {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.detail-title-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px 24px;
}

.detail-title-text {
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
  margin: 0;
}

.detail-title-text:empty::before {
  content: 'Untitled';
  color: var(--text-dim);
  font-weight: 400;
}

.detail-summary-card {
  background: rgba(157, 78, 221, 0.08);
  border: 1px solid rgba(157, 78, 221, 0.3);
  border-radius: var(--radius-md);
  padding: 20px;
}

.card-tag {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent-purple);
  font-weight: 700;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.summary-text {
  font-size: 1.05rem;
  line-height: 1.6;
  color: #fff;
  font-weight: 500;
}

.detail-note-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
}

.note-body-text {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text-main);
  white-space: pre-wrap;
}

/* --- detail sidebar metadata --- */
.detail-sidebar .meta-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
}

.meta-panel h3 {
  font-size: 0.9rem;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
}

.meta-item {
  display: flex;
  flex-direction: column;
  margin-bottom: 14px;
}

.meta-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
}

.meta-value {
  font-size: 0.875rem;
  font-weight: 500;
  margin-top: 2px;
}

.code-font {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ------------------------------------
   Timeline – vertical stream with connecting line
   ------------------------------------ */
.timeline-wrapper {
  position: relative;
  padding-left: 24px;
  margin-top: 10px;
}

/* vertical line down the left side */
.timeline-wrapper::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border-color);
}

.timeline-day-group {
  margin-bottom: 32px;
}

.timeline-date-header {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent-cyan);
  margin-bottom: 16px;
  position: relative;
}

/* dot on the timeline */
.timeline-date-header::before {
  content: '';
  position: absolute;
  left: -21px;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-cyan);
  box-shadow: 0 0 8px var(--accent-cyan);
}

.timeline-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
  margin-left: 8px;
  cursor: pointer;
  transition: var(--transition);
}

.timeline-item:hover {
  border-color: var(--accent-cyan);
}

.timeline-header {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.75rem;
  margin-bottom: 8px;
}

.timeline-time {
  font-family: var(--font-mono);
  color: var(--text-dim);
}

/* ------------------------------------
   Insights – algorithmically generated cards
   ------------------------------------ */
.insights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.insight-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--accent-cyan);
  border-radius: var(--radius-md);
  padding: 20px;
}

.insight-type {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent-cyan);
  font-weight: 700;
  margin-bottom: 6px;
}

.insight-card p {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-main);
}

/* ------------------------------------
   Settings
   ------------------------------------ */
.settings-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 680px;
}

.settings-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
}

.settings-card h3 {
  font-size: 1.05rem;
  margin-bottom: 6px;
}

.settings-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 18px;
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.danger-zone {
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.03);
}

/* ------------------------------------
   Toast notifications (floating bottom‑right)
   ------------------------------------ */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1000;
}

.toast {
  background: var(--bg-card-solid);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--accent-cyan);
  color: var(--text-main);
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.25s ease-out;
}

.toast-error {
  border-left-color: var(--accent-red);
}

.toast-success {
  border-left-color: var(--accent-green);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ------------------------------------
   Confirmation modal overlay
   ------------------------------------ */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.modal-box {
  background: var(--bg-card-solid);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  width: 400px;
  max-width: 90%;
}

.modal-box h3 {
  margin-bottom: 8px;
}

.modal-box p {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* ------------------------------------
   Utilities
   ------------------------------------ */
.hidden {
  display: none !important;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ------------------------------------
   Responsive – adapts to tablet & mobile
   ------------------------------------ */
@media (max-width: 900px) {

  /* sidebar slides off-screen, shown by toggle */
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .mobile-header {
    display: flex;
  }

  .main-viewport {
    margin-left: 0;
    padding-top: 56px;
  }

  .top-bar {
    padding: 0 16px;
  }

  .content-container {
    padding: 16px;
  }

  /* charts stack vertically */
  .charts-grid {
    grid-template-columns: 1fr;
  }

  .chart-card.wide {
    grid-column: span 1;
  }

  /* editor & detail become single‑column */
  .note-editor-card {
    grid-template-columns: 1fr;
  }

  .detail-container {
    grid-template-columns: 1fr;
  }

  .global-search-wrapper {
    width: 100%;
  }
}
