:root {
  --paper: #f3efe6;
  --paper-deep: #e8e0d2;
  --surface: #fffdf8;
  --ink: #171612;
  --ink-soft: #28261f;
  --muted: #625d54;
  --line: #d4ccbd;
  --line-strong: #91887b;
  --accent: #b93620;
  --accent-dark: #8d2818;
  --accent-soft: #f0d8d0;
  --mustard: #e8b83e;
  --mustard-soft: #f6e9b8;
  --green: #246548;
  --green-soft: #dbece3;
  --blue: #2d5d7b;
  --blue-soft: #dce9ef;
  --gray-soft: #e7e3db;
  --display: "Avenir Next", Avenir, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --radius-sm: 10px;
  --radius-md: 18px;
  --radius-lg: 28px;
  --shadow: 0 18px 44px rgba(32, 27, 19, 0.09);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 92px;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
}

body::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  background-image:
    linear-gradient(rgba(23, 22, 18, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 22, 18, 0.025) 1px, transparent 1px);
  background-size: 28px 28px;
  content: "";
  pointer-events: none;
}

[hidden] {
  display: none !important;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
  box-shadow: 0 0 0 6px var(--mustard);
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 12px;
  left: 12px;
  transform: translateY(-150%);
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: #fff;
  padding: 10px 16px;
  font-weight: 750;
  text-decoration: none;
}

.skip-link:focus {
  transform: translateY(0);
}

.admin-header {
  position: sticky;
  z-index: 40;
  top: 0;
  border-bottom: 1px solid rgba(145, 136, 123, 0.65);
  background: rgba(243, 239, 230, 0.94);
  backdrop-filter: blur(16px) saturate(130%);
}

.topbar {
  display: flex;
  width: min(1320px, calc(100% - 48px));
  min-height: 70px;
  margin: 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
}

.brand-logo-wrap {
  position: relative;
  display: block;
  width: 54px;
  height: 54px;
  overflow: hidden;
  flex: 0 0 auto;
}

.brand-logo {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 75px;
  height: 63px;
  max-width: none;
  object-fit: contain;
  transform: translate(-50%, -50%);
}

.brand-copy {
  display: grid;
  line-height: 1.05;
}

.brand-copy strong {
  font-size: 0.94rem;
  letter-spacing: -0.02em;
}

.brand-copy small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.67rem;
  font-weight: 750;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.topbar-link {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 8px 14px;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 750;
  text-decoration: none;
  transition: background 150ms ease, color 150ms ease;
}

.topbar-link::before {
  content: "\2190";
}

.topbar-link:hover {
  background: var(--ink);
  color: #fff;
}

.admin-hero {
  width: min(1320px, calc(100% - 48px));
  margin: 0 auto;
  padding: 58px 0 30px;
}

.admin-hero .eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.admin-hero h1 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(2.8rem, 5vw, 4.7rem);
  font-weight: 500;
  letter-spacing: -0.055em;
  line-height: 0.98;
}

.admin-hero p:last-child {
  max-width: 58ch;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1rem;
}

.admin-main {
  width: min(1320px, calc(100% - 48px));
  margin: 0 auto;
  padding: 0 0 90px;
}

.login-panel {
  display: grid;
  max-width: 880px;
  min-height: 440px;
  margin: 12px auto 0;
  grid-template-columns: minmax(270px, 0.82fr) minmax(320px, 1.18fr);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-identity {
  position: relative;
  display: flex;
  overflow: hidden;
  padding: 34px;
  flex-direction: column;
  justify-content: space-between;
  background: var(--ink);
  color: #fff;
}

.login-identity::after {
  position: absolute;
  right: -60px;
  bottom: -90px;
  width: 250px;
  height: 250px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  content: "";
}

.login-logo {
  width: 126px;
  height: 126px;
  border-radius: 50%;
  background: var(--paper);
  object-fit: contain;
  padding: 6px;
}

.login-identity strong {
  position: relative;
  z-index: 1;
  max-width: 13ch;
  font-family: var(--display);
  font-size: 2rem;
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 1.05;
}

.login-form {
  display: flex;
  padding: clamp(30px, 6vw, 60px);
  flex-direction: column;
  justify-content: center;
}

.login-form h2 {
  margin: 0 0 7px;
  font-family: var(--display);
  font-size: 2rem;
  font-weight: 500;
  letter-spacing: -0.04em;
}

.login-form > p {
  margin: 0 0 26px;
  color: var(--muted);
  font-size: 0.86rem;
}

#login-msg {
  min-height: 1.4em;
  margin: -3px 0 12px;
  color: var(--accent-dark);
  font-size: 0.8rem;
  font-weight: 700;
}

.admin-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 26px;
  align-items: start;
}

.admin-sidebar {
  position: sticky;
  top: 94px;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: var(--ink);
  color: #fff;
  padding: 17px;
}

