:root {
  --bg: #f3f4f6;
  --card: #ffffff;
  --text: #16181d;
  --muted: #64748b;
  --border: #e5e7eb;
  --agreed: #16a34a;
  --agreed-bg: #dcfce7;
  --pending: #d97706;
  --pending-bg: #fef3c7;
  --refused: #ef4444;
  --refused-bg: #fee2e2;
  --unknown: #94a3b8;
  --unknown-bg: #f1f5f9;
  --contacted: #2563eb;
  --contacted-bg: #dbeafe;
  --primary: #0f766e;
  --header-bg: #ffffff;
  --header-text: #16181d;
  --header-muted: #64748b;
  --header-line: #e5e7eb;
  --track: #e5e7eb;
  --bar-signed: linear-gradient(90deg, #34d399, #059669);
  --bar-agree: linear-gradient(90deg, #60a5fa, #2563eb);
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 8px 24px rgba(15,23,42,.05);
  --shadow-elevated: 0 2px 8px rgba(15,23,42,.06), 0 16px 40px rgba(15,23,42,.1);
  --surface-muted: #f8fafc;
  --surface-info: #eff6ff;
  --surface-info-border: #bfdbfe;
  --surface-info-text: #1e3a5f;
  --stat-signed: #059669;
  --stat-unsigned: #64748b;
  --phase-open: #15803d;
  --threshold-met-bg: linear-gradient(135deg, #ffffff 0%, #f0fdf4 100%);
  --threshold-unmet-bg: linear-gradient(135deg, #ffffff 0%, #fffbeb 100%);
  --phase-tag-bg: #dbeafe;
  --phase-tag-text: #1d4ed8;
  --phase2-tag-bg: #dcfce7;
  --phase2-tag-text: #15803d;
  --login-screen-bg: linear-gradient(145deg, #f8fafc 0%, #f0fdf4 48%, #eff6ff 100%);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  color-scheme: light dark;
}

body {
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.header {
  background: var(--header-bg);
  color: var(--header-text);
  border-bottom: 1px solid var(--header-line);
  padding: 1.35rem max(1rem, env(safe-area-inset-right)) 1.35rem max(1rem, env(safe-area-inset-left));
  padding-top: max(1.35rem, env(safe-area-inset-top));
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
}

    .header h1 {
      font-size: 1.5rem;
      font-weight: 700;
      margin-bottom: 0;
    }

    .page-title {
      display: flex;
      align-items: center;
      gap: .5rem;
    }

    .header-oneline {
      flex-wrap: nowrap;
      gap: .55rem;
      line-height: 1.35;
    }

    .header-oneline-icon {
      flex-shrink: 0;
      display: inline-flex;
      align-items: center;
      justify-content: center;
    }

    .header-oneline-icon .ip-icon {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 2.1rem;
      height: 2.1rem;
      border-radius: 10px;
      background: var(--surface-muted);
      border: 1px solid var(--header-line);
      box-shadow: 0 1px 3px rgba(15, 23, 42, .06);
    }

    .header-oneline-icon .ip-title svg {
      width: 20px;
      height: 20px;
      color: var(--primary);
    }

    .header-oneline-body {
      display: flex;
      align-items: baseline;
      flex-wrap: nowrap;
      gap: .35rem .65rem;
      min-width: 0;
      flex: 1;
    }

    .header-oneline-title {
      font-weight: 700;
      white-space: nowrap;
      flex-shrink: 0;
    }

    .header-oneline-badge {
      font-size: .92rem;
      font-weight: 600;
      color: var(--header-text);
      white-space: nowrap;
      flex-shrink: 0;
    }

    .header-times {
      margin-left: auto;
      display: flex;
      flex-direction: column;
      align-items: flex-end;
      gap: .08rem;
      flex-shrink: 1;
      min-width: 0;
      text-align: right;
    }

    .header-clock,
    .header-updated {
      font-size: .78rem;
      font-weight: 500;
      color: var(--header-muted);
      line-height: 1.35;
    }

    .header-updated {
      display: inline-flex;
      flex-wrap: wrap;
      align-items: baseline;
      gap: 0 .3rem;
      min-width: 0;
    }

    .header-updated-at,
    .header-stale {
      white-space: nowrap;
    }

    .header-stale::before {
      content: '·';
      margin-right: .3rem;
      color: var(--header-muted);
      font-weight: 500;
    }

    .header-updated.stale-mild,
    .header-updated.stale-mild .header-updated-at,
    .header-updated.stale-mild .header-stale,
    .header-updated.stale-mild .header-stale::before {
      color: #c47a16;
    }

    .header-updated.stale-warn,
    .header-updated.stale-warn .header-updated-at,
    .header-updated.stale-warn .header-stale,
    .header-updated.stale-warn .header-stale::before {
      color: #d14343;
      font-weight: 600;
    }

    .ip-icon {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      vertical-align: middle;
      flex-shrink: 0;
    }

    .ip-icon svg {
      display: block;
    }

    .ip-title svg { color: var(--header-text); }

    .inline-icon {
      display: inline-flex;
      align-items: center;
      vertical-align: -2px;
    }

    .toolbar-label {
      display: inline-flex;
      align-items: center;
      gap: .25rem;
    }

    .search-wrap {
      position: relative;
      display: inline-flex;
      align-items: center;
    }

    .search-wrap .search-icon {
      position: absolute;
      left: .6rem;
      color: var(--muted);
      pointer-events: none;
    }

    .search-wrap input[type="search"] {
      padding-left: 2rem;
    }

    .legend-hint {
      margin-left: auto;
      color: var(--muted);
      display: inline-flex;
      align-items: center;
      gap: .3rem;
    }

    .legend-icon {
      display: inline-flex;
      align-items: center;
    }

    .legend-item[data-status="agreed"] .legend-icon svg { color: var(--agreed); }
    .legend-item[data-status="pending"] .legend-icon svg { color: var(--pending); }
    .legend-item[data-status="refused"] .legend-icon svg { color: var(--refused); }
    .legend-item[data-status="contacted"] .legend-icon svg { color: var(--contacted); }
    .legend-item[data-status="unknown"] .legend-icon svg { color: var(--unknown); }
    .legend-item[data-status="empty"] .legend-icon {
      width: 14px;
      height: 14px;
      border: 1.5px dashed var(--border);
      border-radius: 3px;
      background: var(--card);
    }

    .stat-card.signed .stat-icon svg { color: var(--stat-signed); }
    .stat-card.unsigned .stat-icon svg { color: var(--stat-unsigned); }

    .stat-card .stat-icon {
      margin-bottom: .25rem;
      opacity: .85;
    }

    .stat-card.agreed .stat-icon svg { color: var(--agreed); }
    .stat-card.pending .stat-icon svg { color: var(--pending); }
    .stat-card.refused .stat-icon svg { color: var(--refused); }
    .stat-card.contacted .stat-icon svg { color: var(--contacted); }
    .stat-card.unknown .stat-icon svg { color: var(--unknown); }
    .stat-card.total .stat-icon svg { color: var(--primary); }

    .unit .unit-status-icon {
      line-height: 0;
      flex-shrink: 0;
    }

    .unit.agreed .unit-status-icon svg { color: var(--agreed); }
    .unit.pending .unit-status-icon svg { color: var(--pending); }
    .unit.refused .unit-status-icon svg { color: var(--refused); }
    .unit.contacted .unit-status-icon svg { color: var(--contacted); }
    .unit.unknown .unit-status-icon svg,
    .unit.empty .unit-status-icon svg { color: var(--unknown); }

    .unit-status-empty {
      display: inline-flex;
      width: 14px;
      height: 14px;
      border: 1.5px dashed var(--border);
      border-radius: 3px;
      background: var(--card);
      box-sizing: border-box;
    }

    .btn-sm {
      padding: .3rem .6rem;
      font-size: .78rem;
      margin-left: .5rem;
    }

    .progress-header h2 {
      display: inline-flex;
      align-items: center;
      gap: .35rem;
    }

    .admin-banner {
      display: flex;
      align-items: center;
      flex-wrap: wrap;
      gap: .35rem;
    }

    .threshold-ok {
      display: inline-flex;
      align-items: center;
      gap: .2rem;
      color: #16a34a;
    }

    .threshold-ok svg { color: #16a34a; }

.header p {
  opacity: 1;
  color: var(--header-muted);
  font-size: .9rem;
}

.form-subtitle {
  margin-top: .5rem;
  font-size: .85rem;
  opacity: .92;
  font-weight: 500;
}

.container {
  max-width: 1200px;
  margin: -1.25rem auto 2rem;
  padding: 0 max(1rem, env(safe-area-inset-right)) 0 max(1rem, env(safe-area-inset-left));
  padding-bottom: max(2rem, env(safe-area-inset-bottom));
}

.concept-tip {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  padding: .75rem 1rem;
  font-size: .82rem;
  color: #1e40af;
  margin-bottom: 1rem;
  line-height: 1.6;
}

.concept-tip strong {
  color: #1e3a8a;
}

.concept-tip .tip-row {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem .75rem;
  margin-top: .35rem;
}

.concept-tip .tip-tag {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .15rem .5rem;
  border-radius: 6px;
  font-size: .78rem;
  font-weight: 600;
}

.concept-tip .tip-tag.sign-tag {
  background: #d1fae5;
  color: #047857;
}

.concept-tip .tip-tag.agree-tag {
  background: #dcfce7;
  color: #166534;
}

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

.stat-card {
  background: var(--card);
  border-radius: 12px;
  padding: 1rem;
  box-shadow: var(--shadow);
  text-align: center;
}

.stat-card .num {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
}

.stat-card .label {
  font-size: .78rem;
  color: var(--muted);
  margin-top: .2rem;
}

.stat-card.agreed .num { color: var(--agreed); }
.stat-card.pending .num { color: var(--pending); }
.stat-card.refused .num { color: var(--refused); }
.stat-card.contacted .num { color: var(--contacted); }
.stat-card.unknown .num { color: var(--unknown); }
.stat-card.empty .num { color: var(--muted); }
.stat-card.signed .num { color: var(--stat-signed); }
.stat-card.unsigned .num { color: var(--stat-unsigned); }

.summary-cards-single,
.summary-cards.summary-cards-single {
  grid-template-columns: 1fr;
}

.progress-combined {
  margin-bottom: 0;
}

.progress-dual {
  display: grid;
  gap: .85rem;
}

.progress-row-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: .5rem;
  margin-bottom: .4rem;
}

.progress-row-label {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text);
}

.progress-row .pct {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary);
}

.progress-bar.agree-bar {
  background: var(--bar-agree);
}

.progress-chips {
  display: none;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.page-layout .progress-chips {
  display: flex;
  grid-column: 1;
  grid-row: 2;
  justify-content: flex-start;
  margin-top: 0;
}

.page-layout .progress-chip {
  background: #fef3c7;
  color: #92400e;
}

.page-layout .progress-combined .phase2-hint {
  grid-column: 1 / -1;
}

.page-layout .progress-header-meta {
  display: none;
}

.progress-chip {
  font-size: 11px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--bg);
  color: var(--muted);
  font-weight: 600;
  line-height: 1.3;
}

.progress-chip.chip-ok {
  background: #dcfce7;
  color: #166534;
}

.progress-chip.chip-warn {
  background: #fef3c7;
  color: #92400e;
}

.progress-combined.threshold-met {
  border-left: 3px solid var(--agreed);
  background: var(--threshold-met-bg);
}

.progress-combined.threshold-unmet {
  border-left: 3px solid #f59e0b;
  background: var(--threshold-unmet-bg);
}

.phase2-hint {
  margin-top: .65rem;
  font-size: .85rem;
}

.phase2-hint.phase2-open { color: var(--phase-open); }
.phase2-hint.phase2-closed { color: var(--muted); }

.progress-section {
  background: var(--card);
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: .75rem;
}

.progress-header-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .35rem .5rem;
  flex: 1;
  min-width: 0;
}

.progress-header h2 {
  font-size: 1rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  margin: 0;
  line-height: 1;
}

.progress-header-meta {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.2;
  display: inline;
}

.progress-header-meta #thresholdStatus {
  display: inline;
}

.progress-header-meta .threshold-fail,
.progress-header-meta .threshold-ok {
  display: inline;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  vertical-align: baseline;
}

.progress-header-meta .threshold-fail span {
  font-weight: inherit;
  vertical-align: baseline;
}

.progress-header-meta .threshold-ok svg {
  display: inline;
  vertical-align: -0.12em;
}

.progress-header .pct {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}

.progress-bar-wrap {
  height: 14px;
  background: var(--track);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.progress-bar {
  height: 100%;
  background: var(--bar-signed);
  border-radius: 999px;
  transition: width .4s ease;
  box-shadow: 0 0 0 1px rgba(5, 150, 105, .12);
}

.progress-bar.signed-bar {
  background: var(--bar-signed);
}

.progress-section-secondary {
  border-left: 3px solid var(--agreed);
}

.threshold-banner {
  background: var(--card);
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
  border-left: 3px solid #94a3b8;
}

.threshold-banner.threshold-met {
  border-left-color: var(--agreed);
  background: linear-gradient(135deg, #ffffff 0%, #f0fdf4 100%);
}

.threshold-banner.threshold-unmet {
  border-left-color: #f59e0b;
  background: linear-gradient(135deg, #ffffff 0%, #fffbeb 100%);
}

.threshold-banner-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: .5rem;
}

.threshold-banner-header h2 {
  font-size: 1rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
}

.threshold-banner .pct {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}

.threshold-fail {
  color: #b45309;
}

.threshold-fail span {
  color: #dc2626;
}

.threshold-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #dc2626;
  z-index: 2;
}

.progress-note {
  font-size: .78rem;
  color: var(--muted);
  margin-top: .5rem;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: center;
  margin-bottom: 1rem;
}

.toolbar label {
  font-size: .85rem;
  color: var(--muted);
}

.toolbar select,
.toolbar input[type="search"] {
  padding: .45rem .75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: .85rem;
  background: var(--card);
}

.toolbar input[type="search"] {
  min-width: 160px;
}

.btn {
  padding: .45rem .85rem;
  border: none;
  border-radius: 8px;
  font-size: .85rem;
  cursor: pointer;
  background: var(--primary);
  color: #fff;
  transition: opacity .15s;
  text-decoration: none;
  display: inline-block;
}

.btn:hover { opacity: .88; }
.btn.secondary { background: #64748b; }
.btn.outline {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: .82rem;
  margin-bottom: 1rem;
  background: var(--card);
  padding: .75rem 1rem;
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: .35rem;
}

.legend-divider {
  width: 1px;
  height: 16px;
  background: var(--border);
}

.legend-signed svg { color: #059669; }
.legend-unsigned svg { color: var(--unknown); }

    .dot {
      width: 12px;
      height: 12px;
      border-radius: 3px;
    }

    /* dot 已改用 IconPark 图标 */

.building {
  display: flex;
  flex-direction: column-reverse;
  gap: .6rem;
}

.floor-row {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: .6rem;
  align-items: stretch;
}

.floor-label {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .9rem;
  color: var(--muted);
  background: var(--card);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.units {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: .4rem;
}

.unit {
  border: 2px solid transparent;
  border-radius: 12px;
  padding: .45rem .2rem;
  text-align: center;
  font-size: .78rem;
  min-height: 62px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 2px;
  -webkit-tap-highlight-color: transparent;
}

.unit.readonly.clickable,
.unit.clickable {
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease;
}

.unit.readonly.clickable:active,
.unit.clickable:active {
  transform: scale(0.96);
}

.unit.editable {
  cursor: pointer;
  transition: transform .12s, box-shadow .12s;
}

.unit.editable:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.unit .room-no {
  font-weight: 700;
  font-size: .85rem;
}

.unit .owner,
.unit .status-text {
  font-size: .68rem;
  font-weight: 600;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.25;
}

.unit.agreed { background: var(--agreed-bg); border-color: var(--agreed); color: #166534; }
.unit.pending { background: var(--pending-bg); border-color: var(--pending); color: #92400e; }
.unit.refused { background: var(--refused-bg); border-color: var(--refused); color: #991b1b; }
.unit.contacted { background: var(--contacted-bg); border-color: var(--contacted); color: #1e40af; }
.unit.unknown { background: var(--unknown-bg); border-color: #cbd5e1; color: #475569; }
.unit.empty {
  background: var(--card);
  border-color: var(--border);
  color: var(--text);
}

.sign-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: .62rem;
  font-weight: 700;
  margin-top: 2px;
  padding: 2px 5px;
  border-radius: 4px;
  letter-spacing: .02em;
  white-space: nowrap;
}

.sign-badge.sign-yes {
  color: #065f46;
  background: #a7f3d0;
  border: 1px solid #6ee7b7;
}

.sign-badge.sign-no {
  color: #475569;
  background: #e2e8f0;
  border: 1px solid #cbd5e1;
}

.sign-badge.sign-empty {
  visibility: hidden;
  min-height: 1.15em;
}

.unit.form-signed {
  box-shadow: inset 0 -3px 0 #059669;
}

.unit.form-unsigned {
  box-shadow: inset 0 -3px 0 #cbd5e1;
}

.unit.form-empty {
  box-shadow: none;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .9rem;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  width: auto;
  accent-color: var(--primary);
}

.unit.filtered-out { opacity: .25; pointer-events: none; }

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.45);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--card);
  border-radius: 14px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 50px rgba(0,0,0,.2);
  overflow: hidden;
}

.modal-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 1.05rem;
}

.modal-body { padding: 1.25rem; }

.form-group { margin-bottom: .85rem; }

.form-group label {
  display: block;
  font-size: .82rem;
  color: var(--muted);
  margin-bottom: .3rem;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: .5rem .65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: .9rem;
  font-family: inherit;
}

.form-group textarea { resize: vertical; min-height: 60px; }

.date-picker-row {
  display: grid;
  grid-template-columns: 1.15fr 1fr 1fr;
  gap: .5rem;
}

.date-picker-row select {
  width: 100%;
  padding: .55rem .65rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: .9rem;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #64748b 50%), linear-gradient(135deg, #64748b 50%, transparent 50%);
  background-position: calc(100% - 14px) calc(50% + 2px), calc(100% - 9px) calc(50% + 2px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 1.75rem;
}

.date-picker-row select:focus {
  outline: none;
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
}

.confirm-modal {
  max-width: 360px;
}

.confirm-message {
  font-size: .92rem;
  line-height: 1.65;
  color: var(--text);
}

.btn-danger {
  background: #dc2626;
}

.btn-danger:hover {
  opacity: .9;
}

.status-btns {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: .4rem;
}

.status-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .2rem;
  padding: .5rem .25rem;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  cursor: pointer;
  font-size: .75rem;
  text-align: center;
}

.status-btn-icon {
  display: inline-flex;
  line-height: 0;
}

.status-btn.active.agreed { border-color: var(--agreed); background: var(--agreed-bg); }
.status-btn.active.pending { border-color: var(--pending); background: var(--pending-bg); }
.status-btn.active.refused { border-color: var(--refused); background: var(--refused-bg); }
.status-btn.active.contacted { border-color: var(--contacted); background: var(--contacted-bg); }
.status-btn.active.unknown { border-color: var(--unknown); background: var(--unknown-bg); }

.sign-btns {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .4rem;
}

.sign-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  padding: .55rem .5rem;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  cursor: pointer;
  font-size: .82rem;
  font-weight: 600;
}

.sign-btn.active.sign-yes-btn {
  border-color: #059669;
  background: #a7f3d0;
  color: #065f46;
}

.sign-btn.active.sign-no-btn {
  border-color: #cbd5e1;
  background: #e2e8f0;
  color: #475569;
}

@media (max-width: 640px) {
  .status-btns {
    grid-template-columns: repeat(2, 1fr);
  }
}

.modal-footer {
  padding: .85rem 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: .5rem;
}

.footer-note {
  text-align: center;
  font-size: .75rem;
  color: var(--muted);
  margin-top: 1.5rem;
  padding-bottom: 0;
}

.footer-beian {
  text-align: center;
  font-size: .75rem;
  color: var(--muted);
  margin-top: .35rem;
  padding-bottom: 1rem;
}

.footer-beian a {
  color: var(--muted);
  text-decoration: none;
}

.footer-beian a:hover {
  color: var(--text);
  text-decoration: underline;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 1.5rem;
}

.loading-panel {
  width: min(360px, 100%);
  background: var(--card);
  border-radius: 12px;
  padding: 1.5rem 1.25rem 1.35rem;
  text-align: center;
  box-shadow: var(--shadow);
}

.loading-text {
  color: var(--muted);
  font-size: .95rem;
  margin-bottom: .85rem;
}

.loading-bar-wrap {
  overflow: hidden;
}

.loading-bar-indeterminate {
  width: 36%;
  animation: loading-bar-slide 1.15s ease-in-out infinite;
}

@keyframes loading-bar-slide {
  0% { transform: translateX(-130%); }
  100% { transform: translateX(280%); }
}

.loading,
.error-box {
  background: var(--card);
  border-radius: 12px;
  padding: 2rem;
  text-align: center;
  box-shadow: var(--shadow);
  color: var(--muted);
}

.error-box { color: #dc2626; }

.admin-banner {
  background: #fef3c7;
  border: 1px solid #f59e0b;
  color: #92400e;
  border-radius: 10px;
  padding: .75rem 1rem;
  font-size: .85rem;
  margin-bottom: 1rem;
}

.save-tip {
  position: fixed;
  left: 50%;
  bottom: max(1rem, env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(120%);
  z-index: 300;
  background: #065f46;
  color: #fff;
  padding: .55rem 1rem;
  border-radius: 999px;
  font-size: .82rem;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  transition: transform .25s ease;
  pointer-events: none;
  white-space: nowrap;
  max-width: calc(100vw - 2rem);
  overflow: hidden;
  text-overflow: ellipsis;
}

.save-tip.show {
  transform: translateX(-50%) translateY(0);
}

.save-tip.error {
  background: #b45309;
  white-space: normal;
  text-align: center;
  border-radius: 12px;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: var(--login-screen-bg);
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--card);
  border-radius: 14px;
  padding: 1.5rem;
  box-shadow: 0 20px 50px rgba(0,0,0,.25);
}

.login-card h2 {
  font-size: 1.15rem;
  margin-bottom: .25rem;
}

.login-hint {
  font-size: .82rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

.login-error {
  min-height: 1.2rem;
  color: #dc2626;
  font-size: .82rem;
  margin-bottom: .5rem;
}

.pwd-error-box.visible,
.pwd-error-box:not([hidden]) {
  display: block;
  padding: .65rem .75rem;
  border-radius: 8px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  margin-top: .35rem;
}

.login-btn {
  width: 100%;
  padding: .6rem;
  font-size: .95rem;
}

.admin-actions-bar {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin-bottom: .45rem;
}

.btn-xs {
  padding: .32rem .6rem;
  font-size: .72rem;
  line-height: 1.2;
}

.admin-actions-bar .btn-xs {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .28rem;
  min-height: 1.85rem;
  white-space: nowrap;
  box-sizing: border-box;
}

.admin-page .admin-banner {
  font-size: .78rem;
  padding: .55rem .65rem;
  margin-bottom: .6rem;
}

.admin-page .admin-toolbar {
  margin-top: .6rem;
  margin-bottom: 0;
}

.admin-page .legend-hint {
  color: var(--muted);
  font-size: inherit;
}

@media (max-width: 768px) {
  .admin-page .admin-banner {
    display: none;
  }

  .admin-actions-bar {
    gap: .3rem;
  }

  .admin-actions-bar .btn-xs {
    padding: .28rem .45rem;
    font-size: .68rem;
  }

  .admin-page .legend-hint {
    flex-shrink: 0;
    white-space: nowrap;
  }

  .admin-page .admin-toolbar {
    margin-top: .5rem;
  }
}

@media (max-width: 900px) {
  .units { grid-template-columns: repeat(6, 1fr); }
  .progress-header h2 { font-size: .92rem; }
}

.page-layout {
  display: flex;
  flex-direction: column;
}

.summary-section {
  order: 1;
}

.building-section {
  order: 2;
}

.page-layout > .footer-note {
  order: 3;
}

.summary-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
}

.legend-compact {
  margin-bottom: .6rem;
}

.building-section .progress-top {
  margin-bottom: .65rem;
  width: 100%;
}

.building-section .progress-top .progress-combined {
  margin-bottom: 0;
}

.page-layout .progress-section {
  box-shadow: var(--shadow-elevated);
  border-radius: 16px;
}

.page-layout .progress-combined {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  column-gap: .65rem;
  row-gap: .35rem;
  align-items: stretch;
}

.page-layout .progress-header {
  display: contents;
}

.page-layout .progress-header-main {
  grid-column: 1;
  grid-row: 1;
  flex-direction: column;
  align-items: flex-start;
  gap: .25rem;
  min-width: 0;
  align-self: start;
}

.page-layout .progress-header h2 {
  font-size: .8125rem;
  font-weight: 600;
  color: var(--muted);
}

.progress-ring {
  display: none;
}

.page-layout .progress-ring {
  display: flex;
  grid-column: 2;
  grid-row: 1 / 3;
  align-self: stretch;
  justify-self: end;
  align-items: center;
  justify-content: center;
  width: auto;
  height: 100%;
  max-width: min(36vw, 7.25rem);
  aspect-ratio: 1;
  margin: 0;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
  --ring-pct: 0;
  background: conic-gradient(#0d9488 calc(var(--ring-pct) * 1%), var(--track) 0);
  box-shadow: 0 4px 14px rgba(13,148,136,.22);
  transition: transform .8s cubic-bezier(.22, 1, .36, 1), opacity .8s ease;
}

.page-layout.app-reveal .progress-ring {
  animation: progress-ring-intro .8s cubic-bezier(.22, 1, .36, 1) .15s both;
}

@keyframes progress-ring-intro {
  from { transform: scale(.92); opacity: .35; }
  to { transform: scale(1); opacity: 1; }
}

.page-layout .progress-ring::after {
  content: "";
  position: absolute;
  inset: 9%;
  background: var(--card);
  border-radius: 50%;
}

.page-layout .progress-ring .pct {
  position: relative;
  z-index: 1;
  font-size: clamp(1rem, 4.2vw, 1.375rem);
  font-weight: 800;
  line-height: 1;
  color: #0f766e;
  font-variant-numeric: tabular-nums;
}

.page-layout .progress-bar-wrap {
  display: none;
}

.page-layout .progress-bar.agree-bar {
  background: linear-gradient(90deg, #2dd4bf, #0d9488, #14b8a6);
  box-shadow: none;
}

.page-layout .stat-card {
  box-shadow: var(--shadow-elevated);
  transition: transform .15s cubic-bezier(.22, 1, .36, 1), box-shadow .15s ease;
  -webkit-tap-highlight-color: transparent;
}

.page-layout .stat-card:active {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 24px rgba(15,23,42,.12), 0 20px 48px rgba(15,23,42,.1);
}

.page-layout .building {
  background: var(--card);
  border-radius: 16px;
  padding: 12px 10px;
  box-shadow: var(--shadow-elevated);
  border: 1px solid rgba(15,23,42,.04);
}

.note-full {
  display: inline;
}

@media (min-width: 769px) {
  .summary-section { order: 1; }
  .building-section { order: 2; }
}

@media (max-width: 768px) {
  .page-layout .building-section {
    order: -1;
  }

  .page-layout .summary-section {
    order: 0;
  }

  .header {
    padding: .85rem max(.75rem, env(safe-area-inset-right)) 1rem max(.75rem, env(safe-area-inset-left));
    padding-top: max(.85rem, env(safe-area-inset-top));
  }

  .header h1 { font-size: clamp(.78rem, 3.2vw, 1.05rem); margin-bottom: 0; }
  .header-oneline { gap: .35rem; }
  .header-oneline-body {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: .2rem .35rem;
  }
  .header-oneline-title,
  .header-oneline-badge {
    white-space: nowrap;
    flex-shrink: 0;
  }
  .header-oneline-badge {
    font-size: clamp(.68rem, 2.8vw, .82rem);
  }
  .header-times {
    display: contents;
  }
  #headerClock {
    margin-left: auto;
    white-space: nowrap;
    flex-shrink: 0;
    text-align: right;
  }
  #headerUpdated {
    width: 100%;
    flex-basis: 100%;
    padding-top: .28rem;
    border-top: 1px solid var(--header-line);
  }
  .header-clock,
  .header-updated { font-size: clamp(.6rem, 2.5vw, .72rem); }
  .header-updated {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0 .25rem;
  }
  .header-updated-at,
  .header-stale {
    white-space: nowrap;
  }
  .form-subtitle { display: none; }

  .container {
    margin-top: -.5rem;
    padding-left: max(.6rem, env(safe-area-inset-left));
    padding-right: max(.6rem, env(safe-area-inset-right));
  }

  .page-layout .concept-tip {
    display: none;
  }

  .page-layout .stats-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: .35rem;
    margin-bottom: .6rem;
  }

  .page-layout .stat-card {
    padding: .4rem .2rem;
    border-radius: 8px;
  }

  .page-layout .stat-card .stat-icon {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: .12rem;
    line-height: 0;
    opacity: .92;
  }

  .page-layout .stat-card .stat-icon svg {
    width: 14px;
    height: 14px;
  }

  .page-layout .stat-card .num {
    font-size: 1rem;
    line-height: 1.1;
  }

  .page-layout .stat-card .label {
    font-size: .58rem;
    margin-top: .1rem;
    line-height: 1.2;
  }

  .page-layout .summary-cards,
  .page-layout .summary-cards-single {
    grid-template-columns: 1fr;
    gap: .4rem;
  }

  .page-layout .progress-combined {
    padding: .85rem .9rem;
    column-gap: .55rem;
    row-gap: .3rem;
  }

  .page-layout .progress-ring {
    max-width: min(38vw, 7rem);
  }

  .page-layout .progress-bar-wrap {
    height: 10px;
  }

  .page-layout .progress-note {
    font-size: .62rem;
    margin-top: .3rem;
    line-height: 1.35;
  }

  .page-layout .progress-header-meta {
    font-size: .72rem;
    line-height: 1;
    gap: .2rem;
  }

  .page-layout .progress-header-main {
    gap: .25rem .35rem;
  }

  .page-layout .progress-chips {
    gap: 5px;
    margin-top: 8px;
  }

  .page-layout .progress-chip {
    font-size: 10px;
    padding: 4px 8px;
  }

  .page-layout .note-full {
    display: none;
  }

  .page-layout .legend-compact {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: .45rem;
    padding: .4rem .55rem;
    margin-bottom: .45rem;
    font-size: .68rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .page-layout .legend-compact::-webkit-scrollbar {
    display: none;
  }

  .page-layout .legend-divider {
    flex-shrink: 0;
    height: 12px;
  }

  .page-layout .legend-item {
    flex-shrink: 0;
    white-space: nowrap;
  }

  .page-layout .building {
    gap: .4rem;
  }

  .page-layout .footer-note {
    margin-top: .75rem;
    padding-bottom: .5rem;
    font-size: .68rem;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: .6rem;
  }

  .toolbar select,
  .toolbar input[type="search"],
  .search-wrap,
  .search-wrap input[type="search"] {
    width: 100%;
    min-width: 0;
    font-size: 16px;
  }

  .toolbar .btn { width: 100%; text-align: center; }

  .legend:not(.legend-compact) {
    gap: .45rem .65rem;
    padding: .65rem .75rem;
    font-size: .78rem;
  }

  .legend:not(.legend-compact) .legend-divider { display: none; }
  .legend-hint {
    margin-left: 0;
    width: 100%;
    padding-top: .25rem;
    border-top: 1px dashed var(--border);
  }
}

@media (max-width: 520px) {
  .units { grid-template-columns: repeat(4, 1fr); gap: .35rem; }
  .floor-row { grid-template-columns: 40px 1fr; gap: .45rem; }
  .floor-label { font-size: .78rem; border-radius: 6px; }

  .unit {
    min-height: 68px;
    padding: .35rem .12rem;
    font-size: .72rem;
    border-radius: 6px;
  }

  .page-layout .unit {
    min-height: 62px;
    padding: .28rem .1rem;
    gap: 1px;
    border-radius: 14px;
  }

  .page-layout .unit-status-icon {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .unit .room-no { font-size: .78rem; }
  .unit .status-text,
  .unit .owner { font-size: .64rem; }
  .sign-badge { font-size: .58rem; padding: 1px 4px; }

  .unit-status-icon svg { width: 14px !important; height: 14px !important; }
}

@media (max-width: 400px) {
  .units { grid-template-columns: repeat(4, 1fr); }
  .unit { min-height: 68px; }
  .page-layout .unit { min-height: 62px; }
  .unit .room-no { font-size: .74rem; }
  .unit .status-text,
  .unit .owner { font-size: .6rem; }
  .sign-badge { font-size: .56rem; }

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

@media (max-width: 320px) {
  .header h1 { font-size: 1.05rem; }
  .units { grid-template-columns: repeat(4, 1fr); gap: .3rem; }
  .floor-row { grid-template-columns: 36px 1fr; }
}

/* 用户详情浮窗 / 管理端收费与日志 */
.unit.clickable {
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease;
}

.unit.clickable:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, .18);
}

.detail-modal .modal {
  max-width: 520px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: .65rem 0;
  border-bottom: 1px solid var(--border);
}

.detail-row:last-child { border-bottom: none; }

.detail-label {
  color: var(--muted);
  font-size: .875rem;
  flex-shrink: 0;
  min-width: 7rem;
}

.detail-value {
  text-align: right;
  font-weight: 500;
}

.detail-value strong.agreed { color: var(--agreed); }
.detail-value strong.refused { color: var(--refused); }
.detail-value strong.contacted { color: var(--contacted); }
.detail-value strong.pending { color: var(--pending); }
.detail-value strong.unknown { color: var(--unknown); }
.detail-value strong.empty { color: var(--muted); font-weight: 500; }
.detail-value .paid-yes { color: var(--agreed); }
.detail-value .paid-no { color: var(--refused); }

.detail-section {
  margin-top: 1rem;
  padding-top: .75rem;
  border-top: 1px dashed var(--border);
}

.detail-section h3 {
  font-size: .9rem;
  margin-bottom: .5rem;
}

.fee-formula {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .75rem 1rem;
  font-size: .85rem;
  line-height: 1.6;
}

.policy-box {
  background: var(--surface-info);
  border: 1px solid var(--surface-info-border);
  border-radius: 8px;
  padding: .75rem 1rem;
  font-size: .82rem;
  line-height: 1.65;
  color: var(--surface-info-text);
  white-space: pre-wrap;
  max-height: 180px;
  overflow-y: auto;
}

.policy-empty,
.policy-muted {
  color: var(--muted);
  background: var(--surface-muted) !important;
  border-color: var(--border) !important;
}

.phase-tag {
  display: inline-flex;
  font-size: .78rem;
  padding: .2rem .55rem;
  border-radius: 6px;
  background: var(--phase-tag-bg);
  color: var(--phase-tag-text);
  margin-bottom: .75rem;
  margin-right: .35rem;
}

.phase-tag.phase2 {
  background: var(--phase2-tag-bg);
  color: var(--phase2-tag-text);
}

.admin-tabs {
  display: flex;
  gap: .35rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.admin-tab {
  border: 1px solid var(--border);
  background: var(--card);
  padding: .45rem .85rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: .875rem;
  color: var(--muted);
}

.admin-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
}

.admin-panel { display: none; }
.admin-panel.active { display: block; }

.settings-card {
  background: var(--card);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 1rem 1.15rem;
  margin-bottom: 1rem;
}

.settings-card h2 {
  font-size: 1rem;
  margin-bottom: .75rem;
  display: flex;
  align-items: center;
  gap: .4rem;
}

.coeff-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: .65rem;
}

.coeff-item label {
  display: block;
  font-size: .78rem;
  color: var(--muted);
  margin-bottom: .25rem;
}

.coeff-item input {
  width: 100%;
  padding: .4rem .5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.log-table-wrap {
  overflow-x: auto;
  background: var(--card);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.log-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .82rem;
}

.log-table th,
.log-table td {
  padding: .65rem .75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.log-table th {
  background: #f8fafc;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}

.log-action-login { color: #2563eb; }
.log-action-update { color: #059669; }
.log-action-config { color: #d97706; }
.log-action-notice { color: #7c3aed; }

.notice-ticker {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin: .5rem 0 0;
  padding: .45rem .75rem;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  color: #92400e;
  font-size: .82rem;
}

.notice-ticker-viewport {
  flex: 1;
  overflow: hidden;
}

.notice-ticker-track {
  display: flex;
  width: max-content;
  animation: notice-scroll 24s linear infinite;
}

.notice-ticker-content {
  padding-right: 3rem;
  white-space: nowrap;
}

@keyframes notice-scroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.notice-admin-card {
  margin-bottom: .75rem;
}

.notice-admin-card .field-hint {
  margin-bottom: .75rem;
}

.notice-composer {
  margin-bottom: .85rem;
}

.notice-composer-field {
  background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

.notice-composer-field:focus-within {
  border-color: #93c5fd;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .1), var(--shadow);
}

.notice-composer-field textarea {
  display: block;
  width: 100%;
  border: none;
  background: transparent;
  padding: .9rem 1rem .55rem;
  font-size: .9rem;
  line-height: 1.6;
  resize: none;
  min-height: 5rem;
  font-family: inherit;
  color: var(--text);
}

.notice-composer-field textarea:focus {
  outline: none;
}

.notice-composer-field textarea::placeholder {
  color: #94a3b8;
}

.notice-composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .55rem .75rem .75rem;
  border-top: 1px solid #eef2f7;
}

.notice-char-count {
  font-size: .72rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.notice-char-count.is-limit {
  color: #b45309;
  font-weight: 600;
}

.notice-publish-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  padding: .48rem 1.05rem;
  font-size: .82rem;
  border-radius: 999px;
  box-shadow: 0 1px 2px rgba(37, 99, 235, .18);
}

.notice-publish-btn:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.notice-admin-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: .55rem;
}

.notice-admin-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
  padding: .75rem .85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f8fafc;
  font-size: .84rem;
  line-height: 1.55;
}

.notice-admin-item:first-child {
  padding-top: .75rem;
}

.notice-admin-meta {
  color: var(--muted);
  font-size: .72rem;
  margin-top: .25rem;
}

.notice-admin-remove {
  flex-shrink: 0;
  border: 1px solid #fecaca;
  background: #fff;
  color: #dc2626;
  cursor: pointer;
  font-size: .72rem;
  padding: .28rem .55rem;
  border-radius: 999px;
  transition: background .15s ease, border-color .15s ease;
}

.notice-admin-remove:hover {
  background: #fef2f2;
  border-color: #fca5a5;
}

.notice-admin-empty {
  padding: .85rem 1rem;
  border: 1px dashed var(--border);
  border-radius: 10px;
  color: var(--muted);
  font-size: .82rem;
  text-align: center;
  background: #fafbfc;
}

.log-detail {
  color: var(--muted);
  font-size: .75rem;
  line-height: 1.5;
  max-width: 420px;
  word-break: break-word;
}

.fee-cost-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: .75rem 1rem;
  margin-bottom: .75rem;
}

.fee-preview {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: .75rem 1rem;
  font-size: .85rem;
  line-height: 1.6;
  color: #1e3a5f;
}

.fee-preview.inline { margin-top: .25rem; }

.field-hint {
  font-size: .78rem;
  color: var(--muted);
  margin-top: .25rem;
}

.pay-amount {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1d4ed8;
}

.detail-row.highlight-row {
  background: #eff6ff;
  margin: .35rem -0.5rem;
  padding: .65rem .5rem;
  border-radius: 8px;
  border-bottom: none;
}

@media (max-width: 640px) {
  .detail-row {
    flex-direction: column;
    gap: .25rem;
  }
  .detail-value { text-align: left; }
  .log-table th:nth-child(5),
  .log-table td:nth-child(5) { display: none; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1216;
    --card: #1a1f27;
    --text: #eef1f5;
    --muted: #9aa4b2;
    --border: #2c3440;
    --agreed: #4ade80;
    --agreed-bg: #14532d;
    --pending: #fbbf24;
    --pending-bg: #78350f;
    --refused: #f87171;
    --refused-bg: #7f1d1d;
    --unknown: #94a3b8;
    --unknown-bg: #1e293b;
    --contacted: #60a5fa;
    --contacted-bg: #1e3a8a;
    --primary: #2dd4bf;
    --header-bg: #14181e;
    --header-text: #f4f6f8;
    --header-muted: #9aa4b2;
    --header-line: #2c3440;
    --track: #3b4554;
    --bar-signed: linear-gradient(90deg, #6ee7b7, #34d399);
    --bar-agree: linear-gradient(90deg, #93c5fd, #3b82f6);
    --shadow: 0 1px 3px rgba(0,0,0,.45), 0 8px 24px rgba(0,0,0,.28);
    --shadow-elevated: 0 8px 28px rgba(0,0,0,.35), 0 20px 48px rgba(0,0,0,.22);
    --surface-muted: #151a21;
    --surface-info: #172554;
    --surface-info-border: #1e40af;
    --surface-info-text: #bfdbfe;
    --stat-signed: #6ee7b7;
    --stat-unsigned: #94a3b8;
    --phase-open: #bbf7d0;
    --threshold-met-bg: linear-gradient(135deg, var(--card) 0%, #14532d 100%);
    --threshold-unmet-bg: linear-gradient(135deg, var(--card) 0%, #78350f 100%);
    --phase-tag-bg: #172554;
    --phase-tag-text: #93c5fd;
    --phase2-tag-bg: #14532d;
    --phase2-tag-text: #bbf7d0;
    --login-screen-bg: linear-gradient(145deg, #111418 0%, #121a18 48%, #141820 100%);
  }

  .unit.agreed { color: #bbf7d0; }
  .unit.pending { color: #fde68a; }
  .unit.refused { color: #fecaca; }
  .unit.contacted { color: #bfdbfe; }
  .unit.unknown { color: #cbd5e1; border-color: #475569; }
  .unit.empty { color: var(--text); }

  .threshold-banner.threshold-met {
    background: linear-gradient(135deg, var(--card) 0%, #14532d 100%);
  }
  .threshold-banner.threshold-unmet {
    background: linear-gradient(135deg, var(--card) 0%, #78350f 100%);
  }

  .progress-bar {
    box-shadow: 0 0 8px rgba(52, 211, 153, .35);
  }

  .fee-preview {
    background: #172554;
    border-color: #1e40af;
    color: #bfdbfe;
  }

  .progress-chip.chip-ok {
    background: #14532d;
    color: #bbf7d0;
  }

  .progress-chip.chip-warn {
    background: #78350f;
    color: #fde68a;
  }

  .page-layout .progress-chip {
    background: #78350f;
    color: #fde68a;
  }

  .page-layout .progress-header .pct {
    color: #2dd4bf;
  }

  .page-layout .progress-ring {
    box-shadow: 0 4px 14px rgba(13,148,136,.15);
  }

  .page-layout .building {
    border-color: rgba(255,255,255,.04);
  }

  .page-layout .stat-card:active {
    box-shadow: 0 12px 32px rgba(0,0,0,.4), 0 24px 48px rgba(0,0,0,.28);
  }

  .notice-ticker {
    background: #422006;
    border-color: #92400e;
    color: #fde68a;
  }

  .log-table th { background: #151a21; }

  .notice-composer-field {
    background: #151a21;
  }
  .notice-composer-field:focus-within {
    background: #1a1f27;
  }
  .notice-composer-footer { border-top-color: var(--border); }
  .notice-admin-item,
  .notice-admin-empty { background: #151a21; }

  .detail-row.highlight-row { background: #172554; }
  .pay-amount { color: #93c5fd; }

  .fee-formula {
    background: var(--surface-muted);
    border-color: var(--border);
    color: var(--text);
  }

  .policy-box {
    background: var(--surface-info);
    border-color: var(--surface-info-border);
    color: var(--surface-info-text);
  }

  .policy-empty,
  .policy-muted {
    background: var(--surface-muted) !important;
    border-color: var(--border) !important;
    color: var(--muted) !important;
  }

  .phase-tag {
    background: var(--phase-tag-bg);
    color: var(--phase-tag-text);
  }

  .phase-tag.phase2 {
    background: var(--phase2-tag-bg);
    color: var(--phase2-tag-text);
  }

  .save-tip { color: #fff; }

  .form-group input,
  .form-group select,
  .form-group textarea,
  .date-picker-row select,
  .coeff-item input,
  .search-wrap input[type="search"] {
    background: #151a21;
    color: var(--text);
    border-color: var(--border);
  }
}

@media (prefers-reduced-motion: reduce) {
  .page-layout .stat-card {
    transition: none;
  }

  .page-layout .stat-card:active {
    transform: none;
  }

  .page-layout.app-reveal .progress-ring {
    animation: none;
  }
}
