/* =============================================
   Greenhead Strategy Hub
   Light mode default · Operations Hub style
   Dark mode via [data-theme="dark"]
   ============================================= */

/* ---- LIGHT MODE TOKENS ---- */
:root {
  --page-bg:      #f0ede6;
  --top-bar-bg:   #1a3d2b;
  --nav-bg:       #ffffff;
  --nav-border:   #e8e4dc;
  --card-bg:      #ffffff;
  --card-bg-alt:  #f9f7f2;
  --card-border:  rgba(0,0,0,0.07);
  --teal:         #1a7a52;
  --teal-bright:  #1D9E75;
  --teal-muted:   rgba(26,122,82,0.08);
  --amber:        #d97706;
  --amber-muted:  rgba(217,119,6,0.08);
  --red:          #dc2626;
  --red-muted:    rgba(220,38,38,0.08);
  --grey-rag:     #9ca3af;
  --grey-muted:   rgba(156,163,175,0.1);
  --text-primary: #111827;
  --text-secondary:#6b7280;
  --text-dim:     #9ca3af;
  --text-on-dark: #ffffff;
  --shadow-sm:    0 1px 2px rgba(0,0,0,0.06);
  --shadow:       0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:    0 4px 12px rgba(0,0,0,0.08);
  --radius:       8px;
  --radius-lg:    12px;
  --font-head:    'Playfair Display', Georgia, serif;
  --font-body:    'DM Sans', system-ui, sans-serif;
}

/* ---- DARK MODE TOKENS ---- */
[data-theme="dark"] {
  --page-bg:      #0d1117;
  --top-bar-bg:   #0d1117;
  --nav-bg:       #161b22;
  --nav-border:   rgba(255,255,255,0.08);
  --card-bg:      #161b22;
  --card-bg-alt:  #1c2333;
  --card-border:  rgba(255,255,255,0.08);
  --teal:         #1D9E75;
  --teal-bright:  #1D9E75;
  --teal-muted:   rgba(29,158,117,0.15);
  --amber:        #F59E0B;
  --amber-muted:  rgba(245,158,11,0.12);
  --red:          #EF4444;
  --red-muted:    rgba(239,68,68,0.12);
  --grey-rag:     #6B7280;
  --grey-muted:   rgba(107,114,128,0.15);
  --text-primary: #e6edf3;
  --text-secondary:#8b949e;
  --text-dim:     #484f58;
  --text-on-dark: #e6edf3;
  --shadow-sm:    0 1px 2px rgba(0,0,0,0.4);
  --shadow:       0 1px 3px rgba(0,0,0,0.5);
  --shadow-md:    0 4px 12px rgba(0,0,0,0.5);
}

/* ---- RESET ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }

body {
  background: var(--page-bg);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.9375rem;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background 0.2s ease, color 0.2s ease;
}

/* =============================================
   TOP BAR
   ============================================= */
.top-bar {
  background: var(--top-bar-bg);
  height: 64px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 200;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

[data-theme="dark"] .top-bar {
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.top-bar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.75rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Brand */
.brand {
  display: flex;
  align-items: center;
  gap: 0.875rem;
}

.brand-logo {
  width: 44px;
  height: 44px;
  background: rgba(255,255,255,0.1);
  border: 1.5px solid rgba(255,255,255,0.2);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-head);
  font-style: italic;
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.brand-name {
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  font-family: var(--font-body);
  letter-spacing: -0.01em;
}

.brand-tagline {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.5);
  font-style: italic;
  font-family: var(--font-head);
  margin-top: 2px;
}

/* Top-bar right */
.top-bar-right {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.hub-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1;
}

.hub-name {
  font-size: 0.82rem;
  color: rgba(255,255,255,0.8);
  font-weight: 500;
}

.hub-meta {
  font-size: 0.68rem;
  color: rgba(255,255,255,0.4);
  margin-top: 3px;
}

/* Theme button */
.theme-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1.5px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.07);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
  position: relative;
  flex-shrink: 0;
}

.theme-btn:hover {
  background: rgba(255,255,255,0.14);
  border-color: rgba(255,255,255,0.3);
}

.theme-icon-light,
.theme-icon-dark {
  position: absolute;
  font-size: 0.9rem;
  line-height: 1;
  transition: opacity 0.15s, transform 0.15s;
}

