/* Admin pages — extends dashboard.css with form / table styles. */

body.admin { background: var(--bg); }

.admin-nav {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
}
.admin-nav a {
    color: var(--fg-dim);
    text-decoration: none;
    border-bottom: 1px solid transparent;
}
.admin-nav a:hover { color: var(--fg); border-bottom-color: var(--fg-dim); }

/* UTC ↔ local-time toggle (rendered into .admin-nav). Sits to the right
   so it doesn't crowd the page links; subtle until hovered/active. */
.admin-nav { align-items: center; }
.time-toggle-btn {
    margin-left: auto;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--fg-dim);
    padding: 0.25rem 0.6rem;
    border-radius: 0.3rem;
    font-size: 0.72rem;
    line-height: 1.2;
    cursor: pointer;
    font-family: inherit;
}
.time-toggle-btn:hover { color: var(--fg); border-color: var(--fg-dim); }
.time-toggle-btn[aria-pressed="true"] {
    color: var(--fg);
    border-color: var(--sev-2);
}

.admin-main {
    max-width: 1200px;
    margin: 1.5rem auto;
    padding: 0 1.25rem;
}
.admin-main h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.4rem;
}
.muted { color: var(--fg-dim); font-size: 0.85rem; }

.flash {
    padding: 0.5rem 0.85rem;
    border-radius: 0.4rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
}
.flash-ok    { background: rgba(46,157,77,0.12); border-color: var(--sev-0); color: var(--sev-0); }
.flash-warn  { background: rgba(234,179,8,0.10); border-color: var(--sev-3); color: var(--sev-3); }
.flash-info  { background: rgba(59,130,246,0.10); border-color: var(--sev-1); color: var(--sev-1); }

.admin-fieldset {
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    margin-bottom: 1.25rem;
    padding: 0.75rem 1rem;
}
.admin-fieldset legend {
    color: var(--fg-dim);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0 0.4rem;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.admin-table th, .admin-table td {
    text-align: left;
    padding: 0.45rem 0.55rem;
    border-bottom: 1px dashed var(--border);
    vertical-align: middle;
}
.admin-table thead th {
    color: var(--fg-dim);
    font-weight: 500;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.admin-table code {
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.8rem;
    color: var(--fg);
}

.type-tag {
    display: inline-block;
    background: rgba(255,255,255,0.05);
    border-radius: 999px;
    padding: 0.05rem 0.5rem;
    font-size: 0.7rem;
    color: var(--fg-dim);
}

input[type=text], input[type=number], textarea, select {
    background: var(--bg-tile);
    color: var(--fg);
    border: 1px solid var(--border);
    border-radius: 0.35rem;
    padding: 0.3rem 0.5rem;
    font-size: 0.85rem;
    font-family: inherit;
    min-width: 8em;
}
textarea { width: 100%; min-height: 4em; font-family: ui-monospace, monospace; }

.bool-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
}
.bool-toggle input[type="checkbox"] { transform: scale(1.1); }

.btn-primary, .btn-small {
    background: var(--sev-1);
    border: 1px solid var(--sev-1);
    color: white;
    padding: 0.45rem 0.9rem;
    border-radius: 0.35rem;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}
.btn-primary:hover, .btn-small:hover { filter: brightness(1.1); }
.btn-small { padding: 0.25rem 0.65rem; font-size: 0.78rem; font-weight: 500; }

.admin-actions {
    margin: 1.25rem 0 2rem;
    text-align: right;
}

/* Status dot for the monitors table */
.status-dot {
    display: inline-block; width: 8px; height: 8px; border-radius: 50%;
    margin-right: 0.4rem; vertical-align: middle;
}
.status-dot.sev-0 { background: var(--sev-0); }
.status-dot.sev-2 { background: var(--sev-2); }
.status-dot.sev-3 { background: var(--sev-3); }
.status-dot.sev-4 { background: var(--sev-4); }
.status-dot.sev-5 { background: var(--sev-5); }

.monitors-table td {
    border-bottom: 1px dashed var(--border);
}

.row-action {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}
.row-feedback {
    font-size: 0.78rem;
    transition: opacity 200ms;
}
.row-feedback.feedback-ok      { color: var(--sev-0); }
.row-feedback.feedback-err     { color: var(--sev-5); }
.row-feedback.feedback-pending { color: var(--fg-dim); }

/* Admin hub cards. */
.admin-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 1rem;
    margin: 1rem 0 2rem;
}
.admin-card {
    display: flex;
    align-items: stretch;
    gap: 0.85rem;
    padding: 1rem 1.1rem;
    background: var(--bg-tile);
    border: 1px solid var(--border);
    border-radius: 0.65rem;
    color: inherit;
    text-decoration: none;
    transition: background 120ms, border-color 120ms;
}
.admin-card:hover {
    background: var(--bg-tile-hi);
    border-color: var(--sev-1);
}
.admin-card-icon {
    font-size: 1.8rem;
    line-height: 1;
    flex: 0 0 auto;
}
.admin-card-body {
    flex: 1;
    min-width: 0;
}
.admin-card-body h3 {
    margin: 0 0 0.3rem 0;
    font-size: 1rem;
}
.admin-card-desc {
    margin: 0 0 0.4rem 0;
    font-size: 0.85rem;
    color: var(--fg);
}
.admin-card-status {
    margin: 0;
    font-size: 0.78rem;
    color: var(--fg-dim);
    font-variant-numeric: tabular-nums;
}
.admin-card-arrow {
    flex: 0 0 auto;
    color: var(--fg-dim);
    align-self: center;
    font-size: 1.4rem;
}

