/* ============================================================
   Sector News Intelligence - GIH Design System
   ============================================================ */

:root {
  --gih-ink:       #0F1419;
  --gih-ink-mid:   #4A5568;
  --gih-ink-lt:    #94A3B8;
  --gih-bg:        #F8F6F2;
  --gih-bg-card:   #FFFFFF;
  --gih-accent:    #C0872A;
  --gih-accent-lt: #F5E5C8;
  --gih-teal:      #1B5F6A;
  --gih-teal-lt:   #D3EDF1;
  --gih-green:     #2A6B3C;
  --gih-green-lt:  #D4EDDA;
  --gih-red:       #A33030;
  --gih-red-lt:    #F5D0D0;
  --gih-border:    #E4E0DA;
  --gih-shadow:    0 1px 3px rgba(0,0,0,0.06), 0 4px 12px rgba(0,0,0,0.04);
  --gih-radius:    10px;
  --gih-radius-sm: 6px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  color: var(--gih-ink);
  background: var(--gih-bg);
  min-height: 100vh;
}

/* Page header */
.gih-page-header {
  background: var(--gih-ink);
  color: #fff;
  padding: 0 28px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 3px solid var(--gih-accent);
  position: sticky;
  top: 0;
  z-index: 100;
}
.gih-page-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}
.gih-logo-mark {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}
.gih-logo-mark svg { width: 100%; height: 100%; }
.gih-page-header-brand {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.45);
  line-height: 1;
  margin-bottom: 3px;
}
.gih-page-header-title {
  font-size: 18px;
  font-weight: 600;
  color: #fff;
  line-height: 1.2;
}
.gih-page-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.header-user {
  color: rgba(255,255,255,0.72);
  font-size: 12px;
  font-weight: 600;
}

/* Content wrapper */
.gih-content {
  padding: 24px 28px;
  max-width: 1360px;
  margin: 0 auto;
}

/* Cards */
.gih-card {
  background: var(--gih-bg-card);
  border: 1px solid var(--gih-border);
  border-radius: var(--gih-radius);
  box-shadow: var(--gih-shadow);
  margin-bottom: 20px;
  overflow: hidden;
}
.gih-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 18px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gih-ink-mid);
  background: var(--gih-bg);
  border-bottom: 1px solid var(--gih-border);
  flex-wrap: wrap;
}
.gih-card-header-hint {
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--gih-ink-lt);
  font-size: 12px;
  margin-left: auto;
}
.gih-card-body {
  padding: 18px;
}

.admin-section[hidden] {
  display: none;
}
.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.admin-page {
  max-width: 1080px;
}
.admin-section {
  scroll-margin-top: 92px;
}
.admin-form {
  display: grid;
  gap: 12px;
}
.compact-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: end;
}
.admin-form h2 {
  font-size: 15px;
  line-height: 1.3;
  color: var(--gih-ink);
}
.section-list {
  margin-top: 18px;
}
.admin-list {
  display: grid;
  gap: 8px;
}
.admin-list-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--gih-border);
  border-radius: var(--gih-radius-sm);
  background: var(--gih-bg);
  font-size: 13px;
}
.permission-grid {
  display: grid;
  gap: 8px;
  border: 1px solid var(--gih-border);
  border-radius: var(--gih-radius-sm);
  padding: 12px;
}
.permission-grid legend {
  padding: 0 6px;
  color: var(--gih-ink-mid);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.permission-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--gih-ink-mid);
  font-size: 13px;
}
.source-editor {
  margin-top: 18px;
}
.code-editor {
  min-height: 240px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
}

/* Stat cards */
.gih-stats-row {
  display: flex;
  gap: 14px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.gih-stat-card {
  background: var(--gih-bg-card);
  border: 1px solid var(--gih-border);
  border-radius: var(--gih-radius);
  padding: 20px 24px;
  box-shadow: var(--gih-shadow);
  flex: 1;
  min-width: 120px;
}
.gih-stat-num {
  font-size: 32px;
  font-weight: 700;
  line-height: 1;
  color: var(--gih-ink);
  margin-bottom: 6px;
}
.gih-stat-num.accent { color: var(--gih-accent); }
.gih-stat-num.muted  { color: var(--gih-ink-lt); }
.gih-stat-label {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gih-ink-lt);
}

