/* MAGENT — Minimalist Editorial Blueprint Aesthetic (Coffee Guide Inspired) */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700;800;900&family=Newsreader:ital,opsz,wght@0,6..72,400;0,6..72,600;1,6..72,400;1,6..72,600&family=JetBrains+Mono:wght@400;600&display=swap');

:root {
  --bg-paper: #f5efe6;
  --bg-card: #fbf8f3;
  --bg-card-contrast: #ede5d8;
  --ink-primary: #111111;
  --ink-secondary: #333333;
  --ink-muted: #555555;
  --ink-light: #777777;
  
  --border-thick: 2px solid #111111;
  --border-heavy: 3px solid #111111;
  --border-thin: 1px solid #111111;
  --border-dashed: 1px dashed #111111;
  --border-dotted: 2px dotted #111111;

  --accent-pass: #0e623b;
  --accent-fail: #991b1b;
  --accent-amber: #b45309;

  --font-display: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --font-mono: 'JetBrains Mono', Consolas, monospace;

  --radius-none: 0px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-serif);
  background-color: var(--bg-paper);
  color: var(--ink-primary);
  line-height: 1.6;
  min-height: 100vh;
  padding-bottom: 80px;
  -webkit-font-smoothing: antialiased;
}

/* Subtle print paper texture */
body::before {
  content: "";
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image: radial-gradient(#111111 0.75px, transparent 0.75px);
  background-size: 24px 24px;
  opacity: 0.04;
  pointer-events: none;
  z-index: 999;
}

.container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ==========================================================================
   MINIMAL EDITORIAL HEADER
   ========================================================================== */
header {
  background-color: var(--bg-paper);
  border-bottom: var(--border-heavy);
  padding: 20px 0 16px 0;
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  flex-wrap: wrap;
}

.logo-area {
  display: flex;
  flex-direction: column;
}

.brand-eyebrow {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 2px;
}

.brand-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 900;
  letter-spacing: -1px;
  line-height: 1.05;
  text-transform: uppercase;
  color: var(--ink-primary);
}

/* Inverted black box tag */
.solid-tag {
  display: inline-block;
  background: var(--ink-primary);
  color: var(--bg-paper);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: var(--radius-none);
}

.system-status {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.status-item {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-right: 1px solid var(--ink-primary);
  padding-right: 12px;
}

.status-item:last-child {
  border-right: none;
  padding-right: 0;
}

.status-dot {
  width: 7px;
  height: 7px;
  background: var(--ink-primary);
  border-radius: 50%;
}

/* ==========================================================================
   NAVIGATION BAR (TAB TOGGLES)
   ========================================================================== */
.main-nav {
  display: flex;
  gap: 0;
  border: var(--border-thick);
  background: var(--bg-card);
  margin-top: 24px;
}

.nav-tab {
  flex: 1;
  background: transparent;
  border: none;
  border-right: var(--border-thick);
  padding: 14px 20px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--ink-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.nav-tab:last-child {
  border-right: none;
}

.nav-tab:hover {
  background: var(--bg-card-contrast);
  color: var(--ink-primary);
}

.nav-tab.active {
  background: var(--ink-primary);
  color: var(--bg-paper);
}

.tab-pill {
  background: var(--bg-card-contrast);
  color: var(--ink-primary);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border: var(--border-thin);
}

.nav-tab.active .tab-pill {
  background: var(--bg-paper);
  color: var(--ink-primary);
  border-color: var(--bg-paper);
}

/* ==========================================================================
   EDITORIAL STATS BANNER
   ========================================================================== */
.stats-banner {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: var(--border-thick);
  background: var(--bg-card);
  margin-top: 24px;
  margin-bottom: 24px;
}

@media (max-width: 768px) {
  .stats-banner {
    grid-template-columns: 1fr 1fr;
  }
}

.stat-cell {
  padding: 16px 20px;
  border-right: var(--border-thick);
  display: flex;
  flex-direction: column;
}

.stat-cell:last-child {
  border-right: none;
}

.stat-eyebrow {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 4px;
}

.stat-val {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 900;
  letter-spacing: -1px;
  color: var(--ink-primary);
}

/* ==========================================================================
   MINIMAL TOOLBAR & SEARCH
   ========================================================================== */
.editorial-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: stretch;
  border: var(--border-thick);
  background: var(--bg-card);
  padding: 12px;
  margin-bottom: 20px;
}

.search-field-wrap {
  flex: 2;
  min-width: 280px;
  display: flex;
  align-items: center;
  border: var(--border-thin);
  background: var(--bg-paper);
  padding: 0 12px;
}

.search-field-wrap input {
  width: 100%;
  border: none;
  background: transparent;
  padding: 10px 8px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-primary);
  outline: none;
}

