:root {
  color-scheme: light;
  --bg: #eef2f5;
  --panel: #ffffff;
  --text: #1d2733;
  --muted: #5d6978;
  --border: #d6dde6;
  --accent: #7a1f2b;
  --accent-strong: #55141d;
  --danger: #ad3434;
  --ok: #276749;
  --warning: #8a5b13;
  --soft: #f8fafb;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  background:
    linear-gradient(180deg, rgba(122, 31, 43, 0.12), rgba(238, 242, 245, 0) 260px),
    var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.vote-shell {
  width: min(980px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 42px;
}

.topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 14px;
}

.brand {
  align-items: baseline;
  color: var(--text);
  display: inline-flex;
  gap: 8px;
  font-weight: 700;
  letter-spacing: 0;
}

.app-version {
  background: #f7e8ea;
  border: 1px solid #e1bcc2;
  border-radius: 999px;
  color: var(--accent-strong);
  font-size: 12px;
  line-height: 1;
  padding: 4px 7px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 18px 45px rgba(25, 42, 58, 0.10);
  padding: 30px;
}

.narrow-panel {
  max-width: 520px;
  margin: 0 auto;
}

.resident-nav {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
  padding: 10px;
}

.resident-nav a {
  color: var(--accent-strong);
  font-weight: 700;
  padding: 8px 10px;
  text-decoration: none;
}

.resident-menu {
  position: relative;
}

.resident-menu-trigger {
  display: inline-block;
}

.resident-submenu {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 12px 28px rgba(25, 42, 58, 0.16);
  display: none;
  left: 0;
  min-width: 160px;
  padding: 6px;
  position: absolute;
  top: calc(100% + 4px);
  z-index: 20;
}

.resident-menu:hover .resident-submenu,
.resident-menu:focus-within .resident-submenu {
  display: block;
}

.resident-submenu a {
  border-radius: 5px;
  display: block;
  padding: 8px 10px;
  white-space: nowrap;
}

.resident-submenu a:hover,
.resident-submenu a:focus {
  background: #eef2f7;
}

.resident-nav form {
  margin-left: auto;
}

.resident-nav button,
.small-button {
  min-height: 34px;
  padding: 6px 10px;
}

.module-intro {
  align-items: flex-start;
  background: #f7fbfd;
  border: 1px solid var(--border);
  border-left: 5px solid var(--accent);
  border-radius: 8px;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 18px;
  padding: 18px;
}

.module-intro h1 {
  font-size: 26px;
}

.module-intro p {
  color: var(--muted);
  margin: 6px 0 0;
}

.help-button {
  border-radius: 999px;
  flex: 0 0 auto;
  min-height: 38px;
  padding: 8px 14px;
}

.grid {
  display: grid;
  gap: 16px;
}

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

.stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  margin-bottom: 16px;
}

.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px;
}

.stat-card strong {
  display: block;
  font-size: 28px;
}

.stat-card span {
  color: var(--muted);
}

.news-panel {
  background: #fff4d6;
  border: 1px solid #d8a541;
  border-left: 6px solid #a96b00;
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(91, 57, 0, 0.11);
  color: #3b2a0a;
  margin-bottom: 18px;
  padding: 20px;
}

.news-header {
  align-items: flex-start;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin-bottom: 12px;
}

.news-header h2 {
  color: #694300;
  margin: 0;
}

.news-header p {
  color: #76591f;
  margin: 4px 0 0;
}

.news-tools {
  align-items: flex-end;
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  gap: 8px;
}

.news-count {
  background: #704700;
  border-radius: 999px;
  color: #fff;
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 700;
  padding: 5px 10px;
}

.news-read-all {
  background: transparent;
  border: 1px solid #9b6b16;
  color: #694300;
  font-size: 12px;
  min-height: 32px;
  padding: 5px 9px;
}

.news-read-all:hover,
.news-read-all:focus {
  background: #fff9e9;
}

.news-error {
  color: #8f1f2f;
  font-size: 13px;
  font-weight: 700;
  margin: 0;
}

.news-error:not(:empty) {
  margin-bottom: 10px;
}