/* Buttons */
.gih-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: 6px;
  border: 1.5px solid transparent;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: opacity .18s, background .18s, border-color .18s, transform .15s;
  line-height: 1.3;
  font-family: inherit;
}
.gih-btn:hover { opacity: 0.88; transform: translateY(-1px); }
.gih-btn:active { transform: translateY(0); }
.gih-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.gih-btn-ghost {
  background: transparent;
  color: rgba(255,255,255,0.7);
  border-color: rgba(255,255,255,0.25);
}
.gih-btn-ghost:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
  opacity: 1;
}
.gih-btn-primary {
  background: var(--gih-accent);
  color: #fff;
  border-color: var(--gih-accent);
  justify-content: center;
}
.gih-btn-primary:hover {
  background: #A77222;
  border-color: #A77222;
  opacity: 1;
}
.gih-btn-sm { padding: 6px 13px; font-size: 12px; }

/* Saved view buttons */
.saved-views {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: auto;
}
.saved-view-button {
  padding: 4px 12px;
  border-radius: 20px;
  border: 1.5px solid var(--gih-border);
  background: var(--gih-bg-card);
  font-size: 12px;
  font-weight: 600;
  color: var(--gih-ink-mid);
  cursor: pointer;
  transition: border-color .18s, color .18s;
  font-family: inherit;
  letter-spacing: 0;
  text-transform: none;
}
.saved-view-button:hover {
  border-color: var(--gih-accent);
  color: var(--gih-accent);
}

/* Filter form */
.filters-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.gih-label {
  display: grid;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--gih-ink-mid);
  text-transform: uppercase;
}
.gih-input,
.gih-select {
  width: 100%;
  padding: 9px 13px;
  border: 1.5px solid var(--gih-border);
  border-radius: var(--gih-radius-sm);
  background: #fff;
  font-family: inherit;
  font-size: 14px;
  color: var(--gih-ink);
  transition: border-color .18s, box-shadow .18s;
}
.gih-input:focus,
.gih-select:focus {
  border-color: var(--gih-accent);
  box-shadow: 0 0 0 2px rgba(192,135,42,0.18);
  outline: none;
}
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  color: var(--gih-ink-mid);
  font-size: 13px;
  font-weight: 700;
}
.filter-button {
  align-self: end;
  color: var(--gih-ink-mid);
  background: #fff;
  border-color: var(--gih-border);
}
.gih-select-multi {
  min-height: 110px;
  padding: 6px;
  appearance: auto;
  background-image: none;
}
.gih-select-multi option {
  padding: 5px 8px;
  border-radius: 4px;
}

/* Dashboard layout */
.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) minmax(300px, 0.9fr);
  gap: 20px;
  align-items: start;
}
.sidebar-stack .gih-card { margin-bottom: 20px; }
.sidebar-stack .gih-card:last-child { margin-bottom: 0; }

/* Article list */
.articles-list {
  display: grid;
  gap: 14px;
}
.sni-article {
  border: 1px solid var(--gih-border);
  border-radius: var(--gih-radius);
  padding: 16px;
  background: var(--gih-bg-card);
  transition: border-color .18s;
}
.sni-article:hover { border-color: var(--gih-accent); }
.article-top-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 10px;
}
.sni-article h3 {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  margin: 0 0 8px;
  color: var(--gih-ink);
}
.sni-article h3 a {
  color: inherit;
  text-decoration: none;
}
.sni-article h3 a:hover {
  color: var(--gih-accent);
  text-decoration: underline;
}
.article-summary {
  font-size: 13.5px;
  color: var(--gih-ink-mid);
  line-height: 1.55;
  margin: 0 0 12px;
}
.meta-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  font-size: 12px;
  color: var(--gih-ink-lt);
  margin-top: 8px;
}
.inline-action {
  border: 0;
  background: transparent;
  color: var(--gih-accent);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  padding: 0;
}
.inline-action:disabled {
  color: var(--gih-ink-lt);
  cursor: default;
}
.muted-text { color: var(--gih-ink-lt); }

