/*
  JARVIS Home — page layout. (Phase 10a; chrome + palette revised after
  first review.)
  Requires jarvis-design-system.css + jarvis-components.css loaded
  first. This file is layout/composition only — visual primitives
  (buttons, chips, cards, empty states) all come from jarvis-components.css.

  The shared .sp-top-bar / .sidebar markup (styles.css, every page) is
  dark by default — that's the thing this revision was asked to move
  away from. Rather than touch styles.css (used by 9 other pages not in
  scope this round), everything below restyles those same shared classes
  to the new light/blue language, scoped to this page only by virtue of
  home.css only ever being loaded on dashboard.html.
*/

html, body {
  background: var(--db-bg);
  color: var(--db-text);
  font-family: var(--font-body);
}

/* ============ Main content ============ */

.home-main {
  flex: 1;
  min-width: 0;
  margin: 0;
  background: var(--db-bg);
  min-height: calc(100vh - var(--jx-shell-h, 52px));
  padding: var(--space-6) var(--space-8) var(--space-10);
}

.home-main * {
  box-sizing: border-box;
}

/* ============ Top-bar search -> command palette trigger ============ */

/* ============ Briefing ============ */

.home-briefing {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-5);
  flex-wrap: wrap;
  margin-bottom: var(--space-5);
}

.home-briefing h1 {
  margin: 4px 0 6px;
}

.home-briefing h1 #home-user-name {
  color: var(--brand-primary);
}

.home-briefing-sentence {
  color: var(--db-text-muted);
}

.home-briefing-chips {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

/* ============ Ask Jarvis ============
   The one place this page leans on the accent — framed as JARVIS's own
   voice/intelligence entry point, not a generic search bar, so the
   restrained green reads as "AI is listening here" rather than a
   second competing primary color. */

.home-ask {
  padding: var(--space-5);
  margin-bottom: var(--space-6);
  background: var(--db-surface);
  border: 1px solid var(--db-accent-soft);
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.home-ask::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--db-accent-bright);
}

.home-ask-form {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.home-ask-icon {
  font-size: 18px;
  flex-shrink: 0;
  color: var(--db-accent);
}

.home-ask-input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 14px;
  font-family: inherit;
  color: var(--db-text);
}

.home-ask-input::placeholder {
  color: var(--db-text-faint);
}

.home-ask-form .jbtn-primary {
  background: var(--db-accent) !important;
}

.home-ask-form .jbtn-primary:hover {
  background: var(--db-accent-hover) !important;
}

.home-ask-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: var(--space-3);
}

.home-ask-chip {
  background: var(--db-surface);
  border: 1px solid var(--db-border);
  color: var(--db-text-muted);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: var(--db-radius-full);
  cursor: pointer;
}

.home-ask-chip:hover {
  border-color: var(--db-accent);
  color: var(--db-accent);
}

/* ============ Grid ============ */

.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: var(--space-5);
  align-items: start;
}