/* Light: show sun */
.theme-icon-light { opacity: 1; transform: scale(1);   color: #fbbf24; }
.theme-icon-dark  { opacity: 0; transform: scale(0.6); color: #93c5fd; }

/* Dark: show moon */
[data-theme="dark"] .theme-icon-light { opacity: 0; transform: scale(0.6); }
[data-theme="dark"] .theme-icon-dark  { opacity: 1; transform: scale(1);   }

/* =============================================
   NAV BAR — separate white bar below top bar
   ============================================= */
.nav-bar {
  background: var(--nav-bg);
  border-bottom: 1px solid var(--nav-border);
  position: sticky;
  top: 64px;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .nav-bar {
  box-shadow: none;
}

.nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.75rem;
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
  gap: 0;
}
.nav-inner::-webkit-scrollbar { display: none; }

.nav-tab {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0 1rem;
  height: 48px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
  flex-shrink: 0;
}

.nav-tab:hover {
  color: var(--text-primary);
  border-bottom-color: var(--nav-border);
}

.nav-tab.active {
  color: var(--teal);
  border-bottom-color: var(--teal-bright);
  font-weight: 600;
}

.nav-icon {
  font-size: 0.82rem;
  opacity: 0.7;
}

.nav-tab.active .nav-icon { opacity: 1; }

/* =============================================
   MAIN CONTENT
   ============================================= */
.main-content {
  flex: 1;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.75rem;
}

/* =============================================
   PAGE HEADER
   ============================================= */
.page-header {
  margin-bottom: 1.75rem;
}

.page-header h1 {
  font-family: var(--font-head);
  font-size: 1.75rem;
  color: var(--text-primary);
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 0.3rem;
}

.page-sub {
  color: var(--text-secondary);
  font-size: 0.88rem;
  max-width: 560px;
}

/* =============================================
   SECTION HEADING
   ============================================= */
.section-heading {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  margin: 2.25rem 0 0.875rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--nav-border);
}

/* =============================================
   CARDS
   ============================================= */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

/* =============================================
   METRICS GRID
   ============================================= */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.metric-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 1.4rem 1.5rem 1.25rem;
  box-shadow: var(--shadow);
}

.metric-label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 0.6rem;
  letter-spacing: 0.01em;
}

.metric-value {
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  font-family: var(--font-head);
}

.metric-scale {
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-weight: 400;
}

.metric-empty { color: var(--text-dim); }

.metric-note {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 0.4rem;
}

/* =============================================
   COMMITMENTS
   ============================================= */
.commitments-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.commitment-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow);
  transition: box-shadow 0.15s;
}

.commitment-row:hover { box-shadow: var(--shadow-md); }

.commitment-info { flex: 1; min-width: 0; }

.commitment-name {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.9rem;
  display: block;
}

.commitment-tagline {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.commitment-link {
  color: var(--teal);
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  padding: 0.3rem 0.75rem;
  border: 1px solid rgba(26,122,82,0.25);
  border-radius: 6px;
  background: var(--teal-muted);
  transition: background 0.15s;
}
[data-theme="dark"] .commitment-link {
  border-color: rgba(29,158,117,0.3);
}
.commitment-link:hover { background: rgba(26,122,82,0.15); }

/* =============================================
   DELIVERY GRID
   ============================================= */
.delivery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.delivery-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.delivery-card:hover {
  border-color: rgba(26,122,82,0.3);
  box-shadow: var(--shadow-md);
}

.delivery-name {
  flex: 1;
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 500;
}

.delivery-arrow { color: var(--text-dim); font-size: 0.75rem; }

/* =============================================
   SIDEBAR GRID
   ============================================= */
.sidebar-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1.5rem;
}

.sidebar-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.4rem;
  box-shadow: var(--shadow);
}

.sidebar-heading {
  font-size: 0.7rem;
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 1rem;
}

.deadline-item {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  margin-bottom: 0.8rem;
}

.deadline-name {
  font-size: 0.84rem;
  color: var(--text-primary);
  font-weight: 500;
}

.deadline-date {
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin-top: 0.1rem;
}

.source-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}

.source-name { flex: 1; font-size: 0.83rem; color: var(--text-primary); }
.source-status { font-size: 0.72rem; color: var(--text-dim); }

/* =============================================
   RAG INDICATORS
   ============================================= */
.rag-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 2px;
}

.rag-dot.green  { background: var(--teal-bright); }
.rag-dot.amber  { background: var(--amber); }
.rag-dot.red    { background: var(--red); }
.rag-dot.grey   { background: var(--grey-rag); }

.rag-pill {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.18rem 0.55rem;
  border-radius: 5px;
  white-space: nowrap;
  font-family: var(--font-body);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.rag-pill.green { background: var(--teal-muted);  color: var(--teal);     border: 1px solid rgba(26,122,82,0.2); }
.rag-pill.amber { background: var(--amber-muted); color: var(--amber);    border: 1px solid rgba(217,119,6,0.2); }
.rag-pill.red   { background: var(--red-muted);   color: var(--red);      border: 1px solid rgba(220,38,38,0.2); }
.rag-pill.grey  { background: var(--grey-muted);  color: var(--grey-rag); border: 1px solid rgba(156,163,175,0.2); }

/* =============================================
   EMPTY STATE
   ============================================= */
.empty-state-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 3.5rem 2rem;
  text-align: center;
  max-width: 480px;
  margin: 2rem auto;
  box-shadow: var(--shadow);
}

