/* UniProf admin dashboard (standalone page) */
:root {
  --bg: #f5f5f4;
  --surface: #ffffff;
  --text: #0a0a0a;
  --text-2: #555555;
  --muted: #8a8a8a;
  --border: #e4e4e2;
  --soft: #f4f4f2;
  --sent: #2a78d6;
  --failed: #d03b3b;
  --ok: #15803d;
  --radius: 12px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0a0a0a;
  --surface: #141414;
  --text: #f0f0f0;
  --text-2: #b0b0b0;
  --muted: #7a7a7a;
  --border: #262626;
  --soft: #1c1c1c;
  --sent: #4b93e8;
  --failed: #e05656;
  --ok: #4ade80;
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: Inter, system-ui, -apple-system, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.45; }
[hidden] { display: none !important; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.82em; background: var(--soft); padding: 0.1rem 0.35rem; border-radius: 6px; }
small { display: block; color: var(--muted); font-size: 0.78rem; }

.ad-gate { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.ad-gate-box { text-align: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 2rem 2.25rem; max-width: 420px; }
.ad-gate-box i { font-size: 1.6rem; color: var(--muted); }
.ad-gate-box h1 { font-size: 1.2rem; margin: 0.6rem 0 0.35rem; }
.ad-gate-box p { color: var(--text-2); margin-bottom: 1rem; }

.ad-top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: 0.75rem 1.25rem; background: var(--surface); border-bottom: 1px solid var(--border);
}
.ad-brand { font-weight: 700; display: flex; align-items: center; gap: 0.5rem; }
.ad-tabs { display: flex; gap: 0.25rem; flex-wrap: wrap; flex: 1; }
.ad-tabs button, .ad-seg button {
  border: none; background: transparent; padding: 0.4rem 0.8rem; border-radius: 8px; font: inherit; font-weight: 600; color: var(--text-2); cursor: pointer;
}
.ad-tabs button.active { background: var(--text); color: var(--surface); }
.ad-who { display: flex; align-items: center; gap: 0.9rem; color: var(--text-2); font-size: 0.82rem; }
.ad-link { color: var(--text); }

.ad-main { max-width: 1240px; margin: 0 auto; padding: 1.25rem 16px 3rem; }
.ad-section-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.ad-section-head h2 { font-size: 1.35rem; letter-spacing: -0.01em; }
.ad-head-actions { display: flex; align-items: center; gap: 0.75rem; }
.ad-muted { color: var(--muted); font-size: 0.85rem; }

.ad-btn {
  display: inline-flex; align-items: center; gap: 0.4rem; border: 1px solid var(--text); background: var(--text); color: var(--surface);
  border-radius: 8px; padding: 0.45rem 0.9rem; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
}
.ad-btn-outline { background: transparent; color: var(--text); border-color: var(--border); }
.ad-btn-danger { background: var(--failed); border-color: var(--failed); color: #fff; }
.ad-btn-sm { padding: 0.2rem 0.6rem; font-size: 0.78rem; }
.ad-icon-btn { border: none; background: transparent; color: var(--text-2); font-size: 1.1rem; cursor: pointer; padding: 0.35rem; }
.ad-input { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 8px; padding: 0.5rem 0.75rem; font: inherit; min-width: 260px; }

.ad-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem; }
.ad-card h3 { font-size: 0.95rem; margin-bottom: 0.6rem; }

