:root {
  color-scheme: light;
  --primary: #fa5d2b;
  --text: #22262a;
  --muted: #5b6269;
}
.access-panel {
  position: fixed;
  inset: 0;
  width: 420px;
  max-width: calc(100vw - 32px);
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 15px;
  border: 1px solid #ebeef5;
  border-radius: 4px;
  background: #fff;
  color: #606266;
  box-shadow: 0 2px 12px #0000001a;
  overflow-y: auto;
}
.access-panel::backdrop { background: rgba(0, 0, 0, 0.5); }
html.access-modal-open,
html.access-modal-open body { overflow: hidden; overscroll-behavior: none; }
.access-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.access-heading h2 { margin: 0; color: #303133; font-size: 18px; font-weight: 400; line-height: 24px; }
.access-heading button { border: 0; background: transparent; color: #909399; font-size: 23px; line-height: 24px; cursor: pointer; }
.access-panel label { display: block; margin-bottom: 16px; line-height: 20px; }
.access-panel input { width: 100%; height: 36px; padding: 0 15px; border: 1px solid #dcdfe6; border-radius: 4px; }
.access-panel input:focus { border-color: #409eff !important; box-shadow: none; }
.access-panel input[aria-invalid="true"] { border-color: #f56c6c !important; }
.access-error { color: #f56c6c; min-height: 30px; padding: 4px 0 8px; font-size: 12px; line-height: 18px; }
.access-actions { display: flex; justify-content: flex-end; padding-top: 5px; }
.access-actions .layui-btn { height: 32px; line-height: 30px; padding: 0 15px; border: 1px solid #409eff; border-radius: 3px; background: #409eff; font-size: 12px; }
.access-panel button:disabled { opacity: 0.6; cursor: wait; }
.access-notice { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); width: 380px; max-width: calc(100vw - 32px); display: flex; align-items: center; gap: 10px; padding: 14px 20px; background: #fef0f0; border: 1px solid #fde2e2; border-radius: 4px; color: #f56c6c; }
.access-notice > span:first-child { font-size: 17px; line-height: 20px; }
.access-locked .filters { opacity: 0.6; }
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: #f4f5f6;
  color: var(--text);
  font: 14px/1.5 'Microsoft YaHei', Arial, sans-serif;
  overflow: hidden;
}
main {
  display: flex;
  flex-direction: column;
  gap: 24px;
  height: 100vh;
  height: 100dvh;
  max-width: 1600px;
  margin: auto;
  padding: 28px clamp(22px, 4vw, 56px);
}
.surface {
  position: relative;
}
.loading-mask {
  position: absolute;
  inset: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.84);
  color: var(--text);
  cursor: wait;
}
.loading-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid #fee9e0;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: loading-spin 0.8s linear infinite;
}
@keyframes loading-spin {
  to { transform: rotate(360deg); }
}
.overview {
  flex-shrink: 0;
}
.overview header,
.title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.overview header {
  justify-content: space-between;
  margin-bottom: 20px;
}
h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
}
#refresh {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 11px;
  color: var(--text);
  background: #fff;
  border: 1px solid #d9dde0;
}
#refresh:hover {
  background: #fbede7;
  border-color: #e5b29b;
}
.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}
.metrics article {
  min-width: 0;
  padding: 15px 17px;
  border: 1px solid #dce0e2;
  border-radius: 13px;
  background: #fff;
}
.metric-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
  min-height: 30px;
}
.metric-line h2 {
  font-size: 16px;
  font-weight: 700;
}
.metric-line strong {
  margin-left: auto;
  text-align: right;
  color: #000;
  font-family: Arial, sans-serif;
  font-size: 14px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
  min-width: 0;
  max-width: 100%;
}
.metric-day {
  min-height: 0;
  padding-top: 10px;
  margin-top: 10px;
  border-top: 1px solid #eaeced;
  color: #596065;
  font-size: 13px;
}
.metric-icon {
  display: grid;
  place-items: center;
  flex: 0 0 30px;
  height: 30px;
  border-radius: 8px;
  font-size: 16px;
}
.metric-new .metric-icon { background: #dff1e6; color: #2d7152; }
.metric-repeat .metric-icon { background: #e5eefb; color: #3c6496; }
.metric-remove .metric-icon { background: #feede2; color: #a7512e; }
.metric-remove-repeat .metric-icon { background: #eee7f6; color: #775696; }
.summary-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
  padding: 13px 18px;
  border-radius: 10px;
  background: #25282a;
  color: #fff;
}
.summary-item {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 2px 10px;
}
.summary-item + .summary-item {
  padding-left: 18px;
  border-left: 1px solid #5a5d60;
}
.summary-item strong {
  font-variant-numeric: tabular-nums;
}
#today-dedup {
  color: #ff986c;
}
.accounts {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  border: 1px solid #dce0e2;
  border-radius: 14px;
  background: #fff;
}
.accounts-title {
  margin: 17px 17px 0;
  padding-left: 9px;
  border-left: 3px solid var(--primary);
  line-height: 21px;
  font-size: 17px;
  font-weight: 700;
}
.filters {
  display: flex;
  align-items: flex-end;
  flex-shrink: 0;
  gap: 12px;
  flex-wrap: wrap;
  padding: 13px 17px 16px;
}
.filter {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 152px;
  min-width: 0;
}
.filter-keyword { width: clamp(205px, 27vw, 310px); }
.filter > span {
  white-space: nowrap;
  color: #596065;
  font-size: 13px;
}
.filters .layui-input,
.filters .layui-select {
  border-color: #dce0e2;
  border-radius: 7px;
  color: var(--text);
}
.filters .layui-input:focus { border-color: #b97255 !important; }
.filters .layui-form-select dl dd.layui-this { color: #9b3919; }
.filter-buttons {
  display: flex;
  gap: 8px;
}
.filter-buttons .layui-btn {
  border-radius: 7px;
  background: #25282a;
  color: #fff;
}
.filter-buttons .layui-btn-primary {
  background: #fff;
  border-color: #dce0e2;
  color: var(--text);
}
.filter-buttons .layui-btn + .layui-btn { margin: 0; }
.table-count {
  flex-shrink: 0;
  order: 1;
  padding: 10px 17px;
  border-top: 1px solid #e9ebed;
  color: var(--muted);
  font-size: 12px;
}
.table-scroll {
  flex: 1;
  width: 100%;
  min-height: 0;
  overflow: hidden;
}
.table-scroll-hint { display: none; }
.layui-table-view {
  display: flex;
  flex-direction: column;
  height: 100%;
  margin: 0;
  border: 0;
}
.layui-table-box {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.layui-table-header {
  flex-shrink: 0;
  background: #f4f5f6;
}
.layui-table th {
  color: #454b50;
  font-weight: 600;
  background: #f4f5f6;
}
.layui-table td,
.layui-table th {
  height: 43px;
  border-color: #e9ebed !important;
}
.layui-table td { color: #4f565a; }
.layui-table-cell {
  height: auto;
  line-height: 24px;
}
.layui-table-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
}
.status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 7px;
  border-radius: 5px;
  background: #e7f4ec;
  color: #356b52;
  font-size: 12px;
}
.status::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}
.status.off,
.status.unknown {
  background: #eff1f2;
  color: #586166;
}
.status.blocked {
  background: #fceeee;
  color: #a43f45;
}
#message {
  padding: 13px 0;
  color: var(--muted);
}
#message.error { color: #a43f45; }
[hidden] { display: none !important; }

@media (max-width: 1023px), (max-height: 500px) {
  body { overflow: auto; }
  main {
    height: auto;
    min-height: 100vh;
    min-height: 100svh;
    gap: 16px;
    padding: 14px max(12px, env(safe-area-inset-right))
      max(16px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  }
  .overview header { margin-bottom: 12px; }
  h1 { font-size: 21px; }
  .title-row img { width: 32px; height: 32px; }
  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
    margin-bottom: 10px;
  }
  .metrics article { padding: 10px; }
  .metric-line { column-gap: 6px; }
  .metric-line h2 { font-size: 14px; }
  .metric-icon { flex-basis: 23px; height: 23px; font-size: 13px; }
  .metric-day { margin-top: 7px; padding-top: 7px; font-size: 12px; }
  .summary-bar { padding: 10px 12px; font-size: 12px; }
  .summary-item + .summary-item { border-left: 0; padding-left: 0; }
  .accounts { flex: none; }
  .accounts-title { margin: 14px 14px 0; }
  .filters { display: grid; gap: 10px; padding: 12px 14px; }
  .filter, .filter-keyword { width: 100%; }
  .filter { flex-direction: row; align-items: center; gap: 8px; }
  .filter > span { flex: 0 0 52px; }
  .filter > input,
  .filter > .layui-form-select { flex: 1; width: 0; min-width: 0; }
  .filters .layui-input { height: 44px; font-size: 16px; }
  .filters .layui-form-select dl { top: 46px; max-height: 180px; }
  .filter-buttons { width: 100%; }
  .filter-buttons .layui-btn { flex: 1; height: 44px; line-height: 42px; }
  .table-scroll-hint {
    display: block;
    padding: 0 14px 9px;
    color: var(--muted);
    font-size: 12px;
  }
  .table-scroll { flex: none; height: clamp(280px, 55svh, 520px); }
}
