/* ══════════════════════════════════════════════════════
   量尺项目通 - Web 版
   Material Design 风格，与 App 一致
   ══════════════════════════════════════════════════════ */

:root {
  --primary: #1976D2;
  --primary-light: #42A5F5;
  --primary-dark: #1565C0;
  --bg: #F5F5F5;
  --card-bg: #FFFFFF;
  --text: #212121;
  --text-secondary: #666;
  --text-light: #999;
  --border: #E0E0E0;
  --success: #4CAF50;
  --warning: #FF9800;
  --danger: #F44336;
  --info: #2196F3;
  --radius: 12px;
  --shadow: 0 2px 8px rgba(0,0,0,.08);
}

* { margin:0; padding:0; box-sizing:border-box; }
body { font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif; background:var(--bg); color:var(--text); line-height:1.5; -webkit-font-smoothing:antialiased; }

/* ── Layout ── */
.app-container { max-width:100%; margin:0 auto; min-height:100vh; position:relative; }
@media (min-width:768px) { .app-container { max-width:900px; } }
@media (min-width:1200px) { .app-container { max-width:1000px; } }
.page { display:none; padding:0 0 80px; }
.page.active { display:block; }

/* ── App Bar ── */
.app-bar {
  background:var(--primary); color:#fff; padding:12px 16px;
  display:flex; align-items:center; gap:8px;
  position:sticky; top:0; z-index:100;
  box-shadow:0 2px 4px rgba(0,0,0,.15);
}
.app-bar .back-btn { background:none; border:none; color:#fff; font-size:22px; cursor:pointer; padding:4px; border-radius:50%; line-height:1; }
.app-bar .back-btn:hover { background:rgba(255,255,255,.15); }
.app-bar h1 { font-size:18px; font-weight:600; flex:1; }
.app-bar .actions { display:flex; gap:4px; }
.app-bar .actions button {
  background:none; border:none; color:#fff; cursor:pointer; padding:6px 8px;
  border-radius:8px; font-size:20px; line-height:1;
}
.app-bar .actions button:hover { background:rgba(255,255,255,.15); }
.app-bar .actions .btn-text { font-size:14px; font-weight:500; }

/* ── Auth Pages ── */
.auth-page {
  min-height:100vh; display:flex; align-items:center; justify-content:center;
  background:linear-gradient(135deg,var(--primary-dark),var(--primary-light));
  padding:20px;
}
.auth-box { background:#fff; border-radius:16px; padding:36px 28px; width:100%; max-width:380px; box-shadow:0 8px 32px rgba(0,0,0,.2); }
.auth-box .auth-icon { text-align:center; font-size:48px; margin-bottom:12px; }
.auth-box h1 { text-align:center; font-size:22px; font-weight:600; color:var(--primary); }
.auth-box .sub { text-align:center; font-size:13px; color:var(--text-light); margin-bottom:24px; }
.auth-box .auth-switch { text-align:center; font-size:14px; color:var(--text-secondary); margin-top:16px; }
.auth-box .auth-switch a { color:var(--primary); cursor:pointer; text-decoration:none; font-weight:500; }
.auth-box .auth-switch a:hover { text-decoration:underline; }

/* ── Forms ── */
.form-group { margin-bottom:14px; }
.form-group label { display:block; font-size:13px; font-weight:500; color:var(--text-secondary); margin-bottom:4px; }
.input-field {
  width:100%; padding:10px 14px; border:1.5px solid var(--border); border-radius:10px;
  font-size:15px; outline:none; transition:border .2s; background:#FAFAFA;
}
.input-field:focus { border-color:var(--primary); background:#fff; }
.input-field.error { border-color:var(--danger); }
textarea.input-field { resize:vertical; min-height:60px; }
select.input-field { appearance:auto; }
.input-group { position:relative; }
.input-group .prefix { position:absolute; left:14px; top:50%; transform:translateY(-50%); color:var(--text-light); font-size:14px; }

/* ── Buttons ── */
.btn { display:inline-flex; align-items:center; justify-content:center; gap:6px;
  padding:10px 20px; border:none; border-radius:10px; font-size:15px; font-weight:500;
  cursor:pointer; transition:all .2s; text-decoration:none; }
.btn-primary { background:var(--primary); color:#fff; }
.btn-primary:hover { background:var(--primary-dark); }
.btn-primary:disabled { opacity:.5; cursor:not-allowed; }
.btn-danger { background:var(--danger); color:#fff; }
.btn-danger:hover { background:#D32F2F; }
.btn-outline { background:transparent; border:1.5px solid var(--border); color:var(--text); }
.btn-outline:hover { border-color:var(--primary); color:var(--primary); }
.btn-sm { padding:6px 12px; font-size:13px; border-radius:8px; }
.btn-block { width:100%; }
.btn-icon { background:none; border:none; cursor:pointer; padding:6px; border-radius:8px; font-size:18px; color:var(--text-secondary); }
.btn-icon:hover { background:rgba(0,0,0,.06); color:var(--text); }

/* ── Cards ── */
.card { background:var(--card-bg); border-radius:var(--radius); box-shadow:var(--shadow); padding:16px; margin-bottom:12px; }
.card-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:12px; }
.card-title { font-size:16px; font-weight:600; }

/* ── Stats Row ── */
.stats-row { display:flex; gap:6px; padding:12px 14px 4px; }
.stat-chip { flex:1; text-align:center; padding:10px 4px; border-radius:10px; }
.stat-chip .count { font-size:22px; font-weight:700; }
.stat-chip .label { font-size:11px; margin-top:2px; }

/* ── Search ── */
.search-bar { padding:8px 14px; }
.search-bar .input-field { padding-left:38px; }
.search-wrap { position:relative; }
.search-wrap .search-icon { position:absolute; left:12px; top:50%; transform:translateY(-50%); color:var(--text-light); font-size:18px; }
.search-wrap .clear-btn { position:absolute; right:8px; top:50%; transform:translateY(-50%); background:none; border:none; cursor:pointer; color:var(--text-light); font-size:16px; padding:4px; }

/* ── Site Card ── */
.site-card {
  background:var(--card-bg); border-radius:var(--radius); box-shadow:var(--shadow);
  margin:0 14px 10px; padding:14px; cursor:pointer; transition:transform .15s, box-shadow .15s;
}
.site-card:hover { transform:translateY(-1px); box-shadow:0 4px 12px rgba(0,0,0,.12); }
.site-card .top { display:flex; justify-content:space-between; align-items:flex-start; }
.site-card .name { font-size:16px; font-weight:600; }
.site-card .meta { font-size:12px; color:var(--text-light); margin-top:4px; }
.site-card .badge { font-size:11px; padding:2px 8px; border-radius:10px; font-weight:500; white-space:nowrap; }
.site-card .footer { display:flex; justify-content:space-between; align-items:center; margin-top:10px; padding-top:8px; border-top:1px solid #f0f0f0; }
.site-card .progress { font-size:12px; color:var(--text-secondary);  }
.site-card .status-btn { font-size:11px; padding:2px 10px; border-radius:10px; border:none; cursor:pointer; font-weight:500; }

/* ── Badge colors ── */
.badge-active { background:#E3F2FD; color:#1565C0; }
.badge-paused { background:#FFF3E0; color:#E65100; }
.badge-completed { background:#E8F5E9; color:#2E7D32; }
.badge-pending { background:#FFF3E0; color:#E65100; }
.badge-done { background:#E8F5E9; color:#2E7D32; }
.badge-overdue { background:#FFEBEE; color:#C62828; }

/* ── Empty State ── */
.empty-state { text-align:center; padding:60px 20px; }
.empty-state .icon { font-size:56px; color:#ddd; margin-bottom:12px; }
.empty-state p { color:var(--text-light); font-size:14px; }

/* ── Detail: Site Info Card ── */
.info-grid { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.info-item .info-label { font-size:11px; color:var(--text-light); margin-bottom:2px; }
.info-item .info-value { font-size:14px; font-weight:500; }
.info-item.full { grid-column:1 / -1; }

/* ── Timeline ── */
.timeline { padding:0; }
.timeline-item { display:flex; gap:12px; position:relative; padding:0 0 0 20px; margin-bottom:16px; }
.timeline-item::before {
  content:''; position:absolute; left:7px; top:28px; bottom:-16px;
  width:2px; background:var(--border);
}
.timeline-item:last-child::before { display:none; }
.timeline-dot {
  position:absolute; left:0; top:2px; width:16px; height:16px; border-radius:50%;
  background:#fff; border:2.5px solid var(--border); z-index:1;
}
.timeline-item.done .timeline-dot { background:var(--success); border-color:var(--success); }
.timeline-item.overdue .timeline-dot { background:var(--danger); border-color:var(--danger); }
.timeline-item.current .timeline-dot { background:var(--primary); border-color:var(--primary); box-shadow:0 0 0 3px rgba(25,118,210,.2); }
.timeline-icon { font-size:16px; flex-shrink:0; margin-top:-1px; }
.timeline-content { flex:1; min-width:0; }
.timeline-content .tl-title { font-size:14px; font-weight:600; }
.timeline-content .tl-date { font-size:12px; color:var(--text-light); margin-top:2px; }
.timeline-content .tl-notes { font-size:12px; color:var(--text-secondary); margin-top:4px; }
.timeline-content .tl-actions { margin-top:6px; display:flex; gap:6px; flex-wrap:wrap; }

/* ── Status badge for siteStatus ── */
.site-status-badge { display:inline-block; padding:2px 10px; border-radius:10px; font-size:11px; font-weight:500; }

/* ── Modal ── */
.modal-overlay {
  display:none; position:fixed; inset:0; background:rgba(0,0,0,.4); z-index:200;
  align-items:flex-end; justify-content:center;
}
.modal-overlay.show { display:flex; }
@media (min-width:500px) {
  .modal-overlay { align-items:center; }
}
.modal-sheet {
  background:#fff; border-radius:20px 20px 0 0; width:100%; max-width:520px;
  max-height:85vh; overflow-y:auto; padding:20px; animation:slideUp .25s ease;
}
@media (min-width:500px) {
  .modal-sheet { border-radius:20px; max-height:80vh; }
}
@keyframes slideUp { from { transform:translateY(100%); } to { transform:translateY(0); } }
.modal-sheet h2 { font-size:18px; margin-bottom:14px; }
.modal-sheet .close-btn {
  position:sticky; top:0; float:right; background:none; border:none; font-size:22px;
  cursor:pointer; color:var(--text-light); padding:4px; border-radius:50%; line-height:1;
}
.modal-sheet .close-btn:hover { background:#f0f0f0; }

/* ── Toast ── */
.toast { position:fixed; bottom:80px; left:50%; transform:translateX(-50%); z-index:300;
  padding:10px 20px; border-radius:10px; color:#fff; font-size:14px;
  box-shadow:0 4px 16px rgba(0,0,0,.2); animation:fadeIn .2s ease; }
.toast.success { background:var(--success); }
.toast.error { background:var(--danger); }
.toast.info { background:var(--primary); }
@keyframes fadeIn { from { opacity:0; transform:translateX(-50%) translateY(10px); } to { opacity:1; transform:translateX(-50%) translateY(0); } }

/* ── Choice Chips ── */
.chip-group { display:flex; flex-wrap:wrap; gap:8px; }
.chip {
  padding:6px 14px; border-radius:20px; border:1.5px solid var(--border);
  font-size:13px; cursor:pointer; transition:all .2s;
}
.chip.selected { border-color:var(--primary); background:rgba(25,118,210,.1); color:var(--primary); font-weight:500; }
.chip:hover { border-color:var(--primary-light); }

/* ── Loading ── */
.loading { text-align:center; padding:40px; }
.spinner { width:32px; height:32px; border:3px solid #eee; border-top-color:var(--primary); border-radius:50%; animation:spin .7s linear infinite; display:inline-block; }
@keyframes spin { to { transform:rotate(360deg); } }

/* ── FAB ── */
.fab {
  position:fixed; bottom:24px; right:24px; width:52px; height:52px; border-radius:50%;
  background:var(--primary); color:#fff; border:none; font-size:28px;
  box-shadow:0 4px 12px rgba(25,118,210,.4); cursor:pointer;
  display:flex; align-items:center; justify-content:center;
  transition:transform .2s, box-shadow .2s; z-index:50;
}
.fab:hover { transform:scale(1.08); box-shadow:0 6px 16px rgba(25,118,210,.5); }

/* ── Price display ── */
.price { font-size:15px; font-weight:600; color:var(--primary); }
.price-label { font-size:11px; color:var(--text-light); }

/* ── Confirm dialog ── */
.confirm-overlay {
  display:none; position:fixed; inset:0; background:rgba(0,0,0,.4); z-index:250;
  align-items:center; justify-content:center;
}
.confirm-overlay.show { display:flex; }
.confirm-box { background:#fff; border-radius:16px; padding:24px; max-width:340px; width:90%; text-align:center; }
.confirm-box h3 { font-size:17px; margin-bottom:8px; }
.confirm-box p { font-size:14px; color:var(--text-secondary); margin-bottom:20px; }
.confirm-box .actions { display:flex; gap:10px; justify-content:center; }

/* ── Log entries ── */
.log-entry { display:flex; gap:10px; padding:10px 0; border-bottom:1px solid #f0f0f0; }
.log-entry:last-child { border-bottom:none; }
.log-entry .log-icon { font-size:18px; }
.log-entry .log-body { flex:1; }
.log-entry .log-body .log-text { font-size:13px; }
.log-entry .log-body .log-time { font-size:11px; color:var(--text-light); margin-top:2px; }

/* ── Month summary card ── */
.month-card {
  margin:0 14px 10px; padding:14px 16px; border-radius:var(--radius);
  background:linear-gradient(135deg,var(--primary-dark),var(--primary));
  color:#fff;
}
.month-card .mc-title { font-size:12px; opacity:.8; }
.month-card .mc-row { display:flex; justify-content:space-between; align-items:center; margin-top:6px; }
.month-card .mc-amount { font-size:18px; font-weight:700; }
.month-card .mc-sub { font-size:13px; opacity:.85; }
.month-card .mc-badge { background:rgba(255,255,255,.2); padding:3px 10px; border-radius:12px; font-size:11px; }

/* ── Responsive ── */
@media (max-width:480px) {
  .auth-box { padding:28px 20px; }
  .info-grid { grid-template-columns:1fr; }
  .stats-row { gap:4px; }
  .stat-chip .count { font-size:18px; }
  .app-bar h1 { font-size:16px; }
}

/* ── For Desktop: side-by-side detail layout ── */
@media (min-width:768px) {
  .detail-grid { display:grid; grid-template-columns:1fr 1fr; gap:12px; align-items:start; }
  .detail-grid .card { margin:0; }
  .info-grid { grid-template-columns:1fr 1fr 1fr; }
}

/* ── Bottom Nav ── */
.bottom-nav {
  position:fixed; bottom:0; left:0; right:0; background:#fff;
  display:flex; border-top:1px solid var(--border); z-index:100;
  box-shadow:0 -2px 8px rgba(0,0,0,.06);
}
.bottom-nav .nav-item {
  flex:1; text-align:center; padding:8px 4px 6px; cursor:pointer;
  color:var(--text-light); font-size:11px; transition:color .2s;
  border:none; background:none;
}
.bottom-nav .nav-item .nav-icon { font-size:22px; display:block; margin-bottom:2px; }
.bottom-nav .nav-item.active { color:var(--primary); font-weight:500; }
.bottom-nav .nav-item:hover { color:var(--primary); }

/* ── Settings Page ── */
.settings-section { margin-bottom:14px; }
.settings-section h3 { font-size:14px; font-weight:600; margin-bottom:6px; color:var(--text-secondary); padding:0 4px; }
.settings-item { display:flex; justify-content:space-between; align-items:center; padding:12px 16px; background:var(--card-bg); border-radius:10px; margin-bottom:6px; }
.settings-item .s-label { font-size:14px; flex:1; }
.settings-item .s-value { font-size:13px; color:var(--text-light); margin-right:10px; }
.settings-item .s-action { font-size:13px; color:var(--primary); cursor:pointer; font-weight:500; }
.about-icon { text-align:center; font-size:48px; margin:20px 0 8px; }
.about-name { text-align:center; font-size:20px; font-weight:700; color:var(--primary); }
.about-version { text-align:center; font-size:13px; color:var(--text-light); margin-bottom:20px; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width:6px; }
::-webkit-scrollbar-track { background:transparent; }
::-webkit-scrollbar-thumb { background:#ccc; border-radius:3px; }

/* ── Version Management ── */
.version-item {
  padding: 10px 12px;
  margin-bottom: 6px;
  border-radius: 8px;
  background: #f8f9fa;
  cursor: pointer;
  transition: all .15s;
  border: 2px solid transparent;
}
.version-item:hover { background: #e8f0fe; }
.version-item.version-stable {
  border-color: var(--primary);
  background: #e3f2fd;
}
.version-tag {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}
.version-item.version-disabled {
  border-color: #ffcdd2;
  background: #fff5f5;
}
