:root {
  --navy: #1f2937;
  --navy-soft: #374151;
  --hunter: #0a494d;
  --green: #95c11f;
  --green-deep: #4c8425;
  --aqua: #46bec4;
  --lime: #ceff88;
  --coral: #da4d35;
  --cloud: #f6f6f6;
  --white: #ffffff;
  --slate: #6b7280;
  --line: #dfe3e8;
  --line-strong: #c9d0d8;
  --success-bg: #e7f4e2;
  --success-text: #286238;
  --danger-bg: #fce6e2;
  --danger-text: #a53427;
  --draft-bg: #e8f7f8;
  --draft-text: #0a494d;
  --radius-lg: 1.5rem;
  --radius-md: .875rem;
  --shadow-sm: 0 2px 6px rgba(31, 41, 55, .04);
  --shadow-lg: 0 18px 48px rgba(31, 41, 55, .1);
}

html { font-size: 16px; }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--navy);
  background: var(--cloud);
  font-family: "Titillium Web", "Segoe UI", sans-serif;
  font-size: 1rem;
  line-height: 1.5;
}
body::selection { color: var(--navy); background: var(--lime); }
a { color: var(--hunter); text-underline-offset: .18em; }
a:hover { color: var(--green-deep); }
h1, h2, h3, p { text-wrap: balance; }
h1, h2, h3 { color: var(--navy); font-weight: 700; letter-spacing: -.025em; }
h1 { font-size: clamp(2rem, 3vw, 3rem); line-height: 1.05; }
h2 { font-size: clamp(1.45rem, 2vw, 2rem); line-height: 1.15; }
h3 { font-size: 1.18rem; }
code, pre, .font-monospace { font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace; }