.home-col-primary,
.home-col-secondary {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.home-card-link {
  font-size: 12px;
  font-weight: 650;
  color: var(--db-primary);
  text-decoration: none;
}

.home-card-link:hover {
  text-decoration: underline;
}

/* ============ Inbox ============ */

.home-inbox-count {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  margin-left: 6px;
  padding: 0 5px;
  border-radius: var(--db-radius-full);
  background: var(--db-accent);
  color: #fff;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  vertical-align: 2px;
}

.home-inbox-toggle {
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.home-inbox-empty {
  margin: 0;
  color: var(--db-text-muted);
  font-size: 13px;
}

.home-inbox-empty a {
  color: var(--db-primary);
}

.home-inbox-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.home-inbox-item {
  border-bottom: 1px solid var(--db-border);
}

.home-inbox-item:last-child {
  border-bottom: 0;
}

.home-inbox-head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: 10px 0;
  border: 0;
  background: none;
  color: var(--db-text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.home-inbox-kind {
  flex: none;
  padding: 2px 8px;
  border-radius: var(--db-radius-full);
  background: var(--db-surface-hover);
  color: var(--db-text-muted);
  font-size: 11px;
  font-weight: 700;
}

.home-inbox-kind-reminder {
  background: var(--db-danger-soft);
  color: var(--db-danger);
}

/* something Nodis did on its own (Agent Authority level 4) */
.home-inbox-kind-update {
  background: var(--db-success-soft);
  color: var(--db-success);
}

.home-inbox-kind-proposal {
  background: var(--db-primary-soft, var(--db-surface-hover));
  color: var(--db-primary);
}

.home-inbox-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-size: 13.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-inbox-item.is-resolved .home-inbox-title {
  color: var(--db-text-faint);
  font-weight: 500;
}

.home-inbox-when {
  flex: none;
  color: var(--db-text-faint);
  font-size: 12px;
}

.home-inbox-detail {
  padding: 0 0 var(--space-3);
  font-size: 13px;
}

.home-inbox-md h3,
.home-inbox-md h4,
.home-inbox-md h5,
.home-inbox-md h6 {
  margin: 0.8em 0 0.3em;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--db-text-muted);
}

.home-inbox-md > :first-child {
  margin-top: 0;
}

.home-inbox-md p,
.home-inbox-md .md-list {
  margin: 0 0 0.5em;
}

.home-inbox-md .md-list {
  padding-left: 1.2em;
}

.home-inbox-actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.home-inbox-resolved {
  margin: var(--space-2) 0 0;
  color: var(--db-text-faint);
  font-size: 12px;
}

/* ============ My Work ============ */

.home-task-group {
  margin-bottom: var(--space-4);
}

.home-task-group:last-child {
  margin-bottom: 0;
}

.home-task-group-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--db-text-faint);
  margin-bottom: var(--space-2);
}

.home-task-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.home-task-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 8px 6px;
  border-radius: var(--db-radius-sm);
}

.home-task-item:hover {
  background: var(--db-surface-hover);
}

.home-task-title {
  flex: 1;
  font-size: 13px;
  color: var(--db-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-task-project {
  font-size: 11.5px;
  color: var(--db-text-faint);
  flex-shrink: 0;
}

.home-task-due {
  font-size: 11.5px;
  color: var(--db-text-muted);
  flex-shrink: 0;
  width: 72px;
  text-align: right;
}

/* ============ Meetings list ============ */

.home-meeting-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.home-meeting-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 9px 6px;
  border-radius: var(--db-radius-sm);
  cursor: pointer;
}

.home-meeting-item:hover {
  background: var(--db-surface-hover);
}

.home-meeting-date {
  font-size: 11px;
  font-weight: 650;
  color: var(--db-text-faint);
  width: 72px;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}

.home-meeting-body {
  flex: 1;
  min-width: 0;
}

.home-meeting-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--db-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-meeting-meta {
  font-size: 11.5px;
  color: var(--db-text-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============ Continue working ============ */

.home-continue-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  text-decoration: none;
}

.home-continue-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--db-radius-sm);
  background: var(--db-primary-soft);
  color: var(--db-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
}

.home-continue-title {
  font-size: 13px;
  font-weight: 650;
  color: var(--db-text);
}

.home-continue-sub {
  font-size: 11.5px;
  color: var(--db-text-faint);
}

/* ============ Intelligence ============
   Severity (danger/warning) still carries the urgency signal — that's
   functional, not brand. The green eyebrow label is the one deliberate
   tie back to "JARVIS noticed this," kept small and singular rather
   than recoloring the whole card, so severity and identity don't
   compete for the same visual channel. */

.home-intelligence-eyebrow {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--db-accent);
  margin-bottom: var(--space-3);
}

.home-insight-card {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--db-radius);
  margin-bottom: var(--space-2);
  border: 1px solid var(--db-border);
  background: var(--db-surface);
  text-decoration: none;
}

