:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --panel-strong: #eef4ff;
  --primary: #0d6efd;
  --primary-dark: #0b5ed7;
  --secondary: #eef2ff;
  --text: #152033;
  --muted: #6b7280;
  --border: #dfe6f1;
  --danger: #dc3545;
  --warning: #b7791f;
  --success: #198754;
  --shadow: 0 12px 28px rgba(17, 24, 39, 0.1);
  --control-large-height: 44px;
  --control-medium-height: 36px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Segoe UI", Tahoma, sans-serif;
  background: linear-gradient(180deg, #eef6ff 0%, #f4f7fb 22%, #f9fafb 100%);
  color: var(--text);
}

body {
  display: flex;
  justify-content: center;
  padding: 18px 12px 40px;
}

button,
input,
select {
  font: inherit;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.button-large {
  --button-control-size: var(--control-large-height);
  height: var(--control-large-height);
  min-height: var(--control-large-height);
  padding: 0 16px;
}

.button-small {
  --button-control-size: var(--control-medium-height);
  height: var(--control-medium-height);
  min-height: var(--control-medium-height);
  padding: 0 12px;
  font-size: 14px;
}

.button.icon-button {
  width: var(--button-control-size, var(--control-large-height));
  min-width: var(--button-control-size, var(--control-large-height));
  padding: 0;
}

.button-large.icon-button img {
  width: 26px;
  height: 26px;
}

.button-small.icon-button img {
  width: 20px;
  height: 20px;
}

.button:hover {
  transform: translateY(-1px);
}

#app {
  width: min(100%, 760px);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  padding: 8px 2px;
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: var(--control-large-height);
  min-width: var(--control-large-height);
  height: var(--control-large-height);
  min-height: var(--control-large-height);
  padding: 0;
  place-items: center;
  overflow: hidden;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), #6ea8fe);
  box-shadow: var(--shadow);
}

.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.room-heading {
  min-width: 0;
}

.room-code-subtitle {
  margin-top: 2px;
  font-size: 0.75rem;
  color: var(--muted);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(1.3rem, 2vw, 2rem);
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-family: "Segoe UI", "Trebuchet MS", "Arial Black", sans-serif;
}

.screen {
  display: block;
}

.hidden {
  display: none !important;
}

body.app-initializing #app {
  visibility: hidden;
}

.card {
  margin-bottom: 16px;
  padding: 16px 14px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.card.subtle {
  background: #f8fbff;
}

.install-card {
  margin-bottom: 12px;
  padding: 12px 14px;
  background: var(--panel-strong);
}

.install-card-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.install-card h2 {
  font-size: 1rem;
}

.install-description {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.76rem;
}

.start-room-card h2 {
  margin-bottom: 18px;
}

.room-code-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  gap: 8px;
  align-items: stretch;
}

.room-code-entry .qr-scan-button {
  display: grid;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  place-items: center;
}

.qr-scan-button img {
  width: 34px;
  height: 34px;
}

.join-room-button {
  width: 100%;
}

.start-room-form {
  margin-bottom: 0;
}

.start-room-form + .message {
  margin-top: 12px;
  margin-bottom: 0;
}

.create-room-action {
  display: flex;
  justify-content: center;
}

.field-label {
  display: block;
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.field-grid > div {
  display: grid;
  gap: 5px;
}

.form-field {
  display: grid;
  gap: 5px;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  font-size: 1rem;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
select {
  height: var(--control-large-height);
  min-height: var(--control-large-height);
  padding: 0 12px;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(13, 110, 253, 0.2);
  outline-offset: 0;
  border-color: var(--primary);
}

.button {
  font-weight: 600;
}

.button.primary {
  background: var(--primary);
  color: white;
}

.button.primary:hover {
  background: var(--primary-dark);
}

.button.secondary {
  background: var(--secondary);
  color: var(--text);
}

.button.danger {
  background: rgba(220, 53, 69, 0.1);
  color: var(--danger);
}

.button.icon-button:not(.primary):not(.secondary):not(.danger) {
  background: rgba(13, 110, 253, 0.08);
  color: var(--primary);
}

.menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
}

.nav-item {
  background: transparent;
  color: var(--text);
  text-align: left;
}

.nav-item.active {
  background: var(--primary);
  color: white;
}

.divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  margin: 18px 0;
  font-size: 0.8rem;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.button-row {
  display: flex;
  gap: 12px;
  margin: 0 0 16px;
  flex-wrap: wrap;
}

.button-row button {
  flex: 1 1 180px;
}

.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-radius: 10px;
  padding: 8px 10px;
  margin-bottom: 14px;
  font-size: 0.8rem;
  font-weight: 600;
}