/* Marketing card (inside article) */
.marketing-card {
  margin: 12px 0;
  padding: 12px 14px;
  border: 1px solid rgba(192,135,42,0.2);
  border-radius: var(--gih-radius-sm);
  background: var(--gih-accent-lt);
  font-size: 13px;
}
.marketing-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--gih-ink);
}
.marketing-card p {
  margin: 0 0 10px;
  color: var(--gih-ink-mid);
  line-height: 1.45;
}
.use-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.use-item {
  padding: 8px 10px;
  border-radius: var(--gih-radius-sm);
  background: rgba(255,255,255,0.7);
  border: 1px solid var(--gih-border);
}
.use-item strong {
  display: block;
  font-size: 11.5px;
  color: var(--gih-ink);
  margin-bottom: 3px;
}
.use-item span {
  font-size: 11.5px;
  color: var(--gih-ink-mid);
  line-height: 1.35;
}

/* Badges */
.gih-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.gih-badge-green { background: var(--gih-green-lt); color: var(--gih-green); }
.gih-badge-muted { background: var(--gih-bg); color: var(--gih-ink-lt); border: 1px solid var(--gih-border); }
.gih-badge-red   { background: var(--gih-red-lt); color: var(--gih-red); }
.source-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  background: var(--gih-teal-lt);
  color: var(--gih-teal);
  white-space: nowrap;
}
.priority-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: rgba(255,255,255,0.7);
  color: var(--gih-accent);
  border: 1px solid rgba(192,135,42,0.25);
  white-space: nowrap;
}

/* Source health */
.source-health-list {
  display: grid;
  gap: 10px;
}
.source-request-form {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--gih-border);
}
.health-card {
  padding: 11px 13px;
  border: 1px solid var(--gih-border);
  border-radius: var(--gih-radius-sm);
  background: var(--gih-bg);
}
.health-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--gih-ink);
  margin-bottom: 4px;
}
.health-card p {
  font-size: 12px;
  color: var(--gih-ink-mid);
  margin: 2px 0 0;
}
.health-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--gih-green-lt);
  color: var(--gih-green);
  flex-shrink: 0;
}

/* Marketing brief */
.marketing-brief {
  display: grid;
  gap: 14px;
}
.brief-block { font-size: 13.5px; }
.brief-block strong {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gih-ink-lt);
  margin-bottom: 7px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--gih-border);
}
.brief-block ul {
  display: grid;
  gap: 6px;
  padding-left: 18px;
  color: var(--gih-ink-mid);
  line-height: 1.4;
}

/* Reading guide */
.guide-copy {
  font-size: 13.5px;
  color: var(--gih-ink-mid);
  line-height: 1.6;
}
.guide-copy p { margin-bottom: 8px; }
.guide-copy p:last-child { margin-bottom: 0; }
.guide-copy strong { color: var(--gih-ink); }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--gih-ink-lt);
  font-size: 13.5px;
  border: 1px dashed var(--gih-border);
  border-radius: var(--gih-radius);
}
.compact-empty {
  padding: 18px;
}

/* Login */
.login-page {
  background:
    linear-gradient(135deg, rgba(15,20,25,0.96), rgba(27,95,106,0.92)),
    var(--gih-ink);
}
.login-shell {
  width: 100%;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-panel {
  width: min(100%, 420px);
  background: var(--gih-bg-card);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--gih-radius);
  box-shadow: 0 24px 60px rgba(0,0,0,0.28);
  padding: 32px;
}
.login-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--gih-accent);
  color: #fff;
  font-weight: 700;
  margin-bottom: 18px;
}
.login-kicker {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gih-ink-lt);
  margin-bottom: 6px;
}
.login-panel h1 {
  font-size: 26px;
  line-height: 1.15;
  margin-bottom: 10px;
}
.login-copy {
  color: var(--gih-ink-mid);
  line-height: 1.5;
  margin-bottom: 22px;
}
.login-form {
  display: grid;
  gap: 14px;
}
.login-error {
  display: none;
  padding: 10px 12px;
  border-radius: var(--gih-radius-sm);
  background: var(--gih-red-lt);
  color: var(--gih-red);
  font-weight: 600;
}
.login-error.is-visible {
  display: block;
}

/* Responsive */
@media (max-width: 1100px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .filters-grid   { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-grid      { grid-template-columns: 1fr; }
  .compact-form    { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .gih-content        { padding: 16px; }
  .gih-page-header    { padding: 0 16px; }
  .gih-page-header-brand { display: none; }
  .filters-grid       { grid-template-columns: 1fr; }
  .use-grid           { grid-template-columns: 1fr; }
  .gih-stats-row .gih-stat-card { min-width: 80px; }
  .login-panel        { padding: 24px; }
}
