:root {
  --paper: #f7f8f3;
  --surface: #ffffff;
  --ink: #202623;
  --muted: #65706a;
  --line: #d8ded6;
  --field: #0e6f52;
  --lacquer: #b83f38;
  --saffron: #df9d18;
  --lapis: #325eb7;
  --mint: #dcefe5;
  --rose: #f4dedb;
  --sky: #dce7fb;
  --shadow: 0 14px 34px rgba(26, 34, 29, 0.12);
  color-scheme: light;
  font-family: "Avenir Next", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background:
    linear-gradient(90deg, rgba(14, 111, 82, 0.06) 1px, transparent 1px),
    linear-gradient(180deg, rgba(50, 94, 183, 0.05) 1px, transparent 1px),
    var(--paper);
  background-size: 22px 22px;
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
}

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

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

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(50, 94, 183, 0.28);
  outline-offset: 2px;
}

.app-shell {
  width: min(100%, 480px);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--paper);
  box-shadow: 0 0 0 1px rgba(32, 38, 35, 0.08);
}

.page {
  min-height: 100vh;
  padding: env(safe-area-inset-top) 16px calc(86px + env(safe-area-inset-bottom));
}

.page.without-tabs {
  padding-bottom: calc(28px + env(safe-area-inset-bottom));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 64px;
  padding: 12px 0;
  background: rgba(247, 248, 243, 0.92);
  backdrop-filter: blur(18px);
}

.kicker {
  margin: 0;
  color: var(--field);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.title {
  margin: 2px 0 0;
  font-size: clamp(24px, 8vw, 34px);
  line-height: 1.02;
  font-weight: 900;
  letter-spacing: 0;
}

.page-title {
  margin: 0;
  font-size: 24px;
  line-height: 1.08;
  font-weight: 900;
}

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

.meta-row,
.card-meta,
.chip-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.role-chip,
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}

.role-chip {
  border-color: rgba(14, 111, 82, 0.26);
  color: var(--field);
}

.chip.private {
  border-color: rgba(184, 63, 56, 0.24);
  background: var(--rose);
  color: var(--lacquer);
}

.chip.public {
  border-color: rgba(14, 111, 82, 0.24);
  background: var(--mint);
  color: var(--field);
}

.chip.leader {
  border-color: rgba(223, 157, 24, 0.34);
  background: #fff2cf;
  color: #8a5c00;
}

.chip.status-ongoing {
  border-color: rgba(14, 111, 82, 0.28);
  background: var(--mint);
  color: var(--field);
}

.chip.status-completed {
  border-color: rgba(101, 112, 106, 0.28);
  background: #edf0ec;
  color: var(--muted);
}

.chip.status-upcoming,
.chip.status-unknown {
  border-color: rgba(50, 94, 183, 0.25);
  background: var(--sky);
  color: var(--lapis);
}

.chip.admin {
  border-color: rgba(50, 94, 183, 0.25);
  background: var(--sky);
  color: var(--lapis);
}

.icon-btn,
.plain-btn,
.primary-btn,
.danger-btn,
.ghost-btn,
.tab-btn,
.quick-btn {
  border: 0;
  cursor: pointer;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 900;
}

.plain-btn {
  min-height: 40px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 800;
}

.primary-btn,
.danger-btn,
.ghost-btn {
  min-height: 46px;
  padding: 0 16px;
  border-radius: 8px;
  font-weight: 850;
}

.primary-btn {
  background: var(--field);
  color: #ffffff;
  box-shadow: 0 12px 24px rgba(14, 111, 82, 0.18);
}

.danger-btn {
  background: var(--lacquer);
  color: #ffffff;
}

.ghost-btn {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

.button-row {
  display: flex;
  gap: 10px;
}

.button-row > button {
  flex: 1;
}

.range-panel {
  display: grid;
  gap: 12px;
  margin: 8px 0 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-left: 6px solid var(--field);
  border-radius: 8px;
  background: var(--surface);
}

.range-panel h2 {
  margin: 2px 0 0;
  font-size: 17px;
  line-height: 1.25;
}

.range-actions {
  display: grid;
  gap: 10px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.segmented.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-width: 132px;
}

.segment-btn {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
}

.segment-btn.active {
  background: var(--ink);
  color: #ffffff;
}

.dashboard-grid {
  display: grid;
  gap: 18px;
}

.calendar-strip {
  position: relative;
  margin: 8px 0 20px;
  padding: 15px 0 13px 52px;
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--line);
}

