body.admin { background: var(--bg-soft); min-height: 100vh; }
.admin-main { padding: 32px 0 80px; }
.admin h1 { font-size: 24px; font-weight: 800; }
.admin h2 { font-size: 17px; font-weight: 800; }
.admin h2 small { font-size: 14px; font-weight: 600; color: var(--muted); margin-left: 4px; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-top: 16px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.panel-actions { display: flex; gap: 8px; }
.login-panel { max-width: 380px; margin: 60px auto 0; }
.login-panel h1 { margin-bottom: 20px; }
.btn-block { width: 100%; margin-top: 8px; }
.btn-danger { background: #fff; color: #c62828; border-color: #e7b4b4; }
.btn-danger:hover:not(:disabled) { background: #fdecec; border-color: #c62828; }
.hint { margin: 6px 0 12px; font-size: 13px; color: var(--muted); }

.range { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-top: 16px; }
.presets, .seg { display: inline-flex; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.presets button, .seg button {
  border: 0; background: none; padding: 7px 14px; border-radius: 999px;
  font-size: 14px; font-weight: 600; color: var(--muted);
}
.presets button.is-active, .seg button.is-active { background: var(--green); color: #fff; }
.range-inputs { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.range-inputs input { height: 40px; padding: 0 10px; font: inherit; font-size: 15px; border: 1.5px solid #d3dbe0; border-radius: 10px; background: #fff; }

.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 16px; transition: opacity .2s; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; min-width: 0; }
.stat span { display: block; font-size: 14px; color: var(--muted); white-space: nowrap; }
.stat strong { display: block; margin-top: 4px; font-size: 30px; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.is-loading .stats, .is-loading .chart, .is-loading .tbl-list { opacity: .5; }

.legend { display: flex; gap: 18px; margin: 12px 0 4px; font-size: 13px; color: var(--text); }
.legend > span { display: inline-flex; align-items: center; gap: 6px; }
.key-bar { width: 12px; height: 12px; border-radius: 3px; background: #2e9b6c; }
.key-line { width: 16px; height: 2px; border-radius: 1px; background: #3a63c4; }

.chart { position: relative; height: 280px; transition: opacity .2s; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart .grid line { stroke: #e9edf0; }
.chart .axis text { fill: #7a858e; font-size: 11px; font-family: inherit; }
.chart .bar { fill: #2e9b6c; }
.chart .bar.is-hover { fill: #46b384; }
.chart .avg { fill: none; stroke: #3a63c4; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { fill: #3a63c4; stroke: #fff; stroke-width: 2; }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:focus { outline: none; }
.chart .empty { fill: #9aa5ad; font-size: 14px; }
.chart-tip {
  position: absolute; z-index: 2; pointer-events: none; min-width: 120px;
  background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(20,40,50,.14);
  padding: 10px 12px; font-size: 13px; color: var(--text);
}
.chart-tip .t-date { font-weight: 700; color: var(--ink); margin-bottom: 6px; }
.chart-tip .t-row { display: flex; align-items: center; gap: 8px; }
.chart-tip .t-row b { color: var(--ink); font-size: 14px; min-width: 32px; }
.chart-tip .t-key { width: 12px; height: 2px; border-radius: 1px; }

.chart-table { margin-top: 10px; font-size: 14px; }
.chart-table summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.chart-table .tbl-wrap { max-height: 280px; overflow: auto; margin-top: 8px; }

.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.tbl th, .tbl td { padding: 11px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.tbl th { font-size: 13px; color: var(--muted); font-weight: 700; background: var(--bg-soft); position: sticky; top: 0; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl td.empty { text-align: center; color: var(--muted); padding: 30px 0; }
.tbl-list tbody tr { cursor: pointer; }
.tbl-list tbody tr:hover { background: #f6faf8; }
.tbl-list tbody tr.is-checked { background: #eef6f2; }
.col-check { width: 36px; }
.tbl input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--green); cursor: pointer; vertical-align: middle; }
.mail-ok { color: var(--green); font-weight: 700; }
.mail-fail { color: #c62828; font-weight: 700; }

.detail { display: grid; grid-template-columns: 80px 1fr; gap: 12px 10px; margin: 20px 0 6px; font-size: 15px; }
.detail dt { color: var(--muted); font-weight: 600; }
.detail dd { margin: 0; color: var(--ink); font-weight: 700; word-break: break-all; }
.detail dd a { color: var(--green); }

.header-actions { display: flex; align-items: center; gap: 8px; }
.header-actions[hidden] { display: none; }
.who { font-size: 14px; font-weight: 600; color: var(--muted); margin-right: 4px; }

.acct-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.acct-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; }
.acct-list li.is-me { border-color: var(--green); background: #f3f9f6; }
.acct-name { font-weight: 800; color: var(--ink); }
.acct-meta { display: block; margin-top: 2px; font-size: 12.5px; color: var(--muted); }
.acct-list .btn { flex: none; }
#acct-form { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
#acct-form h3 { font-size: 16px; margin-bottom: 14px; }
.modal-actions.single { grid-template-columns: 1fr; }
.form-msg.is-success { color: var(--green); font-weight: 700; }

@media (max-width: 640px) {
  .who { display: none; }
  .header-actions .btn { padding: 0 12px; font-size: 13px; height: 36px; }
  .admin-main { padding-top: 22px; }
  .admin h1 { font-size: 21px; }
  .range { gap: 10px; }
  .presets { width: 100%; justify-content: space-between; }
  .presets button { padding: 7px 8px; font-size: 13px; flex: 1; }
  .range-inputs { width: 100%; }
  .range-inputs input { flex: 1; min-width: 0; font-size: 14px; padding: 0 6px; }
  .stats { gap: 8px; }
  .stat { padding: 12px 10px; text-align: center; }
  .stat span { font-size: 12px; }
  .stat strong { font-size: 22px; }
  .panel { padding: 16px 12px; }
  .chart { height: 220px; }
  .tbl { font-size: 13.5px; }
  .tbl th, .tbl td { padding: 10px 8px; }
}
