/* Techmeme / Morning Brief Unified Theme for Portfolio Research Desk */
:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-subtle: #f4f6f8;
  --ink: #111111;
  --ink-secondary: #333333;
  --muted: #556677;
  --faint: #666666;
  --line: #cccccc;
  --line-strong: #d8e0e6;
  --navy: #174a61;
  --navy-hover: #578aa1;
  --sisnav-hover: #25607b;
  --link: #002848;
  --link-visited: #902050;
  --link-hover-bg: #d0e8f4;
  --us: #0f4c81;
  --us-soft: #e7f0f9;
  --in: #8a5200;
  --in-soft: #fbf2e1;
  --good: #145a32;
  --good-soft: #e8f4ec;
  --good-line: #8ec5a1;
  --warn: #7c4700;
  --warn-soft: #fbf2e1;
  --warn-line: #dfba73;
  --bad: #8b1e1e;
  --bad-soft: #fbeaea;
  --bad-line: #dca1a1;
  --neutral: #424b54;
  --neutral-soft: #eef0f2;
  --neutral-line: #b8c0c8;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  padding: 0;
  background-color: var(--bg);
  color: var(--ink);
  font-family: Optima, "Century Gothic", "Trebuchet MS", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15.5px;
  line-height: 1.38;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--link);
  text-decoration: none;
}
a:visited {
  color: var(--link-visited);
}
a:hover {
  background-color: var(--link-hover-bg);
  text-decoration: underline;
}

.page-container {
  max-width: 1380px;
  margin: 0 auto;
  padding: 8px 15px 40px;
}

/* Header & Topline (matches personal-wiki/templates/brief/brief.css) */
.prenavbar {
  margin-bottom: 5px;
}
.topline {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px solid var(--line);
  padding-bottom: 4px;
  margin-bottom: 10px;
  font-size: 0.85em;
  color: var(--faint);
}
.topllinks a {
  font-weight: 600;
  color: var(--link);
}
.logotab {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 8px;
}
.brand-link:hover {
  background: transparent;
  text-decoration: none;
}
.brand-title {
  font-size: 2.2em;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -0.04em;
  line-height: 1.05;
}
.brand-subtitle {
  font-size: 0.9em;
  color: var(--muted);
  margin-top: 3px;
}