.status-bar.success {
  background: rgba(25, 135, 84, 0.1);
  color: var(--success);
  border: 1px solid rgba(25, 135, 84, 0.2);
}

.status-bar.primary {
  background: rgba(13, 110, 253, 0.08);
  color: var(--primary);
  border: 1px solid rgba(13, 110, 253, 0.2);
}

.status-bar.danger {
  background: rgba(220, 53, 69, 0.08);
  color: var(--danger);
  border: 1px solid rgba(220, 53, 69, 0.2);
}

.status-bar.warning {
  background: rgba(255, 193, 7, 0.1);
  color: var(--warning);
  border: 1px solid rgba(255, 193, 7, 0.3);
}

.quick-nav {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 14px;
}

.quick-nav .button {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(17, 24, 39, 0.08);
}

.quick-nav .button.secondary {
  background: var(--panel);
  color: var(--text);
}

.quick-nav .button.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.section-header .sync-indicator {
  position: static;
  flex: 0 0 20px;
}

.person-rows {
  display: grid;
  gap: 10px;
}

.person-row {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) minmax(72px, 96px) max-content;
  gap: 8px;
  align-items: center;
}

.person-row input {
  min-width: 0;
}

.inline-form {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.inline-form input {
  flex: 1;
}

.pin-inline-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px max-content;
  gap: 8px;
  align-items: center;
}

.pin-inline-form input {
  min-width: 0;
}

.no-wrap {
  white-space: nowrap;
}

.check-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
}

.check-wrap input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.person-summary {
  display: grid;
  gap: 6px;
}

.person-name {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  color: var(--text);
}

.person-archived {
  color: var(--muted);
  font-size: 0.72rem;
}

.person-row:has(.person-archived) {
  background: #fbfcfe;
}

.person-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}

.button-small.icon-button {
  display: inline-grid;
  place-items: center;
}

.primary img,
.button.primary.icon-button img {
  filter: brightness(0) saturate(100%) invert(100%) sepia(2%) saturate(8%) hue-rotate(20deg) brightness(104%) contrast(103%);
}

.person-self-toggle.primary img {
  filter: brightness(0) saturate(100%) invert(100%) sepia(2%) saturate(8%) hue-rotate(20deg) brightness(104%) contrast(103%);
}

.secondary img,
.button.secondary.icon-button img {
  filter: brightness(0) saturate(100%) invert(10%) sepia(8%) saturate(4101%) hue-rotate(180deg) brightness(97%) contrast(94%);
}

.danger img,
.button.danger.icon-button img {
  filter: brightness(0) saturate(100%) invert(31%) sepia(98%) saturate(2211%) hue-rotate(334deg) brightness(88%) contrast(96%);
}

.bottom-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.toggle-button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.toggle-icon {
  font-size: 1.3rem;
  line-height: 1;
}

.memo-save-panel {
  margin-top: 10px;
}

.memo-image-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.memo-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 8px;
}

.memo-image-item {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #f5f7fa;
}

.memo-image-item > .image-sync-indicator {
  z-index: 2;
  top: 4px;
  left: 4px;
  width: 22px;
  height: 22px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 1px 4px rgba(17, 24, 39, 0.22);
}

.memo-image-item > .image-sync-indicator img {
  width: 16px;
  height: 16px;
}

