/*
 * static/css/admin-addresses.css — the /opensesame dashboard's Addresses view, an address's page and a person's address
 * rows (plan R-117; R-120 lane dash-addresses, spec dashboard-2.md §3.5): the shared list, the rules, the site-wide
 * throttles, the lookup and the Add rule dialog. The tables are ui.js's responsive tables (they fit their own box and
 * stack below 640 px); this file only adds what the address rows need. Same rules as admin.css: `.adm-` selectors only,
 * tokens only, each selector defined once.
 */

/* ============================================================
   CELLS: an address with its place and marks, the people on it, a rule with its throttles
   ============================================================ */
.adm-addr-cell { display: grid; grid-template-columns: minmax(0, 1fr); row-gap: 4px; min-width: 0; }
.adm-addr-via { font: var(--t-body-s); white-space: nowrap; }
.adm-addr-code { font: var(--t-mono); font-size: 0.8125rem; overflow-wrap: anywhere; }
.adm-addr-rule-cell { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; }
.adm-addr-note { color: var(--c-on-2); }
/* an allowlisted network reads quieter through its text (on-3 keeps AA), never by fading the row (Ray: grayed out) */
.adm-table .adm-row--muted td, .adm-table .adm-row--muted .adm-addr-link { color: var(--c-on-3); }
.adm-people { display: inline-flex; align-items: center; gap: 4px 10px; flex-wrap: wrap; }
.adm-flag { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.adm-flag > .adm-pill { flex: none; min-width: 32px; justify-content: center; }
.adm-flag-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.adm-flag-people { display: flex; flex-direction: column; gap: 4px; min-width: 0; margin: 0; padding: 0; list-style: none; }
.adm-flag-people > li { display: flex; align-items: center; gap: 4px 8px; flex-wrap: wrap; min-width: 0; font: var(--t-body-s); }
/* rows of several lines read from the top: every cell top-aligned, the first lines on one line (a stacked row keeps
   the shared table's own padding) */
@container adm-table (min-width: 641px) {
    .adm-table--shared td, .adm-table--rules td, .adm-table--addresses td {
        height: auto; padding-top: 12px; padding-bottom: 12px; vertical-align: top;
    }
}
/* "5 accounts · 0 guests" on one line: it must beat the fit table's `td { white-space: normal }` (0,1,1) */
.adm-table--fit td.adm-addr-seen { white-space: nowrap; }
.adm-addr-hint { padding-top: 2px; }

/* stacked rows (the table's own box ≤ 640 px): the people list and a note are a block of their own, not a
   "Label value" pair */
@container adm-table (max-width: 640px) {
    .adm-table--shared td.adm-addr-people { display: block; padding-top: 4px; text-align: left; }
    .adm-table--rules td.adm-addr-note { display: block; text-align: left; }
    .adm-table--shared td.adm-addr-people::before, .adm-table--rules td.adm-addr-note::before { content: none; }
}

/* ============================================================
   THE PAGE: the lookup, the address page's title and rule, the site-wide throttles' groups
   ============================================================ */
.adm-addr-lookup { display: flex; flex-direction: column; gap: 4px; width: 240px; max-width: 100%; min-width: 0; }
.adm-addr-lookup > .adm-input--search { width: 100%; }
.adm-addr-lookup-error { font: var(--t-body-s); overflow-wrap: break-word; }
.adm-addr-title { font-family: var(--font-mono); font-size: 0.82em; letter-spacing: 0; }
.adm-addr-norule { margin: 0; }
.adm-addr-throttle-words { overflow-wrap: break-word; }
/* the Rule facts: one column, each value next to its name (not a page width away) */
.adm-addr-facts { grid-template-columns: minmax(0, 1fr); margin: 0; }
.adm-addr-facts > .adm-kv { justify-content: flex-start; align-items: baseline; }
.adm-addr-facts .adm-kv-key { flex: 0 0 96px; }
.adm-addr-facts .adm-kv-value { display: block; flex: 1 1 0; min-width: 0; text-align: left; }
.adm-addr-group { margin: 20px 0 0; }
.adm-addr-group:first-child { margin-top: 0; }
.adm-addr-usedefault { font: inherit; }

/* ============================================================
   DIALOGS: Add rule (radio rows, the throttle choices, the server's reading), Throttles
   ============================================================ */
.adm-addr-kinds { display: flex; flex-direction: column; gap: 2px; min-width: 0; margin: 0; padding: 0; border: 0; }
.adm-addr-kinds > legend { margin-bottom: 6px; padding: 0; }
.adm-addr-kind {
    display: flex; align-items: flex-start; gap: 10px; min-height: 44px; padding: 8px 10px; border-radius: var(--radius-md);
    cursor: pointer;
}
.adm-addr-kind:hover { background: var(--c-hover); }
.adm-addr-kind:has(> .adm-addr-kind-input:checked) { background: var(--c-surface-low); box-shadow: inset 0 0 0 1px var(--c-outline-variant); }
.adm-addr-kind-input { flex: none; width: 16px; height: 16px; margin: 3px 0 0; accent-color: var(--c-accent); }
.adm-addr-kind-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.adm-addr-kind-name { color: var(--c-on); font: var(--t-label-l); }
.adm-addr-kind-line { color: var(--c-on-3); font: var(--t-body-s); }
.adm-addr-throttles { display: flex; flex-direction: column; gap: 14px; }
.adm-addr-preview {
    padding: 4px 14px; border-radius: var(--radius-md); background: var(--c-surface-low);
    box-shadow: inset 0 0 0 1px var(--c-outline-variant);
}
.adm-addr-preview > .adm-dialog-text { margin: 10px 0 0; }
.adm-addr-preview > .adm-callout { margin: 4px 0 10px; }
.adm-addr-setby { margin: 0; }
.adm-addr-remove { margin-right: auto; }

/* ============================================================
   NARROW SCREENS
   ============================================================ */
@media (max-width: 640px) {
    .adm-addr-lookup { flex: 1 1 auto; width: auto; }
}
