:root {
  color-scheme: light;
  --ink: #122c4b;
  --muted: #526779;
  --accent: #087c90;
  --deep: #102b50;
  --line: #d6e1e8;
  --paper: #f4f7fa;
  --white: #fff;
  --danger: #ac293e;
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; }
a { color: var(--accent); }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .58; }
:focus-visible { outline: 3px solid #168fa7; outline-offset: 3px; }
button, .button-link {
  display: inline-flex; align-items: center; justify-content: center;
  gap: .5rem; min-height: 42px; padding: .65rem 1rem;
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
  color: var(--ink); font-weight: 650; text-decoration: none;
}
button:hover:not(:disabled), .button-link:hover { background: #eaf3f7; }
button.primary { background: var(--deep); border-color: var(--deep); color: #fff; }
button.primary:hover:not(:disabled) { background: #174273; }
button.danger { color: var(--danger); border-color: #e6c5ce; }
button.small { min-height: 34px; padding: .35rem .65rem; font-size: .84rem; }
button.quiet { border-color: transparent; background: transparent; }
.skip-link { position: fixed; z-index: 20; top: 8px; left: 8px; transform: translateY(-150%); background: #fff; padding: 10px; }
.skip-link:focus { transform: translateY(0); }
.initial-loading, .noscript { padding: 3rem; }
.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(300px,.9fr) minmax(440px,1.1fr); }
.login-brand { background: var(--deep); color: #fff; padding: clamp(2rem,6vw,6rem); display: flex; flex-direction: column; justify-content: space-between; }
.wordmark { font-size: 2.2rem; font-weight: 760; letter-spacing: -.05em; }
.wordmark span { color: #8ed9e1; }
.login-brand h1 { font-size: clamp(2.1rem,3.5vw,3.5rem); line-height: 1.12; font-weight: 600; letter-spacing: -.04em; margin: 1rem 0; max-width: 450px; }
.login-brand p { color: #cbdce8; max-width: 380px; line-height: 1.7; }
.login-brand small { color: #bed0e0; }
.login-side { display: flex; align-items: center; justify-content: center; padding: 3rem 2rem; }
.login-card { width: min(100%,420px); }
.eyebrow { color: var(--accent); font-size: .75rem; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
h1, h2, h3, p { overflow-wrap: anywhere; }
.login-card h2 { font-size: 2rem; margin: .7rem 0; letter-spacing: -.03em; }
.muted, .hint { color: var(--muted); }
.hint { font-size: .84rem; line-height: 1.6; margin: .45rem 0 0; }
.login-card form { margin-top: 1.8rem; }
.login-card button[type=submit] { width: 100%; margin-top: .8rem; }
.field { display: grid; gap: .45rem; margin-bottom: 1rem; }
.field label, .field > span { font-size: .86rem; font-weight: 650; }
input, select, textarea { width: 100%; color: var(--ink); background: #fff; border: 1px solid #bacbd8; border-radius: 7px; padding: .72rem .8rem; min-height: 44px; }
textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
input:disabled, select:disabled { background: #eef3f7; color: var(--muted); }
input[type=checkbox] { width: 18px; min-height: 18px; height: 18px; accent-color: var(--accent); }
.check { display: flex; align-items: flex-start; gap: .7rem; font-size: .9rem; line-height: 1.45; padding: .45rem 0; }
.check input { flex: 0 0 auto; margin-top: 2px; }
.message { padding: .8rem 1rem; border-radius: 8px; line-height: 1.55; margin: 1rem 0; font-size: .9rem; }
.message.error { background: #fff1f3; color: #90253c; border: 1px solid #f0cdd4; }
.message.success { background: #e9f7f2; color: #216848; border: 1px solid #b5ddcb; }
.message.info { background: #eaf4f8; color: #24546c; border: 1px solid #bedce9; }
.topbar { min-height: 72px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 2rem; }
.topbar .wordmark { color: var(--deep); font-size: 1.5rem; }
.topbar .wordmark span { color: var(--accent); }
.topbar-title { display: flex; align-items: center; gap: 1.2rem; }
.topbar-title > span { padding-left: 1.2rem; border-left: 1px solid var(--line); font-size: .9rem; color: var(--muted); }
.account-tools { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; justify-content: flex-end; }
.identity { font-size: .86rem; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: .25rem .55rem; background: #eaf2f7; color: #3a5b72; font-size: .73rem; font-weight: 650; }
.badge.published { color: #246847; background: #e7f5ed; }
.badge.disabled { color: #9b3047; background: #fae9ee; }
.workspace { display: grid; grid-template-columns: 218px minmax(0,1fr); min-height: calc(100vh - 73px); }
.sidebar { background: #fff; border-right: 1px solid var(--line); padding: 1.8rem 1rem; }
.sidebar .eyebrow { display: block; padding: 0 .75rem; margin-bottom: 1rem; }
.sidebar nav { display: grid; gap: .5rem; }
.nav-button { justify-content: flex-start; border-color: transparent; min-height: 46px; font-weight: 550; }
.nav-button[aria-current=page] { background: #e5f1f5; color: #076b80; }
.sidebar-footer { font-size: .75rem; line-height: 1.7; color: var(--muted); padding: 2rem .75rem; }
.content { padding: 2.4rem clamp(1rem,3vw,3rem) 4rem; min-width: 0; max-width: 1550px; width: 100%; }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.7rem; }
.page-heading h1 { margin: .35rem 0 .6rem; font-size: 1.9rem; letter-spacing: -.03em; }
.page-heading p { margin: 0; font-size: .9rem; line-height: 1.6; max-width: 650px; color: var(--muted); }
.card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 1.5rem; margin-bottom: 1.3rem; }
.card h2 { margin: 0 0 1.2rem; font-size: 1.1rem; }
.card-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.2rem; }
.card-heading h2 { margin: 0; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th { color: var(--muted); text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 650; }
th, td { padding: .95rem .65rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th:first-child, td:first-child { padding-left: 0; }
td { overflow-wrap: anywhere; }
tbody tr:last-child td { border-bottom: 0; }
.record-name { display: block; font-weight: 650; margin-bottom: .3rem; }
.record-detail { display: block; color: var(--muted); font-size: .78rem; line-height: 1.5; }
.table-actions { display: flex; gap: .4rem; flex-wrap: wrap; min-width: 145px; }
.empty { text-align: center; padding: 2.5rem 1rem; color: var(--muted); line-height: 1.7; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 0 1.25rem; }
.full { grid-column: 1/-1; }
.form-actions { display: flex; align-items: center; gap: .7rem; margin-top: 1.25rem; flex-wrap: wrap; }
.section-rule { border: 0; border-top: 1px solid var(--line); margin: 1.5rem 0; }
.compact-form { max-width: 600px; }
.code-editor { font-family: Consolas, "Cascadia Code", ui-monospace, monospace; min-height: 360px; tab-size: 2; font-size: .86rem; white-space: pre; }
.editor-toolbar { display: flex; justify-content: space-between; gap: 1rem; align-items: center; margin-bottom: .8rem; flex-wrap: wrap; }
.editor-toolbar span { font-size: .84rem; color: var(--muted); }
.preview-frame { display: block; width: 100%; min-height: 450px; border: 1px solid var(--line); border-radius: 8px; background: white; }
.preview-note { font-size: .78rem; color: var(--muted); margin: .75rem 0 0; line-height: 1.55; }
.loading { padding: 2rem 0; color: var(--muted); }
.recovery { display: grid; place-items: center; gap: 1rem; min-height: 100vh; padding: 2rem; text-align: center; }
@media (max-width: 900px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-brand { padding: 2rem; }
  .login-brand h1 { font-size: 2.2rem; }
  .login-brand small { display: none; }
  .login-side { padding: 2.5rem 1.5rem; }
  .workspace { grid-template-columns: 1fr; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); padding: 1rem; }
  .sidebar .eyebrow, .sidebar-footer { display: none; }
  .sidebar nav { display: flex; flex-wrap: wrap; gap: .35rem; }
  .nav-button { min-height: 38px; padding: .5rem .7rem; font-size: .82rem; }
  .content { padding-top: 1.5rem; }
  .topbar { padding: 1rem; }
  .topbar-title > span { display: none; }
}
@media (max-width: 560px) {
  .form-grid { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; }
  .account-tools { gap: .4rem; }
  .account-tools button { font-size: .78rem; padding: .4rem .6rem; min-height: 34px; }
  .identity { text-align: right; width: 100%; }
  .card { padding: 1rem; }
  .page-heading { flex-direction: column; }
  .page-heading h1 { font-size: 1.65rem; }
}
