/* ==========================================================================
   XYZnet v3 — sub-site components (services, stats, scanner, ftp, chat)
   Loaded AFTER /_xyz/site.css (= www.xyznet.org/css/site.css, the single
   source of the design tokens). Only adds components the main site lacks;
   uses the same custom properties — never redefine tokens here.
   ========================================================================== */

.brand-sub { font: 600 .85rem/1 var(--mono); color: var(--muted); margin-left: -.25rem; }
.brand:hover .brand-sub { color: var(--accent); }
.hidden { display: none !important; }

/* page head used by every sub-site */
.sub-hero { margin: 0 0 2rem; }
.sub-hero .page-title { margin-bottom: .5rem; }
.sub-hero .page-lead { margin-bottom: 1rem; }
.live-chips { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0; padding: 0; list-style: none; }
.live-chips li { margin: 0; }

/* stat tiles (stats + scanner) */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin: 0 0 1.25rem; }
.tiles-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tile { border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.15rem; background: linear-gradient(180deg, rgba(24,34,58,.72), rgba(17,25,43,.72)); box-shadow: var(--shadow); min-width: 0; }
.tile .n { font: 700 2rem/1.1 var(--mono); color: #fff; letter-spacing: -.02em; }
.tile .l { font: 600 .7rem/1.2 var(--mono); text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin-top: .35rem; }
.tile .peak { font: 500 .78rem/1.2 var(--mono); color: var(--accent-2); margin-top: .5rem; }
.tile.hl { border-color: rgba(62,230,176,.3); background: linear-gradient(180deg, rgba(62,230,176,.08), rgba(17,25,43,.75) 60%); }
.tile.hl .n { color: var(--accent); }

/* sub-nav tabs (segmented, mono) — links or buttons */
.tabs { display: flex; flex-wrap: wrap; gap: .35rem; margin: 0 0 1.25rem; padding: .3rem; border: 1px solid var(--border); border-radius: 12px; background: rgba(7,12,22,.55); width: fit-content; max-width: 100%; }
.tab, .tabs > a {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  padding: .5rem .9rem; border-radius: 9px; font: 600 .85rem/1.2 var(--mono); color: var(--text-2);
  transition: background .15s var(--ease), color .15s var(--ease);
}
.tab:hover, .tabs > a:hover { background: rgba(148,163,184,.1); color: #fff; text-decoration: none; }
.tab.active, .tab[aria-selected="true"], .tabs > a.active, .tabs > a[aria-current] { background: rgba(62,230,176,.12); color: var(--accent); box-shadow: inset 0 0 0 1px rgba(62,230,176,.3); }

/* key/value detail table */
table.details { width: 100%; font-size: .93rem; }
table.details th { width: 11rem; text-align: left; font: 600 .7rem/1.4 var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); padding: .55rem .9rem .55rem 0; vertical-align: top; }
table.details td { padding: .55rem 0; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
table.details tr:last-child td { border-bottom: 0; }
.detail-name { font-size: clamp(1.3rem, 1.1rem + 1vw, 1.8rem); margin: 0 0 1rem; color: #fff; overflow-wrap: anywhere; }
td.topic { color: var(--text-2); overflow-wrap: anywhere; min-width: 12rem; }

/* badges with dot */
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }
.badge-off { color: #fde68a; border-color: rgba(251,191,36,.4); background: rgba(251,191,36,.1); }

/* inline search / filter */
.search { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 1rem; }
.search input[type="search"], .search input[name="q"] { flex: 1 1 16rem; min-width: 0; }

.member-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .45rem; }
.member-list li { margin: 0; font: 500 .88rem/1 var(--mono); padding: .45rem .65rem; border: 1px solid var(--border); border-radius: 9px; background: rgba(10,15,28,.45); }

.chart { display: block; width: 100%; height: 220px; }
.chart-wrap { border: 1px solid var(--border); border-radius: 12px; background: #070c16; padding: .5rem; }
.count-line { margin: .75rem 0 0; font-size: .85rem; }

/* degraded state (DB down etc.) */
.degraded { border-color: rgba(251,191,36,.35); background: linear-gradient(180deg, rgba(251,191,36,.07), rgba(17,25,43,.75) 60%); }
.degraded h2 { color: #fde68a; }

/* ---------- forms (portal) ---------- */
.field { display: grid; gap: .4rem; margin: 0 0 1rem; }
.field > label, .field-label { font: 600 .72rem/1 var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.field input[type="text"], .field input[type="password"], .field input[type="email"] { width: 100%; }
.field .hint { font-size: .82rem; color: var(--muted); }
.check { display: flex; gap: .6rem; align-items: flex-start; font-size: .92rem; color: var(--text-2); margin: 0 0 1rem; cursor: pointer; }
.check input { margin-top: .25rem; accent-color: var(--accent); width: auto; padding: 0; }
.form-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.ok:empty, .err:empty { display: none; }

.auth-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 1.25rem; align-items: start; }
.auth-grid > .card { margin-bottom: 0; }
.stack > .card:last-child { margin-bottom: 0; }

.kv-list { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .55rem 1.25rem; margin: 0 0 1.5rem; }
.kv-list dt { font: 600 .7rem/1.6 var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.kv-list dd { margin: 0; color: var(--text); overflow-wrap: anywhere; }

.svc-buttons { display: flex; flex-wrap: wrap; gap: .45rem; }
.svc-buttons .btn { font-family: var(--mono); }

.dash-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin: 0 0 1.5rem; }
.dash-head h1 { margin: 0; }
.dash-head .grad { overflow-wrap: anywhere; }

.item-list { display: grid; gap: .55rem; }
.item { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem 1rem; padding: .75rem 1rem; border: 1px solid var(--border); border-radius: 11px; background: rgba(10,15,28,.45); }
.item-name { font: 600 .95rem/1.3 var(--mono); color: var(--accent); overflow-wrap: anywhere; }
.item-meta { font-size: .85rem; color: var(--muted); }
.note-item { display: block; }
.note-item.unread { border-color: rgba(139,156,255,.4); box-shadow: inset 3px 0 0 var(--accent-2); }
.note-header { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem; font-size: .82rem; color: var(--muted); margin: 0 0 .35rem; }
.note-from { color: var(--accent-2); font-weight: 600; font-family: var(--mono); }
.note-message { color: var(--text); overflow-wrap: anywhere; white-space: pre-wrap; }
.empty-state { color: var(--muted); border: 1px dashed var(--border-strong); border-radius: 12px; padding: 1rem 1.2rem; }
.inline-form { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 1rem; }
.inline-form input { flex: 1 1 14rem; min-width: 0; }

/* modal (portal help/docs) */
.modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 1rem; background: rgba(3,6,12,.72); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.modal-content { width: min(44rem, 100%); max-height: min(85vh, 54rem); display: flex; flex-direction: column; background: var(--surface-solid); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow-lg); overflow: hidden; animation: pop .16s var(--ease); }
.modal-large { width: min(60rem, 100%); }
.modal-header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .85rem 1.1rem; border-bottom: 1px solid var(--border); background: rgba(148,163,184,.05); }
.modal-header h2 { margin: 0; font-size: 1.05rem; }
.modal-close, .doc-modal-close { width: 2.2rem; height: 2.2rem; border-radius: 9px; border: 1px solid var(--border-strong); background: transparent; color: var(--text); font-size: 1.2rem; cursor: pointer; }
.modal-close:hover, .doc-modal-close:hover { border-color: var(--accent); color: var(--accent); }
.help-text { margin: 0; padding: 1.1rem 1.2rem; overflow: auto; white-space: pre-wrap; font: .86rem/1.6 var(--mono); color: #c9f7e7; background: #070c16; }
.doc-content { padding: 1.1rem 1.4rem; overflow: auto; }
.doc-content h1 { font-size: 1.5rem; } .doc-content h2 { font-size: 1.2rem; margin-top: 1.5rem; } .doc-content h3 { font-size: 1.02rem; margin-top: 1.25rem; }
.doc-content p, .doc-content li { color: var(--text-2); }
.doc-content tr td { padding: .35rem .6rem; border-bottom: 1px solid var(--border); font-size: .88rem; }

/* ---------- ftp.xyznet.org: nginx autoindex wrapped by sub_filter ---------- */
.autoindex-card { padding: 0; overflow: hidden; }
.autoindex-card h1 { display: none; } /* nginx prints its own "Index of"; we show .page-title instead */
.autoindex-card hr { display: none; }
.autoindex-card pre {
  margin: 0; padding: 1rem 1.25rem; overflow-x: auto;
  font: .9rem/2 var(--mono); color: var(--muted); background: #070c16;
}
.autoindex-card pre a { color: var(--accent); font-weight: 600; }
.autoindex-card pre a[href$="/"] { color: var(--accent-2); }
.autoindex-card pre a[href="../"] { color: var(--muted); }
.verify-steps { counter-reset: s; list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; }
.verify-steps li { margin: 0; display: grid; gap: .35rem; }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .auth-grid { grid-template-columns: minmax(0, 1fr); }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .tiles, .tiles-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile .n { font-size: 1.6rem; }
  .tabs { width: 100%; }
  .tab, .tabs > a { flex: 1 1 auto; text-align: center; }
  table.details th { width: 7.5rem; }
  .kv-list { grid-template-columns: minmax(0, 1fr); gap: .15rem; }
  .kv-list dd { margin-bottom: .6rem; }
  .brand-sub { display: none; }
  .autoindex-card pre { font-size: .78rem; }
}

/* portal tab panes (app.js toggles .active) */
.tab-content:not(.active) { display: none; }
table.data th.num, table.data td.num { text-align: right; }
.chip .copy { white-space: nowrap; }