.home-insight-card.severity-danger {
  background: var(--db-danger-soft);
  border-color: var(--db-danger-soft);
}

.home-insight-card.severity-warning {
  background: var(--db-warning-soft);
  border-color: var(--db-warning-soft);
}

.home-insight-icon {
  font-size: 15px;
  flex-shrink: 0;
}

.home-insight-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--db-text);
}

.home-insight-body {
  font-size: 12px;
  color: var(--db-text-muted);
}

/* ============ Meeting drawer content ============ */

.home-drawer-field {
  margin-bottom: var(--space-4);
}

.home-drawer-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.home-drawer-list li {
  font-size: 12.5px;
  color: var(--db-text);
  padding: 8px 10px;
  background: var(--db-surface-sunken);
  border-radius: var(--db-radius-sm);
}

@media (max-width: 980px) {
  .home-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .home-main {
    padding: var(--space-4);
  }
  
}

/* ============ Your concepts ============ */

.home-concept { display: flex; align-items: flex-start; gap: var(--space-3); padding: var(--space-2) 0; border-top: 1px solid var(--n-150); text-decoration: none; color: var(--db-text); }
.home-concept:first-child { border-top: 0; padding-top: 0; }
.home-concept:hover .home-concept-name { color: var(--db-primary); text-decoration: underline; }
.home-concept-icon { width: 32px; height: 32px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; border-radius: var(--db-radius-sm); background: var(--db-accent-soft); color: color-mix(in srgb, var(--db-accent) 70%, #1f2937); font-size: 15px; }
.home-concept-main { min-width: 0; }
.home-concept-name { font-size: 13.5px; font-weight: 600; }
.home-concept-change { margin-top: 2px; font-size: 12px; font-weight: 600; color: var(--db-primary); }
.home-concept-highlight { margin-top: 2px; font-size: 12px; color: var(--db-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-concept-quiet { margin-top: 2px; font-size: 12px; color: var(--db-text-faint); }
.home-concepts-empty { margin: 0 0 var(--space-3); font-size: 13px; line-height: 1.5; color: var(--db-text-muted); }

/* ============ Time saved ============ */

.home-saved-total { margin: 0 0 var(--space-3); font-size: 14px; color: var(--db-text-muted); }
.home-saved-total strong { display: block; font-family: var(--font-display, inherit); font-size: 26px; font-weight: 400; color: var(--db-text, inherit); line-height: 1.15; }
.home-saved-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.home-saved-list li { display: flex; justify-content: space-between; gap: var(--space-3); font-size: 13px; color: var(--db-text-muted); }
.home-saved-n { font-weight: 600; color: var(--db-text, inherit); font-variant-numeric: tabular-nums; }
.home-saved-basis { margin: var(--space-3) 0 0; font-size: 12px; line-height: 1.5; color: var(--db-text-faint); }
.home-saved-empty { margin: 0; font-size: 13px; line-height: 1.5; color: var(--db-text-muted); }

/* ============ Finish setting up ============ */

.home-setup-progress { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-3); color: var(--db-text-muted); font-size: 12.5px; font-weight: 600; }
.home-setup-bar { flex: 1; height: 6px; border-radius: 3px; background: var(--n-150); overflow: hidden; }
.home-setup-bar > span { display: block; height: 100%; background: var(--db-accent); border-radius: 3px; }
.home-setup-list { list-style: none; margin: 0 0 var(--space-3); padding: 0; }
.home-setup-list li + li { border-top: 1px solid var(--n-150); }
.home-setup-list a { display: flex; gap: var(--space-3); padding: 9px 0; text-decoration: none; color: var(--db-text); }
.home-setup-list a:hover .home-setup-title { color: var(--db-primary); text-decoration: underline; }
.home-setup-mark { flex: 0 0 auto; width: 16px; height: 16px; margin-top: 2px; border-radius: 50%; border: 1.5px solid var(--db-border-strong); }
.home-setup-title { display: block; font-size: 13.5px; font-weight: 600; }
.home-setup-opt { font-size: 11px; font-weight: 600; color: var(--db-text-faint); }
.home-setup-detail { display: block; margin-top: 1px; font-size: 12px; color: var(--db-text-muted); }
button.home-card-link { border: 0; background: none; padding: 0; font: inherit; font-family: var(--font-body); font-size: 12px; font-weight: 650; cursor: pointer; }

/* ============ Arranging Home (home-layout.js) =====   Each section's header carries a drag handle (left) and a collapse arrow
   (right). Collapsed: only the header — title and its link — shows. */

[data-home-section] > .jcard-header {
  gap: 8px;
}

[data-home-section] > .jcard-header > .text-section-title {
  flex: 1 1 auto;
  min-width: 0;
}

/* the handle sits in the header's left margin, so titles stay where they were */
[data-home-section] > .jcard-header,
.home-section-head-plain {
  position: relative;
}

.home-section-tools {
  position: absolute;
  left: 2px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
}

.home-section-head-plain .home-section-tools {
  left: -22px;
}

.home-section-grip,
.home-section-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  margin-right: -6px;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--db-text-faint);
  cursor: pointer;
}

.home-section-grip {
  width: 18px;
  margin-right: 0;
  cursor: grab;
  opacity: 0;
  transition: opacity 0.15s;
}

[data-home-section]:hover .home-section-grip,
.home-section-grip:focus-visible {
  opacity: 1;
}

.home-section-grip:active {
  cursor: grabbing;
}

.home-section-grip:hover,
.home-section-toggle:hover,
.home-section-grip:focus-visible,
.home-section-toggle:focus-visible {
  background: var(--db-surface-hover);
  color: var(--db-text);
}

.home-section-toggle svg {
  transition: transform 0.18s ease;
}

[data-home-section].is-collapsed .home-section-toggle svg {
  transform: rotate(-90deg);
}

[data-home-section].is-collapsed > .home-section-collapsible {
  display: none !important;
}

[data-home-section].is-collapsed > .jcard-header {
  border-bottom: 0;
}

/* "Nodis noticed" has no card header: its label is the header */
.home-section-head-plain {
  margin-bottom: var(--space-3);
}

.home-section-head-plain .home-section-toggle {
  margin-left: auto;
}

[data-home-section].is-collapsed .home-section-head-plain {
  margin-bottom: 0;
}

[data-home-section].is-dragging {
  opacity: 0.45;
}

.home-drop-marker {
  height: 3px;
  margin: -10px 0;
  border-radius: 3px;
  background: var(--db-primary);
}

.home-layout-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: var(--space-4);
  color: var(--db-text-faint);
  font-size: 12px;
}

.home-layout-bar[hidden] {
  display: none;
}

.home-layout-reset {
  border: 0;
  background: none;
  padding: 0;
  color: var(--db-primary);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}

.home-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (hover: none) {
  .home-section-grip {
    opacity: 1;
  }
}

/* Approvals: proposals waiting for the user's OK, top of Home */
.home-approvals-list { list-style: none; margin: 0; padding: 0; }
.home-approval { padding: 10px 0; border-bottom: 1px solid var(--db-border); }
.home-approval:last-child { border-bottom: 0; }
.home-approval.is-resolved { opacity: 0.7; }
.home-approval-head { display: flex; align-items: baseline; gap: var(--space-3); margin-bottom: 6px; }
.home-approval-title { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 600; color: var(--db-text); }

/* "Show all N in My Tasks" under a capped My Work group */
.home-task-more { display: inline-block; margin: 6px 0 4px 12px; color: var(--db-primary); font-size: 12.5px; font-weight: 600; text-decoration: none; }
.home-task-more:hover { text-decoration: underline; }