.sidebar-label {
  margin: 4px 9px 12px;
  color: rgba(255, 255, 255, 0.46);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.admin-nav {
  display: grid;
  gap: 3px;
}

.admin-nav a {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-radius: 10px;
  padding: 9px 11px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.79rem;
  font-weight: 700;
  text-decoration: none;
  transition: background 150ms ease, color 150ms ease;
}

.admin-nav a:hover,
.admin-nav a:focus-visible {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.nav-count {
  min-width: 24px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  padding: 2px 6px;
  color: rgba(255, 255, 255, 0.66);
  font-size: 0.65rem;
  text-align: center;
}

.sidebar-actions {
  display: grid;
  margin-top: 20px;
  padding-top: 15px;
  gap: 5px;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.sidebar-button {
  min-height: 40px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: rgba(255, 255, 255, 0.68);
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 700;
  text-align: left;
}

.sidebar-button:hover {
  color: #fff;
}

.sidebar-button.logout {
  color: #f5b5a8;
}

.admin-content {
  min-width: 0;
}

.overview {
  margin-bottom: 28px;
  scroll-margin-top: 94px;
}

.overview-heading {
  display: flex;
  margin-bottom: 14px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.overview-heading h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 2rem;
  font-weight: 500;
  letter-spacing: -0.04em;
}

.overview-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.stat-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  padding: 18px;
}

.stat-label {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.055em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.stat-value {
  display: block;
  margin-top: 8px;
  font-family: var(--display);
  font-size: 2rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
  line-height: 1;
}

.workspace-section {
  margin-top: 26px;
  scroll-margin-top: 94px;
}

.workspace-card {
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: rgba(255, 253, 248, 0.72);
}

.workspace-head {
  display: flex;
  padding: 25px 27px;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.workspace-index {
  display: block;
  margin-bottom: 6px;
  color: var(--accent);
  font-size: 0.67rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.workspace-head h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 2rem;
  font-weight: 500;
  letter-spacing: -0.04em;
}

.workspace-head p {
  max-width: 44ch;
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: right;
}

.workspace-body {
  padding: 18px;
}

.editor-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.86fr) minmax(360px, 1.14fr);
  gap: 14px;
  align-items: start;
}

.editor-grid.equal {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  padding: 21px;
}

.panel h3 {
  margin: 0 0 18px;
  font-size: 0.94rem;
  letter-spacing: -0.015em;
}

.panel-hint {
  margin: -10px 0 18px;
  color: var(--muted);
  font-size: 0.75rem;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

label,
.field-label {
  display: block;
  margin: 0 0 5px;
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 750;
}

input,
textarea,
select {
  width: 100%;
  min-height: 43px;
  margin: 0 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  padding: 9px 11px;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

input:hover,
textarea:hover,
select:hover {
  border-color: var(--ink-soft);
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--ink);
  outline: 2px solid var(--ink);
  outline-offset: 2px;
  box-shadow: 0 0 0 5px var(--mustard);
}

textarea {
  min-height: 88px;
  resize: vertical;
}

input[type="checkbox"] {
  width: 19px;
  min-height: 19px;
  margin: 0;
  accent-color: var(--accent);
}

.check-row {
  display: inline-flex;
  min-height: 40px;
  margin: -2px 0 13px;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

button {
  border: 0;
}

.btn {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  padding: 8px 16px;
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 750;
  transition: transform 150ms ease, background 150ms ease, color 150ms ease;
}

.btn:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
  background: var(--accent);
}

.btn:disabled {
  cursor: wait;
  opacity: 0.55;
}

.btn.ghost {
  border-color: var(--line-strong);
  background: transparent;
  color: var(--ink);
}

.btn.ghost:hover {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.btn.danger {
  border-color: var(--accent);
  background: transparent;
  color: var(--accent-dark);
}

.btn.danger:hover {
  background: var(--accent);
  color: #fff;
}

.btn.small {
  min-height: 36px;
  padding: 6px 11px;
  font-size: 0.7rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

.list {
  display: grid;
  gap: 0;
}

.list > article {
  min-width: 0;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.list > article:first-child {
  padding-top: 0;
}

.list > article:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.standalone-list {
  margin-top: 14px;
}

.standalone-list > article {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  padding: 18px;
}

.standalone-list > article + article {
  margin-top: 10px;
}

.row-head {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.row-head > div {
  min-width: 0;
}

.row-title {
  overflow-wrap: anywhere;
  font-size: 0.88rem;
  font-weight: 750;
  letter-spacing: -0.015em;
}

.muted {
  color: var(--muted);
}

.small {
  overflow-wrap: anywhere;
  font-size: 0.75rem;
}

.item-actions {
  margin-top: 10px;
}

.badge {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 0.61rem;
  font-weight: 800;
  letter-spacing: 0.075em;
  line-height: 1;
  text-transform: uppercase;
}

.badge::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.badge.open,
.badge.submitted,
.badge.accepted,
.badge.active {
  background: var(--green-soft);
  color: var(--green);
}

.badge.planned,
.badge.deferred {
  background: var(--mustard-soft);
  color: #72550b;
}

.badge.closed,
.badge.withdrawn,
.badge.inactive {
  background: var(--gray-soft);
  color: var(--muted);
}

.badge.rejected {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.inline-select {
  width: auto;
  min-width: 160px;
  min-height: 36px;
  margin: 0;
  padding: 6px 9px;
  font-size: 0.72rem;
}

.agenda {
  margin: 14px 0 0;
  padding: 13px 0 0 23px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.75rem;
}

.agenda li {
  margin: 5px 0;
  padding-left: 2px;
}

.agenda button {
  margin-left: 7px;
}

.result-row {
  margin: 12px 0;
}

.result-row .label {
  display: flex;
  margin-bottom: 5px;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
}

.bar {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--gray-soft);
}

.bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
}

.bar.yes span {
  background: var(--green);
}

.bar.no span {
  background: var(--accent);
}

.bar.abstain span {
  background: var(--line-strong);
}

.empty {
  margin: 0;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 16px;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
}

.toast-region {
  position: fixed;
  z-index: 90;
  right: 18px;
  bottom: 18px;
  display: grid;
  width: min(360px, calc(100% - 36px));
  gap: 8px;
  pointer-events: none;
}

.toast {
  border: 1px solid var(--line-strong);
  border-left: 4px solid var(--green);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 13px 15px;
  box-shadow: 0 12px 34px rgba(23, 22, 18, 0.16);
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 700;
  pointer-events: auto;
}

.toast.error {
  border-left-color: var(--accent);
}

@media (max-width: 1040px) {
  .admin-layout {
    grid-template-columns: 190px minmax(0, 1fr);
    gap: 18px;
  }

  .editor-grid,
  .editor-grid.equal {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  html {
    scroll-padding-top: 0;
  }

  .topbar,
  .admin-hero,
  .admin-main {
    width: min(100% - 30px, 1320px);
  }

  .topbar {
    min-height: 64px;
  }

  .brand-copy small {
    display: none;
  }

  .admin-hero {
    padding: 38px 0 24px;
  }

  .admin-layout {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    position: sticky;
    z-index: 30;
    top: 73px;
    display: grid;
    overflow: hidden;
    gap: 6px;
    padding: 8px;
    border-radius: 13px;
  }

  .sidebar-label {
    display: none;
  }

  .admin-nav {
    display: flex;
    width: 100%;
    overflow-x: auto;
    padding: 4px;
    scroll-padding-inline: 4px;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
  }

  .admin-nav a {
    min-height: 44px;
    flex: 0 0 auto;
    scroll-snap-align: start;
  }

  .sidebar-actions {
    display: flex;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 4px;
    border: 0;
  }

  .sidebar-button {
    min-height: 44px;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 9px;
    padding: 7px 10px;
    white-space: nowrap;
  }

  .overview,
  .workspace-section {
    scroll-margin-top: 200px;
  }

  .workspace-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .workspace-head p {
    text-align: left;
  }

  input,
  select,
  textarea {
    min-height: 48px;
    scroll-margin-top: 195px;
    font-size: 16px;
  }

  textarea {
    min-height: 88px;
  }

  .inline-select {
    min-height: 48px;
  }

  .topbar-link {
    min-height: 44px;
  }

  .btn,
  .btn.small,
  .check-row {
    min-height: 44px;
  }

  .badge {
    font-size: 0.72rem;
  }

  label,
  .field-label {
    font-size: 0.76rem;
  }

  .agenda li {
    overflow-wrap: anywhere;
  }
}

@media (max-width: 680px) {
  .brand-logo-wrap {
    width: 46px;
    height: 46px;
  }

  .brand-logo {
    width: 64px;
    height: 54px;
  }

  .login-panel {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .login-identity {
    min-height: 0;
    padding: 16px 20px;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 16px;
  }

  .login-identity::after {
    display: none;
  }

  .login-logo {
    width: 64px;
    height: 64px;
    flex: 0 0 auto;
  }

  .login-identity strong {
    max-width: none;
    font-size: 1.25rem;
  }

  .login-form {
    padding: 25px 24px 30px;
  }

  .login-form .btn {
    width: 100%;
  }

  .admin-hero {
    padding: 24px 0 18px;
  }

  .admin-main {
    padding-bottom: 65px;
  }

  .overview-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stat-card {
    padding: 15px;
  }

  .workspace-head {
    padding: 21px;
  }

  .workspace-body {
    padding: 11px;
  }

  .panel {
    padding: 17px;
  }

  .form-row {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .row-head {
    gap: 9px;
  }

  .inline-select {
    width: 100%;
  }
}

@media (max-width: 420px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .stat-label {
    overflow: visible;
    text-overflow: initial;
    white-space: normal;
  }

  .row-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .badge {
    align-self: flex-start;
  }

  .agenda button {
    display: flex;
    min-height: 44px;
    margin: 8px 0 0;
  }

  .item-actions .btn,
  .item-actions .inline-select {
    flex: 1 1 100%;
  }
}

@media (max-width: 360px) {
  .topbar,
  .admin-hero,
  .admin-main {
    width: calc(100% - 20px);
  }

  .topbar {
    gap: 8px;
  }

  .brand {
    gap: 7px;
  }

  .topbar-link {
    padding-inline: 10px;
    font-size: 0.72rem;
  }

  .admin-hero h1 {
    font-size: 2.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