.memo-image-item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.memo-expand-image {
  cursor: zoom-in;
}

.memo-expand-image:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: -3px;
}

.memo-image-item button {
  position: absolute;
  top: 4px;
  right: 4px;
  width: var(--control-medium-height);
  min-width: var(--control-medium-height);
  height: var(--control-medium-height);
  min-height: var(--control-medium-height);
  padding: 0;
}

.memo-image-item.is-removing {
  opacity: 0.4;
}

.image-viewer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(10, 14, 18, 0.92);
}

body.image-viewer-open {
  overflow: hidden;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

.image-viewer-shell {
  position: relative;
  display: grid;
  place-items: center;
  width: min(100%, 1400px);
  height: min(100%, 1000px);
}

.image-viewer-shell > img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.image-viewer-close {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 1;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 1.8rem;
  line-height: 1;
}

.image-viewer-close:hover {
  background: rgba(255, 255, 255, 0.28);
}

.image-viewer-close img {
  width: 24px;
  height: 24px;
}

textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 12px;
  resize: vertical;
  min-height: 92px;
  font: inherit;
}

.full-width {
  width: 100%;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: grid;
  place-items: center;
  z-index: 50;
  padding: 20px;
  overflow-y: auto;
}

.modal-card {
  width: min(100%, 420px);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  background: white;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.modal-backdrop.keyboard-open {
  inset: auto 0 auto;
  top: var(--visual-viewport-top, 0px);
  height: var(--visual-viewport-height, 100dvh);
  align-items: end;
  padding: 12px 12px max(12px, env(safe-area-inset-bottom));
}

.modal-backdrop.keyboard-open .modal-card {
  max-height: calc(var(--visual-viewport-height, 100dvh) - 24px);
}

.modal-card h3 {
  margin: 0 0 4px;
}

.modal-form {
  display: grid;
  gap: 8px;
}

.modal-form .modal-actions {
  margin-top: 8px;
}

.amount-expression-actions {
  justify-content: flex-start;
}

.amount-expression-actions .modal-action-spacer {
  flex: 1;
}

.modal-form .delete-room-warning {
  margin: 0;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.delete-room-warning {
  margin-bottom: 18px;
  color: var(--text);
  line-height: 1.5;
}

.room-actions {
  margin-top: 18px;
}

.copy-room-link {
  margin-top: 14px;
}

.person-manager-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.person-manager-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.person-manager-row input {
  flex: 1;
  cursor: text;
}

.person-self-toggle {
  flex-shrink: 0;
  background: var(--secondary);
  color: var(--text);
}

.person-self-toggle.secondary {
  background: var(--secondary);
  color: var(--text);
}

.person-self-toggle.primary {
  background: var(--primary);
  color: #fff;
}

.self-person-row {
  border-color: rgba(13, 110, 253, 0.35);
  background: rgba(13, 110, 253, 0.04);
}

.stack-form {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.memo-form {
  margin-bottom: 0;
}

.calculator-form {
  margin-bottom: 0;
}

.room-settings-form {
  margin-bottom: 18px;
}

.item-list,
.memo-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.item-row,
.memo-item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fbfcfe;
  padding: 10px 12px;
}

#peopleList .item-row,
#factorsList .item-row {
  cursor: grab;
}

#peopleList .item-row:active,
#factorsList .item-row:active {
  cursor: grabbing;
}

.sortable-ghost {
  opacity: 0.45;
  background: var(--panel-strong);
}

.sync-indicator {
  position: absolute;
  top: -6px;
  left: -6px;
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
}

.sync-indicator img {
  display: block;
  width: 18px;
  height: 18px;
}

.sync-done img {
  filter: brightness(0) saturate(100%) invert(44%) sepia(44%) saturate(823%) hue-rotate(101deg) brightness(91%) contrast(91%);
}

.sync-pending img {
  filter: brightness(0) saturate(100%) invert(72%) sepia(63%) saturate(677%) hue-rotate(359deg) brightness(93%) contrast(89%);
}