/* Compact Hero Stats right-aligned in logotab */
.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
}
.hero-stats div {
  padding: 5px 10px;
  border: 1px solid var(--line-strong);
  border-top: 2px solid var(--navy);
  background: var(--surface-subtle);
  min-width: 96px;
}
.hero-stats dt {
  color: var(--muted);
  font-size: 0.72em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.hero-stats dd {
  margin: 2px 0 0;
  color: var(--navy);
  font-size: 1.15em;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Main Navy Navigation Bar (#174a61) */
.navbar {
  background-color: var(--navy);
  color: #ffffff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 10px;
  height: 30px;
  font-size: 0.9em;
}
.navtabs {
  display: flex;
  height: 100%;
}
.navtabs a {
  color: #ffffff !important;
  padding: 0 12px;
  display: flex;
  align-items: center;
  font-weight: 700;
  text-decoration: none;
}
.navtabs a:hover, .navtabs a.active {
  background-color: var(--navy-hover);
  text-decoration: none;
}
.sisnav {
  display: flex;
  align-items: center;
  height: 100%;
  font-size: 0.92em;
}
.sis-label {
  color: #b8d0dc;
  margin-right: 6px;
  font-size: 0.9em;
}
.sisnav a {
  color: #ffffff !important;
  padding: 0 9px;
  height: 100%;
  display: flex;
  align-items: center;
  text-decoration: none;
}
.sisnav a:hover {
  background-color: var(--sisnav-hover);
  text-decoration: none;
}

/* Subnavbar Controls */
.subnavbar {
  background-color: var(--surface-subtle);
  border-bottom: 1px solid var(--line-strong);
  padding: 6px 10px;
  margin-bottom: 12px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.control-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.segmented {
  display: inline-flex;
  border: 1px solid var(--line);
  background: var(--surface);
}
.segment {
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--ink-secondary);
  padding: 4px 10px;
  font: inherit;
  font-size: 0.85em;
  font-weight: 700;
  cursor: pointer;
}
.segment:last-child { border-right: 0; }
.segment:hover { background: var(--link-hover-bg); }
.segment.is-active {
  background: var(--navy);
  color: #ffffff;
}
.search-field {
  position: relative;
  flex: 1 1 260px;
  min-width: 200px;
}
.search-field input {
  width: 100%;
  height: 28px;
  padding: 0 28px 0 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.88em;
}
.search-field input:focus, .select-field select:focus {
  outline: 2px solid var(--navy-hover);
  border-color: var(--navy);
}
.search-field kbd {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  padding: 0 5px;
  border: 1px solid var(--line);
  background: var(--surface-subtle);
  color: var(--faint);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.75em;
  pointer-events: none;
}
.select-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.84em;
  font-weight: 700;
}
.select-field select {
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.ghost-button {
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--navy);
  font: inherit;
  font-size: 0.84em;
  font-weight: 700;
  cursor: pointer;
}
.ghost-button:hover {
  background: var(--link-hover-bg);
}

/* Executive Philosophy Box (matches .exec-theme-box in personal-wiki) */
.exec-theme-box {
  background-color: #fdfbe8;
  border: 1px solid #d8c878;
  border-left: 5px solid #d4a017;
  padding: 8px 14px;
  margin-bottom: 18px;
  font-size: 0.94em;
  color: #2b2b20;
}
.exec-label {
  font-weight: 700;
  color: #8a6300;
  text-transform: uppercase;
  font-size: 0.85em;
  letter-spacing: 0.04em;
  margin-right: 6px;
}

/* Main Sections */
.section {
  margin-top: 22px;
}
.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 4px;
  border-bottom: 2px solid var(--navy);
}
.section-kicker {
  margin: 0;
  color: var(--muted);
  font-size: 0.74em;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.section h2 {
  margin: 1px 0 0;
  color: var(--navy);
  font-size: 1.18em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.section-meta {
  margin: 0;
  color: var(--faint);
  font-size: 0.84em;
  font-variant-numeric: tabular-nums;
}

/* Recent Strip & Report Cards */
.recent-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}
.recent-item, .report-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-left: 4px solid var(--navy);
  background: #fcfdfe;
  color: inherit;
  text-decoration: none;
}
.recent-item:visited, .report-card:visited {
  color: inherit;
}
.recent-item:hover, .report-card:hover {
  background: #f0f7fc;
  border-color: var(--navy-hover);
  text-decoration: none;
}
.report-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 12px;
}
.card-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.badge-row {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
}
.market-pill, .symbol-pill, .verdict-pill {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border: 1px solid transparent;
  font-size: 0.76em;
  font-weight: 700;
  letter-spacing: 0.03em;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.market-US { color: var(--us); background: var(--us-soft); border-color: #b7d1ea; }
.market-IN { color: var(--in); background: var(--in-soft); border-color: #e6c88e; }
.symbol-pill {
  color: var(--navy);
  background: var(--surface-subtle);
  border-color: var(--line-strong);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.verdict-good { color: var(--good); background: var(--good-soft); border-color: var(--good-line); }
.verdict-warn { color: var(--warn); background: var(--warn-soft); border-color: var(--warn-line); }
.verdict-bad  { color: var(--bad);  background: var(--bad-soft);  border-color: var(--bad-line); }
.verdict-neutral { color: var(--neutral); background: var(--neutral-soft); border-color: var(--neutral-line); }

.stamp {
  color: var(--faint);
  font-size: 0.8em;
  font-variant-numeric: tabular-nums;
}
.card-title {
  margin: 4px 0 3px;
  color: #004860;
  font-size: 1.05em;
  font-weight: 700;
  line-height: 1.25;
}
.card-summary {
  margin: 0;
  color: var(--ink-secondary);
  font-size: 0.9em;
  line-height: 1.42;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.highlight-list {
  margin: 6px 0 0;
  padding-left: 16px;
  color: var(--ink-secondary);
  font-size: 0.85em;
}
.highlight-list li + li { margin-top: 2px; }
.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px solid #e5ecf0;
  color: var(--muted);
  font-size: 0.8em;
  font-weight: 600;
}

/* Dossier Table List (matches .archive-table in personal-wiki) */
.dossier-list {
  border-top: 1px solid var(--line-strong);
  background: var(--surface);
}
.dossier-row {
  display: grid;
  grid-template-columns: 120px minmax(200px, 1.25fr) minmax(240px, 2fr) auto 115px;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border-bottom: 1px solid #eeeeee;
  color: inherit;
  text-decoration: none;
}
.dossier-row:visited { color: inherit; }
.dossier-row:hover {
  background: #f5f9fc;
  text-decoration: none;
}
.dossier-Code {
  display: flex;
  align-items: center;
  gap: 6px;
}
.dossier-title {
  margin: 0;
  color: #004860;
  font-size: 0.96em;
  font-weight: 700;
}
.dossier-sub {
  margin: 1px 0 0;
  color: var(--faint);
  font-size: 0.8em;
}
.dossier-summary {
  margin: 0;
  color: var(--ink-secondary);
  font-size: 0.88em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dossier-date {
  text-align: right;
  color: var(--faint);
  font-size: 0.82em;
  font-variant-numeric: tabular-nums;
}

.empty-state {
  margin-top: 20px;
  padding: 24px;
  border: 1px solid var(--line-strong);
  border-left: 4px solid var(--navy);
  background: var(--surface-subtle);
}
.empty-state h2 {
  margin: 0 0 6px;
  font-size: 1.1em;
  color: var(--navy);
}
.empty-state p {
  margin: 0;
  color: var(--muted);
}

.footer {
  margin-top: 36px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: 0.85em;
  color: var(--faint);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 980px) {
  .dossier-row {
    grid-template-columns: 115px minmax(180px, 1fr) auto 100px;
  }
  .dossier-summary { display: none; }
}
@media (max-width: 720px) {
  .topline { flex-direction: column; gap: 4px; }
  .navbar { height: auto; flex-direction: column; align-items: stretch; padding: 0; }
  .navtabs { flex-wrap: wrap; border-bottom: 1px solid #2b6077; }
  .navtabs a { padding: 7px 10px; }
  .sisnav { padding: 5px 10px; flex-wrap: wrap; }
  .dossier-row { grid-template-columns: 1fr auto; gap: 6px; }
  .dossier-Code { grid-column: 1 / -1; }
  .dossier-date { text-align: left; }
}
