:root {
  --green: #08b85a;
  --green-dark: #067b42;
  --green-soft: #eafaf1;
  --ink: #111a2e;
  --muted: #667085;
  --line: #e5eaf0;
  --canvas: #f3f6f9;
  --panel: #ffffff;
  --danger: #d92d20;
  --shadow: 0 12px 36px rgba(20, 35, 55, .08);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--canvas); font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.is-hidden { display: none !important; }
.mobile-only { display: none; }

.brand { font-size: 30px; font-weight: 850; letter-spacing: -1.8px; white-space: nowrap; }
.brand-dark { color: var(--ink); }
.brand-green { color: var(--green); }
.brand i { display: inline-block; width: 6px; height: 6px; margin-left: 3px; border-radius: 50%; background: var(--green); vertical-align: 5px; }
.eyebrow { margin: 0 0 7px; color: var(--green-dark); font-size: 11px; font-weight: 800; letter-spacing: 1.25px; }

.login-view { position: relative; min-height: 100vh; display: grid; place-items: center; overflow: hidden; padding: 28px; background: radial-gradient(circle at 15% 10%, #e5fff0 0, transparent 34%), linear-gradient(145deg, #f6faf8, #edf3f8); }
.login-orb { position: absolute; border: 1px solid rgba(8,184,90,.12); border-radius: 50%; }
.login-orb-a { width: 480px; height: 480px; right: -190px; top: -180px; }
.login-orb-b { width: 320px; height: 320px; left: -120px; bottom: -120px; }
.login-card { position: relative; width: min(440px, 100%); padding: 42px; border: 1px solid rgba(226,233,239,.9); border-radius: 26px; background: rgba(255,255,255,.94); box-shadow: 0 30px 90px rgba(21,39,57,.14); backdrop-filter: blur(20px); }
.brand-login { margin-bottom: 34px; }
.login-card h1 { margin: 0; font-size: 32px; letter-spacing: -1px; }
.login-copy { margin: 9px 0 28px; color: var(--muted); line-height: 1.55; }
.field { display: block; margin-top: 17px; }
.field > span, .filters label > span { display: block; margin-bottom: 7px; color: #344054; font-size: 12px; font-weight: 700; }
input, select { width: 100%; min-height: 44px; border: 1px solid #d6dde5; border-radius: 11px; outline: none; background: #fff; color: var(--ink); padding: 0 13px; transition: .2s ease; }
input:focus, select:focus { border-color: var(--green); box-shadow: 0 0 0 4px rgba(8,184,90,.1); }
.password-wrap { display: flex; gap: 7px; }
.password-wrap input { flex: 1; }
.form-error { min-height: 20px; margin: 12px 0 4px; color: var(--danger); font-size: 13px; }
.security-note { margin: 19px 0 0; text-align: center; color: var(--muted); font-size: 12px; }

.primary-button, .secondary-button, .logout-button, .text-button { border: 0; border-radius: 11px; font-weight: 750; transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease; }
.primary-button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 44px; padding: 0 18px; color: #fff; background: linear-gradient(135deg, #08b85a, #00a44e); box-shadow: 0 9px 22px rgba(8,184,90,.22); }
.primary-button:hover { transform: translateY(-1px); box-shadow: 0 12px 26px rgba(8,184,90,.3); }
.primary-button:disabled { opacity: .55; cursor: wait; transform: none; }
.primary-button.wide { width: 100%; }
.secondary-button { min-height: 40px; padding: 0 14px; border: 1px solid #dbe2e9; color: #344054; background: #fff; }
.secondary-button:hover { border-color: #acb9c6; }
.text-button { align-self: end; min-height: 44px; padding: 0 8px; color: var(--green-dark); background: transparent; }
.icon-button { width: 40px; height: 40px; display: inline-grid; place-items: center; border: 1px solid #dbe2e9; border-radius: 11px; color: #475467; background: #fff; }
.icon-button.compact { flex: 0 0 44px; height: 44px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 245px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 30px 20px 22px; border-right: 1px solid var(--line); background: #fff; }
.sidebar-brand { padding: 0 12px; }
.admin-pill { width: max-content; margin: 9px 12px 32px; padding: 4px 8px; color: var(--green-dark); background: var(--green-soft); border-radius: 6px; font-size: 9px; font-weight: 900; letter-spacing: 1.4px; }
.side-nav { display: grid; gap: 6px; }
.side-nav a { display: flex; align-items: center; gap: 11px; padding: 12px; border-radius: 11px; color: #536173; text-decoration: none; font-size: 14px; font-weight: 700; }
.side-nav a span { width: 22px; color: #7d8998; font-size: 18px; text-align: center; }
.side-nav a:hover, .side-nav a.active { color: var(--green-dark); background: var(--green-soft); }
.side-nav a.active span { color: var(--green); }
.sidebar-status { display: flex; align-items: center; gap: 10px; margin-top: auto; padding: 14px 10px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.sidebar-status div { display: grid; gap: 2px; }
.sidebar-status strong { font-size: 12px; }
.sidebar-status small { color: var(--muted); font-size: 10px; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 5px rgba(8,184,90,.1); }
.logout-button { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 12px; color: #667085; background: transparent; text-align: left; }
.logout-button:hover { color: var(--danger); background: #fff2f1; }

.main-content { min-width: 0; }
.topbar { position: sticky; z-index: 10; top: 0; min-height: 94px; display: flex; align-items: center; justify-content: space-between; padding: 17px 34px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.9); backdrop-filter: blur(18px); }
.topbar h1 { margin: 0; font-size: 24px; letter-spacing: -.6px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.updated-at { margin-right: 12px; color: var(--muted); font-size: 11px; }
.avatar { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; color: #fff; background: linear-gradient(145deg, #072f25, #08a957); font-weight: 800; }
.user-copy { display: grid; }
.user-copy strong { font-size: 12px; }
.user-copy small { color: var(--muted); font-size: 10px; }
.content-section { padding: 26px 34px 0; }
.content-section:last-child { padding-bottom: 36px; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; }
.stat-card { min-height: 122px; display: flex; align-items: center; gap: 15px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: 0 6px 20px rgba(30,50,70,.035); }
.stat-icon { width: 44px; height: 44px; flex: 0 0 44px; display: grid; place-items: center; border-radius: 13px; font-size: 20px; }
.stat-icon.green { color: #087b42; background: #e6f9ee; }
.stat-icon.mint { color: #067563; background: #e4f8f4; }
.stat-icon.blue { color: #2167a5; background: #ebf4fd; }
.stat-icon.amber { color: #a35c09; background: #fff4e5; }
.stat-card div:last-child { min-width: 0; display: grid; gap: 3px; }
.stat-card span { color: var(--muted); font-size: 11px; }
.stat-card strong { font-size: 27px; letter-spacing: -.7px; overflow: hidden; text-overflow: ellipsis; }
.stat-card small { color: #98a2b3; font-size: 10px; }

.analysis-grid { display: grid; grid-template-columns: 1.18fr .82fr; gap: 16px; margin-top: 16px; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); }
.run-panel, .log-panel { padding: 23px; }
.panel-heading, .panel-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.panel h2 { margin: 0; font-size: 19px; letter-spacing: -.35px; }
.panel-heading p:not(.eyebrow), .results-title p { margin: 7px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.job-progress { margin-top: 26px; padding: 17px; border: 1px solid #e9edf1; border-radius: 14px; background: #fafcfd; }
.job-status-line, .job-status-line > div, .job-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.job-status-line strong { font-size: 13px; }
.job-status-line > span { color: var(--muted); font-size: 11px; }
.job-dot { width: 8px; height: 8px; border-radius: 50%; background: #98a2b3; }
.job-dot.running { background: #f79009; box-shadow: 0 0 0 5px rgba(247,144,9,.1); animation: pulse 1.3s infinite; }
.job-dot.completed { background: var(--green); box-shadow: 0 0 0 5px rgba(8,184,90,.1); }
.job-dot.failed { background: var(--danger); box-shadow: 0 0 0 5px rgba(217,45,32,.1); }
@keyframes pulse { 50% { opacity: .38; } }
.progress-track { height: 7px; margin: 14px 0 10px; overflow: hidden; border-radius: 999px; background: #e8edf1; }
.progress-track i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #09b75b, #28d574); transition: width .35s ease; }
.job-meta { color: #98a2b3; font-size: 10px; }
.log-panel { min-width: 0; }
.job-log { height: 188px; margin: 17px 0 0; overflow: auto; padding: 15px; border-radius: 13px; color: #c9f7da; background: #0d1f1a; font: 10px/1.6 "Cascadia Code", Consolas, monospace; white-space: pre-wrap; }

.results-panel { overflow: hidden; }
.results-title { padding: 22px 23px 17px; border-bottom: 1px solid var(--line); }
.filters { display: grid; grid-template-columns: minmax(180px, 1.4fr) repeat(4, minmax(130px, .7fr)) auto; gap: 10px; align-items: end; padding: 15px 23px; border-bottom: 1px solid var(--line); background: #fbfcfd; }
.filters input, .filters select { min-height: 40px; font-size: 12px; }
.search-field { position: relative; }
.search-field > span { position: absolute; z-index: 1; left: 12px; bottom: 10px; margin: 0 !important; color: #98a2b3 !important; font-size: 18px !important; }
.search-field input { padding-left: 38px; }
.table-shell { position: relative; min-height: 250px; overflow: auto; }
table { width: 100%; min-width: 1580px; border-collapse: separate; border-spacing: 0; }
th { position: sticky; z-index: 2; top: 0; padding: 11px 13px; border-bottom: 1px solid var(--line); color: #667085; background: #f8fafb; font-size: 10px; text-align: left; text-transform: uppercase; letter-spacing: .45px; white-space: nowrap; }
td { padding: 12px 13px; border-bottom: 1px solid #edf0f3; color: #344054; font-size: 11px; white-space: nowrap; }
tbody tr:hover td { background: #fbfefc; }
.date-cell, .match-cell { display: grid; gap: 3px; }
.date-cell small, .match-cell small { color: #98a2b3; }
.match-cell strong { color: var(--ink); font-size: 12px; }
.pick-badge { display: inline-flex; align-items: center; min-height: 28px; padding: 0 9px; border-radius: 8px; color: var(--green-dark); background: var(--green-soft); font-weight: 800; }
.confidence { color: var(--green); font-size: 15px; font-weight: 850; }
.probability { color: #536173; font-variant-numeric: tabular-nums; }
.empty-state { min-height: 260px; display: grid; place-items: center; align-content: center; gap: 7px; color: var(--muted); }
.empty-state div { font-size: 38px; color: #bac4ce; }
.empty-state strong { color: #344054; }
.empty-state span { font-size: 12px; }
.table-footer { display: flex; align-items: center; justify-content: space-between; padding: 13px 23px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.table-footer div { display: flex; gap: 7px; }

.toast { position: fixed; z-index: 100; right: 24px; top: 22px; max-width: 380px; padding: 13px 16px; border-radius: 12px; color: #fff; background: #172b24; box-shadow: 0 15px 45px rgba(0,0,0,.2); font-size: 12px; opacity: 0; transform: translateY(-12px); pointer-events: none; transition: .25s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: #a9251c; }
.confirm-dialog { width: min(430px, calc(100% - 32px)); border: 0; border-radius: 22px; padding: 0; box-shadow: 0 30px 90px rgba(0,0,0,.22); }
.confirm-dialog::backdrop { background: rgba(12,24,35,.52); backdrop-filter: blur(3px); }
.confirm-dialog form { padding: 28px; text-align: center; }
.dialog-icon { width: 50px; height: 50px; display: grid; place-items: center; margin: 0 auto 15px; border-radius: 15px; color: var(--green-dark); background: var(--green-soft); }
.confirm-dialog h2 { margin: 0; }
.confirm-dialog p { margin: 10px 0 22px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.confirm-dialog form > div:last-child { display: flex; justify-content: center; gap: 9px; }

@media (max-width: 1180px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .analysis-grid { grid-template-columns: 1fr; }
  .filters { grid-template-columns: repeat(3, minmax(130px, 1fr)); }
  .search-field { grid-column: span 2; }
}

@media (max-width: 760px) {
  .mobile-only { display: inline-grid; }
  .app-shell { display: block; }
  .sidebar { position: fixed; z-index: 30; left: 0; transform: translateX(-102%); width: 245px; transition: transform .25s ease; box-shadow: 20px 0 60px rgba(0,0,0,.18); }
  .app-shell.menu-open .sidebar { transform: translateX(0); }
  .topbar { min-height: 78px; padding: 14px 17px; justify-content: flex-start; gap: 12px; }
  .topbar h1 { font-size: 20px; }
  .topbar-actions { margin-left: auto; }
  .updated-at, .user-copy { display: none; }
  .content-section { padding: 17px 14px 0; }
  .content-section:last-child { padding-bottom: 22px; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { min-height: 112px; align-items: flex-start; flex-direction: column; gap: 10px; padding: 15px; }
  .stat-icon { width: 36px; height: 36px; flex-basis: 36px; border-radius: 10px; font-size: 17px; }
  .stat-card strong { font-size: 21px; }
  .panel-heading { flex-direction: column; }
  .panel-heading .primary-button { width: 100%; }
  .filters { grid-template-columns: 1fr 1fr; padding: 13px; }
  .search-field { grid-column: span 2; }
  .results-title { padding: 18px 15px; }
  .results-title .secondary-button { white-space: nowrap; }
  .login-card { padding: 30px 24px; }
}
