:root {
  --bg: #f4f6f6;
  --surface: #fff;
  --ink: #172e31;
  --muted: #687a7e;
  --line: #dfe7e7;
  --accent: #176c64;
  --accent-soft: #e6f3ed;
  --nav: #122b30;
  --nav-muted: #93aaaf;
  --amber: #8a6022;
  --radius: 8px;
  --shadow: 0 2px 4px #152f3304;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: "Avenir Next", "Segoe UI", "Trebuchet MS", sans-serif;
  font-size: 13px;
  line-height: 1.5;
}
a {
  color: var(--accent);
  text-decoration: none;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a,
input,
select,
textarea,
summary {
  outline-offset: 3px;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 2px solid #3d9f88;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}
.sidebar {
  width: 244px;
  position: fixed;
  inset: 0 auto 0 0;
  background: var(--nav);
  color: #f5fcfa;
  display: flex;
  flex-direction: column;
  z-index: 10;
}
.brand {
  height: 76px;
  display: flex;
  align-items: center;
  padding: 0 25px;
  font-size: 25px;
  font-weight: 750;
  letter-spacing: -1px;
  color: #fff;
}
.brand-mark {
  width: 27px;
  height: 30px;
  background: #b6dfc3;
  color: #122b30;
  display: inline-grid;
  place-items: center;
  font-family: Georgia, serif;
  font-style: italic;
  margin-right: 10px;
  border-radius: 6px;
  font-size: 27px;
}
.brand-os {
  font-weight: 350;
}
.version {
  font: 8px monospace;
  letter-spacing: 1px;
  margin-left: auto;
  background: #294248;
  padding: 4px 6px;
  border-radius: 3px;
  color: #bad4cb;
}
.workspace-switch {
  margin: 0 15px 14px;
  padding: 12px 9px;
  border-top: 1px solid #ffffff14;
  border-bottom: 1px solid #ffffff14;
  display: flex;
  gap: 10px;
  font-size: 12px;
}
.workspace-avatar,
.avatar {
  display: grid;
  place-items: center;
  background: #dce8e4;
  color: #355d56;
  border-radius: 6px;
  width: 31px;
  height: 31px;
  font-weight: 700;
}
.workspace-switch small {
  display: block;
  color: var(--nav-muted);
  font-size: 10px;
}
nav {
  overflow: auto;
  padding: 0 12px 18px;
  scrollbar-width: thin;
  scrollbar-color: #344f53 transparent;
}
nav a {
  display: flex;
  gap: 11px;
  padding: 9px 12px;
  border-radius: 5px;
  color: #c0d0d3;
  font-size: 11px;
  margin: 2px 0;
}
nav a:hover {
  background: #ffffff0a;
  color: white;
}
nav a.active {
  color: #e6fff0;
  background: #2b4d4e;
  border-left: 2px solid #bee1be;
  padding-left: 10px;
}
.nav-icon {
  width: 16px;
  text-align: center;
  font-size: 14px;
  line-height: 17px;
  color: #90b0ae;
}
.nav-label {
  font: 8px monospace;
  letter-spacing: 1.3px;
  color: #729197;
  padding: 15px 12px 3px;
  margin: 0;
}
.sidebar-footer {
  margin-top: auto;
  padding: 17px 20px;
  font-size: 9px;
  color: #b3c8c7;
  border-top: 1px solid #ffffff12;
  white-space: nowrap;
}
.status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: #b5d19b;
  border-radius: 50%;
  margin-right: 7px;
}
.main-shell {
  margin-left: 244px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.topbar {
  height: 76px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  border-bottom: 1px solid var(--line);
  gap: 20px;
}
.breadcrumb {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}
.breadcrumb span {
  padding: 0 12px;
  color: #b5c3c5;
}
.breadcrumb strong {
  font-weight: 500;
  color: var(--ink);
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}
.search {
  display: flex;
  align-items: center;
  gap: 7px;
  background: #f6f8f8;
  border: 1px solid var(--line);
  padding: 7px 10px;
  border-radius: 5px;
}
.search input {
  border: 0;
  background: none;
  padding: 0;
  font-size: 11px;
  width: 180px;
  outline: none;
}
.avatar {
  border-radius: 50%;
  font-size: 11px;
}
.environment-bar {
  height: 38px;
  padding: 0 32px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font: 9px monospace;
  color: var(--muted);
  background: #fafcfc;
  gap: 14px;
}
.environment-bar strong {
  color: var(--amber);
  font-weight: 500;
}
.separator {
  padding: 0 9px;
  color: #bcc8c8;
}
.connection:before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  margin-right: 6px;
  background: #b1bfc2;
}
.online:before {
  background: #428374;
}
.offline {
  color: #a43131;
}
.offline:before {
  background: #a43131;
}
main {
  padding: 29px 32px;
  flex: 1;
  min-width: 0;
}
h1 {
  font-size: 25px;
  letter-spacing: -0.6px;
  font-weight: 650;
  line-height: 1.25;
  margin: 0 0 7px;
}
h2 {
  font-size: 14px;
  letter-spacing: -0.1px;
  font-weight: 650;
  margin: 0;
}
h3 {
  font-size: 12px;
  margin: 23px 0 12px;
}
p {
  margin: 0 0 12px;
}
.view-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 25px;
  gap: 20px;
}
.view-heading p {
  color: var(--muted);
  font-size: 12px;
  margin: 0;
}
.primary,
.secondary,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 14px;
  border-radius: 5px;
  border: 1px solid transparent;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
  transition: background 0.12s;
}
.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.primary:hover {
  background: #12594f;
}
.secondary {
  background: #fff;
  border: 1px solid #cfdbdb;
  color: var(--ink);
}
.secondary:hover {
  background: #edf3f1;
}
.icon {
  border: 0;
  background: transparent;
  color: inherit;
  padding: 6px;
  cursor: pointer;
}
.badge {
  display: inline-block;
  white-space: nowrap;
  padding: 3px 7px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 550;
  background: #eef2f3;
  color: #61777b;
  letter-spacing: 0.1px;
}
.badge.completed,
.badge.succeeded,
.badge.connected {
  background: #e7f4eb;
  color: #356d4d;
}
.badge.amber,
.badge.draft,
.badge.pending,
.badge.unverified {
  background: #fbf2df;
  color: #8c672a;
}
.badge.blue,
.badge.running,
.badge.queued {
  background: #e8f1f7;
  color: #376783;
}
.badge.failed,
.badge.error,
.badge.expired {
  background: #fbecea;
  color: #a24a3d;
}
.badge.cancelled,
.badge.blocked {
  background: #edf0f1;
  color: #77898c;
}
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat {
  padding: 19px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.stat span {
  color: var(--muted);
  font-size: 10px;
}
.stat strong {
  font-size: 29px;
  font-weight: 600;
  letter-spacing: -1px;
  line-height: 1.2;
}
.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) minmax(240px, 1fr);
  gap: 20px;
}
.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  overflow: hidden;
  min-width: 0;
}
.card > h2,
.card > p,
.card > button,
.card > .button,
.card > .system-row,
.card > .permission-list {
  margin-left: 20px;
  margin-right: 20px;
}
.card > h2 {
  margin-top: 20px;
}
.card > p {
  margin-top: 14px;
}
.card > button,
.card > .button {
  margin-bottom: 20px;
}
.card-heading {
  padding: 17px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.card-heading a,
.muted {
  font-size: 10px;
  color: var(--muted);
}
.system-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #eef3f3;
  padding: 15px 0;
  font-size: 11px;
  gap: 10px;
}
.helper {
  font-size: 11px;
  line-height: 1.7;
  color: var(--muted);
  margin: 15px 0;
}
.table-wrap {
  overflow: auto;
  max-height: 570px;
}
table {
  border-collapse: collapse;
  width: 100%;
  text-align: left;
  font-size: 11px;
  white-space: nowrap;
}
th {
  background: #f8fafa;
  border-bottom: 1px solid var(--line);
  padding: 11px 17px;
  position: sticky;
  top: 0;
  z-index: 1;
  font-size: 9px;
  font-weight: 550;
  color: var(--muted);
}
td {
  padding: 14px 17px;
  border-bottom: 1px solid #edf1f1;
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
}
tr:last-child td {
  border-bottom: 0;
}
.clickable {
  cursor: pointer;
}
.clickable:hover {
  background: #f4f9f5;
}
.sort {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font-size: inherit;
  text-align: left;
}
.table-toolbar {
  padding: 16px;
  display: flex;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}