.empty-icon { font-size: 2.5rem; margin-bottom: 1rem; opacity: 0.3; }
.empty-title { font-family: var(--font-head); font-size: 1.15rem; color: var(--text-primary); margin-bottom: 0.65rem; }
.empty-body { font-size: 0.85rem; color: var(--text-secondary); line-height: 1.65; }

/* =============================================
   ADMIN
   ============================================= */
.admin-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
}

.admin-card-title {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--nav-border);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.form-group { margin-bottom: 1rem; }

.form-group label {
  display: block;
  font-size: 0.72rem;
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.form-control {
  width: 100%;
  background: var(--page-bg);
  border: 1px solid var(--nav-border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.875rem;
  padding: 0.6rem 0.875rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-muted);
}

textarea.form-control { resize: vertical; }

.form-control-sm {
  width: auto;
  padding: 0.35rem 0.6rem;
  font-size: 0.8rem;
}

.btn-primary {
  background: var(--teal-bright);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.84rem;
  font-weight: 600;
  padding: 0.55rem 1.25rem;
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn-primary:hover { opacity: 0.88; }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--nav-border);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.84rem;
  font-weight: 500;
  padding: 0.55rem 1.25rem;
  cursor: pointer;
  margin-left: 0.5rem;
  transition: color 0.15s, border-color 0.15s;
}
.btn-secondary:hover { color: var(--text-primary); border-color: var(--text-secondary); }

.btn-secondary-sm {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--nav-border);
  border-radius: 6px;
  font-family: var(--font-body);
  font-size: 0.76rem;
  padding: 0.3rem 0.65rem;
  cursor: pointer;
}

.btn-danger-sm {
  background: transparent;
  color: var(--red);
  border: 1px solid rgba(220,38,38,0.2);
  border-radius: 6px;
  font-family: var(--font-body);
  font-size: 0.73rem;
  padding: 0.2rem 0.55rem;
  cursor: pointer;
}

.cache-status { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.cache-label { font-size: 0.72rem; color: var(--text-secondary); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.cache-value { font-size: 0.84rem; color: var(--text-primary); }

.source-health-grid { display: flex; gap: 1.25rem; flex-wrap: wrap; margin-bottom: 1rem; }
.source-health-item { display: flex; align-items: center; gap: 0.5rem; font-size: 0.8rem; color: var(--text-secondary); }

.admin-feedback {
  margin-top: 0.75rem;
  font-size: 0.78rem;
  padding: 0.65rem 1rem;
  border-radius: var(--radius);
  background: var(--card-bg-alt);
  color: var(--text-secondary);
  border: 1px solid var(--nav-border);
}
.admin-feedback.success { color: var(--teal);  border-color: rgba(26,122,82,0.25);  background: var(--teal-muted); }
.admin-feedback.error   { color: var(--red);   border-color: rgba(220,38,38,0.25);  background: var(--red-muted); }

.log-list { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1rem; }
.log-entry { background: var(--page-bg); border: 1px solid var(--nav-border); border-radius: var(--radius); padding: 0.75rem 1rem; }
.log-date  { font-size: 0.7rem; color: var(--teal); font-weight: 600; margin-bottom: 0.2rem; }
.log-what  { font-size: 0.84rem; color: var(--text-primary); font-weight: 500; }
.log-why   { font-size: 0.77rem; color: var(--text-secondary); margin-top: 0.15rem; }

.priority-form { margin-bottom: 0.75rem; }
.priority-row { display: flex; gap: 0.5rem; align-items: center; }
.muted-text { color: var(--text-dim); font-size: 0.83rem; }

.admin-badge {
  display: inline-block;
  background: var(--amber-muted);
  border: 1px solid rgba(217,119,6,0.25);
  color: var(--amber);
  font-size: 0.68rem;
  padding: 0.15rem 0.55rem;
  border-radius: 5px;
  margin-left: 0.75rem;
  vertical-align: middle;
  font-family: var(--font-body);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.admin-page { border-left: 3px solid var(--amber); padding-left: 1rem !important; }

/* =============================================
   FOOTER
   ============================================= */
.site-footer {
  border-top: 1px solid var(--nav-border);
  padding: 0.875rem 1.75rem;
  background: var(--nav-bg);
  box-shadow: var(--shadow-sm);
}

.footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  color: var(--text-dim);
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 1024px) {
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .delivery-grid { grid-template-columns: repeat(2, 1fr); }
  .sidebar-grid  { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .top-bar-inner { padding: 0 1rem; }
  .main-content  { padding: 1.5rem 1rem; }
  .nav-inner     { padding: 0 0.5rem; }
  .metrics-grid  { grid-template-columns: 1fr 1fr; gap: 0.6rem; }
  .delivery-grid { grid-template-columns: 1fr; }
  .page-header h1 { font-size: 1.5rem; }
  .commitment-row { flex-wrap: wrap; gap: 0.5rem; }
  .hub-info { display: none; }
  .footer-inner { flex-direction: column; gap: 0.25rem; text-align: center; }
}