.news-list {
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(148, 94, 0, 0.26);
  border-radius: 6px;
  list-style: none;
  margin: 0;
  max-height: 430px;
  overflow-y: auto;
  padding: 0;
  scrollbar-gutter: stable;
}

.news-item {
  align-items: stretch;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
}

.news-item + .news-item {
  border-top: 1px solid rgba(148, 94, 0, 0.20);
}

.news-item a {
  align-items: center;
  color: #2f250f;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(104px, auto) minmax(0, 1fr) 20px;
  padding: 12px 14px;
  text-decoration: none;
}

.news-item a:hover,
.news-item a:focus {
  background: #fff9e9;
}

.news-kind {
  color: #7a4d00;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.news-copy {
  min-width: 0;
}

.news-copy strong,
.news-copy small {
  display: block;
  overflow-wrap: anywhere;
}

.news-copy small {
  color: #765f31;
  margin-top: 3px;
}

.news-arrow {
  color: #8a5b13;
  font-size: 26px;
  line-height: 1;
  text-align: right;
}

.news-read-button {
  align-self: center;
  background: transparent;
  border: 1px solid #b88a35;
  color: #694300;
  display: inline-flex;
  font-size: 12px;
  gap: 5px;
  margin-right: 10px;
  min-height: 32px;
  padding: 5px 8px;
}

.news-read-button:hover,
.news-read-button:focus {
  background: #fff;
}

.news-read-button:disabled,
.news-read-all:disabled {
  cursor: wait;
  opacity: 0.6;
}

.news-action .news-kind {
  color: #8f1f2f;
}

.news-status .news-kind {
  color: #365f82;
}

.news-calendar .news-kind {
  color: #276749;
}

.news-empty {
  color: #765f31;
  padding: 16px 14px;
}

tr:target td {
  background: #fff4d6;
}

.calendar-item:target {
  box-shadow: 0 0 0 3px rgba(169, 107, 0, 0.32);
}

table {
  border-collapse: collapse;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--border);
  padding: 10px;
  text-align: left;
  vertical-align: top;
}

th {
  background: #eef5f7;
}

.stack-form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

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

label {
  display: grid;
  gap: 6px;
  font-weight: 700;
}

input,
select,
textarea {
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
  padding: 10px;
}

.message-body {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fbfcfd;
  margin-top: 16px;
  padding: 16px;
}

.message-frame {
  background: #fbfcfd;
  border: 1px solid var(--border);
  border-radius: 6px;
  display: block;
  margin-top: 16px;
  min-height: 320px;
  width: 100%;
}

.calendar-toolbar {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  margin-bottom: 18px;
}

.calendar-toolbar h2 {
  flex: 1 1 220px;
  margin: 0;
  text-align: center;
}

.calendar-jump {
  align-items: center;
  display: flex;
  gap: 8px;
}

.calendar-jump input {
  width: 96px;
}

.calendar-scroll {
  overflow-x: auto;
  overflow-y: visible;
  padding-bottom: 6px;
}

.calendar-grid {
  background: var(--border);
  border: 1px solid var(--border);
  display: grid;
  gap: 1px;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  min-width: 760px;
}

.calendar-head {
  background: #eef5f7;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  padding: 8px;
  text-align: center;
}

.calendar-day {
  background: #fff;
  min-height: 118px;
  padding: 8px;
  position: relative;
}

.calendar-day.outside {
  background: #f4f7f9;
  color: #8793a1;
}

