:root {
  --cr-ink: #17231f;
  --cr-muted: #68756f;
  --cr-line: #dfe7e3;
  --cr-canvas: #f3f7f5;
  --cr-green: #1b5d4b;
  --cr-green-dark: #103d32;
  --cr-green-soft: #e3f1eb;
  --cr-amber: #a86e20;
  --cr-amber-soft: #fff1d8;
  --cr-red: #ac4d46;
  --cr-red-soft: #fcebea;
  --cr-blue: #3f719d;
  --cr-blue-soft: #e6f0f8;
  --cr-shadow: 0 18px 55px rgba(15, 48, 38, .12);
}

.cr-shell, .cr-shell * { box-sizing: border-box; }
.cr-shell { width: 100%; max-width: none; margin: 0; color: var(--cr-ink); background: var(--cr-canvas); font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif; }
.cr-shell button, .cr-shell input, .cr-shell select, .cr-shell textarea { font: inherit; }
.cr-shell button { color: inherit; }
.cr-shell [hidden] { display: none !important; }
.cr-shell a { color: var(--cr-green); }
.cr-shell button:focus-visible, .cr-shell input:focus-visible, .cr-shell select:focus-visible, .cr-shell textarea:focus-visible { outline: 3px solid rgba(27, 93, 75, .22); outline-offset: 2px; }