.calendar-strip::before {
  content: "";
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 21px;
  width: 6px;
  border-radius: 99px;
  background:
    repeating-linear-gradient(
      to bottom,
      var(--field) 0,
      var(--field) 10px,
      transparent 10px,
      transparent 17px
    );
}

.calendar-strip h2 {
  margin: 0 0 8px;
  font-size: 16px;
  line-height: 1.2;
}

.rail-events {
  display: grid;
  gap: 8px;
}

.rail-event {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 10px;
  align-items: center;
  min-height: 48px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--saffron);
  border-radius: 8px;
  background: var(--surface);
}

.rail-date,
.date-box {
  font-family: "DIN Condensed", "Avenir Next Condensed", "Arial Narrow", Arial, sans-serif;
  font-weight: 900;
  letter-spacing: 0;
}

.rail-date {
  color: var(--lapis);
  font-size: 22px;
  line-height: 1;
}

.rail-date span {
  display: block;
  color: var(--muted);
  font-family: inherit;
  font-size: 10px;
}

.rail-title {
  display: block;
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 14px;
  font-weight: 850;
}

.rail-place {
  display: block;
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

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

.stat-card {
  min-height: 112px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
}

.stat-card strong {
  display: block;
  margin-bottom: 10px;
  font-family: "DIN Condensed", "Avenir Next Condensed", "Arial Narrow", Arial, sans-serif;
  font-size: clamp(36px, 12vw, 50px);
  line-height: 0.9;
  letter-spacing: 0;
}

.stat-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.stat-card:nth-child(1) strong {
  color: var(--field);
}

.stat-card:nth-child(2) strong {
  color: var(--lapis);
}

.stat-card:nth-child(3) strong {
  color: var(--saffron);
}

.stat-card:nth-child(4) strong {
  color: var(--lacquer);
}

.stat-card-action {
  cursor: pointer;
}

.stat-card-action:active {
  transform: translateY(1px);
}

.stat-card-action::after {
  content: "筛选";
  display: inline-flex;
  margin-top: 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 20px 0 10px;
}

.section-head h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
}

.activities-head {
  align-items: center;
}

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

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

.quick-btn {
  min-height: 76px;
  padding: 12px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
}

.quick-btn strong,
.quick-btn span {
  display: block;
}

.quick-btn strong {
  font-size: 16px;
  line-height: 1.1;
}

.quick-btn span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.activity-list {
  display: grid;
  gap: 10px;
}

.calendar-view {
  display: grid;
  gap: 18px;
}

.calendar-month {
  padding: 12px 0 16px;
  border-top: 2px solid var(--ink);
}

.calendar-month-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.calendar-month-head h3 {
  margin: 0;
  font-size: 19px;
  line-height: 1.1;
  font-weight: 950;
}

.calendar-month-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.calendar-weekdays {
  gap: 4px;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-align: center;
}

.calendar-grid {
  gap: 4px;
}

.calendar-day {
  min-height: 86px;
  padding: 6px 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
  overflow: hidden;
}

.calendar-day.blank {
  border-color: transparent;
  background: transparent;
}

.calendar-day.has-event {
  border-color: rgba(14, 111, 82, 0.22);
  background: var(--surface);
}

.calendar-day.today {
  box-shadow: inset 0 0 0 2px rgba(50, 94, 183, 0.28);
}

.calendar-day-number {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2px;
  min-height: 18px;
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
}

.calendar-day-number em {
  display: inline-grid;
  place-items: center;
  min-width: 17px;
  height: 17px;
  border-radius: 999px;
  background: var(--field);
  color: #ffffff;
  font-style: normal;
  font-size: 10px;
}

.calendar-event {
  display: block;
  width: 100%;
  min-height: 25px;
  margin-top: 3px;
  padding: 3px 4px;
  border: 0;
  border-left: 3px solid var(--saffron);
  border-radius: 6px;
  background: #fff7df;
  color: var(--ink);
  text-align: left;
}

.calendar-event span,
.calendar-event strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-event span {
  color: #8a5c00;
  font-size: 9px;
  font-weight: 900;
}

.calendar-event strong {
  margin-top: 1px;
  font-size: 10px;
  line-height: 1.15;
  font-weight: 900;
}

.calendar-more {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
}

.activity-card {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 12px;
  width: 100%;
  min-height: 112px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  box-shadow: none;
}

.activity-card:active {
  transform: translateY(1px);
}

