:root {
  color-scheme: light;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: #17211b;
  background: #f2f5f1;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: #f2f5f1; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }

.auth-view { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(380px, .8fr); background: #edf2ed; }
.auth-brand {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: clamp(32px, 5vw, 72px);
  color: #eef5f0;
  background-color: #14241b;
  background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 42px 42px;
}
.brand-lockup, .brand { display: flex; align-items: center; gap: 12px; }
.brand-lockup strong, .brand-lockup span, .brand strong, .brand span { display: block; }
.brand-lockup strong { font-size: 18px; }
.brand-lockup span, .brand span { margin-top: 3px; color: #9eafa4; font-size: 12px; }
.brand-mark { width: 48px; height: 48px; display: grid; place-items: center; color: #fff; background: #238a59; border-radius: 6px; font-weight: 800; font-size: 23px; }
.brand-mark.small { width: 36px; height: 36px; font-size: 17px; }
.auth-copy { max-width: 730px; margin: auto 0; padding: 80px 0; }
.eyebrow { margin: 0 0 8px; color: #6d7971; font-size: 11px; text-transform: uppercase; font-weight: 800; letter-spacing: 0; }
.auth-copy .eyebrow { color: #83ae96; }
.auth-copy h1 { max-width: 690px; margin: 0 0 22px; font-size: clamp(38px, 5vw, 68px); line-height: 1.04; font-weight: 760; }
.auth-copy > p:last-child { max-width: 610px; color: #b8c7bd; font-size: 17px; line-height: 1.65; }
.process-line { display: flex; align-items: center; gap: 14px; color: #a9b9ae; font-size: 12px; font-weight: 700; }
.process-line i { width: clamp(24px, 5vw, 72px); height: 1px; background: #496055; }
.auth-panel { display: flex; flex-direction: column; justify-content: center; padding: clamp(28px, 6vw, 86px); background: #fff; border-left: 1px solid #dce3dd; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 42px; border-bottom: 1px solid #dce3dd; }
.auth-tab { padding: 13px 4px; border: 0; border-bottom: 2px solid transparent; color: #7a867e; background: transparent; font-weight: 700; }
.auth-tab.active { color: #176e45; border-bottom-color: #176e45; }
.auth-form { width: 100%; max-width: 440px; margin: 0 auto; }
.auth-form h2 { margin: 0 0 28px; font-size: 30px; }

h1, h2, h3, p { margin-top: 0; }
.muted { color: #69756d; line-height: 1.5; }
label { display: grid; gap: 7px; margin-top: 18px; color: #4d5952; font-size: 13px; font-weight: 650; }
input, textarea, select { width: 100%; border: 1px solid #c9d2cb; border-radius: 5px; background: #fff; color: #17211b; padding: 11px 12px; outline: none; }
input:focus, textarea:focus, select:focus { border-color: #176e45; box-shadow: 0 0 0 3px rgba(23,110,69,.1); }
textarea { resize: vertical; line-height: 1.5; }

.primary-button, .secondary-button, .danger-button, .small-button, .text-button, .nav-item, .icon-button, .tool-button, .light-button {
  border: 0;
  border-radius: 5px;
  font-weight: 700;
}
.primary-button { padding: 11px 16px; color: #fff; background: #176e45; }
.primary-button:hover { background: #115b38; }
.primary-button:disabled { cursor: wait; opacity: .65; }
.auth-form .primary-button { width: 100%; margin-top: 24px; }
.secondary-button { padding: 10px 14px; color: #243028; background: #fff; border: 1px solid #c9d2cb; }
.light-button { padding: 10px 14px; color: #173c29; background: #f3faf6; border: 1px solid #9fc2ad; }
.light-button:hover { background: #e5f3ea; }
.danger-button { padding: 10px 14px; color: #fff; background: #a83e34; }
.small-button { padding: 7px 10px; color: #22543b; background: #edf5f0; border: 1px solid #c9dfd1; font-size: 12px; }
.disable-user { color: #81362f; background: #fbefed; border-color: #ecd0cc; }
.text-button { padding: 8px 0; color: #66716a; background: transparent; text-align: left; }
.icon-button, .tool-button { width: 36px; height: 36px; background: transparent; color: #526058; font-size: 24px; line-height: 1; }
.tool-button { border: 1px solid #ccd5ce; background: #fff; font-size: 20px; }
.form-error { color: #a33329; margin: 12px 0 0; font-size: 13px; }
.form-message { padding: 12px; margin: 16px 0 0; color: #145d3b; background: #edf6f0; border: 1px solid #c9e0d1; border-radius: 5px; font-size: 13px; line-height: 1.45; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 238px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 24px 18px; color: #eaf1ec; background: #15241b; }
.brand { padding: 0 8px 25px; border-bottom: 1px solid #314138; }
nav { display: grid; gap: 5px; padding-top: 22px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 11px 12px; color: #aebcb3; background: transparent; text-align: left; }
.nav-item.active, .nav-item:hover { color: #fff; background: #283a2f; }
.nav-icon { width: 18px; text-align: center; font-size: 17px; }
.sidebar-footer { margin-top: auto; display: grid; gap: 10px; padding: 18px 8px 0; border-top: 1px solid #314138; }
.system-state { display: flex; align-items: center; gap: 8px; color: #b7c4bc; font-size: 12px; }
.system-state i { width: 8px; height: 8px; border-radius: 50%; background: #4bd184; }
.account-block { padding: 10px 0; }
.account-block strong, .account-block span { display: block; }
.account-block strong { font-size: 13px; }
.account-block span { margin-top: 3px; color: #90a198; font-size: 11px; }
.sidebar .text-button { color: #aebcb3; }

main { min-width: 0; }
.topbar { min-height: 104px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 23px 34px; background: #fff; border-bottom: 1px solid #dfe4df; }
.topbar .eyebrow { margin: 0 0 4px; }
.topbar h1 { margin: 0; font-size: 24px; }
.content { padding: 28px 34px 48px; }
.summary-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); background: #fff; border: 1px solid #dce2dc; border-radius: 7px; }
.analytics-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 24px; background: #fff; border: 1px solid #dce2dc; border-radius: 7px; }
.analytics-summary > div { min-width: 0; padding: 20px 22px; border-right: 1px solid #e4e8e4; }
.analytics-summary > div:last-child { border-right: 0; }
.analytics-summary span, .analytics-summary strong { display: block; }
.analytics-summary span { color: #68736c; font-size: 13px; }
.analytics-summary strong { margin-top: 7px; font-size: 25px; white-space: nowrap; }
.analytics-heading { margin-top: 0; }
.summary-row > div { min-width: 0; padding: 20px 22px; border-right: 1px solid #e4e8e4; }
.summary-row > div:last-child { border-right: 0; }
.summary-row span, .summary-row strong { display: block; }
.summary-row span { color: #68736c; font-size: 13px; }
.summary-row strong { margin-top: 7px; font-size: 25px; white-space: nowrap; }
.toolbar { display: grid; grid-template-columns: minmax(220px, 1fr) 190px auto; gap: 10px; margin: 22px 0 12px; }
.table-wrap { overflow: hidden; background: #fff; border: 1px solid #dce2dc; border-radius: 7px; }
table { width: 100%; border-collapse: collapse; table-layout: fixed; }
th, td { padding: 15px 17px; border-bottom: 1px solid #e6eae6; text-align: left; vertical-align: middle; }
th { color: #69736d; background: #f8faf8; font-size: 11px; text-transform: uppercase; }
.jobs-table th:first-child { width: 29%; }
.jobs-table th:last-child { width: 54px; }
.analytics-table th:first-child { width: 30%; }
.analytics-table th:last-child { width: 54px; }
.analysis-score-cell { color: #176e45; font-weight: 800; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: #f6f9f7; }
tbody tr:last-child td { border-bottom: 0; }
.job-title { display: block; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-id { display: block; margin-top: 4px; color: #859087; font-size: 11px; }
.actions-cell { text-align: right; }
.row-delete { width: 30px; height: 30px; border: 0; border-radius: 4px; color: #8d5b56; background: transparent; font-size: 21px; }
.row-delete:hover { color: #a3342a; background: #f8eae8; }
.status { display: inline-flex; align-items: center; gap: 7px; color: #4c5a51; font-size: 12px; font-weight: 700; }
.status::before { content: ""; flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; background: #9aa39d; }
.status.running::before, .status.pending::before { background: #d49a16; box-shadow: 0 0 0 4px #fbf1d7; }
.status.completed::before, .status.active::before { background: #1b9a5d; }
.status.needs_review::before { background: #d27c1f; }
.status.failed::before, .status.disabled::before { background: #c1483d; }
.empty-state { padding: 72px 20px; text-align: center; color: #7b857e; }
.empty-state strong, .empty-state span { display: block; }
.empty-state strong { color: #354138; margin-bottom: 7px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.section-heading h2 { margin-bottom: 5px; font-size: 21px; }
.section-heading p { margin: 0; color: #69756d; }
.users-table th:first-child { width: 27%; }
.users-table strong { display: block; }
.admin-label { display: block; margin-top: 3px; color: #176e45; font-size: 10px; text-transform: uppercase; font-weight: 800; }

dialog { width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; border: 0; border-radius: 8px; box-shadow: 0 30px 90px rgba(14,34,20,.3); }
dialog::backdrop { background: rgba(15,26,19,.62); }
dialog form { padding: 28px; }
dialog header, .detail-panel header, .viewer-shell > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
dialog h2 { margin-bottom: 0; }
.file-row { display: flex; align-items: center; gap: 14px; margin-top: 12px; color: #748078; font-size: 12px; }
dialog footer { display: flex; justify-content: flex-end; gap: 9px; margin-top: 24px; padding-top: 20px; border-top: 1px solid #e1e6e2; }

.detail-panel { position: fixed; z-index: 20; top: 0; right: 0; width: min(590px, 100vw); height: 100vh; overflow-y: auto; padding: 28px; background: #fff; border-left: 1px solid #d9dfda; box-shadow: -20px 0 60px rgba(23,42,29,.16); }
.detail-panel h2 { font-size: 21px; }
.detail-meta { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 20px; }
.detail-meta > div:last-child { text-align: right; }
.detail-meta span, .detail-meta strong { display: block; }
.detail-meta span { color: #77827a; font-size: 11px; }
.detail-meta strong { margin-top: 3px; font-size: 14px; }
.progress-block { margin: 20px 0 18px; padding: 20px; background: #f4f7f4; border: 1px solid #dde4de; border-radius: 6px; }
.progress-heading { display: flex; justify-content: space-between; gap: 15px; font-size: 13px; }
.progress-track { height: 8px; margin: 14px 0; overflow: hidden; border-radius: 4px; background: #dce3dd; }
.progress-track i { display: block; height: 100%; width: 0; background: #1b8454; transition: width .3s ease; }
.progress-block p { margin: 0; color: #667269; font-size: 13px; }
.queue-notice { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 18px; padding: 17px 18px; margin-bottom: 20px; color: #55420e; background: #fff8df; border: 1px solid #eadba2; border-radius: 6px; }
.queue-notice strong, .queue-notice span { display: block; }
.queue-notice > div:last-child > span { margin-top: 4px; color: #796a3e; font-size: 12px; line-height: 1.5; }
.queue-position { min-width: 72px; padding-right: 18px; border-right: 1px solid #e1ce87; text-align: center; }
.queue-position span { font-size: 10px; text-transform: uppercase; font-weight: 800; }
.queue-position strong { margin-top: 3px; font-size: 24px; }
.viewer-action { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 17px 18px; margin-bottom: 20px; color: #eff7f2; background: #193c29; border-radius: 6px; }
.viewer-action strong, .viewer-action span { display: block; }
.viewer-action span { margin-top: 4px; color: #b9cbbf; font-size: 12px; }
.viewer-action-buttons { display: flex; flex: 0 0 auto; gap: 8px; }
.viewer-action .light-button { white-space: nowrap; }
.analysis-report { padding-top: 0 !important; border-top: 0 !important; }
.analysis-report-header { display: grid; grid-template-columns: 118px minmax(0, 1fr); gap: 20px; align-items: center; padding: 20px; color: #eef6f1; background: #183c29; border-radius: 6px; }
.analysis-report-header > div { padding-right: 20px; border-right: 1px solid #456151; text-align: center; }
.analysis-report-header span, .analysis-report-header strong { display: block; }
.analysis-report-header span { color: #b7cbbf; font-size: 10px; text-transform: uppercase; font-weight: 800; }
.analysis-report-header strong { margin-top: 4px; font-size: 27px; }
.analysis-report-header p { margin: 0; color: #d5e2da; line-height: 1.55; }
.analysis-outdated { margin-top: 12px; padding: 12px 14px; color: #785615; background: #fff7dc; border: 1px solid #ebd997; border-radius: 5px; font-size: 12px; line-height: 1.5; }
.analysis-block { margin-top: 22px; }
.analysis-block > p { color: #536158; line-height: 1.6; }
.analysis-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 20px; }
.analysis-columns > div { padding: 17px; background: #f5f8f5; border: 1px solid #dfe6e0; border-radius: 6px; }
.analysis-columns h3 { margin-bottom: 10px; }
.analysis-columns ul, .analysis-block ul { margin: 0; padding-left: 19px; color: #536158; font-size: 13px; line-height: 1.6; }
.analysis-findings { display: grid; gap: 12px; }
.finding { padding: 17px; border: 1px solid #dce3dd; border-left: 4px solid #9aa39d; border-radius: 5px; background: #fff; }
.finding.critical { border-left-color: #9f2921; }
.finding.high { border-left-color: #c34f31; }
.finding.medium { border-left-color: #d19725; }
.finding.low { border-left-color: #3d8b64; }
.finding > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.finding > header > div { display: flex; gap: 11px; min-width: 0; }
.finding-number { color: #849087; font: 700 11px/1.5 "Cascadia Mono", Consolas, monospace; }
.finding header strong, .finding header div span { display: block; }
.finding header div span { margin-top: 3px; color: #768179; font-size: 11px; }
.severity { flex: 0 0 auto; padding: 5px 7px; color: #5c4235; background: #f6eee7; border-radius: 4px; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.finding > p { margin: 14px 0; color: #536158; font-size: 13px; line-height: 1.55; }
.finding-recommendation { padding: 12px; color: #183b29; background: #edf6f0; border-radius: 4px; }
.finding-recommendation span, .finding-effect span { display: block; margin-bottom: 4px; color: #678071; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.finding-recommendation strong { font-size: 13px; line-height: 1.5; }
.finding-effect { margin-top: 11px; color: #536158; font-size: 12px; line-height: 1.5; }
.finding footer { display: flex; flex-wrap: wrap; gap: 7px 15px; margin-top: 13px; padding-top: 11px; border-top: 1px solid #e7ebe7; color: #7c867f; font-size: 10px; }
.detail-panel section { padding: 22px 0; border-top: 1px solid #e2e6e3; }
.detail-panel h3 { font-size: 14px; }
.event-list { margin: 0; padding: 0; list-style: none; }
.event-list li { position: relative; padding: 0 0 18px 25px; color: #67726b; font-size: 13px; }
.event-list li::before { content: ""; position: absolute; left: 3px; top: 4px; width: 8px; height: 8px; border-radius: 50%; background: #2a8a5b; }
.event-list li::after { content: ""; position: absolute; left: 6px; top: 15px; bottom: 3px; width: 1px; background: #d7ddd8; }
.event-list li:last-child::after { display: none; }
.event-list strong, .event-list time { display: block; }
.event-list time { margin-top: 3px; color: #959d97; font-size: 11px; }
.artifact-list { display: flex; flex-wrap: wrap; gap: 8px; }
.artifact-list a { padding: 9px 11px; color: #145b3b; background: #edf6f0; border-radius: 4px; font-size: 12px; font-weight: 700; text-decoration: none; }
details summary { cursor: pointer; font-weight: 700; font-size: 13px; }
pre { max-height: 280px; overflow: auto; white-space: pre-wrap; color: #4f5b53; font: 12px/1.55 "Cascadia Mono", Consolas, monospace; }

.viewer-dialog { width: calc(100vw - 36px); height: calc(100vh - 36px); max-width: none; max-height: none; }
.viewer-shell { display: grid; grid-template-rows: auto minmax(0, 1fr); height: 100%; background: #f6f8f5; }
.viewer-shell > header { align-items: center; padding: 16px 20px; background: #fff; border-bottom: 1px solid #dbe2dc; }
.viewer-shell h2 { font-size: 18px; }
.viewer-tools { display: flex; align-items: center; gap: 8px; }
.save-state { max-width: 160px; color: #68736c; font-size: 11px; line-height: 1.2; text-align: right; }
.save-state.dirty { color: #9a6410; }
#zoom-value { min-width: 52px; color: #68736c; text-align: center; font-size: 12px; font-weight: 700; }
#bpmn-canvas { min-width: 0; min-height: 0; background-color: #f9faf9; background-image: linear-gradient(#e8ece8 1px, transparent 1px), linear-gradient(90deg, #e8ece8 1px, transparent 1px); background-size: 24px 24px; }
#bpmn-canvas .djs-container { background: transparent; }
#bpmn-canvas .djs-palette { border: 1px solid #d7ded8; border-radius: 5px; box-shadow: 0 8px 22px rgba(23,42,29,.1); }
.viewer-error { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); max-width: 520px; padding: 18px; color: #96362e; background: #fff; border: 1px solid #eccbc7; border-radius: 6px; }
.confirm-dialog { width: min(440px, calc(100vw - 32px)); }
.confirm-dialog h2 { font-size: 20px; }
.confirm-dialog p { color: #667269; line-height: 1.55; }
.toast { position: fixed; z-index: 40; right: 24px; bottom: 24px; padding: 13px 16px; color: #fff; background: #183a27; border-radius: 5px; box-shadow: 0 12px 35px rgba(20,40,27,.25); }

@media (max-width: 1050px) {
  .summary-row { grid-template-columns: repeat(3, 1fr); }
  .summary-row > div:nth-child(3) { border-right: 0; }
  .summary-row > div:nth-child(-n+3) { border-bottom: 1px solid #e4e8e4; }
  .jobs-table { min-width: 900px; }
  .table-wrap { overflow-x: auto; }
}

@media (max-width: 800px) {
  .auth-view { grid-template-columns: 1fr; }
  .auth-brand { min-height: 320px; padding: 28px; }
  .auth-copy { padding: 50px 0 35px; }
  .auth-copy h1 { font-size: 38px; }
  .auth-panel { padding: 36px 24px 54px; border-left: 0; }
  .app-shell { grid-template-columns: 74px minmax(0, 1fr); }
  .sidebar { padding: 20px 10px; }
  .brand > div:last-child, .nav-item > span:last-child, .sidebar-footer span, .account-block, .sidebar .text-button { display: none; }
  .brand { justify-content: center; padding-left: 0; padding-right: 0; }
  .nav-item { justify-content: center; height: 44px; }
  .summary-row { grid-template-columns: repeat(2, 1fr); }
  .analytics-summary { grid-template-columns: repeat(2, 1fr); }
  .analytics-summary > div:nth-child(2n) { border-right: 0; }
  .analytics-summary > div:nth-child(-n+2) { border-bottom: 1px solid #e4e8e4; }
  .summary-row > div { border-bottom: 1px solid #e4e8e4; }
  .summary-row > div:nth-child(2n) { border-right: 0; }
  .summary-row > div:last-child { border-bottom: 0; }
}

@media (max-width: 650px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; z-index: 10; top: auto; bottom: 0; width: 100%; height: 64px; flex-direction: row; padding: 8px 14px; }
  .brand, .sidebar-footer { display: none; }
  nav { width: 100%; display: flex; justify-content: center; padding: 0; }
  .nav-item { flex: 1; max-width: 220px; }
  .nav-item > span:last-child { display: inline; }
  .topbar { min-height: 88px; padding: 18px; }
  .topbar h1 { font-size: 20px; }
  .content { padding: 18px 14px 90px; }
  .summary-row > div { padding: 15px; }
  .summary-row strong { font-size: 21px; }
  .toolbar { grid-template-columns: 1fr; }
  dialog form, .detail-panel { padding: 20px; }
  .viewer-dialog { width: 100vw; height: 100vh; border-radius: 0; }
  .viewer-shell > header { align-items: flex-start; }
  .viewer-tools { flex-wrap: wrap; justify-content: flex-end; }
  .viewer-action { align-items: flex-start; flex-direction: column; }
  .viewer-action-buttons { width: 100%; flex-wrap: wrap; }
  .analysis-report-header { grid-template-columns: 1fr; }
  .analysis-report-header > div { padding: 0 0 14px; border-right: 0; border-bottom: 1px solid #456151; }
  .analysis-columns { grid-template-columns: 1fr; }
}
