:root {
  --navy: #10243e;
  --navy-deep: #071d35;
  --blue: #2f6fed;
  --blue-dark: #1f57c8;
  --canvas: #f4f7fb;
  --surface: #ffffff;
  --text: #12233b;
  --muted: #637086;
  --border: #d8e0ea;
  --border-soft: #e9eef4;
  --green: #1ba566;
  --amber: #e99a14;
  --red: #dc4c54;
  --shadow: 0 1px 3px rgba(13, 36, 66, .08);
  --radius: 8px;
  --sidebar: 244px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--canvas);
  font-synthesis: none;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--canvas); font-size: 14px; line-height: 1.5; }
a { color: var(--blue); text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.app-shell { display: flex; min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); z-index: 20; display: flex; flex-direction: column; padding: 22px 14px 18px; color: #dce8f7; background: var(--navy-deep); }
.brand, .login-brand { display: flex; align-items: center; gap: 12px; color: white; }
.brand { padding: 2px 12px 30px; }
.brand-mark { display: grid; place-items: center; width: 39px; height: 39px; flex: 0 0 auto; border: 2px solid #3c82ff; border-radius: 50%; color: #75a7ff; font-size: 13px; font-weight: 800; letter-spacing: -.4px; transform: skew(-7deg); }
.brand strong, .login-brand strong { display: block; font-size: 20px; line-height: 1.1; letter-spacing: -.4px; }
.brand small, .login-brand small { display: block; margin-top: 2px; color: #4f8cff; font-size: 14px; font-weight: 700; }
.nav-list { display: flex; flex-direction: column; gap: 5px; }
.nav-item { display: flex; align-items: center; gap: 13px; min-height: 48px; padding: 0 14px; border-radius: 6px; color: #dbe5f2; font-size: 14px; font-weight: 600; transition: background .16s, color .16s; }
.nav-item svg { width: 21px; height: 21px; }
.nav-item:hover { background: rgba(255,255,255,.07); color: white; }
.nav-item.active { color: white; background: var(--blue); box-shadow: 0 5px 18px rgba(30, 95, 220, .26); }
.sidebar-status { display: flex; align-items: flex-start; gap: 9px; margin-top: auto; padding: 17px 10px 0; border-top: 1px solid rgba(255,255,255,.12); }
.sidebar-status strong, .sidebar-status small { display: block; font-size: 12px; line-height: 1.35; }
.sidebar-status small { color: #adc0d6; font-weight: 400; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #9aa7b8; }
.status-dot.ok { background: var(--green); }
.status-dot.warn { background: var(--amber); }
.status-dot.bad { background: var(--red); }
.sidebar-status > .status-dot { margin-top: 4px; }

.app-main { width: calc(100% - var(--sidebar)); min-height: 100vh; margin-left: var(--sidebar); display: flex; flex-direction: column; }
.topbar { height: 74px; flex: 0 0 auto; display: flex; align-items: center; padding: 0 32px; border-bottom: 1px solid var(--border); background: var(--surface); box-shadow: 0 1px 2px rgba(13,36,66,.03); }
.topbar-title { font-size: 16px; font-weight: 650; }
.topbar-user { display: flex; align-items: center; gap: 10px; margin-left: auto; color: #24344c; font-size: 13px; }
.topbar-user form { margin: 0; }
.avatar { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; color: white; background: var(--blue); font-size: 11px; font-weight: 800; }
.link-button { padding: 4px; border: 0; color: var(--muted); background: none; cursor: pointer; font-size: 12px; }
.link-button:hover { color: var(--red); }
.icon-button { display: grid; place-items: center; width: 38px; height: 38px; border: 0; color: var(--text); background: transparent; cursor: pointer; }
.mobile-menu { display: none; margin-right: 8px; }
.content { width: 100%; max-width: 1500px; flex: 1; padding: 32px; margin: 0 auto; }
.footer { display: flex; justify-content: space-between; padding: 17px 32px; border-top: 1px solid var(--border); color: #7b879a; background: var(--surface); font-size: 11px; }

.page-heading { margin: 0 0 25px; }
.page-heading h1 { margin: 2px 0 5px; font-size: 28px; line-height: 1.2; letter-spacing: -.65px; }
.page-heading p { margin: 0; color: var(--muted); font-size: 14px; }
.heading-actions { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.back-link { display: inline-block; margin-bottom: 6px; color: var(--muted); font-size: 12px; font-weight: 650; }
.back-link:hover { color: var(--blue); }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 17px; border: 1px solid transparent; border-radius: 5px; cursor: pointer; font-size: 13px; font-weight: 650; transition: background .16s, border-color .16s, color .16s, transform .1s; }
.button:active { transform: translateY(1px); }
.button.primary { color: white; background: var(--blue); }
.button.primary:hover { background: var(--blue-dark); }
.button.secondary { border-color: var(--border); color: var(--text); background: white; }
.button.secondary:hover, .button.ghost:hover { border-color: #b7c6d9; background: #f8fafc; }
.button.ghost { border-color: transparent; color: var(--muted); background: transparent; }
.button.danger-outline { border-color: #efb7bb; color: #be323b; background: white; }
.button.small { min-height: 31px; padding: 0 10px; font-size: 11px; }
.button.full { width: 100%; }
.button svg { width: 17px; height: 17px; }
.button:disabled { cursor: not-allowed; opacity: .5; }
.action-row, .row-actions { display: flex; align-items: center; gap: 8px; }
.row-actions { justify-content: flex-end; }
.row-actions form, .action-row form { margin: 0; }

.panel, .status-band, .detail-summary { min-width: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.panel-header { min-height: 56px; display: flex; align-items: center; justify-content: space-between; padding: 0 18px; border-bottom: 1px solid var(--border); }
.panel-header h2 { margin: 0; font-size: 15px; letter-spacing: -.15px; }
.panel-header a { font-size: 12px; font-weight: 650; }
.status-band { display: grid; grid-template-columns: repeat(4, 1fr); margin-bottom: 24px; padding: 23px 10px; }
.service-status { display: flex; align-items: flex-start; gap: 14px; min-width: 0; padding: 0 20px; border-right: 1px solid var(--border); }
.service-status:last-child { border-right: 0; }
.service-icon { display: grid; place-items: center; width: 38px; height: 38px; flex: 0 0 auto; color: var(--blue); }
.service-icon svg { width: 28px; height: 28px; }
.service-status strong, .service-status span, .service-status small { display: block; }
.service-status strong { margin: 1px 0 7px; font-size: 14px; }
.service-status span { color: #40516a; font-size: 12px; }
.service-status span .status-dot { margin-right: 7px; }
.service-status small { margin-top: 11px; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(310px, .85fr); align-items: start; gap: 24px; }
.dashboard-side { min-width: 0; display: grid; gap: 24px; }
.schedule-summary { display: flex; align-items: flex-start; gap: 15px; padding: 21px; }
.schedule-summary > svg { width: 25px; height: 25px; margin-top: 2px; color: var(--text); }
.schedule-summary small, .schedule-summary strong, .schedule-summary span { display: block; }
.schedule-summary small { color: var(--muted); font-size: 10px; }
.schedule-summary strong { margin: 4px 0; font-size: 15px; }
.schedule-summary span { color: var(--muted); font-size: 11px; }
.resource-list { padding: 3px 18px; }
.resource { display: flex; align-items: center; gap: 13px; padding: 15px 0; border-bottom: 1px solid var(--border-soft); }
.resource:last-child { border-bottom: 0; }
.resource > svg { width: 31px; height: 31px; padding: 6px; border: 1px solid #b9d0ff; color: var(--blue); background: #eef4ff; }
.resource > div { min-width: 0; flex: 1; }
.resource span { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.resource small { color: var(--muted); font-size: 10px; }
.resource strong { font-size: 11px; font-weight: 650; }
.meter { height: 5px; margin-top: 9px; overflow: hidden; border-radius: 10px; background: #e5eaf0; }
.meter i { display: block; height: 100%; background: var(--blue); }
.meter.green i { background: var(--green); }

.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 16px; border-bottom: 1px solid var(--border-soft); text-align: left; vertical-align: middle; white-space: nowrap; }
th { color: #4d5b70; background: #fbfcfe; font-size: 11px; font-weight: 700; }
td { color: #34435a; font-size: 12px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fbfdff; }
.mono-link { color: #233b60; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-weight: 700; }
.strong-link { color: var(--text); font-weight: 700; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.small { font-size: 10px; }
.truncate { max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
.cell-error { max-width: 300px; overflow: hidden; color: #a03a40; text-overflow: ellipsis; }
.text-warn { color: var(--amber); font-weight: 700; }
.run-status { display: inline-flex; align-items: center; gap: 7px; color: #40516a; font-size: 11px; text-transform: capitalize; }
.run-status i { width: 7px; height: 7px; border-radius: 50%; background: #8997aa; }
.run-status.completed i { background: var(--green); }
.run-status.partial i, .run-status.pending i { background: var(--amber); }
.run-status.running i { background: var(--blue); box-shadow: 0 0 0 4px #dfe9ff; }
.run-status.failed i, .run-status.cancelled i { background: var(--red); }
.empty-state { padding: 38px 20px; color: var(--muted); text-align: center; }
.empty-state.compact { padding: 25px 15px; }
.filter-bar { display: flex; flex-wrap: wrap; gap: 5px; margin: -9px 0 18px; }
.filter { padding: 7px 11px; border-radius: 4px; color: var(--muted); font-size: 11px; font-weight: 650; text-transform: capitalize; }
.filter:hover, .filter.active { color: var(--blue); background: #e8f0ff; }

.detail-summary { display: grid; grid-template-columns: repeat(6, 1fr); margin-bottom: 20px; }
.detail-summary > div { min-width: 0; padding: 17px; border-right: 1px solid var(--border); }
.detail-summary > div:last-child { border-right: 0; }
.detail-summary small, .detail-summary strong { display: block; }
.detail-summary small { margin-bottom: 6px; color: var(--muted); font-size: 10px; }
.detail-summary strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.two-column { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, .7fr); align-items: start; gap: 20px; }
.artifact-list { display: flex; flex-direction: column; padding: 6px 16px; }
.artifact-list a { display: flex; align-items: center; gap: 11px; padding: 12px 3px; border-bottom: 1px solid var(--border-soft); color: var(--text); }
.artifact-list a:last-child { border-bottom: 0; }
.artifact-list svg { width: 18px; height: 18px; color: var(--blue); }
.artifact-list strong, .artifact-list small { display: block; }
.artifact-list strong { font-size: 11px; }
.artifact-list small { color: var(--muted); font-size: 9px; text-transform: uppercase; }
.log-panel { margin-top: 20px; }
.live-label { color: var(--muted); font-size: 10px; }
.log-panel pre { max-height: 430px; min-height: 140px; margin: 0; padding: 18px; overflow: auto; color: #c8d7e8; background: #0a1b2e; font: 11px/1.7 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; }

.form-panel { overflow: hidden; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; padding: 21px; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.compact-grid { padding: 0; }
.form-stack { display: flex; flex-direction: column; gap: 16px; padding: 21px; }
.form-sections { display: grid; gap: 20px; }
label, fieldset { min-width: 0; color: #34435a; font-size: 11px; font-weight: 650; }
input, select, textarea { width: 100%; min-height: 41px; margin-top: 7px; padding: 9px 11px; border: 1px solid #cbd5e1; border-radius: 5px; outline: none; color: var(--text); background: white; font-size: 12px; transition: border-color .15s, box-shadow .15s; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(47,111,237,.12); }
input[type="checkbox"] { width: 17px; min-height: 17px; margin: 0; accent-color: var(--blue); }
.checkbox-row { display: flex; align-items: center; gap: 9px; min-height: 41px; margin-top: 19px; }
.checkbox-row span { font-size: 12px; }
.span-2 { grid-column: span 2; }
fieldset { grid-column: span 2; margin: 0; padding: 0; border: 0; }
legend { margin-bottom: 8px; }
.form-actions, .sticky-actions { display: flex; justify-content: flex-end; gap: 10px; }
.form-actions { padding: 0 21px 21px; }
.sticky-actions { position: sticky; bottom: 0; z-index: 3; padding: 14px 18px; border: 1px solid var(--border); border-radius: var(--radius); background: rgba(255,255,255,.96); box-shadow: 0 -6px 20px rgba(13,36,66,.06); }
.confirmation-box { padding: 14px 16px; border-left: 3px solid var(--amber); background: #fff9ed; }
.confirmation-box strong { font-size: 12px; }
.confirmation-box p { margin: 4px 0 7px; color: #756348; font-size: 11px; font-weight: 400; }
.info-strip, .phase-banner { display: flex; gap: 14px; margin-top: 18px; padding: 15px 18px; border: 1px solid #bfd2f5; border-radius: 6px; color: #2c4c7d; background: #eef4ff; font-size: 12px; }
.phase-banner { margin: 0 0 18px; border-color: #f1d49d; color: #76591f; background: #fff8e9; }
.scheduler-toggle { display: flex; align-items: center; justify-content: space-between; padding: 21px; }
.scheduler-toggle h2 { margin: 0 0 4px; font-size: 15px; }
.scheduler-toggle p { margin: 0; color: var(--muted); font-size: 11px; }
.switch input { position: absolute; opacity: 0; }
.switch span { position: relative; display: block; width: 45px; height: 25px; border-radius: 20px; cursor: pointer; background: #c9d2df; transition: background .2s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 19px; height: 19px; border-radius: 50%; background: white; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .2s; }
.switch input:checked + span { background: var(--blue); }
.switch input:checked + span::after { transform: translateX(20px); }
.days-row { display: flex; flex-wrap: wrap; gap: 8px; }
.days-row label input { position: absolute; opacity: 0; }
.days-row label span { display: block; min-width: 45px; padding: 8px; border: 1px solid var(--border); border-radius: 4px; cursor: pointer; text-align: center; }
.days-row label input:checked + span { border-color: var(--blue); color: var(--blue); background: #edf3ff; }
.settings-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.path-panel { margin-top: 20px; }
.path-panel dl { display: grid; grid-template-columns: 150px 1fr; gap: 10px 15px; padding: 18px; margin: 0; }
.path-panel dt { color: var(--muted); font-size: 11px; }
.path-panel dd { min-width: 0; margin: 0; overflow: hidden; font: 11px ui-monospace, SFMono-Regular, Consolas, monospace; text-overflow: ellipsis; }

.flash { margin-bottom: 18px; padding: 12px 15px; border: 1px solid #a9d9c2; border-radius: 5px; color: #17633f; background: #ecf9f2; font-size: 12px; }
.flash.warning { border-color: #edd29a; color: #72551a; background: #fff8e8; }
.flash.error { border-color: #efb8bc; color: #91353b; background: #fff1f2; }

.login-body { min-height: 100vh; background: var(--navy-deep); }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 50% 30%, #17365b 0, var(--navy-deep) 58%); }
.login-card { width: min(100%, 390px); padding: 34px; border: 1px solid rgba(255,255,255,.12); border-radius: 10px; background: white; box-shadow: 0 24px 70px rgba(0,0,0,.3); }
.login-brand { color: var(--text); }
.login-card h1 { margin: 30px 0 6px; font-size: 24px; letter-spacing: -.5px; }
.login-card > p { margin: 0 0 5px; color: var(--muted); font-size: 12px; }
.login-card .form-stack { padding: 20px 0 0; }

@media (max-width: 1120px) {
  .status-band { grid-template-columns: repeat(2, 1fr); gap: 24px 0; }
  .service-status:nth-child(2) { border-right: 0; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .dashboard-side { grid-template-columns: repeat(2, 1fr); }
  .detail-summary { grid-template-columns: repeat(3, 1fr); }
  .detail-summary > div:nth-child(3) { border-right: 0; }
  .detail-summary > div:nth-child(-n+3) { border-bottom: 1px solid var(--border); }
}
@media (max-width: 820px) {
  :root { --sidebar: 228px; }
  .sidebar { transform: translateX(-100%); transition: transform .2s; box-shadow: 10px 0 30px rgba(7,29,53,.18); }
  .sidebar.open { transform: translateX(0); }
  .app-main { width: 100%; margin-left: 0; }
  .mobile-menu { display: grid; }
  .topbar { height: 64px; padding: 0 16px; }
  .topbar-user > span:not(.avatar) { display: none; }
  .content { padding: 24px 16px; }
  .footer { padding: 15px 16px; }
  .heading-actions { align-items: flex-start; flex-direction: column; }
  .status-band { grid-template-columns: 1fr; gap: 20px; }
  .service-status { border-right: 0; }
  .dashboard-side { grid-template-columns: 1fr; }
  .two-column, .settings-columns { grid-template-columns: 1fr; }
  .form-grid, .form-grid.three { grid-template-columns: 1fr; }
  .span-2, fieldset { grid-column: span 1; }
  .detail-summary { grid-template-columns: repeat(2, 1fr); }
  .detail-summary > div:nth-child(2n) { border-right: 0; }
  .detail-summary > div { border-bottom: 1px solid var(--border); }
  .detail-summary > div:nth-last-child(-n+2) { border-bottom: 0; }
}
@media (max-width: 520px) {
  .topbar-title { font-size: 14px; }
  .topbar-user .avatar { display: none; }
  .page-heading h1 { font-size: 24px; }
  .button { width: 100%; }
  .action-row, .row-actions { align-items: stretch; flex-direction: column; }
  .action-row form, .row-actions form, .action-row button, .row-actions button { width: 100%; }
  .service-status { padding: 0 12px; }
  .detail-summary { grid-template-columns: 1fr; }
  .detail-summary > div { border-right: 0; }
  .detail-summary > div:nth-last-child(-n+2) { border-bottom: 1px solid var(--border); }
  .detail-summary > div:last-child { border-bottom: 0; }
  .footer { flex-direction: column; gap: 4px; }
  .path-panel dl { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; } }