.date-box {
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 78px;
  border: 1px solid rgba(14, 111, 82, 0.2);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(14, 111, 82, 0.08), transparent 56%),
    var(--paper);
  color: var(--field);
  font-size: 31px;
}

.date-box span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-family: inherit;
  font-size: 11px;
  font-weight: 900;
}

.card-title {
  margin: 0 0 8px;
  overflow-wrap: anywhere;
  font-size: 17px;
  line-height: 1.25;
  font-weight: 900;
}

.card-meta {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
}

.card-note {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.card-progress {
  margin: 8px 0 0;
  color: var(--field);
  font-size: 12px;
  font-weight: 850;
}

.filters {
  display: grid;
  gap: 10px;
  margin: 10px 0 16px;
}

.search-input,
.field-input,
.field-select,
.field-textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
}

.search-input,
.field-input,
.field-select {
  padding: 0 12px;
}

.field-textarea {
  min-height: 94px;
  padding: 12px;
  resize: vertical;
}

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

.floating-add {
  position: fixed;
  right: max(18px, calc((100vw - 480px) / 2 + 18px));
  bottom: calc(86px + env(safe-area-inset-bottom));
  z-index: 12;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 50%;
  background: var(--field);
  color: #ffffff;
  box-shadow: var(--shadow);
  font-size: 28px;
  font-weight: 700;
}

.empty-state,
.permission-state {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 32px 20px;
  border: 1px dashed rgba(101, 112, 106, 0.45);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  text-align: center;
}

.empty-mark {
  width: 84px;
  height: 48px;
  border: 2px solid var(--line);
  border-left: 10px solid var(--saffron);
  border-radius: 8px;
  background:
    linear-gradient(90deg, transparent 13px, rgba(50, 94, 183, 0.2) 13px, rgba(50, 94, 183, 0.2) 15px, transparent 15px),
    linear-gradient(180deg, transparent 15px, rgba(14, 111, 82, 0.15) 15px, rgba(14, 111, 82, 0.15) 17px, transparent 17px),
    var(--surface);
}

.detail-hero {
  margin: 4px 0 16px;
  padding: 16px 0 12px;
  border-bottom: 1px solid var(--line);
}

.detail-hero h1 {
  margin: 6px 0 10px;
  font-size: 28px;
  line-height: 1.08;
  font-weight: 950;
  overflow-wrap: anywhere;
}

.detail-grid {
  display: grid;
  gap: 10px;
}

.detail-row {
  display: grid;
  grid-template-columns: 94px 1fr;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.detail-row dt {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.detail-row dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-weight: 760;
}

.attachment-panel {
  display: grid;
  gap: 10px;
  margin: 18px 0 0;
  padding: 14px 0;
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--line);
}

.attachment-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.attachment-head h2 {
  margin: 0;
  font-size: 17px;
  line-height: 1.2;
  font-weight: 950;
}

.attachment-head p {
  margin: 4px 0 0;
  font-size: 12px;
}

.attachment-list,
.upload-queue {
  display: grid;
  gap: 8px;
}

.attachment-item {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 10px;
  align-items: center;
  min-height: 66px;
  padding: 10px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--lapis);
  border-radius: 8px;
  background: var(--surface);
}

.attachment-type {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(50, 94, 183, 0.22);
  border-radius: 8px;
  background: var(--sky);
  color: var(--lapis);
  font-family: "DIN Condensed", "Avenir Next Condensed", "Arial Narrow", Arial, sans-serif;
  font-size: 15px;
  font-weight: 900;
}

.attachment-main {
  min-width: 0;
}

.attachment-main h3 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 1.25;
  font-weight: 900;
}

.attachment-main p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.attachment-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

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

.attachment-empty {
  min-height: 54px;
  padding: 16px;
  border: 1px dashed rgba(101, 112, 106, 0.38);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.upload-queue {
  padding: 10px;
  border: 1px solid rgba(14, 111, 82, 0.2);
  border-radius: 8px;
  background: rgba(220, 239, 229, 0.55);
}

.upload-row {
  display: grid;
  gap: 7px;
}

.upload-row strong,
.upload-row span {
  display: block;
}

.upload-row strong {
  overflow-wrap: anywhere;
  font-size: 13px;
}

.upload-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.progress-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(101, 112, 106, 0.18);
}

.progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--field);
}

.form {
  display: grid;
  gap: 18px;
  padding-top: 8px;
}

