/* ==========================================================================
   /admin: the visitor dashboard (admin/visits). Everything is scoped under
   body.admin, so none of it reaches the public pages, which load this file
   too. Colors come from application.css's tokens, light and dark.
   The chart's one series color is the brand blue, stepped into the chart
   lightness band (OKLCH L 0.43-0.77 light, 0.48-0.67 dark) and checked at
   3:1 or more against the card in each mode.
   ========================================================================== */
.admin {
  --adm-bar: #2353a3;
  --adm-bar-hover: #2f66c2;
  --adm-wash: var(--mist);
  background: var(--mist);
  font-size: 15px;
  line-height: 1.5;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .admin { --adm-bar: #3d9bd8; --adm-bar-hover: #5fb0e6; --adm-wash: var(--paper); }
}
:root[data-theme="dark"] .admin { --adm-bar: #3d9bd8; --adm-bar-hover: #5fb0e6; --adm-wash: var(--paper); }

.admin .adm-wrap { max-width: 1100px; margin: 0 auto; padding: 0 24px; }
@media (max-width: 520px) { .admin .adm-wrap { padding: 0 16px; } }

/* header */
.admin .adm-bar { background: var(--night); color: var(--on-night); }
.admin .adm-bar .adm-wrap { display: flex; align-items: center; gap: 14px; height: 56px; }
.admin .adm-logo img { display: block; }
.admin .adm-bar-title { font-weight: 600; color: var(--on-night-muted); padding-left: 14px; border-left: 1px solid var(--on-night-line); }

.admin .adm-main { padding-top: 24px; padding-bottom: 56px; display: grid; gap: 20px; }

/* period filter: one row above everything it scopes */
.admin .adm-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.admin .adm-periods { display: inline-flex; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.admin .adm-period { padding: 5px 12px; border-radius: 7px; color: var(--muted); font-weight: 600; font-size: 14px; text-decoration: none; }
.admin .adm-period:hover { background: var(--adm-wash); color: var(--ink); }
.admin .adm-period[aria-current="page"] { background: var(--ink); color: var(--paper); }
.admin .adm-note { margin: 0; color: var(--muted); font-size: 13px; }

/* totals */
.admin .adm-stats { display: grid; grid-template-columns: 1.4fr repeat(4, 1fr); gap: 12px; }
@media (max-width: 860px) { .admin .adm-stats { grid-template-columns: repeat(2, 1fr); } .admin .adm-stat-hero { grid-column: 1 / -1; } }
.admin .adm-stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.admin .adm-stat-label { color: var(--muted); font-size: 13px; font-weight: 500; }
.admin .adm-stat-value { font-size: 28px; font-weight: 600; letter-spacing: -0.01em; color: var(--ink); }
.admin .adm-stat-hero .adm-stat-value { font-size: 48px; line-height: 1.05; }
.admin .adm-stat-quiet .adm-stat-value { color: var(--muted); }

/* cards */
.admin .adm-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; margin: 0; min-width: 0; }
.admin .adm-card-title { font-family: var(--f-body); font-size: 14px; font-weight: 600; letter-spacing: 0; color: var(--ink); margin: 0 0 12px; }
.admin .adm-empty { margin: 0; color: var(--faint); }
.admin .adm-muted { color: var(--faint); }

/* the column chart: thin columns grow from one baseline, 2px apart, with
   hairline gridlines; each column is the hover and focus target */
.admin .adm-plot { position: relative; height: 200px; margin: 6px 0 0 34px; }
.admin .adm-grid { position: absolute; inset: 0; }
.admin .adm-gridline { position: absolute; left: 0; right: 0; height: 0; border-top: 1px solid var(--line); }
.admin .adm-gridline span { position: absolute; right: calc(100% + 8px); top: 0; transform: translateY(-50%); font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.admin .adm-cols { position: absolute; inset: 0; display: flex; align-items: flex-end; gap: 2px; list-style: none; margin: 0; padding: 0; }
.admin .adm-col { position: relative; flex: 1 1 0; min-width: 0; height: 100%; display: flex; align-items: flex-end; justify-content: center; cursor: default; }
.admin .adm-col:focus-visible { outline: 2px solid var(--sky); outline-offset: 1px; border-radius: 4px; }
.admin .adm-col-bar { display: block; width: 100%; max-width: 24px; background: var(--adm-bar); border-radius: 4px 4px 0 0; }
.admin .adm-col:hover .adm-col-bar, .admin .adm-col:focus-visible .adm-col-bar { background: var(--adm-bar-hover); }
.admin .adm-col:hover, .admin .adm-col:focus-visible { background: color-mix(in srgb, var(--line) 45%, transparent); border-radius: 4px; }
.admin .adm-tip { position: absolute; z-index: 2; top: -6px; left: 50%; transform: translate(-50%, -100%); display: none; white-space: nowrap; background: var(--ink); color: var(--paper); font-size: 12px; padding: 5px 8px; border-radius: 6px; box-shadow: var(--shadow-sm); pointer-events: none; }
.admin .adm-tip strong { font-weight: 700; margin-right: 4px; }
.admin .adm-col-start .adm-tip { left: 0; transform: translate(0, -100%); }
.admin .adm-col-end .adm-tip { left: auto; right: 0; transform: translate(0, -100%); }
.admin .adm-col:hover .adm-tip, .admin .adm-col:focus-visible .adm-tip { display: block; }
.admin .adm-x { position: relative; height: 22px; margin-left: 34px; border-top: 1px solid var(--line-2); }
.admin .adm-x span { position: absolute; top: 4px; transform: translateX(-50%); font-size: 12px; color: var(--faint); white-space: nowrap; font-variant-numeric: tabular-nums; }
.admin .adm-x .adm-x-first { transform: none; left: 0 !important; }
.admin .adm-x .adm-x-last { transform: none; left: auto !important; right: 0; }

.admin .adm-table-view { margin-top: 10px; }
.admin .adm-table-view summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.admin .adm-table-view .adm-table { margin-top: 8px; max-width: 360px; }

/* ranked lists: the number beside the name, a thin bar for its share */
.admin .adm-rankings { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.admin .adm-ranking ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.admin .adm-ranking li { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: baseline; }
.admin .adm-ranking-label { overflow-wrap: anywhere; color: var(--ink); }
.admin .adm-ranking-count { font-weight: 600; font-variant-numeric: tabular-nums; }
.admin .adm-ranking-bar { grid-column: 1 / -1; height: 6px; min-width: 4px; background: var(--adm-bar); border-radius: 3px; }

/* tables */
.admin .adm-table-wrap { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
.admin .adm-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin .adm-table th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; padding: 0 12px 8px 0; border-bottom: 1px solid var(--line-2); }
.admin .adm-table td { padding: 9px 12px 9px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.admin .adm-table tr:last-child td { border-bottom: 0; }
.admin .adm-table .adm-num { text-align: right; font-variant-numeric: tabular-nums; padding-right: 0; }
.admin .adm-recent td { min-width: 120px; }
.admin .adm-recent td.adm-nowrap { white-space: nowrap; min-width: 0; }