.search-field-wrap input::placeholder {
  color: var(--ink-light);
  font-weight: 400;
}

.editorial-select {
  border: var(--border-thin);
  background: var(--bg-paper);
  padding: 10px 14px;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--ink-primary);
  cursor: pointer;
  outline: none;
}

/* Buttons */
.btn-editorial {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 10px 16px;
  border: var(--border-thick);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--ink-primary);
  color: var(--bg-paper);
  text-decoration: none;
  transition: all 0.15s ease;
}

.btn-editorial:hover {
  background: var(--bg-paper);
  color: var(--ink-primary);
}

.btn-editorial-outline {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 8px 14px;
  border: var(--border-thin);
  cursor: pointer;
  background: var(--bg-paper);
  color: var(--ink-primary);
  text-decoration: none;
  transition: all 0.15s ease;
}

.btn-editorial-outline:hover {
  background: var(--ink-primary);
  color: var(--bg-paper);
}

/* ==========================================================================
   REPORTS GRID & DOSSIER CARDS
   ========================================================================== */
.reports-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 20px;
}

.editorial-card {
  border: var(--border-thick);
  background: var(--bg-card);
  padding: 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  transition: transform 0.15s ease;
}

.editorial-card:hover {
  transform: translate(-3px, -3px);
  box-shadow: 4px 4px 0px #111111;
}

.card-top {
  margin-bottom: 16px;
}

.card-eyebrow-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px dotted #111111;
}

.card-run-id {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-muted);
}

.company-headline {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 900;
  letter-spacing: -0.5px;
  line-height: 1.2;
  text-transform: uppercase;
  margin-bottom: 10px;
  cursor: pointer;
}

.company-headline:hover {
  text-decoration: underline;
}

.card-metadata-row {
  display: flex;
  gap: 12px;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-muted);
  margin-bottom: 14px;
}

.card-metadata-row a {
  color: var(--ink-primary);
  text-decoration: underline;
}

/* Editorial Technical Spec Table inside Card */
.spec-box {
  border: var(--border-thin);
  margin-bottom: 14px;
  background: var(--bg-paper);
}

.spec-row {
  display: grid;
  grid-template-columns: 100px 1fr;
  border-bottom: 1px solid rgba(0, 0, 0, 0.15);
}

.spec-row:last-child {
  border-bottom: none;
}

.spec-label {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: rgba(0, 0, 0, 0.05);
  padding: 6px 8px;
  border-right: 1px solid rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
}

.spec-val {
  padding: 6px 10px;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.spec-val.pass {
  color: var(--accent-pass);
}

.spec-val.fail {
  color: var(--accent-fail);
}

/* Card Summary / Notes in Serif */
.card-note {
  font-family: var(--font-serif);
  font-size: 13px;
  font-style: italic;
  color: var(--ink-secondary);
  line-height: 1.5;
  margin-bottom: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Card Action Buttons */
.card-actions {
  display: flex;
  gap: 8px;
  border-top: var(--border-thin);
  padding-top: 14px;
}

.card-actions .btn-editorial {
  flex: 2;
  font-size: 11px;
  padding: 8px 10px;
}

.card-actions .btn-editorial-outline {
  flex: 1;
  font-size: 11px;
  padding: 8px 10px;
  text-align: center;
}

/* ==========================================================================
   RESEARCH ENGINE & SEARCH FORM
   ========================================================================== */
.research-grid {
  display: grid;
  grid-template-columns: 460px 1fr;
  gap: 24px;
  margin-top: 24px;
}

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

.editorial-panel {
  border: var(--border-thick);
  background: var(--bg-card);
  padding: 24px;
}

.panel-header {
  border-bottom: var(--border-thick);
  padding-bottom: 12px;
  margin-bottom: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.panel-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -0.5px;
}

.editorial-form-group {
  margin-bottom: 16px;
}

.editorial-form-group label {
  display: block;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.editorial-input,
.editorial-select-full,
.editorial-textarea {
  width: 100%;
  padding: 10px 12px;
  border: var(--border-thick);
  background: var(--bg-paper);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-primary);
  outline: none;
}

.editorial-input:focus,
.editorial-select-full:focus,
.editorial-textarea:focus {
  background: #ffffff;
}

.editorial-textarea {
  min-height: 85px;
  resize: vertical;
  font-family: var(--font-serif);
  font-size: 14px;
}

.field-help {
  font-family: var(--font-serif);
  font-size: 12px;
  font-style: italic;
  color: var(--ink-muted);
  margin-top: 4px;
}

/* ==========================================================================
   LIVE ORCHESTRATION TERMINAL
   ========================================================================== */
.terminal-card {
  border: var(--border-thick);
  background: var(--bg-card);
  padding: 20px;
  margin-bottom: 24px;
}

.terminal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: var(--border-thick);
  padding-bottom: 10px;
  margin-bottom: 14px;
}

.terminal-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 900;
  text-transform: uppercase;
}