.calendar-day.today {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.calendar-day.has-event {
  background: #f6fbfd;
}

.calendar-date {
  align-items: center;
  border-radius: 999px;
  display: inline-flex;
  font-weight: 700;
  height: 28px;
  justify-content: center;
  min-width: 28px;
}

.calendar-day.has-event .calendar-date {
  background: var(--accent);
  color: #fff;
}

.calendar-items {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.calendar-item {
  appearance: none;
  background: #e9f5f8;
  border-left: 4px solid var(--accent);
  border-radius: 6px;
  color: #153d4d;
  cursor: default;
  min-height: auto;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
  padding: 7px 8px;
  position: relative;
  text-align: left;
  width: 100%;
}

.calendar-item:hover {
  background: #dceff5;
}

.calendar-tooltip {
  background: #172633;
  border-radius: 6px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.24);
  color: #fff;
  display: none;
  font-weight: 400;
  left: 0;
  max-width: min(340px, 78vw);
  padding: 10px 12px;
  position: absolute;
  top: calc(100% + 8px);
  white-space: pre-line;
  width: max-content;
  z-index: 20;
}

.calendar-item:hover .calendar-tooltip,
.calendar-item:focus .calendar-tooltip {
  display: block;
}

.modal-open {
  overflow: hidden;
}

.calendar-detail-backdrop {
  align-items: center;
  background: rgba(13, 27, 32, 0.62);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 20px;
  position: fixed;
  z-index: 120;
}

.calendar-detail-box {
  background: var(--panel);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.26);
  max-width: min(620px, calc(100vw - 32px));
  padding: 24px;
  position: relative;
  width: 100%;
}

.calendar-detail-box h2 {
  margin: 0 42px 14px 0;
}

.calendar-detail-body {
  background: #fbfcfd;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: #24313d;
  padding: 14px;
  white-space: pre-line;
}

.calendar-detail-close {
  min-height: 34px;
  padding: 4px 10px;
  position: absolute;
  right: 12px;
  top: 12px;
}

.clean-list {
  margin: 0;
  padding-left: 20px;
}

.help-backdrop {
  align-items: center;
  background: rgba(13, 27, 32, 0.62);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 20px;
  position: fixed;
  z-index: 100;
}

.help-box {
  background: var(--panel);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.26);
  max-width: 560px;
  padding: 24px;
  position: relative;
}

.help-close {
  min-height: 34px;
  padding: 4px 10px;
  position: absolute;
  right: 12px;
  top: 12px;
}

.vote-panel {
  overflow: hidden;
}

h1 {
  margin: 0 0 8px;
  font-size: 34px;
  line-height: 1.15;
}

h2 {
  margin: 28px 0 12px;
  font-size: 20px;
}

.lead {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
}

.meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 24px 0;
}

.meta-item {
  border: 1px solid var(--border);
  background: var(--soft);
  border-radius: 6px;
  padding: 12px;
  min-height: 74px;
}

.meta-label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 4px;
}

.resolution-body {
  white-space: pre-wrap;
  border: 1px solid var(--border);
  border-left: 5px solid var(--accent);
  border-radius: 6px;
  background: #fbfcfd;
  max-height: 360px;
  overflow: auto;
  padding: 16px 18px;
  color: #25313f;
}

.attachments {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #f7fbfd;
  margin-top: 18px;
  padding: 12px 14px;
}

.attachments h2 {
  margin-top: 0;
}

.attachments ul {
  margin: 0;
  padding-left: 20px;
}

.attachments a {
  color: var(--accent-strong);
  font-weight: 700;
}

.vote-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0;
}

.vote-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: 96px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 6px;
  padding: 14px;
  cursor: pointer;
  transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

.vote-option:hover {
  transform: translateY(-1px);
}

.vote-option:has(input:checked) {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(31, 111, 139, 0.14);
}

.vote-option strong,
.vote-option small {
  display: block;
}

.vote-option small {
  color: var(--muted);
  margin-top: 4px;
}

.vote-for:has(input:checked) {
  border-color: var(--ok);
  box-shadow: 0 0 0 2px rgba(39, 103, 73, 0.16);
}

.vote-against:has(input:checked) {
  border-color: var(--danger);
  box-shadow: 0 0 0 2px rgba(173, 52, 52, 0.14);
}

.vote-abstain:has(input:checked) {
  border-color: var(--warning);
  box-shadow: 0 0 0 2px rgba(138, 91, 19, 0.14);
}

.vote-option input,
.confirm-row input {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.confirm-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 20px 0;
  color: #2f3b48;
}

.file-row,
.file-drop {
  display: grid;
  gap: 12px;
  border: 1px dashed #9aa9b8;
  border-radius: 6px;
  background: #fbfcfd;
  padding: 16px;
  color: #2f3b48;
}