.sync-failed img {
  filter: brightness(0) saturate(100%) invert(31%) sepia(98%) saturate(2211%) hue-rotate(334deg) brightness(88%) contrast(96%);
}

.soft-deleted-item {
  opacity: 0.72;
}

.item-main,
.memo-main {
  min-width: 0;
  overflow: hidden;
}

.item-name,
.memo-title {
  font-weight: 600;
}

.item-meta,
.memo-meta {
  margin-top: 4px;
  font-size: 0.8rem;
  color: var(--muted);
}

.item-actions,
.memo-actions {
  display: flex;
  gap: 8px;
}

.memo-item {
  align-items: flex-start;
}

.memo-item.memo-color-green {
  background: linear-gradient(90deg, rgba(25, 135, 84, 0.16) 0%, rgba(25, 135, 84, 0.07) 36%, #fbfcfe 78%);
  border-color: rgba(25, 135, 84, 0.25);
}

.memo-item.memo-color-blue {
  background: linear-gradient(90deg, rgba(13, 110, 253, 0.15) 0%, rgba(13, 110, 253, 0.06) 36%, #fbfcfe 78%);
  border-color: rgba(13, 110, 253, 0.24);
}

.memo-item.memo-color-red {
  background: linear-gradient(90deg, rgba(220, 53, 69, 0.15) 0%, rgba(220, 53, 69, 0.06) 36%, #fbfcfe 78%);
  border-color: rgba(220, 53, 69, 0.24);
}

.memo-item.memo-color-yellow {
  background: linear-gradient(90deg, rgba(255, 193, 7, 0.18) 0%, rgba(255, 193, 7, 0.08) 36%, #fbfcfe 78%);
  border-color: rgba(255, 193, 7, 0.3);
}

.memo-amount {
  color: var(--text);
  font-weight: 700;
  white-space: nowrap;
}

.memo-heading {
  display: flex;
  align-items: baseline;
  gap: 7px;
  min-width: 0;
}

.memo-payer {
  display: inline-block;
  color: inherit;
}

.memo-filters {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
  flex-wrap: wrap;
}

.memo-filter-colors {
  display: flex;
  align-items: center;
  gap: 8px;
}

.memo-filter-option {
  display: block;
  width: 36px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: transparent;
  cursor: pointer;
}

.memo-filter-option > span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 5px;
  background: #fbfcfe;
}

.memo-filter-option.memo-color-green > span {
  background: linear-gradient(90deg, rgba(25, 135, 84, 0.3), rgba(25, 135, 84, 0.08));
}

.memo-filter-option.memo-color-blue > span {
  background: linear-gradient(90deg, rgba(13, 110, 253, 0.3), rgba(13, 110, 253, 0.08));
}

.memo-filter-option.memo-color-red > span {
  background: linear-gradient(90deg, rgba(220, 53, 69, 0.3), rgba(220, 53, 69, 0.08));
}

.memo-filter-option.memo-color-yellow > span {
  background: linear-gradient(90deg, rgba(255, 193, 7, 0.38), rgba(255, 193, 7, 0.1));
}

.memo-filter-option.active {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.memo-color-options {
  display: flex;
  gap: 8px;
  align-items: center;
}

.memo-color-option {
  position: relative;
  display: block;
  width: 36px;
  height: 30px;
  cursor: pointer;
}

.memo-color-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.memo-color-option > span:first-of-type {
  display: block;
  width: 36px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: #fbfcfe;
}

.memo-color-option.memo-color-green > span:first-of-type {
  background: linear-gradient(90deg, rgba(25, 135, 84, 0.3), rgba(25, 135, 84, 0.08));
}

.memo-color-option.memo-color-blue > span:first-of-type {
  background: linear-gradient(90deg, rgba(13, 110, 253, 0.3), rgba(13, 110, 253, 0.08));
}

.memo-color-option.memo-color-red > span:first-of-type {
  background: linear-gradient(90deg, rgba(220, 53, 69, 0.3), rgba(220, 53, 69, 0.08));
}

.memo-color-option.memo-color-yellow > span:first-of-type {
  background: linear-gradient(90deg, rgba(255, 193, 7, 0.38), rgba(255, 193, 7, 0.1));
}

.memo-color-option input:checked + span {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.memo-main {
  flex: 1;
}

.memo-title {
  display: block;
  margin-bottom: 4px;
}

.memo-heading .memo-title {
  margin-bottom: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.memo-summary {
  cursor: pointer;
}

.memo-summary:focus-visible {
  outline: 2px solid rgba(13, 110, 253, 0.2);
  outline-offset: 3px;
  border-radius: 5px;
}

.memo-details {
  display: none;
  gap: 12px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(107, 114, 128, 0.2);
}

.memo-item.expanded .memo-details {
  display: grid;
}

.memo-calculation {
  display: grid;
  gap: 5px;
}

.memo-note {
  color: var(--muted);
  font-size: 0.8rem;
  white-space: pre-wrap;
}

.memo-detail-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.8rem;
  color: var(--muted);
}

.memo-detail-line strong {
  color: var(--text);
  text-align: right;
}

.result-box {
  background: #f8fbff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 16px;
}

.result-box table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}

.result-box th,
.result-box td {
  text-align: left;
  padding: 8px 6px;
  border-bottom: 1px solid var(--border);
}

.result-box .total-line {
  margin-top: 10px;
  font-weight: 700;
}

.message {
  position: fixed;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 120;
  width: min(calc(100% - 24px), 460px);
  transform: translateX(-50%);
  border-radius: 10px;
  padding: 10px 12px;
  margin: 0;
  font-size: 0.92rem;
  text-align: center;
  box-shadow: 0 10px 26px rgba(17, 24, 39, 0.18);
  animation: toast-in 0.18s ease-out;
}

.message.error {
  background: rgba(220, 53, 69, 0.96);
  border: 1px solid rgba(220, 53, 69, 0.2);
  color: #fff;
}

.message.success {
  background: rgba(25, 135, 84, 0.96);
  border: 1px solid rgba(25, 135, 84, 0.25);
  color: #fff;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

.muted-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.last-room-row {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-left: 30px;
}

.last-rooms-list {
  display: grid;
  gap: 0;
  margin-top: 10px;
}

.last-room-row + .last-room-row {
  border-top: 0;
  margin-top: 14px;
}

.last-room-row + .last-room-row::before {
  position: absolute;
  top: -7px;
  right: 0;
  left: 0;
  height: 1px;
  background: var(--border);
  content: "";
}

.last-room-info {
  display: grid;
  min-width: 0;
}

.last-room-info strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.last-room-info span,
.room-qr-label,
.scanner-message {
  color: var(--muted);
  font-size: 0.78rem;
}

.last-room-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
}

.last-room-row > .sync-indicator {
  top: 50%;
  left: 4px;
  transform: translateY(-50%);
}

.room-qr-section {
  display: grid;
  justify-items: center;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.room-qr-section > .field-label {
  margin: 0 0 8px;
}

.room-qr-code {
  padding: 10px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.room-qr-code img,
.room-qr-code canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

.room-qr-label {
  margin-top: 8px;
}

.scanner-modal-card {
  width: min(100%, 480px);
}

.qr-reader {
  min-height: 240px;
  overflow: hidden;
  border-radius: 8px;
}

.scanner-message {
  margin: 10px 0 16px;
  text-align: center;
}

@media (max-width: 540px) {
  body {
    padding-inline: 10px;
  }

  .field-grid {
    grid-template-columns: 1fr;
  }

  .person-row {
    grid-template-columns: 22px minmax(0, 1fr) minmax(62px, 78px) max-content;
    gap: 4px;
  }

  .person-row > input[data-person-amount] {
    padding-inline: 6px;
  }

  .button-row {
    flex-direction: column;
  }

  .button-row button {
    flex: none;
  }

  .button-row button,
  .inline-form {
    width: 100%;
  }

  .inline-form {
    display: grid;
  }

}
