:root {
  color-scheme: light dark;
  --bg: #f6f7f5;
  --surface: #ffffff;
  --text: #1c231f;
  --muted: #5b655c;
  --border: #dfe4de;
  --accent: #2c6e49;
  --accent-contrast: #ffffff;
  --danger: #b3261e;
  --radius: 12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141815;
    --surface: #1e2420;
    --text: #eef1ee;
    --muted: #a3ada4;
    --border: #333c35;
    --accent: #6fbf8b;
    --accent-contrast: #0c140f;
  }
}

* {
  box-sizing: border-box;
}


/* Important! Else overlay mumbo jumbo happens.*/
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  padding: 0 16px calc(24px + env(safe-area-inset-bottom));
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  max-width: 640px;
  margin-inline: auto;
}

h1,
h2 {
  line-height: 1.2;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: 16px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 5;
}

.app-header h1 {
  margin: 0;
  font-size: 1.3rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.header-mark {
  width: 22px;
  height: 22px;
  flex: none;
}

.header-actions {
  display: flex;
  gap: 8px;
}

.icon-button {
  position: relative;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  width: 40px;
  height: 40px;
  font-size: 1.1rem;
  cursor: pointer;
}

.badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--danger);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 600;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-inline: 4px;
}

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.tab-button {
  flex: 1;
  padding: 10px 0;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.tab-button.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}

.empty {
  color: var(--muted);
  text-align: center;
  padding: 24px 0;
}

.banner {
  position: relative;
  margin-bottom: 16px;
  padding-right: 40px;
}

.banner .icon-button {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  font-size: 0.9rem;
}

.banner p,
.banner ol {
  margin: 0 0 8px;
}

.banner ol {
  padding-left: 20px;
}

.handoff-code {
  font: 700 1.3rem/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 2px;
  text-align: center;
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 8px 16px;
  margin: 8px 0;
}

#handoff-settings-code {
  align-self: flex-start;
}

.primary-button {
  background: var(--accent);
  color: var(--accent-contrast);
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

a.primary-button {
  display: inline-block;
  text-decoration: none;
  text-align: center;
}

.primary-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.text-button {
  background: none;
  border: none;
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
  padding: 10px;
}

.panel > .text-button,
.card > .text-button,
.stack-form > .text-button {
  margin-left: -10px;
}

.text-button.danger {
  color: var(--danger);
}

#new-post-button {
  display: block;
  margin-bottom: 16px;
}

.feed-group {
  margin-bottom: 8px;
}

.feed-group-toggle {
  display: block;
  margin-bottom: 8px;
  padding-left: 0;
}

.feed-item .sentence {
  margin: 0 0 6px;
  font-size: 1rem;
}

.feed-item .post-info {
  margin: 0 0 10px;
  padding: 8px 10px;
  background: var(--bg);
  border-radius: 8px;
  font-size: 0.9rem;
}

.feed-item .meta {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.85rem;
}

.feed-item .actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.circle-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.circle-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.members-toggle {
  align-self: flex-start;
}

.member-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}

.member-item:first-child {
  border-top: none;
  padding-top: 0;
}

.circle-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.circle-meta {
  color: var(--muted);
  font-size: 0.85rem;
}

.inline-form {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.inline-form input,
.inline-form select {
  flex: 1;
  min-width: 0;
}

input,
select,
textarea {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 10px;
}

.stack-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 20px;
}

.stack-form .stack-form {
  margin-bottom: 0;
}

.stack-form label,
.field-label {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 6px;
}

/* Names a whole section rather than a single input*/
.stack-form label.section-title,
.section-title {
  margin: 0 0 2px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

/* A standing action button */
.secondary-button {
  align-self: flex-start;
  background: var(--surface);
  color: var(--accent);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.secondary-button.danger {
  color: var(--danger);
}

/* Each settings section gets its own band, so the panel reads as a list of topics. */
.panel > .stack-form {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  margin-bottom: 16px;
}

.panel > .stack-form:first-of-type {
  border-top: none;
  padding-top: 0;
}

.stack-form > button {
  margin-top: 10px;
  align-self: flex-start;
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text);
  margin-top: 8px;
  cursor: pointer;
}

.checkbox-row input {
  flex: none;
  margin-top: 2px;
}

.time-row {
  display: flex;
  gap: 12px;
}

.time-row>div {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 8px;
}

.hint {
  color: var(--muted);
  font-size: 0.8rem;
  margin: 4px 0 0;
}

.panel {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(360px, 100%);
  background: var(--bg);
  border-left: 1px solid var(--border);
  padding: 16px;
  overflow-y: auto;
  z-index: 20;
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s ease;
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.panel-header h2 {
  flex: 1;
  margin: 0;
  font-size: 1.1rem;
}

.help-content h3 {
  margin: 20px 0 4px;
  font-size: 0.95rem;
}

.help-content p {
  margin: 0 0 10px;
}

.notification-item.unread {
  border-color: var(--accent);
}

.notification-text {
  margin: 0 0 4px;
}

.notification-time {
  color: var(--muted);
  font-size: 0.8rem;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 30;
  padding: 16px;
}

.overlay .card {
  width: min(420px, 100%);
  margin-bottom: env(safe-area-inset-bottom);
}

@media (min-width: 480px) {
  .overlay {
    align-items: center;
  }
}

#share-overlay .field-label,
#share-overlay .form-actions {
  text-align: center;
  justify-content: center;
}

.qr-image {
  display: block;
  width: 100%;
  max-width: 260px;
  height: auto;
  margin: 12px auto;
  border-radius: 8px;
}

.share-url {
  word-break: break-all;
  text-align: center;
  color: var(--muted);
  font-size: 0.9em;
}

.toast {
  position: fixed;
  bottom: calc(16px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.85rem;
  z-index: 40;
  max-width: calc(100% - 32px);
  text-align: center;
}

.app-footer {
  margin-top: 24px;
  padding-top: 16px;
  padding-bottom: 24px;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.5;
}

.app-footer p { margin: 0; }

.app-footer a {
  color: var(--muted);
  text-decoration: underline;
}

.app-footer .app-version {
  margin-top: 4px;
  font-size: 0.75rem;
  opacity: 0.7;
}