* { margin: 0; padding: 0; box-sizing: border-box; }
body { background: #fff; color: #24292e; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif; }

/* Topbar */
.topbar { background: #f6f8fa; border-bottom: 1px solid #d0d7de; padding: 12px 24px; display: flex; justify-content: space-between; align-items: center; }
.topbar h1 { font-size: 18px; color: #24292e; }
.topbar h1 span { color: #0969da; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar a { color: #57606a; font-size: 13px; text-decoration: none; }
.topbar a:hover { color: #0969da; }

/* Login */
.login-wrap { display: flex; justify-content: center; align-items: center; min-height: 100vh; }
.login-box { background: #fff; border: 1px solid #d0d7de; border-radius: 12px; padding: 40px; width: 360px; }
.login-box h1 { font-size: 22px; margin-bottom: 8px; color: #24292e; text-align: center; }
.login-box .subtitle { color: #57606a; font-size: 13px; text-align: center; margin-bottom: 24px; }

/* Forms */
label { display: block; font-size: 13px; color: #57606a; margin-bottom: 4px; }
input[type="text"], input[type="password"], select {
  width: 100%; padding: 8px 10px; background: #fff; border: 1px solid #d0d7de;
  border-radius: 6px; color: #24292e; font-size: 13px; margin-bottom: 12px;
}
input:focus, select:focus { outline: none; border-color: #0969da; }
.btn { display: inline-block; padding: 8px 16px; background: #2da44e; color: #fff; border: none; border-radius: 6px; font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { background: #218838; }
.btn-secondary { background: #f6f8fa; border: 1px solid #d0d7de; color: #24292e; }
.btn-secondary:hover { background: #eaeef2; }

/* Flash */
.flash { padding: 8px 12px; border-radius: 6px; font-size: 13px; margin-bottom: 12px; }
.flash-error { background: #ffebe9; color: #cf222e; border: 1px solid #cf222e; }
.flash-success { background: #dafbe1; color: #116329; border: 1px solid #2da44e; }

/* Portal */
.portal-wrap { display: flex; flex-direction: column; align-items: center; padding: 80px 24px; }
.portal-wrap h2 { font-size: 24px; color: #24292e; margin-bottom: 8px; }
.portal-subtitle { color: #57606a; font-size: 14px; margin-bottom: 40px; }
.portal-grid { display: flex; gap: 24px; }
.portal-card { display: block; width: 280px; padding: 32px 24px; background: #fff; border: 1px solid #d0d7de; border-radius: 12px; text-decoration: none; color: inherit; text-align: center; transition: border-color 0.2s, box-shadow 0.2s; }
.portal-card:hover { border-color: #0969da; box-shadow: 0 2px 8px rgba(9,105,218,0.1); }
.portal-card.disabled { opacity: 0.5; cursor: not-allowed; }
.portal-card.disabled:hover { border-color: #d0d7de; box-shadow: none; }
.portal-icon { font-size: 40px; margin-bottom: 16px; }
.portal-title { font-size: 16px; font-weight: 600; color: #24292e; margin-bottom: 8px; }
.portal-desc { font-size: 13px; color: #57606a; }

/* Gallery layout */
.gallery-wrap { display: flex; min-height: calc(100vh - 49px); }
.filter-sidebar { width: 280px; background: #f6f8fa; border-right: 1px solid #d0d7de; padding: 20px; flex-shrink: 0; overflow-y: auto; }
.filter-sidebar h2 { font-size: 13px; color: #57606a; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 12px; }
.filter-section { margin-bottom: 20px; }
.gallery-main { flex: 1; padding: 24px; }

/* Material cards */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.card { background: #fff; border: 1px solid #d0d7de; border-radius: 8px; padding: 16px; transition: border-color 0.2s; cursor: pointer; text-decoration: none; color: inherit; display: block; }
.card:hover { border-color: #0969da; }
.card-formula { font-size: 18px; font-weight: 700; color: #24292e; margin-bottom: 8px; }
.card-meta { font-size: 12px; color: #57606a; line-height: 1.8; }
.card-meta span { display: inline-block; background: #f6f8fa; padding: 2px 8px; border-radius: 12px; margin-right: 4px; margin-bottom: 4px; }
.card-bands { font-size: 11px; color: #0969da; margin-top: 8px; }

/* Pagination */
.pagination { display: flex; gap: 4px; margin-top: 24px; justify-content: center; }
.pagination a, .pagination span { padding: 6px 12px; border-radius: 6px; font-size: 13px; text-decoration: none; }
.pagination a { background: #f6f8fa; color: #24292e; border: 1px solid #d0d7de; }
.pagination a:hover { background: #eaeef2; }
.pagination .current { background: #0969da; color: #fff; border: 1px solid #0969da; }

/* Viewer layout */
.viewer-wrap { display: flex; height: calc(100vh - 49px); }
.viewer-sidebar { width: 320px; background: #f6f8fa; border-right: 1px solid #d0d7de; padding: 20px; overflow-y: auto; flex-shrink: 0; }
.viewer-main { flex: 1; position: relative; }
#canvas3d { width: 100%; height: 100%; display: block; }
#status { position: absolute; bottom: 16px; left: 16px; background: rgba(255,255,255,0.95); color: #57606a; padding: 8px 14px; border-radius: 6px; font-size: 12px; border: 1px solid #d0d7de; }
.section { margin-bottom: 24px; }
.section h2 { font-size: 13px; color: #57606a; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 10px; }
.meta-table { width: 100%; font-size: 12px; }
.meta-table td { padding: 4px 0; }
.meta-table td:first-child { color: #57606a; width: 100px; }
.meta-table td:last-child { color: #24292e; }

/* Band rows */
.band-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid #d0d7de; }
.band-row:last-child { border-bottom: none; }
.band-row input[type="checkbox"] { accent-color: #0969da; width: 16px; height: 16px; cursor: pointer; }
.band-row input[type="color"] { width: 28px; height: 22px; border: 1px solid #d0d7de; border-radius: 4px; background: none; cursor: pointer; padding: 0; }
.band-label { color: #24292e; font-size: 13px; font-weight: 600; flex: 1; }
.band-range { color: #57606a; font-size: 11px; }

/* Results info */
.results-info { font-size: 13px; color: #57606a; margin-bottom: 16px; }
.no-results { text-align: center; padding: 60px 20px; color: #8c959f; font-size: 15px; }