.table-toolbar input {
  max-width: 360px;
}
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 245px;
  padding: 35px;
  text-align: center;
  white-space: normal;
}
.empty-icon {
  font:
    35px Georgia,
    serif;
  color: #9cb4b3;
}
.empty h3 {
  font-size: 13px;
  margin: 13px 0 8px;
  font-weight: 550;
}
.empty p {
  color: var(--muted);
  font-size: 11px;
  max-width: 420px;
  line-height: 1.8;
  margin-bottom: 18px;
}
.stepper {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  overflow: hidden;
  margin-bottom: 20px;
}
.step {
  padding: 16px;
  text-align: left;
  border: 0;
  border-right: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-size: 11px;
}
.step:last-child {
  border-right: 0;
}
.step.active {
  color: var(--accent);
  background: #edf5f1;
  box-shadow: inset 0 -2px var(--accent);
  font-weight: 650;
}
.wizard-content {
  padding: 24px;
  min-height: 270px;
}
.wizard-navigation {
  padding: 17px 24px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 11px;
  min-width: 0;
}
.field > span {
  font-weight: 550;
}
.field small {
  font-size: 10px;
  color: var(--muted);
}
input:not([type="checkbox"]),
select,
textarea {
  width: 100%;
  border: 1px solid #d0dddd;
  border-radius: 5px;
  padding: 10px 11px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
}
input[type="checkbox"] {
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
  cursor: pointer;
}
select {
  min-height: 39px;
}
.choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.choice {
  display: flex;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  padding: 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
}
.choice:has(input:checked) {
  border-color: #579889;
  background: #f0f8f3;
}
.choice small {
  display: block;
  color: var(--muted);
  font-size: 9px;
  margin-top: 3px;
}
.callout {
  padding: 15px 17px;
  background: #edf5f2;
  color: #42655d;
  border: 1px solid #d6e6df;
  border-radius: 5px;
  margin: 20px 0;
  font-size: 11px;
  line-height: 1.7;
}
.callout.warning {
  background: #fff8ec;
  color: #87652c;
  border-color: #eaddc2;
}
.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.compact .stat {
  box-shadow: none;
  padding: 15px;
}
.compact .stat strong {
  font-size: 23px;
}
.advanced {
  padding: 17px 20px;
}
.advanced summary {
  font-size: 11px;
  cursor: pointer;
}
.advanced textarea {
  margin-top: 20px;
  min-height: 300px;
  background: #f7faf9;
  font: 11px/1.7 monospace;
  resize: vertical;
}
.advanced .actions {
  margin-top: 15px;
}
.advanced pre {
  overflow: auto;
  max-height: 360px;
  font: 10px/1.7 monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin-top: 18px;
}
.advanced > p {
  margin-left: 0;
}
.integration-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.integration {
  padding: 20px;
}
.integration > h2 {
  margin: 0 0 13px;
}
.integration > p {
  margin: 12px 0 0;
  font-size: 11px;
  color: var(--muted);
}
.permission-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}
.sync-form {
  padding: 20px;
  border-top: 1px solid var(--line);
}
.create-record {
  margin-bottom: 20px;
}
.create-record > summary {
  list-style: none;
  cursor: pointer;
  width: max-content;
}
.library-form {
  padding: 22px;
  margin-top: 15px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.library-form h2 {
  margin: 0;
  grid-column: 1/-1;
}
.library-form button {
  align-self: end;
  justify-self: start;
  margin: 0;
}
.settings-list {
  display: grid;
  grid-template-columns: 200px 1fr;
  font-size: 12px;
  padding: 20px;
  gap: 18px;
}
.settings-list dt {
  color: var(--muted);
}
.settings-list dd {
  margin: 0;
}
.backlink {
  display: block;
  font-size: 10px;
  margin-bottom: 12px;
}
progress {
  display: block;
  width: calc(100% - 40px);
  height: 5px;
  margin: 20px;
  accent-color: var(--accent);
}
footer {
  font-size: 9px;
  color: #839699;
  border-top: 1px solid var(--line);
  padding: 17px 32px;
  display: flex;
  justify-content: space-between;
  gap: 15px;
}
.notice {
  padding: 13px 20px;
  margin: 15px 32px 0;
  background: #eaf2f7;
  border: 1px solid #cbdce5;
  border-radius: 5px;
  color: #385b70;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  gap: 15px;
}
.notice.error {
  background: #fff0ed;
  border-color: #edcbc4;
  color: #97493c;
}
.notice.success {
  background: #eaf5ee;
  border-color: #c7dfcf;
  color: #3b6d4c;
}
.offline-banner {
  padding: 15px 32px;
  background: #fff2dd;
  color: #855a25;
  font-size: 12px;
}
.offline-banner button {
  margin-left: 15px;
}
#menu-toggle {
  display: none;
}
[hidden] {
  display: none !important;
}
#view[aria-busy="true"] {
  opacity: 0.55;
  pointer-events: none;
}
code {
  font: 10px monospace;
}
@media (min-width: 1600px) {
  main {
    padding: 36px 45px;
  }
  .topbar,
  .environment-bar {
    padding-left: 45px;
    padding-right: 45px;
  }
}
@media (max-width: 1150px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .sidebar {
    width: 222px;
  }
  .main-shell {
    margin-left: 222px;
  }
  .search input {
    width: 130px;
  }
  .topbar,
  main {
    padding-left: 22px;
    padding-right: 22px;
  }
  .integration-grid {
    grid-template-columns: 1fr;
  }
  .integration {
    margin-bottom: 0;
  }
  .integration-grid {
    margin-bottom: 20px;
  }
}
@media (max-width: 850px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.15s;
  }
  .nav-open .sidebar {
    transform: translateX(0);
    box-shadow: 20px 0 60px #0002;
  }
  .main-shell {
    margin-left: 0;
  }
  #menu-toggle {
    display: block;
  }
  .topbar {
    gap: 12px;
  }
  .breadcrumb {
    margin-right: auto;
  }
  .topbar-actions .search {
    display: none;
  }
  .environment-bar {
    font-size: 8px;
  }
  .view-heading {
    align-items: start;
  }
  .stats {
    gap: 10px;
  }
  .stat {
    padding: 14px;
  }
  .stat span {
    font-size: 9px;
  }
  .step {
    padding: 12px;
    font-size: 10px;
  }
}
@media (max-width: 560px) {
  .stats {
    grid-template-columns: 1fr 1fr;
  }
  .form-grid,
  .choices {
    grid-template-columns: 1fr;
  }
  .stepper {
    grid-template-columns: 1fr 1fr;
  }
  .step {
    border-bottom: 1px solid var(--line);
  }
  .topbar .avatar {
    display: none;
  }
  .topbar {
    padding: 0 15px;
  }
  .breadcrumb {
    font-size: 10px;
  }
  .topbar-actions {
    gap: 5px;
  }
  .topbar-actions button {
    font-size: 10px;
    padding: 7px;
  }
  .environment-bar {
    padding: 8px 15px;
    height: auto;
    align-items: start;
    flex-direction: column;
    gap: 4px;
  }
  main {
    padding: 22px 15px;
  }
  .view-heading {
    flex-direction: column;
    gap: 15px;
  }
  .library-form {
    grid-template-columns: 1fr;
  }
  .settings-list {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .notice {
    margin: 12px 15px 0;
  }
  footer {
    padding: 17px 15px;
    flex-direction: column;
  }
  .wizard-content {
    padding: 18px;
  }
  .table-toolbar {
    flex-direction: column;
  }
}
.workspace-switch select {
  font-size: 11px;
  background: #1e3a3f;
  color: #d4e6e3;
  border-color: #466062;
  padding: 5px;
  min-height: 30px;
  margin-top: 3px;
}
.workspace-switch label {
  font-size: 9px;
  color: var(--nav-muted);
}
.workspace-switch > div {
  min-width: 0;
  flex: 1;
}
.login-form {
  padding: 25px;
  max-width: 440px;
  display: grid;
  gap: 18px;
}
.login-form > h2,
.login-form > p,
.login-form > button {
  margin: 0;
}
:root[data-theme="dark"] {
  --bg: #152326;
  --surface: #1d3034;
  --ink: #deebe8;
  --muted: #a0b6b6;
  --line: #34494e;
  --accent: #6bbfa8;
  --accent-soft: #214b40;
  --shadow: none;
}
:root[data-theme="dark"] .topbar,
:root[data-theme="dark"] .stepper,
:root[data-theme="dark"] .step,
:root[data-theme="dark"] input,
:root[data-theme="dark"] select,
:root[data-theme="dark"] textarea,
:root[data-theme="dark"] .secondary {
  background: var(--surface);
  color: var(--ink);
}
:root[data-theme="dark"] .environment-bar,
:root[data-theme="dark"] th,
:root[data-theme="dark"] .search {
  background: #192c30;
}
:root[data-theme="dark"] .step.active,
:root[data-theme="dark"] .choice:has(input:checked),
:root[data-theme="dark"] .clickable:hover {
  background: #2a4942;
}
:root[data-theme="dark"] td,
:root[data-theme="dark"] .system-row {
  border-color: var(--line);
}

/* Public access shell: no internal navigation, including while session loads. */
[hidden] { display: none !important; }
body.auth-mode > .sidebar,
body.session-pending > .sidebar,
body.auth-mode .topbar,
body.session-pending .topbar,
body.auth-mode .environment-bar,
body.session-pending .environment-bar,
body.auth-mode .main-shell > footer,
body.session-pending .main-shell > footer { display: none; }
body.auth-mode .main-shell,
body.session-pending .main-shell { margin-left: 0; }
body.auth-mode main,
body.session-pending main { width: 100%; max-width: none; padding: 28px; }
body.auth-mode { background: #edf2ef; }
.session-loading { text-align: center; margin: 25vh auto; color: var(--muted); }
.auth-layout { width: min(100%, 420px); margin: 7vh auto; }
.auth-brand { display: flex; align-items: center; gap: 10px; width: fit-content; margin: 0 0 30px; font-size: 24px; letter-spacing: -.8px; font-weight: 750; color: #173d38; }
.auth-mark { display: grid; place-items: center; width: 36px; height: 40px; border-radius: 8px 8px 16px 8px; color: #d8eede; background: #173d38; font-family: Georgia, serif; }
.auth-card { width: 100%; max-width: none; padding: 32px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 16px 48px #183f3510; gap: 18px; }
.auth-card h1 { font-size: 29px; letter-spacing: -1px; margin: 0; }
.auth-card .auth-eyebrow { font-size: 10px; letter-spacing: 1.8px; color: var(--accent); font-weight: 700; }
.auth-card input { width: 100%; min-height: 44px; }
.auth-card button.primary { min-height: 46px; }
.auth-code-toggle { background: none; border: 0; padding: 0; color: var(--accent); text-align: left; width: fit-content; font-size: 12px; }
.auth-error { color: #a32e28; padding: 10px; background: #fff2ef; border-radius: 6px; }
.auth-footnote { padding-top: 14px; border-top: 1px solid var(--line); font-size: 11px; color: var(--muted); }
.settings-links { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 16px; }
.account-security > .view-heading { margin-top: 28px; }
body.auth-mode:has(.recovery-form) main { max-width: 720px; margin: auto; }
@media (max-width: 520px) {
  body.auth-mode main { padding: 22px 16px; }
  .auth-layout { margin: 3vh auto; }
  .auth-card { padding: 25px; }
}
body.auth-mode main:not(:has(.auth-layout)) { max-width: 760px; margin: auto; }
:root[data-theme="dark"] body.auth-mode { background: #122624; }
:root[data-theme="dark"] .auth-brand { color: #d8eede; }