.admin-subhead {
    margin: 1.5rem 0 0.5rem;
    font-size: 0.95rem;
    color: var(--fg-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.admin-quicklinks {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.88rem;
}
.admin-quicklinks li { padding: 0.2rem 0; }
.admin-quicklinks a { color: var(--sev-1); text-decoration: none; }
.admin-quicklinks a:hover { text-decoration: underline; }

/* /admin/notifications.php — banner, sized columns, routing block, expandable detail */
.notif-mode-banner {
    display: flex;
    align-items: stretch;
    gap: 0.85rem;
    margin: 0 0 1rem;
    border-radius: 0.45rem;
    border: 1px solid var(--border);
    overflow: hidden;
    background: var(--bg-tile);
}
.notif-mode-pill {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 1rem;
    font-weight: 700;
    font-size: 0.78rem;
    letter-spacing: 0.1em;
    color: #fff;
    min-width: 6.5rem;
}
.notif-mode-text {
    padding: 0.7rem 0.9rem;
    font-size: 0.85rem;
    line-height: 1.45;
    color: var(--fg);
    flex: 1;
}
.notif-mode-text a    { color: var(--sev-1); text-decoration: none; }
.notif-mode-text a:hover { text-decoration: underline; }
.notif-mode-text code { background: rgba(255,255,255,0.06); padding: 0.05rem 0.3rem; border-radius: 0.2rem; font-size: 0.85em; }
.notif-mode-simulate .notif-mode-pill { background: var(--sev-2); }
.notif-mode-simulate                  { border-left: 4px solid var(--sev-2); }
.notif-mode-live     .notif-mode-pill { background: var(--sev-0); }
.notif-mode-live                      { border-left: 4px solid var(--sev-0); }
.notif-mode-disabled .notif-mode-pill { background: var(--fg-dim); color: var(--bg); }
.notif-mode-disabled                  { border-left: 4px solid var(--sev-4); }

/* Severity pill — used by the events table, open issues, and notifications.
   Colour comes from the dashboard sev palette. Was missing rules, so the
   "Notice"/"Critical" labels rendered as plain text. */
.ev-sev {
    display: inline-block;
    padding: 0.05rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.72rem;
    font-weight: 500;
    border: 1px solid currentColor;
    line-height: 1.3;
    white-space: nowrap;
}
.ev-sev.sev-0 { color: var(--sev-0); }
.ev-sev.sev-1 { color: var(--sev-1); }
.ev-sev.sev-2 { color: var(--sev-2); }
.ev-sev.sev-3 { color: var(--sev-3); }
.ev-sev.sev-4 { color: var(--sev-4); }
.ev-sev.sev-5 { color: var(--sev-5); }

.notif-table { table-layout: auto; }
.notif-table .col-when   { white-space: nowrap; width: 7ch; vertical-align: top; }
.notif-table .col-sev    { white-space: nowrap; width: 9ch; vertical-align: top; }
.notif-table .col-route  { vertical-align: top; min-width: 18ch; max-width: 32ch; }
.notif-table .col-src    { white-space: nowrap; width: 12ch; color: var(--fg-dim); vertical-align: top; }
.notif-table .col-status { white-space: nowrap; width: 13ch; vertical-align: top; }
.notif-table .col-detail { white-space: nowrap; text-align: right; vertical-align: top; }

.notif-route-channel {
    display: flex;
    align-items: baseline;
    gap: 0.3rem;
    flex-wrap: wrap;
    font-size: 0.85rem;
}
.notif-route-icon   { color: var(--fg-dim); font-size: 0.95rem; }
.notif-route-arrow  { color: var(--fg-dim); }
.notif-route-target { color: var(--fg); }
.notif-route-addr   { font-size: 0.72rem; color: var(--fg-dim); margin-top: 0.1rem; }
.notif-route-addr code {
    background: rgba(255,255,255,0.04);
    padding: 0 0.3rem;
    border-radius: 0.2rem;
}
.notif-route-rule   { font-size: 0.7rem; color: var(--fg-dim); margin-top: 0.15rem; }
.notif-route-rule code {
    background: rgba(255,255,255,0.04);
    padding: 0 0.3rem;
    border-radius: 0.2rem;
}

.notif-table .notif-preview {
    font-size: 0.82rem;
    line-height: 1.35;
    color: var(--fg);
    word-break: break-word;
    vertical-align: top;
}
.notif-preview-subject { font-weight: 500; }
.notif-preview-body    { color: var(--fg-dim); font-size: 0.75rem; margin-top: 0.15rem; }

.notif-table .btn-notif-view {
    display: inline-block;
    color: var(--fg-dim);
    text-decoration: none;
    font-size: 0.72rem;
    padding: 0.2rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 0.25rem;
    line-height: 1.3;
    white-space: nowrap;
}
.notif-table .btn-notif-view:hover { color: var(--fg); border-color: var(--fg-dim); }

.notif-table .notif-simulate-tag {
    display: inline-block;
    margin-left: 0.35rem;
    font-size: 0.62rem;
    color: var(--sev-2);
    border: 1px dashed var(--sev-2);
    padding: 0 0.3rem;
    border-radius: 0.2rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    vertical-align: middle;
}

.notif-detail td {
    background: rgba(255,255,255,0.02);
    border-top: 1px dashed var(--border);
    padding: 0.5rem 0.85rem 0.7rem;
}
.notif-meta-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 0.3rem 1rem;
    font-size: 0.78rem;
    margin-bottom: 0.55rem;
}
.notif-meta-row a       { color: var(--sev-1); text-decoration: none; }
.notif-meta-row a:hover { text-decoration: underline; }
.notif-meta-label {
    display: inline-block;
    min-width: 6.5em;
    color: var(--fg-dim);
    text-transform: uppercase;
    font-size: 0.65rem;
    letter-spacing: 0.05em;
}
.notif-body {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: 0.3rem;
    padding: 0.55rem 0.75rem;
    font-size: 0.78rem;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 320px;
    overflow: auto;
    line-height: 1.4;
    margin: 0;
}
.notif-status {
    display: inline-block;
    padding: 0.05rem 0.45rem;
    border-radius: 0.25rem;
    font-size: 0.72rem;
    border: 1px solid var(--border);
}
.notif-status-sent       { color: #2bd17e; border-color: rgba(43,209,126,0.3); }
.notif-status-pending    { color: #5fd1ff; border-color: rgba(95,209,255,0.3); }
.notif-status-failed     { color: #ff4040; border-color: rgba(255,64,64,0.3); }
.notif-status-suppressed { color: var(--fg-dim); }
/* Simulate-mode counterparts: same hue family as their live-mode peers, but
   dashed border so the eye picks up "this is hypothetical, not actual". */
.notif-status-wouldsend  { color: #2bd17e; border-color: rgba(43,209,126,0.4); border-style: dashed; }
.notif-status-wouldfail  { color: #ff4040; border-color: rgba(255,64,64,0.4);   border-style: dashed; }

/* admin-card used standalone (rules editor reuses it as a wrapper) */
details.admin-card {
    background: var(--bg-tile);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 0.7rem 0.9rem;
}
details.admin-card > summary { cursor: pointer; padding: 0.15rem 0; }

.flash { padding: 0.5rem 0.85rem; border-radius: 0.35rem; margin-bottom: 0.85rem; font-size: 0.85rem; }
.flash-ok   { background: rgba(43,209,126,0.12); border: 1px solid rgba(43,209,126,0.4); color: #2bd17e; }
.flash-warn { background: rgba(255,165,0,0.12);  border: 1px solid rgba(255,165,0,0.4);  color: orange; }