.ad-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 0.75rem; margin-bottom: 1rem; }
.ad-tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.85rem 1rem; display: flex; flex-direction: column; gap: 0.1rem; }
.ad-tile-label { font-size: 0.78rem; color: var(--text-2); }
.ad-tile-value { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.ad-tile-sub { font-size: 0.76rem; color: var(--muted); }

.ad-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 0.75rem; margin-bottom: 0.75rem; }
.ad-chart figcaption { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.4rem; }
.ad-chart figcaption h3 { margin: 0; }
.ad-chart-plot svg { width: 100%; height: auto; display: block; }
.ad-grid { stroke: var(--border); stroke-width: 1; }
.ad-axis { fill: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.ad-bar.is-sent { fill: var(--sent); }
.ad-bar.is-failed { fill: var(--failed); }
.ad-hit:hover .ad-bar { opacity: 0.85; }
.ad-legend { display: flex; gap: 0.8rem; font-size: 0.78rem; color: var(--text-2); }
.ad-legend span { display: inline-flex; align-items: center; gap: 0.3rem; }
.ad-swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.ad-swatch.is-sent { background: var(--sent); }
.ad-swatch.is-failed { background: var(--failed); }
.ad-tooltip { position: fixed; z-index: 30; pointer-events: none; background: var(--text); color: var(--surface); font-size: 0.78rem; padding: 0.35rem 0.55rem; border-radius: 6px; white-space: nowrap; }
.ad-table-view summary { cursor: pointer; font-weight: 600; font-size: 0.85rem; }
.ad-table-view .ad-table-wrap { margin-top: 0.6rem; max-height: 320px; overflow: auto; }

.ad-table-wrap { overflow-x: auto; }
.ad-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.ad-table th { text-align: left; font-size: 0.74rem; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.03em; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--border); white-space: nowrap; }
.ad-table td { padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.ad-table tr:last-child td { border-bottom: none; }
.ad-row-link { cursor: pointer; }
tr.ad-row-link:hover td, td.ad-row-link:hover { background: var(--soft); }
.ad-more { display: flex; justify-content: center; margin-top: 0.75rem; }
.ad-two { display: grid; grid-template-columns: repeat(auto-fit, minmax(440px, 1fr)); gap: 0.75rem; }
.ad-seg { display: inline-flex; background: var(--soft); border: 1px solid var(--border); border-radius: 8px; padding: 2px; }
.ad-seg button.active { background: var(--surface); color: var(--text); }

.ad-pill { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.74rem; font-weight: 600; padding: 0.1rem 0.5rem; border-radius: 999px; border: 1px solid var(--border); color: var(--text-2); }
.ad-pill.is-ok { color: var(--ok); border-color: currentColor; }
.ad-pill.is-bad { color: var(--failed); border-color: currentColor; }

.ad-drawer { position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, 0.4); display: flex; justify-content: flex-end; }
.ad-drawer-panel { width: min(720px, 100%); height: 100%; background: var(--bg); display: flex; flex-direction: column; }
.ad-drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 0.9rem 1.1rem; background: var(--surface); border-bottom: 1px solid var(--border); }
.ad-drawer-head h2 { font-size: 1.1rem; }
.ad-drawer-body { overflow: auto; padding: 1rem 1.1rem 2rem; display: flex; flex-direction: column; gap: 0.9rem; }
.ad-drawer-body section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.9rem 1rem; display: flex; flex-direction: column; gap: 0.6rem; align-items: flex-start; }
.ad-drawer-body section > * { max-width: 100%; }
.ad-drawer-body h3 { font-size: 0.9rem; }
.ad-facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.3rem 1rem; font-size: 0.85rem; width: 100%; }
.ad-facts dt { color: var(--text-2); }
.ad-facts dd { overflow-wrap: anywhere; }
.ad-pre { white-space: pre-line; }
.ad-docs { list-style: none; display: flex; flex-direction: column; gap: 0.4rem; width: 100%; }
.ad-docs li { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.ad-docs small { display: inline; }

.ad-toast { position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--surface); padding: 0.6rem 1rem; border-radius: 10px; z-index: 40; }
.ad-toast.is-bad { background: var(--failed); color: #fff; }

@media (max-width: 720px) {
  .ad-charts, .ad-two { grid-template-columns: 1fr; }
  .ad-input { min-width: 0; width: 100%; }
  .ad-who { width: 100%; justify-content: space-between; }
}

/* Plans & codes */
.ad-form { display: flex; flex-direction: column; gap: 0.65rem; }
.ad-form label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.85rem; font-weight: 600; }
.ad-form .ad-input { min-width: 0; }
.ad-plans-pick { border: 1px solid var(--border); border-radius: 8px; padding: 0.5rem 0.75rem; display: flex; gap: 1rem; flex-wrap: wrap; }
.ad-plans-pick legend { font-size: 0.85rem; font-weight: 600; padding: 0 0.25rem; }
.ad-plans-pick label { flex-direction: row; align-items: center; gap: 0.35rem; font-weight: 500; }
.ad-plan-set { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.ad-plan-set .ad-input { min-width: 0; width: auto; }
.ad-plan-set #ad-plan-days { width: 90px; }
.ad-check { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.85rem; }

/* Professors, support, email details */
.ad-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ad-count { display: inline-block; min-width: 1.2rem; padding: 0 0.35rem; margin-left: 0.25rem; border-radius: 999px; background: var(--failed); color: #fff; font-size: 0.7rem; line-height: 1.2rem; text-align: center; }
.ad-code, .ad-code-block { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.8rem; }
.ad-code-block { white-space: pre; overflow-x: auto; background: var(--soft); border: 1px solid var(--border); border-radius: 8px; padding: 0.6rem 0.75rem; margin: 0.5rem 0 0; max-height: 320px; }
.ad-result { font-size: 0.86rem; }
.ad-result p { margin: 0.4rem 0; }
.ad-good { color: var(--ok); }
.ad-bad { color: var(--failed); }
.ad-errors { margin: 0.25rem 0 0; padding-left: 1.2rem; color: var(--text-2); font-size: 0.82rem; max-height: 220px; overflow-y: auto; }
.ad-tax-list { margin: 0.5rem 0 0; padding-left: 1.2rem; font-size: 0.84rem; max-height: 320px; overflow-y: auto; }
.ad-tax-list li { margin-bottom: 0.45rem; }
.ad-hint { margin: 0 0 0.6rem; padding: 0.55rem 0.75rem; border-radius: 8px; background: var(--soft); border: 1px solid var(--border); font-size: 0.86rem; }
.ad-hint i { color: var(--sent); margin-right: 0.25rem; }
.ad-details { margin-top: 0.5rem; font-size: 0.85rem; }
.ad-details summary { cursor: pointer; font-weight: 600; }
.ad-details .ad-pre { margin: 0.5rem 0 0; padding: 0.6rem 0.75rem; background: var(--soft); border-radius: 8px; }
.ad-thread { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.ad-thread li { padding: 0.6rem 0.75rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); max-width: 92%; }
.ad-thread li.is-admin { align-self: flex-end; background: var(--soft); }
.ad-thread p { margin: 0.25rem 0 0; font-size: 0.86rem; }
.ad-thread-meta { font-size: 0.74rem; color: var(--muted); }
.ad-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--sent); vertical-align: middle; }
textarea.ad-input { width: 100%; resize: vertical; }

/* Professor browser and editor */
.ad-prof-filters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(0, 1.4fr) auto; gap: 0.5rem; align-items: center; margin-bottom: 0.5rem; }
.ad-prof-filters .ad-input { min-width: 0; }
.ad-prof-edit label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.85rem; }
.ad-prof-edit .ad-plans-pick { max-height: 180px; overflow-y: auto; }
.ad-prof-edit textarea.ad-code { font-size: 0.78rem; }
@media (max-width: 900px) { .ad-prof-filters { grid-template-columns: 1fr 1fr; } }
