@import url("./styles/tokens.css");

* { box-sizing: border-box; }
html { color-scheme: light; scroll-behavior: smooth; }
body { margin: 0; color: var(--umd-gray-900); background: #f5f5f5; font: 16px/1.55 var(--font-sans); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: var(--umd-red-dark); text-underline-offset: .18em; }
:focus-visible { outline: 3px solid var(--umd-gold); outline-offset: 3px; box-shadow: none; }
[hidden] { display: none !important; }
.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; }
.skip-link { position: fixed; z-index: 100; top: 8px; left: 8px; transform: translateY(-180%); padding: 10px 16px; color: white; background: black; }
.skip-link:focus { transform: none; }

.pre-auth > :not(.auth-overlay) { visibility: hidden; }
.auth-overlay { position: fixed; z-index: 90; inset: 0; display: none; place-items: center; padding: 24px; background: rgb(0 0 0 / 82%); }
.auth-overlay.active { display: grid; }
.auth-card { width: min(100%, 470px); border-top: 6px solid var(--umd-gold); padding: 40px; background: white; box-shadow: 0 24px 80px rgb(0 0 0 / 35%); text-align: center; }
.auth-card h1 { margin: 8px 0 12px; font: 700 2rem/1.15 var(--font-serif); }
.spinner { display: inline-block; width: 34px; height: 34px; border: 4px solid #ddd; border-top-color: var(--umd-red); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.site-header { position: sticky; z-index: 40; top: 0; color: white; background: var(--umd-black); border-top: 5px solid var(--umd-gold); box-shadow: 0 3px 12px rgb(0 0 0 / 15%); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; width: min(calc(100% - 32px), 1500px); min-height: 74px; margin: auto; }
.brand-lockup { display: flex; align-items: center; gap: 13px; color: white; text-decoration: none; }
.brand-lockup strong, .brand-lockup small { display: block; }
.brand-lockup strong { font-size: 1.2rem; line-height: 1.2; }
.brand-lockup small { color: #d6d6d6; }
.brand-icon { width: 40px; height: 40px; padding: 8px; background: var(--umd-red); }
.header-meta { display: flex; align-items: center; gap: 14px; }
.environment-badge, .status-pill, .tag { display: inline-flex; align-items: center; min-height: 26px; border-radius: 999px; padding: 3px 10px; font-size: .78rem; font-weight: 800; letter-spacing: .02em; text-transform: uppercase; }
.environment-badge { border: 1px solid #777; color: white; }
.session-user { font-weight: 700; }
.text-button { border: 0; padding: 7px; color: white; background: transparent; text-decoration: underline; text-underline-offset: 4px; }

.app-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); min-height: calc(100vh - 79px); }
.side-nav { position: sticky; top: 79px; align-self: start; height: calc(100vh - 79px); padding: 32px 20px; background: #242424; }
.nav-item { display: block; width: 100%; border: 0; border-left: 4px solid transparent; padding: 13px 14px; color: #eee; background: transparent; text-align: left; font-weight: 700; }
.nav-item:hover { background: #333; }
.nav-item.active { border-left-color: var(--umd-gold); color: white; background: #3a3a3a; }
.page-shell { min-width: 0; width: min(100%, 1320px); padding: 44px 40px 72px; }
.view > h1, .page-heading-row h1 { margin: 0; font: 700 clamp(2rem, 4vw, 3rem)/1.08 var(--font-serif); }
.page-heading-row { display: flex; align-items: end; justify-content: space-between; gap: 32px; margin-bottom: 30px; }
.page-heading-row.compact { align-items: start; }
.eyebrow { margin: 0 0 6px; color: var(--umd-red-dark); font-size: .78rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.lede { max-width: 72ch; margin: 10px 0 0; color: #454545; font-size: 1.08rem; }
.muted, .field-help { color: #666; }
.field-help { margin: 6px 0 18px; font-size: .9rem; }

.button { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; border: 2px solid var(--umd-red); border-radius: 3px; padding: 10px 18px; color: white; background: var(--umd-red); font-weight: 800; line-height: 1; }
.button:hover { border-color: var(--umd-red-dark); background: var(--umd-red-dark); }
.button.secondary { border-color: #5a5a5a; color: #242424; background: white; }
.button.secondary:hover { border-color: #000; background: #f2f2f2; }
.button.success { border-color: #006b2e; background: #006b2e; }
.button:disabled { cursor: not-allowed; opacity: .55; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 16px; margin-bottom: 24px; }
.metric-card { border: 1px solid #ddd; border-top: 4px solid var(--umd-red); padding: 20px; background: white; box-shadow: 0 5px 18px rgb(0 0 0 / 5%); }
.metric-card span { display: block; color: #5c5c5c; font-weight: 700; }
.metric-card strong { display: block; margin-top: 6px; font: 700 2.1rem/1 var(--font-serif); }
.panel { border: 1px solid #d9d9d9; border-radius: 4px; padding: 26px; background: white; box-shadow: 0 8px 24px rgb(0 0 0 / 5%); }
.panel-heading { display: flex; align-items: start; justify-content: space-between; gap: 24px; padding-bottom: 18px; border-bottom: 1px solid #e6e6e6; }
.panel-heading h2, .panel-heading p { margin: 0; }
.panel-heading h2, .wizard-step h2 { font: 700 1.55rem/1.2 var(--font-serif); }
.panel-heading p { margin-top: 4px; color: #666; }
.notification-list { display: grid; }
.notification-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 24px; padding: 22px 0; border-bottom: 1px solid #e6e6e6; }
.notification-row:last-child { border-bottom: 0; }
.row-title { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.row-title h3, .notification-row p { margin: 0; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.recipient-line { margin-top: 5px !important; font-size: .9rem; }
.status-pill.good { color: #064c27; background: #dff5e8; }
.status-pill.warning { color: #702a00; background: #ffeadb; }
.status-pill.neutral, .tag { color: #444; background: #e9e9e9; }
.empty-state { margin: 0; padding: 34px 12px; color: #666; text-align: center; }
.empty-state p { margin: 6px 0 0; }

.stepper { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 0 0 24px; padding: 0; list-style: none; }
.step { width: 100%; border: 0; border-bottom: 4px solid #ccc; padding: 12px 8px; color: #555; background: transparent; font-weight: 800; text-align: left; }
.step span { display: inline-grid; width: 27px; height: 27px; place-items: center; margin-right: 6px; border-radius: 50%; color: white; background: #666; }
.step.active { border-color: var(--umd-red); color: #111; }
.step.active span { background: var(--umd-red); }
.wizard-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, .85fr); gap: 24px; align-items: start; }
.wizard-panel { min-height: 520px; }
.wizard-step h2 { margin: 0 0 8px; }
.wizard-step > p { margin: 0 0 22px; color: #555; }
label { display: block; margin: 18px 0 7px; font-weight: 800; }
input, select, textarea { width: 100%; border: 1px solid #777; border-radius: 3px; padding: 11px 12px; color: #111; background: white; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: #000; }
.optional { color: #666; font-size: .85rem; font-weight: 400; }
.check-row { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.check-row input { width: 20px; height: 20px; }
.warning-box, .info-box, .success-box, .error-box { margin: 18px 0; border-left: 5px solid; padding: 14px 16px; }
.warning-box { border-color: #b45f06; background: #fff5e6; }
.info-box { border-color: #276aa6; background: #eef7ff; }
.success-box { border-color: #16723c; background: #eaf7ef; }
.error-box { border-color: #a90007; color: #700006; background: #fff0f1; }
.wizard-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 30px; padding-top: 20px; border-top: 1px solid #ddd; }
.variable-panel { position: sticky; top: 104px; max-height: calc(100vh - 130px); overflow: auto; }
.variable-panel input { margin: 18px 0 10px; }
.variable-catalog h3 { margin: 18px 0 7px; color: #555; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; }
.variable-button { display: block; width: 100%; border: 1px solid #ddd; border-radius: 3px; margin: 6px 0; padding: 9px 10px; color: #222; background: #fafafa; text-align: left; }
.variable-button:hover { border-color: var(--umd-red); background: #fff; }
.variable-button strong, .variable-button small { display: block; }
.variable-button small { overflow: hidden; color: #666; text-overflow: ellipsis; white-space: nowrap; }
.preview-grid { display: grid; gap: 16px; margin-top: 20px; }
.preview-grid article { border: 1px solid #ddd; padding: 16px; background: #fafafa; }
.preview-grid h3 { margin: 0 0 8px; font-size: 1rem; }
.preview-value { margin: 0; white-space: pre-wrap; word-break: break-word; }

.run-list { display: grid; }
.run-row { display: grid; gap: 5px; padding: 18px 0; border-bottom: 1px solid #ddd; }
.run-row:last-child { border-bottom: 0; }
.run-row span { color: #555; }
.connection-card { display: flex; align-items: center; justify-content: space-between; gap: 32px; }
.connection-card h2 { margin: 10px 0 2px; font: 700 1.5rem/1.2 var(--font-serif); }
.connection-card p { margin: 0; }
.connection-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.permission-panel { margin-top: 20px; }
.permission-panel h2 { margin: 0; font: 700 1.35rem/1.2 var(--font-serif); }
.permission-panel > p { margin: 6px 0 16px; color: #555; }
.permission-choice { display: flex; align-items: flex-start; gap: 12px; margin: 12px 0; padding: 14px; border: 1px solid #ddd; border-radius: 3px; }
.permission-choice input { flex: 0 0 auto; width: 20px; height: 20px; margin-top: 2px; }
.permission-choice strong, .permission-choice small { display: block; }
.permission-choice small { margin-top: 3px; color: #555; font-weight: 400; }
.toast { position: fixed; z-index: 80; right: 24px; bottom: 24px; max-width: 420px; border-left: 5px solid var(--umd-gold); padding: 15px 18px; color: white; background: #222; box-shadow: 0 10px 40px rgb(0 0 0 / 25%); }
.site-footer { padding: 20px 24px; border-top: 1px solid #ddd; color: #555; background: white; text-align: center; }
.site-footer p { margin: 0; }

@media (max-width: 980px) {
  .app-layout { grid-template-columns: 1fr; }
  .side-nav { position: static; display: flex; height: auto; overflow-x: auto; padding: 8px 16px; }
  .nav-item { width: auto; min-width: max-content; border-bottom: 4px solid transparent; border-left: 0; }
  .nav-item.active { border-bottom-color: var(--umd-gold); border-left: 0; }
  .page-shell { padding: 32px 24px 60px; }
  .wizard-layout { grid-template-columns: 1fr; }
  .variable-panel { position: static; max-height: none; }
}

@media (max-width: 700px) {
  .header-inner, .header-meta, .page-heading-row, .connection-card { align-items: flex-start; flex-direction: column; }
  .header-inner { padding: 14px 0; }
  .site-header { position: static; }
  .session-user { display: none; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .stepper { grid-template-columns: 1fr 1fr; }
  .step { font-size: .88rem; }
  .notification-row { grid-template-columns: 1fr; }
  .wizard-actions { flex-wrap: wrap; justify-content: stretch; }
  .wizard-actions .button { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