.form-band {
  display: grid;
  gap: 12px;
  padding: 14px 0 2px;
  border-top: 2px solid var(--ink);
}

.form-band h2 {
  margin: 0;
  font-size: 16px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label,
.field-label,
.switch-label {
  color: var(--ink);
  font-size: 13px;
  font-weight: 850;
}

.time-range-field {
  gap: 8px;
}

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

.time-select-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.field-error {
  min-height: 17px;
  color: var(--lacquer);
  font-size: 12px;
  font-weight: 750;
}

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

.switch-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.switch-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch-track {
  position: relative;
  flex: 0 0 auto;
  width: 48px;
  height: 28px;
  border-radius: 999px;
  background: #cbd3cd;
  transition: background 160ms ease;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  transition: transform 160ms ease;
}

.switch-card input:checked + .switch-track {
  background: var(--field);
}

.switch-card input:checked + .switch-track::after {
  transform: translateX(20px);
}

.profile-band,
.auth-user {
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.profile-name {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 900;
}

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

.permission-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.ok {
  color: var(--field);
  font-weight: 900;
}

.no {
  color: var(--lacquer);
  font-weight: 900;
}

.auth-user {
  display: grid;
  grid-template-columns: 1fr 132px;
  gap: 10px;
  align-items: center;
}

.auth-form {
  gap: 12px;
}

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

.inline-btn {
  min-height: 30px;
  border: 0;
  background: transparent;
  color: var(--field);
  font-size: 13px;
  font-weight: 900;
}

.admin-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.admin-row,
.log-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.log-row {
  grid-template-columns: minmax(0, 1fr);
}

.admin-row h3,
.log-row h3 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 1.25;
  font-weight: 900;
}

.admin-row p,
.log-row p {
  margin: 5px 0 0;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.log-detail {
  color: var(--ink);
}

.auth-name {
  margin: 0;
  font-weight: 900;
}

.auth-meta {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.status-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.tabbar {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 20;
  display: flex;
  justify-content: center;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  background: rgba(247, 248, 243, 0.93);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.tabbar-inner {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  width: min(100%, 456px);
}

.tab-btn {
  min-height: 52px;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.tab-btn span {
  display: block;
  margin-bottom: 3px;
  font-size: 18px;
  line-height: 1;
}

.tab-btn.active {
  background: var(--ink);
  color: #ffffff;
}

.modal-scrim {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: end center;
  padding: 18px;
  background: rgba(32, 38, 35, 0.36);
}

.modal {
  width: min(100%, 444px);
  padding: 18px;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.modal h2 {
  margin: 0 0 8px;
  font-size: 20px;
}

.modal p {
  margin: 0 0 16px;
  color: var(--muted);
  line-height: 1.55;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: calc(92px + env(safe-area-inset-bottom));
  left: 18px;
  z-index: 60;
  max-width: 444px;
  margin: 0 auto;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: #ffffff;
  text-align: center;
  font-size: 14px;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

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

@media (min-width: 720px) {
  body {
    padding: 24px 0;
  }

  .app-shell {
    min-height: calc(100vh - 48px);
    border-radius: 18px;
    overflow: hidden;
  }

  .tabbar {
    right: auto;
    left: 50%;
    width: 480px;
    transform: translateX(-50%);
  }
}

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

  .attachment-actions {
    grid-column: 2;
    justify-content: flex-start;
  }
}

@media (min-width: 900px) {
  .app-shell {
    width: min(100%, 1120px);
  }

  .page {
    padding-right: 28px;
    padding-left: 28px;
  }

  .topbar {
    min-height: 76px;
  }

  .title {
    font-size: 42px;
  }

  .range-panel {
    grid-template-columns: 1fr auto;
    align-items: center;
  }

  .range-actions {
    grid-template-columns: 260px 120px;
    align-items: center;
  }

  .dashboard-grid {
    grid-template-columns: minmax(0, 1.1fr) minmax(340px, 0.9fr);
    align-items: start;
  }

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

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

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

  .calendar-day {
    min-height: 112px;
    padding: 8px 6px;
  }

  .calendar-event strong {
    font-size: 11px;
  }

  .dashboard-grid .activity-list {
    grid-template-columns: 1fr;
  }

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

  .form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }

  .form .button-row {
    grid-column: 1 / -1;
    max-width: 420px;
    justify-self: end;
  }

  .tabbar {
    width: 1120px;
  }

  .floating-add {
    right: max(24px, calc((100vw - 1120px) / 2 + 24px));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
