.page-top {
  flex: none;
  display: flex; align-items: baseline; gap: 10px;
  padding: calc(12px + var(--safe-t)) 18px 10px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.page-top h2 { font-size: 19px; font-weight: 700; }
.page-sub { font-size: 13px; color: var(--muted); }

.page-scroll {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 16px 18px 26px;
  max-width: 760px; width: 100%; margin: 0 auto;
}

.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; margin-bottom: 14px; }
.stat-card { background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); padding: 13px 10px; text-align: center;  }
.stat-num { font-size: 21px; font-weight: 700; color: var(--primary); line-height: 1.25; }
.stat-label { font-size: 11.5px; color: var(--muted); margin-top: 1px; }

.chart-card { padding: 15px; margin-bottom: 14px; }
.chart-card h3 { font-size: 14px; font-weight: 700; margin-bottom: 8px; }
.chart { width: 100%; height: 200px; }

.app-list { padding: 2px 0; }
.chat-item {
  display: flex; align-items: center; gap: 10px;
  padding: 15px 16px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background .15s;
}
.chat-item:last-child { border-bottom: none; }
.chat-item:hover { background: #fafbfd; }
.chat-item:active { background: var(--primary-soft); }
.chat-item-title { flex: 1; min-width: 0; font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-item-chev { flex: none; display: flex; color: #c3c7d6; }

.profile { display: flex; align-items: center; gap: 15px; padding: 20px; margin-bottom: 14px; }
.profile-info b { display: block; font-size: 17px; font-weight: 700; }
.profile-info span { font-size: 13px; color: var(--muted); }

.quota-card { padding: 17px; margin-bottom: 14px; }
.quota-head { display: flex; justify-content: space-between; align-items: center; font-size: 14px; font-weight: 600; }
.quota-head b { color: var(--primary); font-size: 15px; }
.quota-bar { height: 8px; background: #eef0f5; border-radius: 999px; overflow: hidden; margin-top: 11px; }
.quota-bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--primary), var(--primary-600)); transition: width .4s; }

.menu-card { overflow: hidden; margin-top: 14px; }
.menu-item {
  width: 100%;
  display: flex; align-items: center; gap: 12px;
  padding: 15px 17px;
  text-align: left;
  font-size: 14.5px; font-weight: 600; color: var(--danger);
}
.menu-ico { font-size: 16px; }
.menu-label { flex: 1; }
.menu-arrow { color: #c3c7d6; }
.foot-note { text-align: center; font-size: 11.5px; color: var(--muted); padding: 10px 0 4px; }

.detail-top {
  flex: none;
  display: flex; align-items: center; gap: 12px;
  padding: calc(8px + var(--safe-t)) 14px 8px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.back-btn { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--text); }
.detail-title { flex: 1; font-size: 15.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.detail-hero {
  flex: none;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 18px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.detail-url { font-size: 13px; font-weight: 600; word-break: break-all; }
.detail-ops { display: flex; gap: 7px; margin-left: auto; flex-wrap: wrap; }

.detail-tabs {
  flex: none;
  display: flex;
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 0 14px;
}
.dtab {
  padding: 11px 4px;
  margin-right: 22px;
  font-size: 14px; font-weight: 600; color: var(--muted);
  border-bottom: 2px solid transparent;
}
.dtab.active { color: var(--primary); border-bottom-color: var(--primary); }

.detail-pane { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.detail-pane.hidden { display: none; }
.detail-scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 14px 18px 24px; }

.detail-chat-scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 16px 16px 8px; }
.detail-chat-feed { max-width: 720px; margin: 0 auto; padding-bottom: 10px; }

.fm-toolbar {
  flex: none;
  display: flex; gap: 8px;
  padding: 10px 18px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.fm-toolbar .btn-sm { flex: none; }
#fileListWrap { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 12px 18px 24px; }
.fm-crumb { display: flex; align-items: center; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-bottom: 10px; }
.fm-crumb button { color: var(--primary); font-weight: 600; font-size: 12.5px; }
.fm-crumb-sep { color: #c3c7d6; }

.fm-list { overflow: hidden; }
.fm-row {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 15px;
  border-bottom: 1px solid var(--line);
}
.fm-row:last-child { border-bottom: none; }
.fm-row.is-dir { cursor: pointer; }
.fm-ico { flex: none; font-size: 16px; width: 22px; text-align: center; }
.fm-name { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm-size { flex: none; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.fm-actions { flex: none; display: flex; gap: 6px; }
.fm-empty { padding: 36px 16px; text-align: center; color: var(--muted); font-size: 13px; }

.file-editor { flex: 1; display: flex; flex-direction: column; min-height: 0; background: #fff; }
.editor-head {
  flex: none;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 16px;
  border-bottom: 1px solid var(--line);
}
.editor-title { font-size: 12.5px; color: var(--text-2); font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; word-break: break-all; }
.editor-ops { display: flex; gap: 7px; flex: none; }
.file-editor textarea {
  flex: 1;
  padding: 14px 16px;
  font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
  font-size: 13px; line-height: 1.65;
  resize: none;
  background: #fbfcfe;
  color: var(--text);
}

.db-info { padding: 15px 17px; margin-bottom: 13px; }
.db-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; font-size: 13px; }
.db-row span { color: var(--muted); flex: none; min-width: 82px; }
.db-row b { font-weight: 600; word-break: break-all; flex: 1; text-align: right; }
.db-row .db-copy { flex: none; margin-left: 8px; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.db-php {
  background: #fbfcfe; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; margin: 6px 0 4px;
  font-size: 11.5px; line-height: 1.65; word-break: break-all; white-space: pre-wrap;
  color: var(--text-2);
}
.db-switch { margin-top: 13px; padding-top: 13px; border-top: 1px dashed var(--line); }
.db-switch .btn-primary { height: 38px; font-size: 13px; border-radius: 10px; }
.db-switch-hint { font-size: 12px; color: var(--muted); margin-top: 8px; line-height: 1.7; }

.db-console { padding: 15px 17px; margin-bottom: 13px; }
.db-console h3 { font-size: 14px; font-weight: 700; margin-bottom: 10px; }
.db-console h3 .muted { font-size: 11.5px; font-weight: 500; color: var(--muted); }
.muted { color: var(--muted); }

.db-tables { display: flex; gap: 8px; flex-wrap: wrap; }
.db-table-chip {
  padding: 6px 13px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12.5px; font-weight: 600; color: var(--text-2);
  font-family: ui-monospace, Consolas, monospace;
}
.db-console textarea {
  width: 100%;
  background: #fbfcfe;
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  padding: 11px 13px;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12.5px; line-height: 1.6;
  resize: vertical;
  margin-bottom: 10px;
}

.db-out { margin-top: 12px; font-size: 12.5px; }
.db-ok { color: var(--ok); font-weight: 600; padding: 4px 0; }
.db-err { color: var(--danger); background: var(--danger-soft); border-radius: 9px; padding: 9px 12px; word-break: break-all; }
.db-running { color: var(--muted); padding: 4px 0; }
.db-table-wrap { overflow-x: auto; margin-top: 8px; border: 1px solid var(--line); border-radius: 10px; }
.db-table-wrap table { border-collapse: collapse; width: 100%; font-size: 12px; }
.db-table-wrap th { background: var(--bg); text-align: left; padding: 8px 11px; font-weight: 700; white-space: nowrap; border-bottom: 1px solid var(--line); }
.db-table-wrap td { padding: 7px 11px; border-bottom: 1px solid var(--line); word-break: break-all; max-width: 260px; }
.db-table-wrap tr:last-child td { border-bottom: none; }

@media (max-width: 560px) {
  .stat-row { gap: 7px; }
  .stat-num { font-size: 18px; }
  .detail-hero { padding: 9px 14px; }
}

.site-select { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 12px; scrollbar-width: none; }
.site-select::-webkit-scrollbar { display: none; }
.site-chip {
  flex: none; padding: 8px 16px;
  border-radius: 999px;
  background: #fff; border: 1px solid var(--line);
  color: var(--text-2); font-size: 13px; font-weight: 500;
}
.site-chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.site-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; margin-bottom: 14px; }
.site-head-title { font-size: 16px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.file-card { margin-bottom: 14px; overflow: hidden; }
.fm-wrap { padding: 12px 16px 6px; }

.file-card .file-editor { flex: none; display: block; }
.file-card .file-editor textarea { width: 100%; min-height: 320px; resize: vertical; }

.points-card { padding: 16px 18px; margin-bottom: 14px; }
.points-head { display: flex; justify-content: space-between; align-items: center; font-size: 14px; font-weight: 600; }
.points-head b { font-size: 20px; color: #17192b; }
.points-log { margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 8px; }
.pt-row { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; font-size: 12.5px; }
.pt-reason { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.pt-delta.up { color: var(--ok); font-weight: 600; }
.pt-delta.down { color: var(--danger); font-weight: 600; }

.site-top { align-items: center; }
.site-top-new { flex: none; margin-left: auto; }
.site-scroll { padding-top: 14px; }

.site-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  padding-bottom: 8px;
  width: 100%;
}
@media (min-width: 620px) {
  .site-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.site-card {
  display: flex; flex-direction: column; gap: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 15px 16px 13px;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
  cursor: pointer;
}
.site-card-top { display: flex; align-items: center; gap: 12px; min-width: 0; }
.site-card-ico {
  flex: none;
  width: 42px; height: 42px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 800; color: var(--primary);
  background: var(--primary-soft);
}
.site-card-info { flex: 1; min-width: 0; }
.site-card-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.site-card-name b { font-size: 15.5px; font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-card-name .badge { flex: none; margin-left: auto; }
.site-card-url {
  display: block; margin-top: 3px;
  font-size: 12px; color: var(--primary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.site-card-url.muted { color: var(--muted); }

.site-card-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.site-act {
  height: 36px;
  min-width: 0;
  padding: 0 6px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 13px; font-weight: 600; white-space: nowrap;
  color: var(--text-2);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.site-act:active { background: var(--primary-soft); }
.site-act.danger { color: var(--danger); background: var(--danger-soft); border-color: transparent; }

#view-site-files .detail-url,
#view-site-db .detail-url {
  flex: none; max-width: 46%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 12.5px; color: var(--primary); font-weight: 600;
}

.fm-list { background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); }
.fm-ico { color: var(--muted); }

#dbDetailScroll { max-width: 760px; width: 100%; margin: 0 auto; box-sizing: border-box; }
