* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; line-height: 1.6; color: #1a1a1a; background: #f8f9fa; }

/* Global link reset — kill browser default underline */
a { text-decoration: none; color: #1a73e8; }
a:hover { text-decoration: underline; }

/* Navigation */
nav { background: #1a1a2e; color: white; padding: 0 2rem; display: flex; align-items: center; gap: 1.5rem; height: 52px; flex-wrap: wrap; }
nav a { color: #a0a0b8; text-decoration: none; font-size: 0.95rem; }
nav a:hover, nav a.active { color: white; text-decoration: none; }
nav .brand { font-weight: 700; font-size: 1.1rem; color: white; margin-right: auto; }
nav .brand:hover { color: white; text-decoration: none; }

/* Search bar in nav */
.nav-search { padding: 0.4rem 0.9rem; border-radius: 20px; border: none; width: 320px; font-size: 0.9rem; background: rgba(255,255,255,0.15); color: white; transition: all 0.25s; backdrop-filter: blur(4px); }
.nav-search::placeholder { color: rgba(255,255,255,0.5); }
.nav-search:focus { outline: none; background: rgba(255,255,255,0.25); width: 400px; box-shadow: 0 0 0 2px rgba(255,255,255,0.2); }

/* Layout */
.container { max-width: 1200px; margin: 0 auto; padding: 2rem; }

/* Cards */
.card { background: white; border-radius: 8px; padding: 1.5rem; margin-bottom: 1rem; box-shadow: 0 1px 3px rgba(0,0,0,0.08); transition: box-shadow 0.15s; }
.card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.12); }
.card h3 { margin-bottom: 0.5rem; }
.card h3 a { color: #1a1a2e; font-weight: 600; }
.card h3 a:hover { color: #1a73e8; text-decoration: none; }

/* Dimension cards for 6-dimension analysis (Stream 1) */
.dimension-card { border-left: 4px solid #5f6368; }
.dimension-card:nth-of-type(6n+1) { border-left-color: #1a73e8; }
.dimension-card:nth-of-type(6n+2) { border-left-color: #ea4335; }
.dimension-card:nth-of-type(6n+3) { border-left-color: #f9ab00; }
.dimension-card:nth-of-type(6n+4) { border-left-color: #34a853; }
.dimension-card:nth-of-type(6n+5) { border-left-color: #ab47bc; }
.dimension-card:nth-of-type(6n+6) { border-left-color: #00acc1; }
.dimension-card h3 { font-size: 1rem; color: #1a1a2e; margin-bottom: 0.75rem; padding-bottom: 0.5rem; border-bottom: 1px solid #eee; }

/* Table links */
table a { color: #1a1a2e; }
table a:hover { color: #1a73e8; text-decoration: underline; }

/* Tags (for filtering + display) */
.tag { display: inline-block; background: #e8f0fe; color: #1a73e8; padding: 0.15rem 0.6rem; border-radius: 12px; font-size: 0.8rem; margin-right: 0.3rem; }
.tag:hover { text-decoration: none; }
.tag-row { margin: 0.5rem 0; }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.75rem; border-bottom: 1px solid #eee; }
th { font-weight: 600; color: #555; font-size: 0.85rem; }
tbody tr:hover { background: #f8f9ff; }

/* Status badges */
.status { font-size: 0.8rem; padding: 0.1rem 0.5rem; border-radius: 10px; }
.status-active { background: #e6f4ea; color: #137333; }
.status-in_progress { background: #fef7e0; color: #b06000; }
.status-resolved { background: #e6f4ea; color: #137333; }
.status-archived { background: #f1f3f4; color: #5f6368; }
.status-pending_review { background: #fce8e6; color: #c5221f; }

/* Action buttons */
.action-bar { margin: 1rem 0; display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.action-btn { display: inline-block; padding: 0.35rem 0.9rem; border-radius: 16px; border: 1px solid #ddd; background: white; color: #555; cursor: pointer; font-size: 0.85rem; text-decoration: none; transition: all 0.15s; }
.action-btn:hover { background: #1a73e8; color: white; border-color: #1a73e8; text-decoration: none; }
.action-btn.primary { background: #1a73e8; color: white; border-color: #1a73e8; }
.action-btn.primary:hover { background: #1557b0; border-color: #1557b0; }

/* Utility */
.meta { color: #888; font-size: 0.85rem; }

/* Filter bars */
.filter-bar { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1.5rem; align-items: center; }
.filter-bar a { padding: 0.3rem 0.8rem; border-radius: 16px; background: #eee; color: #555; font-size: 0.85rem; }
.filter-bar a:hover { background: #ddd; text-decoration: none; }
.filter-bar a.sel { background: #1a73e8; color: white; }
.filter-bar a.sel:hover { background: #1557b0; }

/* Typography */
h1 { margin-bottom: 1rem; font-size: 1.6rem; }
h2 { margin-bottom: 0.75rem; }
.back-link { color: #1a73e8; text-decoration: none; font-size: 0.9rem; }
.back-link:hover { text-decoration: underline; }
.entity-body { line-height: 1.8; color: #1a1a1a; }
.entity-body h1 { font-size: 1.5rem; margin: 1.5rem 0 1rem; padding-bottom: 0.5rem; border-bottom: 1px solid #eee; color: #1a1a2e; }
.entity-body h2 { font-size: 1.3rem; margin: 1.5rem 0 0.75rem; color: #1a1a2e; }
.entity-body h3 { font-size: 1.1rem; margin: 1.25rem 0 0.5rem; color: #333; }
.entity-body h4, .entity-body h5, .entity-body h6 { font-size: 1rem; margin: 1rem 0 0.5rem; color: #555; }
.entity-body p { margin: 0.75rem 0; }
.entity-body ul, .entity-body ol { margin: 0.75rem 0; padding-left: 2rem; }
.entity-body li { margin: 0.35rem 0; }
.entity-body ul li { list-style-type: disc; }
.entity-body ol li { list-style-type: decimal; }
.entity-body ul ul li { list-style-type: circle; }
.entity-body ul ul ul li { list-style-type: square; }
.entity-body blockquote { margin: 1rem 0; padding: 0.5rem 1rem; border-left: 4px solid #1a73e8; background: #f0f5ff; color: #555; }
.entity-body blockquote p { margin: 0.25rem 0; }
.entity-body code { background: #f1f3f4; padding: 0.15rem 0.4rem; border-radius: 3px; font-family: 'SF Mono', 'Fira Code', 'Fira Mono', monospace; font-size: 0.9em; color: #c5221f; }
.entity-body pre { margin: 1rem 0; padding: 1rem; background: #1a1a2e; color: #e8eaed; border-radius: 6px; overflow-x: auto; font-size: 0.85rem; line-height: 1.5; }
.entity-body pre code { background: none; color: inherit; padding: 0; font-size: inherit; }
.entity-body table { margin: 1rem 0; width: 100%; border-collapse: collapse; }
.entity-body table th { background: #f8f9fa; font-weight: 600; text-align: left; padding: 0.5rem 0.75rem; border: 1px solid #ddd; text-transform: none; }
.entity-body table td { padding: 0.5rem 0.75rem; border: 1px solid #ddd; }
.entity-body table tr:nth-child(even) { background: #fafafa; }
.entity-body hr { margin: 1.5rem 0; border: none; border-top: 1px solid #eee; }
.entity-body a { color: #1a73e8; text-decoration: none; }
.entity-body a:hover { text-decoration: underline; }
.entity-body strong { font-weight: 600; color: #1a1a2e; }
.entity-body em { font-style: italic; }
.entity-body img { max-width: 100%; border-radius: 4px; margin: 0.5rem 0; }
.refs-section { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid #eee; }

/* Insight confidence badges */
.insight-confidence { font-size: 0.8rem; padding: 0.1rem 0.5rem; border-radius: 10px; }
.confidence-high { background: #e6f4ea; color: #137333; }
.confidence-medium { background: #fef7e0; color: #b06000; }
.confidence-low { background: #fce8e6; color: #c5221f; }

/* Dashboard stats */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card { background: white; border-radius: 8px; padding: 1.5rem; text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.stat-card .number { font-size: 2.5rem; font-weight: 700; color: #1a73e8; }
.stat-card .label { color: #888; font-size: 0.9rem; margin-top: 0.25rem; }
.product-stat-card { background: #f8f9fa; border-radius: 8px; padding: 1rem; border: 1px solid #eee; }

/* Form elements */
input[type="text"], input[type="date"], input[type="url"], select, textarea {
  padding: 0.5rem 0.75rem; border: 1px solid #ddd; border-radius: 6px;
  font-size: 0.95rem; font-family: inherit; transition: border-color 0.15s;
  width: 100%; max-width: 500px; margin-bottom: 0.75rem;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: #1a73e8; box-shadow: 0 0 0 2px rgba(26,115,232,0.15); }
label { display: block; font-weight: 600; margin-bottom: 0.25rem; color: #555; font-size: 0.9rem; }
textarea { min-height: 120px; max-width: 700px; }
select { background: white; cursor: pointer; }
input[type="checkbox"] { margin-right: 0.5rem; transform: scale(1.1); }

/* Form layout */
.form-group { margin-bottom: 1rem; }
.form-hint { color: #888; font-size: 0.8rem; margin-top: -0.5rem; margin-bottom: 0.75rem; }

/* Empty state */
.empty-state { text-align: center; padding: 3rem 1rem; color: #888; }
.empty-state p { margin-bottom: 1rem; font-size: 1.05rem; }

/* Pagination */
.pagination { display: flex; gap: 0.5rem; margin-top: 1.5rem; justify-content: center; align-items: center; }
.pagination a { padding: 0.35rem 0.9rem; border-radius: 16px; background: #e8f0fe; color: #1a73e8; font-size: 0.85rem; }
.pagination a:hover { background: #1a73e8; color: white; text-decoration: none; }
.pagination .page-info { color: #888; font-size: 0.85rem; }
.pagination .disabled { opacity: 0.35; pointer-events: none; }

@media (max-width: 768px) {
  nav { flex-wrap: wrap; height: auto; padding: 0.5rem 1rem; gap: 0.75rem; }
  nav .brand { width: 100%; text-align: center; }
  .nav-search { width: 100% !important; max-width: none; }
  .container { padding: 1rem; }
  .stats-grid { grid-template-columns: 1fr; }
  table { font-size: 0.85rem; }
  th, td { padding: 0.5rem; }
  .filter-bar { gap: 0.3rem; }
  .filter-bar a { padding: 0.2rem 0.5rem; font-size: 0.75rem; }
}