.cr-topbar { min-height: 70px; display: flex; align-items: center; gap: 36px; padding: 0 30px; color: white; background: var(--cr-green-dark); position: sticky; top: 0; z-index: 30; }
.admin-bar .cr-topbar { top: 32px; }
.cr-logo { display: flex; align-items: center; gap: 10px; }
.cr-logo > span { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; background: #f3c86c; color: var(--cr-green-dark); font-weight: 800; }
.cr-logo strong, .cr-logo small { display: block; }
.cr-logo strong { font-size: 16px; line-height: 1.1; letter-spacing: -.3px; }
.cr-logo small { margin-top: 3px; color: #9cbdb1; font-size: 8px; letter-spacing: 1.7px; font-weight: 700; }
.cr-topbar nav { align-self: stretch; display: flex; }
.cr-topbar nav button { padding: 0 16px; border: 0; border-bottom: 3px solid transparent; background: transparent; color: #b9d0c7; cursor: pointer; }
.cr-topbar nav button:hover, .cr-topbar nav button.cr-nav-active { color: white; border-color: #f3c86c; }
.cr-user { margin-left: auto; display: flex; align-items: center; gap: 12px; text-align: right; }
.cr-user span, .cr-user small { display: block; }
.cr-user span { font-size: 12px; font-weight: 600; }
.cr-user small { color: #92afa4; font-size: 9px; font-weight: 400; }
.cr-icon-button { width: 36px; height: 36px; border: 1px solid rgba(255,255,255,.16); border-radius: 8px; color: white !important; background: rgba(255,255,255,.06); cursor: pointer; }

.cr-main { max-width: 1480px; margin: 0 auto; padding: 36px 30px 60px; }
.cr-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 25px; margin-bottom: 25px; }
.cr-heading h1 { margin: 0 0 7px; font-size: clamp(25px, 3vw, 34px); line-height: 1.15; letter-spacing: -.8px; color: var(--cr-ink); }
.cr-heading p:last-child { margin: 0; color: var(--cr-muted); }
.cr-kicker { margin: 0 0 7px !important; color: #809089 !important; font-size: 10px !important; letter-spacing: 1.5px; font-weight: 700; }
.cr-primary, .cr-secondary, .cr-danger { min-height: 40px; border-radius: 8px; padding: 0 14px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; font-weight: 650; text-decoration: none !important; }
.cr-primary { border: 1px solid var(--cr-green); color: white !important; background: var(--cr-green); box-shadow: 0 4px 12px rgba(27,93,75,.16); }
.cr-primary:hover { background: var(--cr-green-dark); }
.cr-secondary { border: 1px solid var(--cr-line); background: white; }
.cr-secondary:hover { border-color: #adc5bb; }
.cr-danger { border: 1px solid #eccfcd; color: var(--cr-red); background: white; }
.cr-wide { width: 100%; }

.cr-metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.cr-metrics > button { padding: 17px; border: 1px solid var(--cr-line); border-radius: 11px; background: white; text-align: left; cursor: pointer; transition: .16s ease; }
.cr-metrics > button:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(20,50,40,.08); }
.cr-metrics strong, .cr-metrics small { display: block; }
.cr-metrics strong { margin: 11px 0 3px; font-size: 25px; line-height: 1; }
.cr-metrics small { color: var(--cr-muted); }
.cr-metric-icon { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 8px; font-weight: 800; }
.cr-blue { color: var(--cr-blue); background: var(--cr-blue-soft); }
.cr-green { color: var(--cr-green); background: var(--cr-green-soft); }
.cr-amber { color: var(--cr-amber); background: var(--cr-amber-soft); }
.cr-grey { color: #6f7c76; background: #edf1ef; }
.cr-purple { color: #745d95; background: #eee9f7; }

.cr-panel { overflow: hidden; border: 1px solid var(--cr-line); border-radius: 12px; background: white; box-shadow: 0 2px 8px rgba(20,50,40,.03); }
.cr-panel-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; padding: 21px; }
.cr-panel-heading h2 { margin: 0 0 5px; color: var(--cr-ink); font-size: 18px; }
.cr-panel-heading p { margin: 0; color: var(--cr-muted); font-size: 11px; }
.cr-actions { display: flex; gap: 7px; }
.cr-search-mode { display: flex; align-items: center; gap: 5px; padding: 10px 20px; border-top: 1px solid #ebefed; background: white; }
.cr-search-mode button { min-height: 31px; padding: 0 11px; border: 1px solid transparent; border-radius: 6px; color: #617069; background: transparent; cursor: pointer; font-size: 10px; font-weight: 650; }
.cr-search-mode button:hover { background: #f2f6f4; }
.cr-search-mode button.cr-mode-active { border-color: #cde0d7; color: var(--cr-green); background: var(--cr-green-soft); }
.cr-search-mode span { margin-left: 8px; color: var(--cr-muted); font-size: 10px; }
.cr-search-grid { display: grid; grid-template-columns: minmax(250px, 2fr) repeat(5, minmax(120px, 1fr)) auto auto; gap: 8px; align-items: end; padding: 13px 20px; border-top: 1px solid #ebefed; background: #f9fbfa; }
.cr-search-grid label { display: grid; gap: 5px; color: #66736d; font-size: 9px; font-weight: 700; }
.cr-search-grid input, .cr-search-grid select { width: 100%; height: 37px; border: 1px solid var(--cr-line); border-radius: 7px; padding: 0 9px; color: var(--cr-ink); background: white; font-size: 11px; }
.cr-search-main { position: relative; }
.cr-search-main > span { position: absolute; left: 11px; bottom: 9px; color: #718078; font-size: 15px; }
.cr-search-main input { padding-left: 32px; }
.cr-link-button { height: 37px; border: 0; color: var(--cr-green) !important; background: transparent; cursor: pointer; white-space: nowrap; font-size: 10px !important; }
.cr-search-status { padding: 10px 20px; border-top: 1px solid var(--cr-line); border-left: 4px solid #8da39a; color: #53625b; background: #f7faf8; font-size: 11px; }
.cr-status-starting, .cr-status-loading { border-left-color: var(--cr-blue); color: #385e7d; background: var(--cr-blue-soft); }
.cr-status-loading:before { content: "↻"; display: inline-block; margin-right: 7px; animation: cr-spin .8s linear infinite; }
.cr-status-ready { border-left-color: var(--cr-green); color: #285f4e; background: #edf7f2; }
.cr-status-error { border-left-color: var(--cr-red); color: #873c37; background: var(--cr-red-soft); font-weight: 650; }
@keyframes cr-spin { to { transform: rotate(360deg); } }

.cr-table-wrap { min-height: 220px; overflow-x: auto; position: relative; border-top: 1px solid var(--cr-line); }
.cr-table { width: 100%; min-width: 1050px; border: 0 !important; border-collapse: collapse; margin: 0 !important; }
.cr-table th { padding: 10px 13px; border: 0; border-bottom: 1px solid var(--cr-line); color: #74817b; background: #f5f8f6; text-align: left; text-transform: uppercase; letter-spacing: .55px; font-size: 9px; }
.cr-table td { padding: 12px 13px; border: 0; border-bottom: 1px solid #edf1ef; color: #4f5e57; font-size: 11px; vertical-align: middle; }
.cr-table tbody tr { cursor: pointer; }
.cr-table tbody tr:hover { background: #f6faf8; }
.cr-table td strong, .cr-table td small { display: block; }
.cr-table td strong { color: var(--cr-ink); }
.cr-table td small { margin-top: 2px; color: #8a9590; font-size: 9px; }
.cr-church-cell { display: flex; align-items: center; gap: 10px; }
.cr-church-cell > span { width: 34px; height: 34px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 8px; color: var(--cr-green); background: var(--cr-green-soft); font-size: 10px; font-weight: 800; }
.cr-status { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: 20px; white-space: nowrap; font-size: 9px; font-weight: 700; }
.cr-status:before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.cr-verified { color: #247158; background: var(--cr-green-soft); }
.cr-review { color: var(--cr-amber); background: var(--cr-amber-soft); }
.cr-unverified { color: #6f7b75; background: #edf1ef; }
.cr-row-button { border: 0; background: transparent; cursor: pointer; }
.cr-save-result { min-width: 62px; padding: 6px 8px; border: 1px solid #c9ddd4; border-radius: 6px; color: var(--cr-green) !important; background: #eff7f3; cursor: pointer; white-space: nowrap; font-size: 9px !important; font-weight: 700; }
.cr-save-result:hover { border-color: var(--cr-green); }
.cr-save-result.cr-saved { color: #fff !important; background: var(--cr-green); }
.cr-empty { padding: 70px 20px; text-align: center; }
.cr-empty > span { font-size: 30px; color: #9ca8a2; }
.cr-empty h3 { margin: 8px 0 4px; font-size: 17px; }
.cr-empty p { margin: 0 0 15px; color: var(--cr-muted); }
.cr-loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--cr-muted); background: rgba(255,255,255,.86); }
.cr-pagination { display: flex; justify-content: flex-end; align-items: center; gap: 10px; padding: 12px 20px; color: var(--cr-muted); font-size: 10px; }
.cr-pagination button { width: 29px; height: 29px; border: 1px solid var(--cr-line); border-radius: 6px; background: white; cursor: pointer; }
.cr-attribution { padding: 9px 20px 13px; color: #78857f; text-align: right; font-size: 9px; }
.cr-attribution a { font-weight: 650; }

.cr-backdrop { position: fixed; inset: 0; z-index: 80; background: rgba(10, 30, 23, .38); backdrop-filter: blur(2px); }
.cr-drawer { position: fixed; z-index: 90; top: 0; right: 0; bottom: 0; width: min(510px, 96vw); display: flex; flex-direction: column; color: var(--cr-ink); background: white; box-shadow: -20px 0 60px rgba(15,45,35,.18); transform: translateX(105%); transition: transform .22s ease; }
.admin-bar .cr-drawer { top: 32px; }
.cr-drawer.cr-open { transform: translateX(0); }
.cr-drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 15px; padding: 23px; border-bottom: 1px solid var(--cr-line); }
.cr-drawer-head h2 { margin: 8px 0 3px; font-size: 21px; }
.cr-drawer-head p { margin: 0; color: var(--cr-muted); font-size: 11px; }
.cr-close { width: 34px; height: 34px; border: 0; border-radius: 7px; color: #6b7972 !important; background: transparent; cursor: pointer; font-size: 24px !important; line-height: 1; }
.cr-close:hover { background: #eff4f1; }
.cr-drawer-body { flex: 1; overflow-y: auto; padding: 20px 23px; }
.cr-drawer-actions { display: flex; justify-content: space-between; gap: 8px; padding: 14px 23px; border-top: 1px solid var(--cr-line); }
.cr-confidence { padding: 13px; border: 1px solid #d4e7de; border-radius: 9px; background: #eef7f3; }
.cr-confidence > div { display: flex; justify-content: space-between; font-size: 11px; }
.cr-confidence strong { color: var(--cr-green); }
.cr-confidence i { display: block; height: 5px; overflow: hidden; margin-top: 8px; border-radius: 5px; background: #d8e7e0; }
.cr-confidence b { display: block; height: 100%; border-radius: inherit; background: var(--cr-green); }
.cr-detail-section { padding: 19px 0; border-bottom: 1px solid #e8eeeb; }
.cr-detail-section h3 { margin: 0 0 12px; font-size: 13px; }
.cr-detail-section p { margin: 0; white-space: pre-wrap; }
.cr-detail-section dl { display: grid; gap: 10px; margin: 0; }
.cr-detail-section dl div { display: grid; grid-template-columns: 115px minmax(0, 1fr); gap: 12px; font-size: 10px; }
.cr-detail-section dt { color: #7a8781; }
.cr-detail-section dd { margin: 0; overflow-wrap: anywhere; font-weight: 600; }
.cr-muted { color: var(--cr-muted); font-size: 11px; }
.cr-link-list { display: flex; flex-wrap: wrap; gap: 6px; }
.cr-link-list a { padding: 5px 8px; border-radius: 6px; background: #eef5f1; text-decoration: none; font-size: 9px; font-weight: 650; }
.cr-source-list { margin: 0; padding-left: 18px; }
.cr-source-list li { margin-bottom: 7px; font-size: 9px; overflow-wrap: anywhere; }
.cr-history > div { display: grid; grid-template-columns: 10px 1fr; gap: 9px; position: relative; padding-bottom: 12px; }
.cr-history i { width: 9px; height: 9px; margin-top: 3px; border: 2px solid #cce2d8; border-radius: 50%; background: var(--cr-green); }
.cr-history p, .cr-history strong, .cr-history span { display: block; margin: 0; }
.cr-history strong { text-transform: capitalize; font-size: 10px; }
.cr-history span { margin-top: 2px; color: var(--cr-muted); font-size: 9px; }

.cr-modal { position: fixed; z-index: 100; top: 50%; left: 50%; width: min(760px, calc(100vw - 30px)); max-height: min(850px, calc(100vh - 40px)); overflow-y: auto; padding: 24px; border-radius: 13px; color: var(--cr-ink); background: white; box-shadow: var(--cr-shadow); transform: translate(-50%, -50%); }
.cr-modal-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; }
.cr-modal-head h2 { margin: 0; font-size: 21px; }
.cr-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.cr-form-grid label { display: grid; gap: 5px; color: #5e6c65; font-size: 10px; font-weight: 650; }
.cr-form-grid input, .cr-form-grid select, .cr-form-grid textarea { width: 100%; border: 1px solid var(--cr-line); border-radius: 7px; padding: 9px; color: var(--cr-ink); background: white; }
.cr-form-grid input, .cr-form-grid select { height: 39px; }
.cr-form-grid textarea { resize: vertical; }
.cr-form-grid .cr-span-2 { grid-column: 1 / -1; }
.cr-form-grid .cr-check { display: flex; align-items: center; gap: 7px; font-weight: 500; }
.cr-form-grid .cr-check input { width: auto; height: auto; }
.cr-modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--cr-line); }
.cr-alert { margin: 13px 0; padding: 10px; border-radius: 7px; font-size: 11px; }
.cr-alert-error { border: 1px solid #edceca; color: var(--cr-red); background: var(--cr-red-soft); }
.cr-toast { position: fixed; z-index: 110; right: 22px; bottom: 22px; max-width: 360px; padding: 13px 16px; border-radius: 9px; color: white; background: var(--cr-green-dark); box-shadow: var(--cr-shadow); }
.cr-toast-error { background: #7f312d; }

.cr-gate-wrap { min-height: 650px; display: grid; place-items: center; padding: 30px; background: linear-gradient(135deg, #edf5f1, #f8f4e9); }
.cr-login-card { width: min(430px, 100%); padding: 34px; border: 1px solid var(--cr-line); border-radius: 15px; background: white; box-shadow: var(--cr-shadow); }
.cr-login-card .cr-logo { margin-bottom: 30px; }
.cr-login-card .cr-logo strong { color: var(--cr-ink); }
.cr-login-card h1 { margin: 0 0 8px; color: var(--cr-ink); font-size: 27px; }
.cr-login-card > p:not(.cr-kicker) { margin: 0 0 22px; color: var(--cr-muted); }
.cr-login-card form { display: grid; gap: 14px; }
.cr-login-card label { display: grid; gap: 6px; color: #53615a; font-size: 11px; font-weight: 650; }
.cr-login-card input { height: 43px; border: 1px solid var(--cr-line); border-radius: 7px; padding: 0 11px; }
.cr-session-note { display: block; margin-top: 17px; color: #87928d; text-align: center; font-size: 9px; }

@media (max-width: 1200px) {
  .cr-search-grid { grid-template-columns: repeat(4, minmax(120px, 1fr)); }
  .cr-search-main { grid-column: span 2; }
}
@media (max-width: 900px) {
  .cr-metrics { grid-template-columns: repeat(2, 1fr); }
  .cr-topbar nav { display: none; }
  .cr-search-grid { grid-template-columns: 1fr 1fr; }
  .cr-search-main { grid-column: 1 / -1; }
}
@media (max-width: 782px) {
  .admin-bar .cr-topbar, .admin-bar .cr-drawer { top: 46px; }
}
@media (max-width: 650px) {
  .cr-topbar { padding: 0 14px; }
  .cr-user > span { display: none; }
  .cr-main { padding: 24px 12px 45px; }
  .cr-heading { align-items: flex-start; flex-direction: column; }
  .cr-heading .cr-primary { width: 100%; }
  .cr-panel-heading { flex-direction: column; }
  .cr-actions { width: 100%; }
  .cr-actions button { flex: 1; padding: 0 7px; }
  .cr-search-mode { align-items: stretch; flex-wrap: wrap; }
  .cr-search-mode button { flex: 1; }
  .cr-search-mode span { width: 100%; margin: 4px 0 0; }
  .cr-search-grid { grid-template-columns: 1fr; }
  .cr-search-main { grid-column: auto; }
  .cr-form-grid { grid-template-columns: 1fr; }
  .cr-form-grid .cr-span-2 { grid-column: auto; }
}
@media (max-width: 420px) {
  .cr-metrics { grid-template-columns: 1fr; }
  .cr-login-card { padding: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  .cr-shell * { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
