:root {
  color-scheme: light;
  font-family: Inter, system-ui, sans-serif;
  color: #10264b;
  background: #f2f6fc;
  font-synthesis: none;
  --navy: #092b63;
  --blue: #0b50b8;
  --blue-soft: #eaf2ff;
  --orange: #b74400;
  --orange-dark: #953800;
  --muted: #465975;
  --line: #d7e1ed;
  --white: #fff;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .56; }
h1, h2, h3, p { margin: 0; }
:focus-visible { outline: 3px solid #0b50b8; outline-offset: 3px; }

.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  align-items: center;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin-inline: auto;
  max-width: 78rem;
  min-height: 4.5rem;
  padding: .7rem 1.5rem;
}

.brand {
  align-items: center;
  color: var(--navy);
  display: inline-flex;
  gap: .65rem;
  line-height: 1.2;
  text-decoration: none;
}

.brand strong { display: block; font-size: .97rem; }
.brand strong + span { color: var(--muted); display: block; font-size: .75rem; margin-top: .2rem; }
.brand-logo {
  display: block;
  flex: none;
  object-fit: contain;
}

.header-actions, .publish-actions, .item-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.button {
  align-items: center;
  border: 1px solid transparent;
  border-radius: .6rem;
  display: inline-flex;
  font-size: .875rem;
  font-weight: 650;
  gap: .4rem;
  justify-content: center;
  line-height: 1.25;
  min-height: 2.65rem;
  padding: .55rem .85rem;
  text-align: center;
  text-decoration: none;
}
.primary { background: var(--orange); color: var(--white); }
.primary:not(:disabled):hover { background: var(--orange-dark); }
.secondary { background: var(--blue-soft); color: var(--navy); }
.secondary:not(:disabled):hover { background: #dceaff; }
.ghost { background: var(--white); border-color: var(--line); color: var(--navy); }
.ghost:hover, .quiet:not(:disabled):hover { background: var(--blue-soft); }
.quiet { background: transparent; color: var(--navy); }

.auth-view, .loading-area { margin: 0 auto; max-width: 32rem; padding: clamp(2rem, 9vw, 6rem) 1.25rem; }
.loading-area { text-align: center; }
.loading-area button { margin-top: 1rem; }
.auth-card, .section-panel, .sidebar, .publish-bar {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 1rem;
}
.auth-card { box-shadow: 0 1rem 2.2rem #092b630e; padding: clamp(1.3rem, 5vw, 2.6rem); }
.auth-card h1, .editor-heading h1 { color: var(--navy); font-size: clamp(1.5rem, 4vw, 2.1rem); letter-spacing: -.03em; line-height: 1.17; }
.auth-card h1 + p, .editor-heading h1 + p, .section-heading h2 + p { color: var(--muted); line-height: 1.55; margin-top: .45rem; }
.auth-card form { display: grid; gap: .65rem; margin-top: 1.6rem; }
.auth-card .primary { margin-top: .3rem; }
#token-field, #confirm-field { display: grid; gap: .6rem; }
#managed-signin { margin-top: 1.2rem; }

.editor-shell { margin: 0 auto; max-width: 78rem; padding: 2.3rem 1.5rem 3rem; }
.editor-heading { margin-bottom: 1.5rem; }
.editor-layout { align-items: start; display: grid; gap: 1.1rem; grid-template-columns: 14.5rem minmax(0, 1fr); }
.sidebar { padding: .45rem; position: sticky; top: 1rem; }
.sidebar nav { display: grid; gap: .17rem; }
.nav-button {
  background: transparent;
  border: 0;
  border-radius: .56rem;
  color: var(--muted);
  font-size: .875rem;
  font-weight: 600;
  min-height: 2.65rem;
  padding: .62rem .7rem;
  text-align: left;
}
.nav-button:hover { background: #f3f7fd; color: var(--navy); }
.nav-button[aria-current="true"] { background: var(--blue-soft); box-shadow: inset .2rem 0 var(--blue); color: var(--navy); }
.section-picker { display: none; }

#editor-form { min-width: 0; }
.section-panel { overflow: clip; }
.section-heading { border-bottom: 1px solid var(--line); padding: 1.4rem 1.55rem; }
.section-heading h2 { color: var(--navy); font-size: 1.35rem; letter-spacing: -.015em; }
.section-heading p { font-size: .9rem; }
fieldset { border: 0; margin: 0; min-width: 0; padding: 1.4rem 1.55rem 1.55rem; }
.fields-grid { display: grid; gap: 1.15rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field { align-content: start; display: grid; gap: .42rem; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
label { color: var(--navy); font-size: .875rem; font-weight: 650; }
input, textarea, select {
  background: var(--white);
  border: 1px solid #aabbd1;
  border-radius: .48rem;
  color: #10264b;
  line-height: 1.4;
  min-height: 2.65rem;
  padding: .63rem .72rem;
  width: 100%;
}
textarea { min-height: 5.5rem; resize: vertical; }
.help { color: var(--muted); font-size: .79rem; line-height: 1.45; }
.field-error { color: #9b241b; font-size: .79rem; line-height: 1.4; }
[aria-invalid="true"] { border-color: #ab241b; }
.field-group { margin-top: 1.55rem; }
.field-group-title { color: var(--navy); font-size: 1rem; margin-bottom: .45rem; }
.items-list { display: grid; gap: .65rem; margin: .8rem 0; }
.item-card { background: #f7faff; border: 1px solid var(--line); border-radius: .65rem; padding: .9rem; }
.item-header { align-items: center; display: flex; flex-wrap: wrap; gap: .6rem; justify-content: space-between; margin-bottom: .65rem; }
.item-header strong { color: var(--navy); font-size: .85rem; }
.compact { font-size: .8rem; min-height: 2.35rem; padding: .45rem .55rem; }
.remove { color: #9b241b; }
.remove:not(:disabled):hover { background: #fff0ee; }

.notice {
  border: 1px solid #edb6b1;
  border-radius: .62rem;
  color: #842820;
  font-size: .88rem;
  line-height: 1.5;
  margin-bottom: .75rem;
  overflow-wrap: anywhere;
  padding: .65rem .8rem;
}
.error { background: #fff2f0; }
.publish-bar {
  align-items: center;
  bottom: .75rem;
  box-shadow: 0 .35rem 1.5rem #092b6318;
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  justify-content: space-between;
  margin-top: .75rem;
  padding: .72rem .85rem;
  position: sticky;
  z-index: 1;
}
.publish-bar p { color: var(--muted); flex: 1 1 12rem; font-size: .85rem; line-height: 1.4; }
.publish-bar p[data-tone="success"] { color: #236143; }
.publish-bar p[data-tone="error"] { color: #9b241b; }

@media (max-width: 760px) {
  .editor-layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar { padding: .75rem; position: static; }
  .sidebar nav { display: none; }
  .section-picker { display: grid; gap: .5rem; }
  .topbar-inner, .editor-shell { padding-inline: 1rem; }
  .editor-shell { padding-top: 1.55rem; }
  .section-heading, fieldset { padding: 1rem; }
}

@media (max-width: 510px) {
  .fields-grid { grid-template-columns: minmax(0, 1fr); }
  .topbar-inner { align-items: flex-start; flex-wrap: wrap; }
  .topbar-inner .button { min-height: 2.35rem; }
  .brand { min-height: 2.35rem; }
  .publish-bar { gap: .45rem; }
}