.progress-track {
  width: 100%;
  height: 14px;
  border: var(--border-thick);
  background: var(--bg-paper);
  margin-bottom: 14px;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--ink-primary);
  transition: width 0.3s ease;
}

.editorial-log-box {
  background: #ffffff;
  border: var(--border-thick);
  padding: 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  height: 240px;
  overflow-y: auto;
  color: var(--ink-primary);
  line-height: 1.5;
}

.log-line {
  margin-bottom: 5px;
}

.log-tag-badge {
  background: var(--ink-primary);
  color: var(--bg-paper);
  padding: 1px 5px;
  font-size: 10px;
  font-weight: 700;
  margin-right: 6px;
}

/* ==========================================================================
   MARKDOWN DOSSIER READER (BOOK / TECHNICAL MONOGRAPH STYLE)
   ========================================================================== */
.markdown-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(17, 17, 17, 0.75);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 30px;
}

.markdown-modal-content {
  background: var(--bg-paper);
  border: var(--border-heavy);
  width: 100%;
  max-width: 1060px;
  height: 92vh;
  display: flex;
  flex-direction: column;
  box-shadow: 12px 12px 0px #111111;
  overflow: hidden;
}

.markdown-modal-header {
  padding: 16px 24px;
  border-bottom: var(--border-heavy);
  background: var(--bg-card);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.modal-doc-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.markdown-modal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.markdown-modal-body {
  padding: 36px 48px;
  overflow-y: auto;
  flex: 1;
  color: var(--ink-primary);
  background: #ffffff;
}

/* Typography inside the Document Reader */
.markdown-body {
  font-family: var(--font-serif);
  font-size: 16px;
  line-height: 1.7;
  max-width: 900px;
  margin: 0 auto;
}

.markdown-body h1 {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -1px;
  line-height: 1.1;
  border-bottom: var(--border-heavy);
  padding-bottom: 12px;
  margin-top: 10px;
  margin-bottom: 24px;
}

.markdown-body h2 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: -0.5px;
  border-bottom: var(--border-thick);
  padding-bottom: 8px;
  margin-top: 36px;
  margin-bottom: 16px;
}

.markdown-body h3 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 24px;
  margin-bottom: 12px;
}

.markdown-body p {
  margin-bottom: 16px;
}

.markdown-body blockquote {
  border-left: 4px solid var(--ink-primary);
  background: var(--bg-card);
  padding: 16px 20px;
  margin: 20px 0;
  font-style: italic;
  font-size: 17px;
}

.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-family: var(--font-display);
  font-size: 13px;
  border: var(--border-thick);
}

.markdown-body th {
  background: var(--ink-primary);
  color: var(--bg-paper);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 10px 14px;
  border: var(--border-thick);
}

.markdown-body td {
  padding: 10px 14px;
  border: var(--border-thin);
}

.markdown-body ul, .markdown-body ol {
  margin-bottom: 18px;
  padding-left: 28px;
}

.markdown-body li {
  margin-bottom: 8px;
}

.markdown-body code {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--bg-card-contrast);
  padding: 2px 6px;
  border: 1px solid rgba(0, 0, 0, 0.2);
}

.markdown-body pre code {
  display: block;
  padding: 16px;
  background: #111111;
  color: #f5efe6;
  border: none;
  overflow-x: auto;
}

.raw-markdown-editor {
  width: 100%;
  height: 100%;
  background: #ffffff;
  color: #111111;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  border: none;
  outline: none;
  resize: none;
  padding: 24px;
}

/* Channels & Auth Modals */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(17, 17, 17, 0.8);
  backdrop-filter: blur(4px);
  z-index: 210;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-content-editorial {
  background: var(--bg-paper);
  border: var(--border-heavy);
  box-shadow: 10px 10px 0px #111111;
  padding: 28px;
  max-width: 620px;
  width: 100%;
}
