:root {
  --font: 'Segoe UI Variable', 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  --ew-navy: #0f172a;
  --ew-teal: #0269c7;
  --ew-teal-dark: #03529b;
  --ew-teal-bg: #eef6fc;
  --ew-bg: #f5f6f8;
  --ew-card: #ffffff;
  --ew-border: #e1e5ea;
  --ew-text: #17212b;
  --ew-muted: #5b6873;
  --ew-shadow: 0 10px 30px rgba(20, 30, 40, .08), 0 2px 6px rgba(20, 30, 40, .04);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  max-width: 100%;
  overflow-x: hidden;
}
body {
  font-family: var(--font);
  background: var(--ew-bg);
  color: var(--ew-text);
  font-size: 13.5px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.ew-topbar {
  background: var(--ew-card);
  color: var(--ew-text);
  border-bottom: 1px solid var(--ew-border);
  padding: 10px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.ew-topbar h1 { margin: 0; font-size: 15.5px; font-weight: 700; color: var(--ew-text); }
.ew-topbar-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.ew-shell {
  max-width: 980px;
  margin: 16px auto;
  padding: 0 14px 36px;
}

.ew-card {
  background: var(--ew-card);
  border: 1px solid var(--ew-border);
  border-radius: 11px;
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--ew-shadow);
}

.ew-card h2 {
  margin: 0 0 10px;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ew-text);
  border-bottom: 1px solid var(--ew-border);
  padding-bottom: 6px;
}

.ew-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px 12px;
}
.ew-wide { grid-column: 1 / -1; }

label.ew-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ew-muted);
}

input, select, textarea {
  font: inherit;
  padding: 7px 10px;
  border: 1px solid var(--ew-border);
  border-radius: 8px;
  background: #fff;
  color: var(--ew-text);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(14, 124, 134, 0.35);
  outline-offset: 1px;
  border-color: var(--ew-teal);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 9px;
  border: 1px solid var(--ew-border);
  background: var(--ew-card);
  color: var(--ew-text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { border-color: var(--ew-teal); }
.btn-primary { background: var(--ew-teal); border-color: var(--ew-teal); color: #fff; }
.btn-primary:hover { background: var(--ew-teal-dark); border-color: var(--ew-teal-dark); }
.btn-navy { background: var(--ew-navy); border-color: var(--ew-navy); color: #fff; }
.btn-outline { background: #fff; color: var(--ew-text); border-color: var(--ew-border); }
.btn-sm { padding: 5px 10px; font-size: 12px; }

.flow-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 6px;
  margin-top: 8px;
}
.flow-step {
  background: var(--ew-teal-bg);
  border: 1px solid #bce3e6;
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 11.5px;
}
.flow-step strong { display: block; color: var(--ew-teal-dark); font-size: 11px; }

.ref-row {
  border: 1px solid var(--ew-border);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 8px;
  background: #fbfbfc;
}
.hidden { display: none !important; }
.status-msg { font-size: 12.5px; font-weight: 600; }

.ew-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100dvh;
  background: rgba(15, 23, 42, 0.62);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 80;
  overflow-y: auto;
}
.ew-modal-backdrop > .ew-card {
  margin: auto;
  max-width: 100%;
}
