/*##############################################################################
# Script:        admin.css           (stylesheet, loaded by frontend/pages/login.html, password.html, system.html)
# Version:       1.01
# Created by:    Matthew Boucher
# Start date:    2026-09-10
# Location:      <project root>/frontend/css/admin.css   (main script: <project root>/aiacolyte.py; subscripts: <project root>/subscripts/aiacolyte/)
# Description:   The look of the login, password and System pages, in the site's palette on top of
#                styles.css (its colour tokens, fonts and buttons): the admin bar with the brand and
#                the logged-in links, cards and forms, the System page tabs, the log and user tables,
#                the Server stats cards with meters, and the web stats frame. Works with the main
#                script, which serves it as /static/css/admin.css; aiacolyte.py --checkup confirms it is in place.
# Reads:         the tokens and classes of styles.css and fonts.css
# Writes:        nothing
# Sensitive:     none needed
# Arguments:     none (a stylesheet cannot take flags)
# Changelog (last 15):
#   1.01  2026-09-10  First version: login, password and System pages.
##############################################################################*/

[hidden] { display: none !important; }

.admin-body {
  min-height: 100vh;
  background: radial-gradient(60% 40% at 50% 0%, rgba(43, 39, 102, 0.3), transparent 70%), var(--ink-1);
}

/* ---------- Admin bar ---------- */

.admin-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  padding: 16px var(--gutter);
  background: rgba(12, 10, 8, 0.9);
  border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.admin-bar__links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 22px;
  font-family: var(--font-display);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.admin-bar__links a,
.admin-bar__links .linkish {
  padding: 0;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  text-decoration: none;
  color: var(--text);
  background: none;
  border: 0;
  cursor: pointer;
  transition: color 0.3s;
}

.admin-bar__links a:hover,
.admin-bar__links .linkish:hover,
.admin-bar__links a[aria-current="page"] {
  color: var(--gold-bright);
}

.admin-bar__who {
  color: var(--text-faint);
}

/* ---------- Page body, cards, forms ---------- */

.admin-main {
  max-width: 1280px;
  margin: 0 auto;
  padding: clamp(28px, 5vw, 56px) var(--gutter) 72px;
}

.admin-narrow {
  max-width: 600px;
}

.admin-head {
  margin-bottom: 24px;
}

.admin-head h1,
.admin-card h1 {
  margin-top: 12px;
  font-size: clamp(2rem, 4vw, 2.8rem);
  color: var(--parchment);
}

.admin-head p:not(.eyebrow),
.admin-card > p {
  margin-top: 10px;
  color: var(--text-dim);
}

.admin-card {
  padding: clamp(24px, 4vw, 40px);
  background: linear-gradient(180deg, rgba(43, 39, 102, 0.22), transparent 55%), linear-gradient(180deg, #1b1612, #120f0c);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
}

.admin-card + .admin-card,
.admin-section + .admin-section {
  margin-top: 22px;
}

.admin-section h2 {
  font-size: 1.3rem;
  color: var(--parchment);
}

.admin-form {
  display: grid;
  gap: 16px;
  margin-top: 20px;
}

.admin-field label {
  display: block;
  margin-bottom: 6px;
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
}

.admin-field input,
.admin-field select {
  display: block;
  width: 100%;
  padding: 0.55em 0.8em;
  font: inherit;
  font-size: 1.1rem;
  color: var(--text);
  background: rgba(22, 20, 58, 0.35);
  border: 1px solid rgba(140, 200, 255, 0.25);
  border-radius: 6px;
}

.admin-field select option {
  background: #16143a;
}

.admin-field input:focus,
.admin-field select:focus {
  outline: none;
  border-color: var(--arcane);
  box-shadow: 0 0 0 3px rgba(140, 200, 255, 0.18);
}

.admin-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px;
}

.admin-row .grow {
  flex: 1 1 260px;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}

.opt {
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-style: italic;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-faint);
}

.admin-error {
  font-style: italic;
  color: #f0a08a;
}