.file-drop.is-dragover {
  border-color: var(--accent);
  background: #eef8fb;
  box-shadow: 0 0 0 3px rgba(31, 111, 139, 0.12) inset;
}

.file-drop-copy {
  display: grid;
  gap: 4px;
}

.file-drop-copy span {
  color: var(--muted);
}

.file-row input,
.file-input {
  width: 100%;
}

.file-input {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  padding: 10px;
}

.file-list {
  display: grid;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.file-list li {
  align-items: center;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  min-height: 42px;
  padding: 8px 10px;
}

.file-list li.muted {
  color: var(--muted);
  justify-content: flex-start;
}

.remove-file {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--danger);
  min-height: 34px;
  padding: 6px 10px;
}

.remove-file:hover {
  background: #fff3f3;
}

.actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 22px;
}

button,
.button {
  appearance: none;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: white;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  min-height: 44px;
  padding: 10px 18px;
  text-decoration: none;
}

button:hover,
.button:hover {
  background: var(--accent-strong);
}

.secondary-button {
  background: #eef2f7;
  color: var(--text);
}

.secondary-button:hover {
  background: #dde5ef;
}

.notice {
  border: 1px solid #b7d6c4;
  background: #eef8f1;
  border-radius: 6px;
  color: var(--ok);
  padding: 14px;
  margin-top: 20px;
}

.warning {
  border: 1px solid #e5c98f;
  background: #fff8e8;
  border-radius: 6px;
  color: var(--warning);
  padding: 14px;
  margin-top: 20px;
}

.error {
  border: 1px solid #e0b4b4;
  background: #fff3f3;
  border-radius: 6px;
  color: var(--danger);
  padding: 14px;
  margin-top: 20px;
}

.footnote {
  margin-top: 18px;
  color: var(--muted);
  font-size: 13px;
}

.info-board {
  margin: 22px 0;
}

.info-board h2 {
  margin: 0 0 10px;
}

.info-sheet {
  background: #fff;
  border: 1px solid #d8d8d8;
  border-radius: 2px;
  color: #171717;
  margin: 0 0 12px;
  padding: 18px 20px;
}

.info-sheet h3 {
  font-size: 15px;
  margin: 0 0 10px;
}

.info-sheet-text {
  line-height: 1.65;
  max-height: 260px;
  overflow-wrap: anywhere;
  overflow-y: scroll;
  overscroll-behavior: contain;
  padding-right: 8px;
  scrollbar-gutter: stable;
}

.info-sheet-text > :first-child {
  margin-top: 0;
}

.info-sheet-text > :last-child {
  margin-bottom: 0;
}

@media print {
  body {
    background: #fff;
  }

  .vote-shell {
    width: auto;
    padding: 0;
  }

  .topline,
  .confirmation-actions {
    display: none;
  }

  .panel {
    border: 0;
    box-shadow: none;
    padding: 0;
  }
}

@media (max-width: 680px) {
  .vote-shell {
    width: min(100vw - 20px, 920px);
    padding: 16px 0;
  }

  .panel {
    padding: 18px;
  }

  .topline,
  .actions {
    align-items: stretch;
    flex-direction: column;
  }

  .meta {
    grid-template-columns: 1fr;
  }

  .vote-options {
    grid-template-columns: 1fr;
  }

  .calendar-toolbar,
  .calendar-jump {
    align-items: stretch;
    flex-direction: column;
    width: 100%;
  }

  .calendar-toolbar h2 {
    text-align: left;
  }

  .news-header {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  .news-count {
    align-self: flex-start;
  }

  .news-tools {
    align-items: flex-start;
  }

  .news-item a {
    grid-template-columns: 1fr 18px;
  }

  .news-kind {
    grid-column: 1 / -1;
  }

  .news-read-button {
    margin-right: 8px;
    width: auto;
  }

  .news-read-all {
    width: auto;
  }

  .calendar-jump input,
  .calendar-jump select {
    width: 100%;
  }

  button,
  .button {
    width: 100%;
  }
}