.btn, .form-control, .form-select, .form-check-input, .nav-link, summary { transition: border-color .18s ease, background-color .18s ease, color .18s ease, box-shadow .18s ease, transform .18s ease; }
.btn:focus-visible, .form-control:focus, .form-select:focus, .form-check-input:focus, a:focus-visible, summary:focus-visible, .navbar-toggler:focus { outline: 0; box-shadow: 0 0 0 .24rem rgba(70, 190, 196, .28); }
.btn { min-height: 2.75rem; padding: .57rem 1rem; border-radius: .62rem; font-weight: 700; letter-spacing: .01em; }
.btn-sm { min-height: 2.2rem; padding: .33rem .68rem; border-radius: .5rem; }
.btn-lg { min-height: 3.25rem; }
.btn-primary { color: var(--navy); background: var(--green); border-color: var(--green); }
.btn-primary:hover, .btn-primary:focus { color: var(--navy); background: #a8d73a; border-color: #a8d73a; transform: translateY(-1px); }
.btn-outline-primary { color: var(--hunter); border-color: var(--hunter); }
.btn-outline-primary:hover { color: var(--white); background: var(--hunter); border-color: var(--hunter); }
.btn-outline-secondary { color: var(--navy-soft); background: var(--white); border-color: var(--line-strong); }
.btn-outline-secondary:hover { color: var(--navy); background: var(--cloud); border-color: var(--navy-soft); }
.btn-danger { background: var(--coral); border-color: var(--coral); }

.app-shell { min-height: 100vh; background: var(--cloud); }
.shell-grid { display: grid; grid-template-columns: 18.5rem minmax(0, 1fr); min-height: 100vh; }
.app-sidebar {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2.7rem;
  overflow: hidden;
  padding: 2.15rem 1.35rem 1.5rem;
  color: var(--white);
  background: var(--navy);
}
.app-sidebar::after {
  position: absolute;
  right: -4.5rem;
  bottom: -4.5rem;
  width: 15rem;
  height: 15rem;
  content: "";
  pointer-events: none;
  opacity: .65;
  background-image: radial-gradient(circle, rgba(149, 193, 31, .82) 1.5px, transparent 1.8px);
  background-position: 0 0;
  background-size: .72rem .72rem;
  border-radius: 50%;
  mask-image: radial-gradient(circle, #000 0%, transparent 68%);
}
.brand-mark { position: relative; z-index: 1; display: inline-flex; gap: .65rem; align-items: center; width: fit-content; color: var(--white); text-decoration: none; }
.bridge-symbol { display: block; flex: 0 0 auto; width: 3.2rem; height: auto; }
.brand-mark strong { display: block; font-size: 1.65rem; font-weight: 700; letter-spacing: -.055em; line-height: .9; }
.brand-mark small { display: block; margin-top: .45rem; color: var(--green); font-size: .66rem; font-weight: 700; letter-spacing: .17em; }
.app-nav { position: relative; z-index: 1; gap: .3rem; }
.nav-caption { margin: 0 .7rem .35rem; color: rgba(255,255,255,.48); font-size: .65rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.nav-caption-spaced { margin-top: 1.4rem; }
.app-nav .nav-link { display: flex; align-items: center; justify-content: space-between; min-height: 2.9rem; padding: .7rem .8rem .7rem 1rem; color: rgba(255,255,255,.75); border-left: .2rem solid transparent; border-radius: 0 .62rem .62rem 0; font-size: 1rem; font-weight: 600; text-decoration: none; }
.app-nav .nav-link small { color: rgba(255,255,255,.38); font-size: .64rem; font-weight: 700; letter-spacing: .08em; }
.app-nav .nav-link:hover { color: var(--white); background: rgba(255,255,255,.07); }
.app-nav .nav-link.active { color: var(--white); background: rgba(149,193,31,.15); border-left-color: var(--green); }
.app-nav .nav-link.active small { color: var(--lime); }
.sidebar-footnote { position: relative; z-index: 1; display: flex; gap: .55rem; align-items: center; margin-top: auto; color: rgba(255,255,255,.62); font-size: .77rem; }
.status-pulse { width: .5rem; height: .5rem; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 .25rem rgba(149,193,31,.15); }

.main-column { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; min-height: 5.8rem; padding: 1.1rem clamp(1.25rem, 3vw, 3rem); background: rgba(255,255,255,.92); border-bottom: 1px solid var(--line); }
.topbar .eyebrow { margin-bottom: .18rem; }
.topbar-title { color: var(--navy); font-size: .98rem; font-weight: 700; }
.topbar-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: .5rem; }
.app-main { width: min(100%, 100rem); margin: 0 auto; padding: clamp(1.4rem, 3vw, 3rem); }
.app-footer { display: flex; justify-content: space-between; gap: 1rem; width: min(100%, 100rem); margin: auto auto 0; padding: 1.5rem clamp(1.4rem, 3vw, 3rem); color: var(--slate); font-size: .83rem; }
.mobile-nav { display: none; }

.eyebrow { display: inline-block; color: var(--green-deep); font-size: .67rem; font-weight: 700; letter-spacing: .13em; line-height: 1.2; text-transform: uppercase; }
.hero-panel {
  position: relative;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
  overflow: hidden;
  min-height: 15.5rem;
  padding: clamp(1.5rem, 4vw, 3rem);
  color: var(--white);
  background: linear-gradient(128deg, var(--navy) 0%, #123b43 100%);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
.hero-panel::after { position: absolute; top: -7rem; right: -4rem; width: 22rem; height: 22rem; content: ""; opacity: .72; background: radial-gradient(circle, rgba(206,255,136,.68) 0 2px, transparent 2.4px); background-size: .9rem .9rem; border-radius: 50%; mask-image: radial-gradient(circle, #000 0%, transparent 67%); }
.hero-panel > * { position: relative; z-index: 1; }
.hero-panel .eyebrow { color: var(--lime); }
.hero-panel h1 { max-width: 41rem; margin: .55rem 0 .8rem; color: var(--white); }
.hero-panel p { max-width: 43rem; margin: 0; color: rgba(255,255,255,.78); font-size: 1.08rem; }
.hero-actions, .page-actions, .action-stack { display: flex; flex-wrap: wrap; gap: .65rem; }
.hero-panel .btn-outline-secondary { color: var(--white); background: transparent; border-color: rgba(255,255,255,.5); }
.hero-panel .btn-outline-secondary:hover { color: var(--navy); background: var(--white); border-color: var(--white); }

.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 1.5rem; padding: .7rem 0 1.25rem; border-bottom: 1px solid var(--line); }
.section-heading h1 { margin: .45rem 0 .55rem; }
.section-heading h2 { margin: .3rem 0 0; }
.section-heading p { max-width: 48rem; margin: 0; color: var(--slate) !important; }
.section-heading.compact { padding: 0 0 1rem; border: 0; }
.section-heading.compact h2 { margin-bottom: 0; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-top: 1.25rem; }
.stat-card, .content-card, .error-panel { background: var(--white); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.stat-card { position: relative; overflow: hidden; min-height: 11.5rem; padding: 1.25rem; border-radius: var(--radius-md); }
.stat-card::before { position: absolute; top: 0; left: 0; width: 100%; height: .26rem; content: ""; background: var(--green); }
.stat-card:nth-child(2)::before { background: var(--aqua); }
.stat-card:nth-child(3)::before { background: var(--hunter); }
.stat-card:nth-child(4)::before { background: var(--coral); }
.stat-card strong { display: block; margin: .45rem 0 .6rem; color: var(--navy); font-size: clamp(1.65rem, 2.5vw, 2.35rem); line-height: 1; }
.stat-card p { margin: 0; color: var(--slate); font-size: .9rem; }
.stat-label { color: var(--slate); font-size: .68rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.content-card, .error-panel { margin-top: 1.25rem; padding: clamp(1.1rem, 2.5vw, 1.65rem); border-radius: var(--radius-md); }
.directory-filter { display: grid; grid-template-columns: minmax(0, 1fr) minmax(16rem, 24rem); gap: 1rem 2rem; align-items: end; margin-bottom: .8rem; }
.directory-filter .form-text { margin-top: 0; }
.directory-filter-status { min-height: 1.3rem; margin: 0 0 .8rem; color: var(--slate); font-size: .85rem; }
.error-panel { max-width: 52rem; }
.stack-lg { display: flex; flex-direction: column; gap: 1.5rem; }
.grid-two { display: grid; grid-template-columns: minmax(0, 2fr) minmax(18rem, 1fr); gap: 1.25rem; }
.empty-state { max-width: 32rem; padding: 2.5rem 1rem; margin: 0 auto; text-align: center; }
.empty-state h2, .empty-state h3 { margin-bottom: .55rem; }
.empty-state p { color: var(--slate); }

.table-responsive { border: 1px solid var(--line); border-radius: .7rem; }
.table { margin: 0; color: var(--navy); }
.table > :not(caption) > * > * { padding: .9rem .85rem; background: transparent; border-bottom-color: var(--line); vertical-align: middle; }
.table thead th { color: var(--slate); background: #fafbfc; border-bottom-width: 1px; font-size: .67rem; font-weight: 700; letter-spacing: .085em; text-transform: uppercase; white-space: nowrap; }
.table tbody tr { transition: background-color .16s ease; }
.table tbody tr:hover { background: #f8fbf7; }
.table tbody tr:last-child > * { border-bottom: 0; }
.badge-soft { display: inline-flex; align-items: center; justify-content: center; min-height: 1.72rem; padding: .25rem .58rem; border-radius: .35rem; font-size: .74rem; font-weight: 700; letter-spacing: .02em; }
.badge-active, .badge-succeeded { color: var(--success-text); background: var(--success-bg); }
.badge-draft, .badge-pending, .badge-queued, .badge-running { color: var(--draft-text); background: var(--draft-bg); }
.badge-disabled, .badge-failed { color: var(--danger-text); background: var(--danger-bg); }
.run-summary { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem; }
.run-details { display: inline-block; }
.run-details[open] { flex-basis: 100%; }
.run-details summary { display: inline-flex; cursor: pointer; list-style: none; }
.run-details summary::-webkit-details-marker { display: none; }
.run-details-icon { display: inline-flex; align-items: center; justify-content: center; width: 1.35rem; height: 1.35rem; color: var(--hunter); background: #e8f7f8; border: 1px solid #b7e3e5; border-radius: 50%; font-family: Georgia, serif; font-size: .8rem; font-weight: 700; }
.run-details summary:hover .run-details-icon { color: var(--white); background: var(--hunter); border-color: var(--hunter); }
.run-details pre { max-width: 55rem; max-height: 17rem; padding: .9rem; margin: .7rem 0 0; overflow: auto; color: var(--navy); background: #fafbfc; border: 1px solid var(--line); border-radius: .55rem; font-size: .78rem; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.detail-grid { display: grid; grid-template-columns: minmax(10rem, .75fr) minmax(0, 2fr); gap: .82rem 1.3rem; margin: 0; }
.detail-grid dt { color: var(--slate); font-size: .85rem; font-weight: 700; }
.detail-grid dd { min-width: 0; margin: 0; color: var(--navy); font-weight: 600; overflow-wrap: anywhere; }
.detail-grid pre { max-height: 11rem; padding: .7rem; overflow: auto; color: var(--navy); background: #fafbfc; border: 1px solid var(--line); border-radius: .45rem; font-size: .82rem; white-space: pre-wrap; }

.form-label { margin-bottom: .42rem; color: var(--navy); font-size: .9rem; font-weight: 700; }
.form-control, .form-select { min-height: 3rem; color: var(--navy); background: var(--white); border-color: var(--line-strong); border-radius: .58rem; }
.form-control::placeholder { color: #98a1ad; }
.form-control:hover, .form-select:hover { border-color: #aab3bd; }
.form-control:focus, .form-select:focus { color: var(--navy); border-color: var(--aqua); box-shadow: 0 0 0 .22rem rgba(70,190,196,.19); }
.form-check { border-color: var(--line) !important; border-radius: .6rem !important; }
.form-check:has(.form-check-input:checked) { background: #f8fcf2; border-color: rgba(149,193,31,.55) !important; }
.form-check-input { width: 1.15rem; height: 1.15rem; border-color: #9aa4b2; }
.form-check-input:checked { background-color: var(--green-deep); border-color: var(--green-deep); }
.form-switch .form-check-input { width: 2.45rem; }
.form-text { color: var(--slate); }
.text-danger { color: var(--danger-text) !important; }
.alert { border-width: 1px; border-radius: .65rem; }
.alert-success { color: var(--success-text); background: var(--success-bg); border-color: #c7e4bd; }
.alert-danger { color: var(--danger-text); background: var(--danger-bg); border-color: #f0c2b9; }
.alert-info { color: var(--hunter); background: #e8f7f8; border-color: #b9e6e8; }
.validation-summary-valid { display: none; }

.auth-shell { min-height: 100vh; background: var(--cloud); }
.auth-grid { display: grid; grid-template-columns: minmax(20rem, .92fr) minmax(24rem, 1.08fr); min-height: 100vh; }
.auth-brand-panel { position: relative; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; padding: clamp(2rem, 5vw, 5rem); color: var(--white); background: linear-gradient(145deg, var(--navy), var(--hunter)); }
.auth-brand-panel::after { position: absolute; right: -9rem; bottom: -8rem; width: 32rem; height: 32rem; content: ""; opacity: .8; background-image: radial-gradient(circle, rgba(206,255,136,.7) 0 2px, transparent 2.35px); background-size: .95rem .95rem; border-radius: 50%; mask-image: radial-gradient(circle, #000 0%, transparent 64%); }
.auth-brand-panel > * { position: relative; z-index: 1; }
.auth-brand-lockup { display: flex; gap: .9rem; align-items: center; }
.auth-brand-lockup .bridge-symbol { width: clamp(4.1rem, 7vw, 5.8rem); }
.auth-brand-lockup strong { display: block; font-size: clamp(2rem, 4vw, 3rem); font-weight: 700; letter-spacing: -.065em; line-height: .9; }
.auth-brand-lockup span { display: block; margin-top: .65rem; color: var(--green); font-size: .72rem; font-weight: 700; letter-spacing: .2em; }
.auth-brand-copy { max-width: 30rem; }
.auth-brand-copy .eyebrow { color: var(--lime); }
.auth-brand-copy h2 { max-width: 24rem; margin: .6rem 0 1rem; color: var(--white); font-size: clamp(2rem, 4vw, 3.5rem); }
.auth-brand-copy p { max-width: 28rem; margin: 0; color: rgba(255,255,255,.77); font-size: 1.1rem; }
.auth-brand-footer { color: rgba(255,255,255,.58); font-size: .84rem; }
.auth-stage { display: grid; grid-template-rows: 1fr auto; place-items: center; padding: 2rem; }
.auth-card { width: min(100%, 29rem); padding: 0; background: transparent; border: 0; box-shadow: none; }
.auth-brand { color: var(--green-deep); font-size: .68rem; font-weight: 700; letter-spacing: .15em; text-transform: uppercase; }
.auth-card h1 { margin: .55rem 0 .7rem; }
.auth-copy, .auth-hint { color: var(--slate); }
.auth-copy { font-size: 1.03rem; }
.auth-hint { margin: 1.25rem 0 0; font-size: .87rem; }
.auth-legal { align-self: end; margin-top: 2rem; color: var(--slate); font-size: .82rem; }
.auth-form { margin-top: 1.8rem; }
.mfa-qr { max-width: 16rem; padding: .85rem !important; border: 1px solid var(--line); border-radius: .75rem !important; box-shadow: var(--shadow-sm) !important; }
.mfa-qr svg { display: block; width: 100%; height: auto; }

@media (max-width: 1100px) {
  .shell-grid { grid-template-columns: 15.5rem minmax(0, 1fr); }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-two { grid-template-columns: 1fr; }
  .directory-filter { grid-template-columns: 1fr; }
  .auth-grid { grid-template-columns: minmax(18rem, .8fr) minmax(23rem, 1.2fr); }
}
@media (max-width: 820px) {
  .shell-grid { display: block; }
  .app-sidebar, .topbar, .app-footer { display: none; }
  .mobile-nav { display: block; position: sticky; top: 0; z-index: 10; background: var(--white); border-bottom: 1px solid var(--line); box-shadow: 0 2px 12px rgba(31,41,55,.05); }
  .mobile-nav .navbar { padding: .75rem 1rem; }
  .mobile-nav .navbar-brand { color: var(--navy); font-weight: 700; letter-spacing: -.04em; }
  .bridge-mobile-brand { display: inline-flex; gap: .45rem; align-items: center; }
  .bridge-mobile-brand img { width: 2.5rem; height: auto; }
  .bridge-mobile-brand span { display: flex; flex-direction: column; line-height: .8; }
  .bridge-mobile-brand b { margin-top: .25rem; color: var(--green-deep); font-size: .63rem; letter-spacing: .12em; }
  .mobile-nav .nav-link { color: var(--navy); font-weight: 600; }
  .app-main { padding: 1.1rem; }
  .section-heading, .hero-panel { align-items: flex-start; flex-direction: column; }
  .hero-panel { min-height: 0; }
  .topbar-actions { justify-content: flex-start; }
  .auth-grid { grid-template-columns: 1fr; }
  .auth-brand-panel { min-height: 17rem; padding: 2rem; }
  .auth-brand-copy { margin-top: 2.5rem; }
  .auth-brand-copy h2 { font-size: 2rem; }
  .auth-brand-footer { display: none; }
}
@media (max-width: 560px) {
  html { font-size: 15px; }
  .stats-grid { grid-template-columns: 1fr; }
  .hero-actions, .page-actions, .topbar-actions { width: 100%; }
  .hero-actions .btn, .page-actions .btn { flex: 1 1 auto; }
  .detail-grid { grid-template-columns: 1fr; gap: .3rem; }
  .detail-grid dd { margin-bottom: .8rem; }
  .table > :not(caption) > * > * { padding: .75rem .7rem; }
  .auth-stage { padding: 2.5rem 1.3rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
