/* ===== Home — the ADR-145 cross-app landing view =====
   Every colour is a framework theme token so the view is native to all cockpit themes;
   tone-* carries the closed neutral|good|warn enum and never invents a fourth state. */
/* CHANGE LOG: 1 | maintainer@emeraldcoastsystemsgroup.com | Compact daily areas and source details beside a stable Jarvis frame; retain searchable catalog access. */
/* 2 | maintainer@emeraldcoastsystemsgroup.com | Restore explicit centered native Home dialogs after the global margin reset. */

.apps-home {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 20px;
  height: 100%;
  overflow-y: auto;
}

.apps-home-head {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 4px 12px;
}

.apps-home-head h2 {
  margin: 0;
  font-family: var(--font-family-display);
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--text-primary);
}

.apps-home-head p {
  margin: 0;
  grid-column: 1;
  color: var(--text-secondary);
  font-size: 13px;
}

.apps-home-head button {
  grid-row: 1 / span 2;
  grid-column: 2;
  padding: 7px 14px;
  border-radius: var(--radius-md, 8px);
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-weight: 600;
  cursor: pointer;
}

.apps-home-head button:hover { border-color: var(--border-color-hover); }

/* The page is a column of suite shelves; each shelf holds the tile grid. */
.apps-home-grid {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.apps-home-shelf {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.apps-home-shelf-label {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.apps-home-tiles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 14px;
  align-items: start;
}

.apps-home-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md, 10px);
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Value leads; app-owned details and contextual actions form the reading surface. */
.apps-home { --home-accent: var(--accent-primary, #75a7ff); padding: clamp(16px, 3vw, 40px); gap: 30px; background: radial-gradient(ellipse at 80% 0%, color-mix(in srgb, var(--home-accent) 9%, transparent), transparent 50%); }
.apps-home-head { padding: 12px 0 22px; }
.apps-home-head h2 { font-size: clamp(24px, 3vw, 36px); letter-spacing: -.035em; line-height: 1.15; }
.apps-home-head p { margin-top: 10px; font-size: 14px; }
.apps-home-grid { gap: 36px; }
.apps-home-tiles-grid { gap: 18px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 350px), 1fr)); }
.apps-home-shelf[data-suite="ai-knowledge"] { --home-accent: #ad8bf7; }
.apps-home-shelf[data-suite="ai-finance"] { --home-accent: #47bea5; }
.apps-home-shelf[data-suite="ai-creative"] { --home-accent: #df91c5; }
.apps-home-shelf[data-suite="ai-home"] { --home-accent: #dfa961; }
.apps-home-shelf[data-suite="ai-engineering"] { --home-accent: #68b7d6; }
.apps-home-card { position: relative; border-radius: 18px; padding: 20px; gap: 16px; overflow: hidden; box-shadow: 0 8px 24px #0000000d, inset 0 1px 0 #ffffff0c; background: linear-gradient(135deg, color-mix(in srgb, var(--home-accent) 6%, var(--bg-card)), var(--bg-card) 65%); border-top-color: color-mix(in srgb, var(--home-accent) 35%, var(--border-color)); }
.apps-home-card-head { gap: 10px; }
.apps-home-app-icon { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 36px; height: 36px; border-radius: 11px; background: color-mix(in srgb, var(--home-accent) 13%, transparent); color: var(--home-accent); font-size: 18px; font-weight: 700; }
.apps-home-card-head h3 { flex: 1; min-width: 100px; letter-spacing: -.02em; }
.apps-home-purpose { margin: -4px 0 0; color: var(--text-secondary); font-size: 12px; line-height: 1.6; }
.apps-home-suite-overview { color: var(--text-muted); font-size: 12px; margin: -4px 0 4px; }
.apps-home-card .apps-home-items { order: 1; margin: 0; padding: 0; gap: 14px; }
.apps-home-card .apps-home-tiles { order: 2; padding-top: 14px; border-top: 1px solid var(--border-color); }
.apps-home-card .apps-home-todos { order: 3; }
.apps-home-card .apps-home-items li { display: flex; flex-wrap: wrap; gap: 10px; padding: 0 0 12px; border-bottom: 1px solid var(--border-color); line-height: 1.5; }
.apps-home-card .apps-home-items li:last-child { border-bottom: 0; padding-bottom: 0; }
.apps-home-card .apps-home-items li > span { flex: 1 1 100%; font-weight: 550; font-size: 14px; }
.apps-home-item-detail { display: block; font-size: 12px; color: var(--text-secondary); font-weight: 400; line-height: 1.65; margin-top: 6px; }
.apps-home-source { color: var(--home-accent); text-underline-offset: 3px; }
.apps-home-card .apps-home-items li.tone-neutral > span { color: var(--text-primary); }
.apps-home .apps-home-context-action { border-color: color-mix(in srgb, var(--home-accent) 45%, var(--border-color)); background: color-mix(in srgb, var(--home-accent) 10%, var(--bg-card)); font-weight: 600; padding: 8px 12px; }
.apps-home-card .apps-home-tile { background: transparent; padding: 4px 0; border: 0; }
.apps-home-card .apps-home-tile strong { font-size: 23px; letter-spacing: -.04em; }
.apps-home-tiles-grid { container-type: inline-size; }
@container (min-width: 718px) {
  .apps-home-card.is-briefing { grid-column: span 2; }
  .apps-home-card.is-briefing .apps-home-items { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
  .apps-home-card.is-briefing .apps-home-items li { align-content: start; }
  .apps-home-card.is-briefing .apps-home-items li:first-child { grid-column: 1 / -1; }
  .apps-home-card.is-briefing .apps-home-items li:first-child > span { font-size: 20px; line-height: 1.4; }
  .apps-home-card.is-briefing .apps-home-items li:last-child { grid-column: 1 / -1; }
}
.apps-home-highlights { background: linear-gradient(120deg, color-mix(in srgb, var(--home-accent) 9%, var(--bg-card)), var(--bg-card)); }
@media (prefers-reduced-motion: no-preference) {
  .apps-home button { transition: background .15s, border-color .15s; }
  .apps-home-card { transition: border-color .2s, box-shadow .2s; }
  .apps-home-card:hover { border-color: color-mix(in srgb, var(--home-accent) 40%, var(--border-color)); box-shadow: 0 10px 28px #00000015; }
}
@media (max-width: 600px) {
  .apps-home { padding: 14px; }
  .apps-home-head { grid-template-columns: 1fr; gap: 12px; }
  .apps-home-head-actions { grid-column: 1; grid-row: 3; justify-self: start; }
  .apps-home-card { padding: 16px; }
}

.apps-home-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.apps-home-card-head h3 {
  margin: 0;
  flex: 1;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.apps-home-badge {
  font-size: 11px;
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
}

.apps-home-open,
.apps-home-fix {
  padding: 5px 12px;
  border-radius: var(--radius-md, 8px);
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.apps-home-fix { border-color: var(--accent-primary); color: var(--accent-primary); }
.apps-home-open:hover,
.apps-home-fix:hover { background: var(--bg-card-hover); }

.apps-home-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 8px;
}

.apps-home-tile {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md, 8px);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.apps-home-tile-label {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.apps-home-tile strong {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.apps-home-tile.tone-good strong { color: var(--status-success); }
.apps-home-tile.tone-warn strong { color: var(--status-warning); }

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

.apps-home-items li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.apps-home-items li span { flex: 1; }
.apps-home-items li.tone-good span { color: var(--status-success); }
.apps-home-items li.tone-warn span { color: var(--status-warning); }

.apps-home-todos {
  border-top: 1px solid var(--border-color);
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.apps-home-progress {
  height: 4px;
  border-radius: 999px;
  background: var(--bg-tertiary);
  overflow: hidden;
}

.apps-home-progress span {
  display: block;
  height: 100%;
  background: var(--accent-primary);
}

.apps-home-count {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
}

.apps-home-todo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.apps-home-todo > div {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.apps-home-todo strong {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.apps-home-todo span {
  font-size: 12px;
  color: var(--text-muted);
}

.apps-home-loading,
.apps-home-quiet {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}
.apps-home button { cursor: pointer; border: 1px solid var(--border-color, #435067); background: var(--bg-card, #162033); color: inherit; border-radius: 6px; padding: 6px 10px; }
.apps-home button:disabled { cursor: default; opacity: .45; }
.apps-home button:focus-visible, .apps-home input:focus-visible { outline: 2px solid var(--accent-primary, #77baff); outline-offset: 3px; }
.apps-home-shelf-head, .apps-home-editor header, .apps-home-edit-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.apps-home-shelf-head h3 { margin: 0; }
.apps-home-highlights { border: 1px solid var(--border-color, #435067); padding: 16px; border-radius: 12px; }
.apps-home-highlights h3 { margin-top: 0; }
.apps-home-highlights-list { margin: 8px 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.apps-home-highlights-list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; font-size: 13px; }
.apps-home-highlights-list .tone-warn { color: var(--status-warning, #ffcb77); }
.apps-home-notice { border-left: 3px solid var(--status-warning, #ffcb77); padding: 8px 12px; font-size: 13px; }
.apps-home-card-head { flex-wrap: wrap; }
.apps-home-card.is-compact { padding: 12px; gap: 8px; }
.apps-home-card.is-compact .apps-home-tiles { gap: 4px; }
.apps-home-card.is-compact .apps-home-tile { padding: 8px; }
.apps-home-editor { position: fixed; inset: 0; margin: auto; width: min(640px, calc(100vw - 32px)); max-height: 85vh; box-sizing: border-box; overflow-y: auto; padding: 20px; border: 1px solid var(--border-color, #435067); border-radius: 12px; background: var(--bg-primary, #111827); color: var(--text-primary, #e5e7eb); }
.apps-home-editor::backdrop { background: #0009; }
.apps-home-editor h2 { margin: 0; font-size: 20px; }
.apps-home-editor fieldset { border: 0; padding: 0; min-width: 0; }
.apps-home-edit-group { padding: 12px 0; border-bottom: 1px solid var(--border-color, #435067); }
.apps-home-edit-row { padding: 7px 0; }
.apps-home-edit-row label { flex: 1; overflow-wrap: anywhere; }
.apps-home-edit-row input, .apps-home-editor input { accent-color: var(--accent-primary, #77baff); }
.apps-home-order { display: flex; gap: 4px; flex-shrink: 0; }
@media (max-width: 520px) { .apps-home-head { flex-wrap: wrap; } .apps-home-tiles-grid { grid-template-columns: minmax(0, 1fr); } .apps-home-editor { padding: 12px; } }

.apps-home-head-actions { grid-row: 1 / span 2; grid-column: 2; display: flex; gap: 8px; flex-wrap: wrap; }
.apps-home-tiles { grid-template-columns: repeat(auto-fit, minmax(125px, 1fr)); }
.apps-home-tile-label { white-space: normal; overflow-wrap: anywhere; }
@media (max-width: 520px) { .apps-home-head { grid-template-columns: 1fr; } .apps-home-head-actions { grid-row: 3; grid-column: 1; } }

/* Daily Home has bounded summaries; catalog and setup remain available on request. */
.apps-home-daily { box-sizing: border-box; padding: 16px 20px; gap: 14px; min-height: 0; color: var(--text-primary); }
.apps-home-daily .apps-home-head { padding: 0; gap: 12px; }
.apps-home-daily .apps-home-head h2 { font-size: 26px; }
.apps-home-daily .apps-home-head p { margin-top: 4px; font-size: 13px; }
.apps-home-daily .apps-home-head-actions { grid-row: 1; align-self: center; }
.apps-home-workspace { display: grid; grid-template-columns: minmax(290px, .85fr) minmax(0, 1.65fr); gap: 16px; align-items: start; }
.apps-home-assistant { position: sticky; top: 0; height: 560px; max-height: 78vh; min-height: 420px; overflow: hidden; border: 1px solid var(--border-color); border-radius: 14px; background: var(--bg-primary); }
.apps-home-assistant iframe { display: block; border: 0; width: 100%; height: 100%; }
.apps-home-summary { display: flex; flex-direction: column; min-width: 0; gap: 12px; }
.apps-home-areas { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.apps-home-areas button { text-align: left; min-width: 0; padding: 9px 10px; }
.apps-home-areas strong { display: block; font-size: 13px; }
.apps-home-areas span { display: block; margin-top: 4px; color: var(--text-secondary); font-size: 11px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.apps-home-areas button[aria-pressed="true"] { border-color: var(--accent-primary); background: color-mix(in srgb, var(--accent-primary) 10%, var(--bg-primary)); }
.apps-home-updates h3 { margin: 0 0 6px; font-size: 13px; color: var(--text-secondary); }
.apps-home-updates ul { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.apps-home-updates button { display: flex; flex-direction: column; gap: 4px; width: 100%; height: 100%; text-align: left; min-width: 0; }
.apps-home-updates strong { font-size: 12px; }
.apps-home-updates span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; color: var(--text-secondary); }
.apps-home-detail { min-width: 0; }
.apps-home-detail-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 0 0 8px; }
.apps-home-detail-head label { display: flex; align-items: center; flex: 1; min-width: 0; gap: 8px; font-size: 12px; color: var(--text-secondary); }
.apps-home-detail select { min-width: 0; max-width: 100%; flex: 1; padding: 7px; border: 1px solid var(--border-color); background: var(--bg-primary); color: var(--text-primary); border-radius: 6px; }
.apps-home-daily .apps-home-card { border-radius: 12px; padding: 14px; gap: 12px; max-height: 440px; overflow: auto; overscroll-behavior: contain; }
.apps-home-daily .apps-home-purpose { font-size: 12px; line-height: 1.4; }
.apps-home-daily .apps-home-card .apps-home-items { gap: 8px; }
.apps-home-daily .apps-home-card .apps-home-items li { gap: 6px; padding-bottom: 8px; }
.apps-home-daily .apps-home-card .apps-home-items li > span { font-size: 13px; overflow-wrap: anywhere; }
.apps-home-daily .apps-home-card .apps-home-tiles { padding-top: 8px; }
.apps-home-daily .apps-home-tile strong { font-size: 20px; }
.apps-home-daily .apps-home-todos { display: block; }
.apps-home-daily .apps-home-todos summary { cursor: pointer; color: var(--text-secondary); font-size: 12px; }
.apps-home-daily .apps-home-todos[open] > :not(summary) { margin-top: 10px; }
.apps-home-directory > label { display: block; margin: 18px 0 6px; }
.apps-home-directory input[type="search"] { box-sizing: border-box; width: 100%; background: var(--bg-primary); color: var(--text-primary); border: 1px solid var(--border-color); padding: 10px; border-radius: 6px; font: inherit; }
.apps-home-directory ul { list-style: none; padding: 0; margin: 12px 0 0; }
.apps-home-directory li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border-color); }
.apps-home-directory li > span { min-width: 0; overflow-wrap: anywhere; }
.apps-home-directory strong, .apps-home-directory small { display: block; }
.apps-home-directory small { margin-top: 4px; color: var(--text-secondary); line-height: 1.4; }
.apps-home-daily select:focus-visible, .apps-home-daily summary:focus-visible { outline: 2px solid var(--accent-primary); outline-offset: 3px; }
.apps-home-area-apps { margin-top: 12px; min-width: 0; }
.apps-home-area-apps h4, .apps-home-shelf-group h4 { margin: 0 0 6px; font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.apps-home-area-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px; min-width: 0; }
.apps-home-mini-card { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 6px 8px; border: 1px solid var(--border-color); border-radius: 8px; background: var(--bg-primary); min-width: 0; }
.apps-home-mini-card.is-selected { border-color: var(--accent-primary); background: color-mix(in srgb, var(--accent-primary) 10%, var(--bg-primary)); }
.apps-home-mini-select { flex: 1; min-width: 0; text-align: left; border: 0; background: transparent; color: var(--text-primary); font-size: 12px; font-weight: 600; padding: 2px 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.apps-home-all-shelf { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--border-color); min-width: 0; }
.apps-home-shelf-group { min-width: 0; }
.apps-home-shelf-chips { display: flex; flex-wrap: wrap; gap: 5px; min-width: 0; }
.apps-home-chip { font-size: 11px; padding: 4px 8px; border-radius: 999px; border: 1px solid var(--border-color); background: var(--bg-primary); color: var(--text-primary); cursor: pointer; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.apps-home-chip:hover { border-color: var(--accent-primary); }
@media (max-width: 800px) {
  .apps-home-workspace { grid-template-columns: minmax(0, 1fr); }
  .apps-home-assistant { position: static; height: 440px; min-height: 360px; max-height: none; }
  .apps-home-daily .apps-home-card { max-height: none; }
}
@media (max-width: 520px) {
  .apps-home-daily { padding: 12px; }
  .apps-home-daily .apps-home-head { grid-template-columns: minmax(0, 1fr); }
  .apps-home-daily .apps-home-head-actions { grid-row: 2; grid-column: 1; gap: 6px; }
  .apps-home-daily .apps-home-head button { padding: 7px 10px; }
  .apps-home-areas { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .apps-home-updates ul { grid-template-columns: minmax(0, 1fr); }
  .apps-home-detail-head { flex-wrap: wrap; }
  .apps-home-detail-head label { flex-basis: 100%; }
  .apps-home-area-grid { grid-template-columns: minmax(0, 1fr); }
  .apps-home-all-shelf { grid-template-columns: minmax(0, 1fr); }
}

/* A complete launcher and standard personal calendar remain independent of daily summaries. */
.apps-home-launcher {display:flex;align-items:center;gap:10px;flex-wrap:wrap;padding:12px;border:1px solid var(--border-color);border-radius:12px;background:var(--bg-card);}
.apps-home-launcher label {font-size:13px;font-weight:600;}
.apps-home-launcher select {flex:1;min-width:0;max-width:100%;padding:9px;color:var(--text-primary);background:var(--bg-primary);border:1px solid var(--border-color);border-radius:8px;}
.apps-home-launcher a,.apps-home-calendar a {color:var(--accent-primary);font-size:13px;}
.apps-home-launcher p:empty {display:none;}.apps-home-launcher p {width:100%;margin:0;font-size:13px;}
.apps-home-summary [data-home-content] {display:flex;flex-direction:column;gap:12px;min-width:0;}
.apps-home-calendar {min-width:0;border:1px solid var(--border-color);border-radius:12px;overflow:hidden;background:var(--bg-card);}
.apps-home-calendar[hidden] {display:none;}.apps-home-calendar header {display:flex;align-items:center;justify-content:space-between;padding:12px;gap:12px;}
.apps-home-calendar h3 {margin:0;font-size:15px;}.apps-home-calendar iframe {display:block;width:100%;height:570px;border:0;}
@media(max-width:520px){.apps-home-launcher label{width:100%;}.apps-home-calendar iframe{height:650px;}}

@media(max-width:900px){.apps-home-workspace .apps-home-summary{order:1;}.apps-home-workspace .apps-home-assistant{order:2;}}