.admin-note {
  font-style: italic;
  color: var(--text-dim);
}

.empty {
  padding: 18px 4px;
  font-style: italic;
  color: var(--text-dim);
}

.btn-small {
  padding: 0.55em 1em;
  font-size: 0.66rem;
}

/* ---------- Tabs and chips ---------- */

.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.admin-tab {
  padding: 0.75em 1.15em;
  font-family: var(--font-display);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-dim);
  background: none;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
  cursor: pointer;
}

.admin-tab:hover,
.admin-tab.is-active {
  color: var(--gold-bright);
}

.admin-tab.is-active {
  background: rgba(227, 176, 75, 0.07);
  border-color: var(--line);
}

.admin-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin-bottom: 14px;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.admin-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.35em 0.85em;
  font: italic 500 1rem/1.2 var(--font-body);
  color: var(--text-dim);
  text-decoration: none;
  background: rgba(227, 176, 75, 0.06);
  border: 1px solid rgba(227, 176, 75, 0.22);
  border-radius: 999px;
}

button.admin-chip {
  cursor: pointer;
}

.admin-chip:hover,
.admin-chip.is-active {
  color: var(--gold-bright);
  border-color: rgba(246, 216, 139, 0.6);
}

.admin-chip .count {
  font-style: normal;
  color: var(--text-faint);
}

.admin-search {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-search input[type="search"] {
  min-width: 200px;
  padding: 0.45em 0.8em;
  font: inherit;
  font-size: 1rem;
  color: var(--text);
  background: rgba(22, 20, 58, 0.35);
  border: 1px solid rgba(140, 200, 255, 0.25);
  border-radius: 6px;
}

/* ---------- Tables ---------- */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1.02rem;
}

.admin-table th {
  padding: 0.7em 0.8em;
  font-family: var(--font-display);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--gold);
  background: #15110d;
  border-bottom: 1px solid var(--line);
}

.admin-table td {
  padding: 0.6em 0.8em;
  vertical-align: top;
  border-bottom: 1px solid rgba(227, 176, 75, 0.08);
}

.admin-table tr:hover td {
  background: rgba(227, 176, 75, 0.04);
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  white-space: nowrap;
  color: var(--text-dim);
}

.kind {
  display: inline-block;
  padding: 0.12em 0.6em;
  font-family: var(--font-display);
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--gold-bright);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.kind-auth { color: var(--arcane); border-color: rgba(140, 200, 255, 0.35); }
.kind-system { color: #d6a8ff; border-color: rgba(214, 168, 255, 0.35); }
.kind-email { color: #9fe0a8; border-color: rgba(159, 224, 168, 0.35); }

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* ---------- Server stats ---------- */

.server-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr));
  gap: 16px;
}

.server-card {
  padding: 18px 20px;
  background: linear-gradient(180deg, #1b1612, #120f0c);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.server-card h3 {
  margin-bottom: 12px;
  font-size: 0.9rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold-bright);
}

.server-rows {
  display: grid;
  grid-template-columns: minmax(0, 42%) minmax(0, 1fr);
  gap: 6px 12px;
  margin: 0;
  font-size: 1.02rem;
}

.server-rows dt {
  color: var(--text-faint);
}

.server-rows dd {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--text);
}

.meter {
  grid-column: 1 / -1;
  height: 6px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
}

.meter span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold-bright));
}

.meter span.warm { background: linear-gradient(90deg, #b98433, #f0a060); }
.meter span.hot { background: linear-gradient(90deg, #9b2c1c, #e0604a); }

.ok { color: #9fe0a8 !important; }
.bad { color: #f0a08a !important; }

.stats-frame {
  width: 100%;
  min-height: 75vh;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

@media (max-width: 640px) {
  .admin-bar {
    position: static;
  }

  .server-rows {
    grid-template-columns: minmax(0, 1fr);
  }
}

/*##############################################################################
# End of admin.css  v1.01
##############################################################################*/
