.app-shell { display: contents; }
.app-shell[hidden], .login-shell[hidden], [data-view][hidden] { display: none !important; }
body.auth-pending { display: block; overflow-x: hidden; background: #f3efe6; }
.login-shell { position: relative; isolation: isolate; min-height: 100vh; display: grid; place-items: center; overflow: hidden; padding: 32px 24px; background: radial-gradient(circle at 15% 10%, rgba(38, 179, 202, .13), transparent 28%), radial-gradient(circle at 86% 88%, rgba(238, 75, 45, .12), transparent 30%), #f3efe6; }
.login-shell::before, .login-shell::after { content: ''; position: absolute; z-index: -1; border-radius: 50%; }
.login-shell::before { width: 420px; height: 420px; top: -260px; right: -120px; border: 80px solid rgba(23, 60, 48, .06); }
.login-shell::after { width: 300px; height: 300px; bottom: -210px; left: -90px; background: rgba(23, 60, 48, .06); }
.login-card { position: relative; width: min(100%, 520px); padding: 48px; overflow: hidden; border: 1px solid rgba(222, 216, 204, .9); border-radius: 24px; background: rgba(255, 253, 248, .96); box-shadow: 0 28px 80px rgba(31, 50, 42, .16); }
.login-card::before { content: ''; position: absolute; inset: 0 0 auto; height: 5px; background: linear-gradient(90deg, #ee4b2d 0 43%, #22b8cf 43% 100%); }
.login-brand { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 52px; }
.login-brand img { display: block; width: 158px; height: auto; }
.login-brand span { padding: 7px 10px; border-radius: 999px; color: #245846; background: #dde9df; font-size: 10px; font-weight: 850; letter-spacing: .6px; text-transform: uppercase; }
.login-card h1 { margin: 3px 0 14px; font-size: clamp(32px, 6vw, 44px); line-height: 1.02; letter-spacing: -1.6px; }
.login-description { max-width: 420px; margin: 0; color: #667069; font-size: 15px; line-height: 1.65; }
.login-access { min-width: 0; display: grid; gap: 5px; margin-top: 34px; padding: 22px; border: 1px solid #e3ddd1; border-radius: 16px; background: #fff; }
.login-access strong { font-size: 14px; }
.login-access > span { margin-bottom: 15px; color: #667069; font-size: 12px; }
#google-signin { min-height: 44px; display: flex; align-items: center; }
#google-signin > div, #google-signin iframe { max-width: 100% !important; }
.login-notice { min-height: 20px; margin: 14px 0 0; color: #a0372d; font-size: 12px; font-weight: 700; }
.login-footnote { margin: 22px 0 0; padding-top: 18px; border-top: 1px solid #ece7de; color: #667069; font-size: 11px; }
.signout { width: 100%; margin-top: 18px; padding: 9px 12px; border: 1px solid rgba(255,255,255,.25); border-radius: 8px; color: #fff; background: transparent; cursor: pointer; }
.stats article[data-status-filter] { cursor: pointer; transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease; }
.stats article[data-status-filter]:hover { transform: translateY(-2px); border-color: #9fb6a8; box-shadow: 0 8px 22px rgba(31, 50, 42, .08); }
.stats article[data-status-filter]:focus-visible { outline: 3px solid rgba(34, 184, 207, .35); outline-offset: 3px; }
.stats article[data-status-filter].selected { border-color: #245846; box-shadow: inset 0 0 0 1px #245846; }
.tracker-execution { margin: 24px 0 18px; padding: 22px; border: 1px solid #cbd9d0; border-radius: 16px; background: linear-gradient(135deg, #f8fbf9, #edf5f0); box-shadow: 0 10px 30px rgba(31, 50, 42, .06); }
.tracker-execution-heading { display: flex; justify-content: space-between; gap: 24px; align-items: center; }
.tracker-execution-heading h2 { margin: 2px 0 5px; color: #173c30; font-size: 22px; }
.tracker-execution-heading p:last-child { margin: 0; color: #667069; font-size: 13px; }
.run-tracker-button { min-width: 205px; padding: 14px 18px; border: 0; border-radius: 10px; background: #173c30; color: #fff; cursor: pointer; font-size: 12px; font-weight: 900; letter-spacing: .04em; }
.run-tracker-button:hover:not(:disabled) { background: #245846; }
.run-tracker-button:disabled { cursor: wait; opacity: .68; }
.tracker-execution-status { display: flex; flex-wrap: wrap; gap: 9px 14px; align-items: center; margin-top: 18px; padding-top: 15px; border-top: 1px solid #d8e3dc; color: #667069; font-size: 12px; }
.tracker-execution-status strong { padding: 5px 9px; border-radius: 999px; color: #52615a; background: #e3e8e5; }
.tracker-execution-status strong[data-state="running"] { color: #765009; background: #f5d99f; }
.tracker-execution-status strong[data-state="completed"] { color: #245846; background: #d8eadf; }
.tracker-execution-status strong[data-state="error"] { color: #8f2d25; background: #f4d5d1; }
.run-error { flex-basis: 100%; color: #8f2d25; font-weight: 700; overflow-wrap: anywhere; }
.tracker-run-metrics { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; margin: 15px 0 0; }
.tracker-run-metrics div { min-width: 0; padding: 10px; border-radius: 9px; background: rgba(255,255,255,.72); }
.tracker-run-metrics dt { color: #748078; font-size: 9px; font-weight: 850; letter-spacing: .04em; text-transform: uppercase; }
.tracker-run-metrics dd { margin: 5px 0 0; color: #173c30; font-size: 12px; font-weight: 800; overflow-wrap: anywhere; }
.normalization-card { margin-top: 16px; padding: 14px; border: 1px solid #d7dfd9; border-radius: 12px; background: #f7faf7; }
.normalization-heading { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.normalization-state { padding: 4px 8px; border-radius: 999px; font-size: 10px; font-weight: 850; }
.normalization-state.ready { color: #245846; background: #dde9df; }
.normalization-state.pending { color: #7a4d0d; background: #f4d49c; }
.normalization-card dl { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 6px 12px; margin: 12px 0; font-size: 12px; }
.normalization-card dt { color: #667069; }
.normalization-card dd { min-width: 0; margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.normalization-card dd.missing { color: #a05b22; }
.normalization-card p { margin: 0; color: #667069; font-size: 10px; }
.flyer-preview { display: block; width: min(100%, 360px); height: auto; margin: 16px auto; border-radius: 18px; background: #173c30; box-shadow: 0 16px 36px rgba(31, 50, 42, .18); }
.research-item { border-left: 5px solid #245846; }
.research-query { margin: 10px 0 0; padding: 10px 12px; border-radius: 8px; color: #173c30; background: #edf6f0; font-size: .86rem; font-weight: 700; overflow-wrap: anywhere; }
.research-sources { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.research-sources strong { flex-basis: 100%; color: #667069; font-size: .72rem; letter-spacing: .04em; text-transform: uppercase; }
.research-sources a, .research-sources span { max-width: 100%; padding: 7px 9px; border-radius: 999px; background: #f3f6f4; color: #245846; font-size: .78rem; font-weight: 750; overflow-wrap: anywhere; }
.quality-section { scroll-margin-top: 20px; }
.quality-section .section-heading { align-items: flex-start; }
.quality-section .section-heading h1 { margin: 0; color: #173c30; font-size: clamp(1.8rem, 5vw, 2.7rem); }
.quality-guide { margin: 16px 0 18px; padding: 18px 20px; border: 1px solid #bed4c6; border-radius: 14px; background: #edf6f0; color: #173c30; }
.quality-guide > strong { display: block; margin-bottom: 8px; font-size: 1.05rem; }
.quality-guide ol { margin: 0; padding-left: 22px; }
.quality-guide li + li { margin-top: 6px; }
.quality-guide p { margin: 10px 0 0; color: #4f665b; font-size: .88rem; }
.quality-stats { margin-bottom: 16px; }
.quality-list { display: grid; gap: 12px; }
.quality-published-search { display: grid; gap: 7px; margin: 0; padding: 14px; border: 1px solid #bed4c6; border-radius: 12px; background: #fff; }
.quality-published-search span { color: #4f665b; font-size: .78rem; font-weight: 850; letter-spacing: .04em; text-transform: uppercase; }
.quality-published-search input { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid #c8d6ce; border-radius: 10px; color: #173c30; background: #f8faf8; font: inherit; }
.quality-published-search input:focus { outline: 3px solid rgba(36, 88, 70, .18); border-color: #245846; }
.quality-next-step { margin: 0; padding: 18px; border: 1px solid #bed4c6; border-left: 5px solid #245846; border-radius: 12px; background: #edf6f0; color: #173c30; }
.quality-next-step strong { display: block; font-size: 1rem; line-height: 1.25; }
.quality-next-step p { margin: 8px 0 14px; color: #4f665b; font-size: .9rem; line-height: 1.45; }
.quality-finding, .quality-clean { margin: 0; padding: 16px 18px; border: 1px solid #d7e1da; border-left-width: 5px; border-radius: 12px; background: white; }
.quality-finding.error { border-left-color: #a6382e; }
.quality-finding.review { border-left-color: #cf7a28; }
.quality-finding.warning { border-left-color: #426f88; }
.quality-finding.resolved { opacity: .7; border-left-color: #6d8a78; background: #f7faf8; }
.quality-finding-layout { display: grid; grid-template-columns: 152px minmax(0, 1fr); gap: 20px; align-items: start; }
.quality-poster { display: block; width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 10px; background: #e7ece8; }
.quality-finding-content h3 { margin: 8px 0 2px; color: #173c30; font: 750 1.15rem/1.25 system-ui, sans-serif; }
.quality-finding-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.quality-finding-heading code { color: #587064; font-size: .76rem; }
.quality-finding p { margin: 8px 0 0; }
.quality-event-meta { color: #587064; font-size: .84rem; }
.quality-comparison { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.quality-comparison p { display: grid; gap: 4px; margin: 0; padding: 12px; border-radius: 9px; background: #f3f6f4; }
.quality-comparison span { color: #667069; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.quality-comparison strong { color: #173c30; font-size: .9rem; line-height: 1.35; overflow-wrap: anywhere; }
.quality-event-ids { color: #587064; font-size: .8rem; overflow-wrap: anywhere; }
.quality-actions { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; margin-top: 14px; }
.quality-actions a { color: #245846; font-size: .85rem; font-weight: 700; }
.quality-actions .button.danger { border-color: #a6382e; background: #a6382e; color: #fff; }
.quality-actions .button.danger:hover { background: #84291f; }
.quality-clean { border-left-color: #2d7657; color: #245846; }
.normalization-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 10px; align-items: end; margin: 16px 0; }
.normalization-form label { display: grid; gap: 5px; color: #667069; font-size: 11px; font-weight: 750; }
.normalization-form input { min-width: 0; width: 100%; padding: 10px; border: 1px solid #ccd7d0; border-radius: 8px; background: #fff; color: #173c30; }
@media (max-width: 720px) {
  .tracker-execution-heading { display: grid; }
  .run-tracker-button { width: 100%; min-width: 0; }
  .tracker-run-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quality-section { padding: 18px 14px; }
  .quality-section .section-heading { display: grid; gap: 10px; }
  .quality-guide { padding: 15px; }
  .quality-finding-layout { grid-template-columns: 92px minmax(0, 1fr); gap: 13px; }
  .quality-comparison { grid-template-columns: 1fr; }
}
@media (max-width: 620px) { .normalization-form { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 850px) {
  html, body { width: 100%; max-width: 100%; overflow-x: hidden; }
  body.authenticated { display: block; }
  .app-shell:not([hidden]) { display: block; width: 100%; max-width: 100%; }
  .app-shell aside { position: static; width: 100%; height: auto; padding: 16px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; }
  .app-shell .brand { min-width: 0; }
  .app-shell .brand img { width: 112px; }
  .app-shell .environment, .app-shell .sidebar-note { display: none; }
  .app-shell nav { grid-column: 1 / -1; grid-row: 2; grid-template-columns: minmax(0, 1fr); }
  .app-shell nav a { min-width: 0; padding: 9px 11px; }
  .app-shell .signout { grid-column: 2; grid-row: 1; width: auto; margin: 0; padding: 8px 11px; font-size: 12px; }
  .app-shell main { width: 100%; max-width: 100%; padding: 24px 16px 40px; overflow: hidden; }
  .app-shell header { gap: 12px; }
  .app-shell h1 { font-size: 32px; letter-spacing: -1px; }
  .app-shell .subtitle { max-width: 32rem; font-size: 14px; line-height: 1.5; }
  .app-shell .freshness { font-size: 11px; }
  .app-shell .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 22px 0 16px; }
  .app-shell .stats article { min-width: 0; padding: 14px; border-radius: 12px; }
  .app-shell .stats strong { font-size: 24px; }
  .app-shell .panel { width: 100%; max-width: 100%; border-radius: 14px; }
  .app-shell .tracker-filters { width: 100%; grid-template-columns: minmax(0, 1fr); padding: 12px; }
  .app-shell .tracker-filters > * { min-width: 0; width: 100%; }
  .app-shell .candidate { min-width: 0; grid-template-columns: minmax(0, 1fr); gap: 16px; padding: 16px; }
  .app-shell .candidate > *, .app-shell .candidate-text { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
  .app-shell .candidate-actions { min-width: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .app-shell .candidate-actions a { grid-column: 1 / -1; }
  .app-shell .candidate-actions .button { width: 100%; white-space: normal; }
  .app-shell .panel-footer { gap: 12px; align-items: flex-start; flex-direction: column; }
  .app-shell .source-section { margin-top: 24px; }
  .app-shell .table-wrap { width: 100%; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .app-shell table { min-width: 640px; }
}
@media (max-width: 560px) {
  .login-shell { width: 100%; grid-template-columns: minmax(0, 1fr); place-items: stretch; padding: 0; }
  .login-card { width: 100vw; min-width: 0; max-width: 100vw; min-height: 100vh; padding: 34px 24px; overflow-x: hidden; border: 0; border-radius: 0; box-shadow: none; }
  .login-brand { align-items: flex-start; flex-direction: column; gap: 14px; margin-bottom: 46px; }
  .login-brand img { width: 145px; }
  .login-brand span { font-size: 9px; }
  .login-description { max-width: 100%; overflow-wrap: anywhere; }
  .login-access { width: 100%; overflow: hidden; padding: 18px; }
  .login-card > *, .login-access > *, #google-signin, #google-signin > div, #google-signin iframe { min-width: 0 !important; max-width: 100% !important; }
}
@media (max-width: 420px) {
  .app-shell main { padding-inline: 12px; }
  .app-shell .stats { grid-template-columns: minmax(0, 1fr); }
  .app-shell .candidate-actions { grid-template-columns: minmax(0, 1fr); }
  .app-shell .candidate-actions a { grid-column: auto; }
  .login-card { padding-inline: 20px; }
}
