/* =============================================================================
   Quay FM Ops - stylesheet
   =============================================================================
   Minimal CSS, no framework. Aims for clean and functional over decorative.
   Mobile-responsive via simple flex layouts.
   ============================================================================= */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
                 Arial, sans-serif;
    line-height: 1.5;
    color: #222;
    background: #f4f5f7;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ---- Top bar (authenticated pages) ------------------------------------- */

.topbar {
    background: #2b3441;
    color: #fff;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    border-bottom: 3px solid #46505a;
}

.brand {
    font-weight: 600;
    font-size: 1.1rem;
    letter-spacing: 0.02em;
}

.brand-sub {
    color: #9aa5b1;
    font-weight: 400;
}

.topnav {
    display: flex;
    gap: 1rem;
    flex: 1;
}

.topnav a {
    color: #d1d5db;
    text-decoration: none;
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
    transition: background 0.15s ease;
}

.topnav a:hover {
    background: #46505a;
    color: #fff;
}

.userbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.9rem;
}

.user-info {
    color: #d1d5db;
}

.user-role {
    color: #9aa5b1;
    font-size: 0.85rem;
}

.logout-form {
    display: inline;
}

.btn-link {
    background: none;
    border: none;
    color: #9aa5b1;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0.25rem 0.5rem;
    text-decoration: underline;
    font-family: inherit;
}

.btn-link:hover {
    color: #fff;
}

/* ---- Main content ------------------------------------------------------ */

.content {
    flex: 1;
    max-width: 1024px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.page-header {
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 1.75rem;
    font-weight: 600;
    color: #2b3441;
    margin-bottom: 0.5rem;
}

.page-header .lede {
    color: #555;
    font-size: 1.05rem;
}

.card {
    background: #fff;
    border: 1px solid #e2e5ea;
    border-radius: 6px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.card h2 {
    font-size: 1.15rem;
    font-weight: 600;
    color: #2b3441;
    margin-bottom: 0.75rem;
}

.card p {
    margin-bottom: 0.75rem;
    color: #333;
}

.card p:last-child {
    margin-bottom: 0;
}

.card ul, .card ol {
    margin-left: 1.5rem;
    margin-bottom: 0.75rem;
}

.card li {
    margin-bottom: 0.25rem;
}

.card a {
    color: #2b6cb0;
}

.card code {
    background: #f0f1f4;
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    font-family: "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.9em;
}

/* ---- Definition list --------------------------------------------------- */

.info-list {
    display: grid;
    grid-template-columns: 12rem 1fr;
    gap: 0.5rem 1rem;
}

.info-list dt {
    font-weight: 600;
    color: #555;
}

.info-list dd {
    color: #222;
}

/* ---- Login page -------------------------------------------------------- */

.login-page {
    background: #2b3441;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-container {
    background: #fff;
    padding: 2.5rem;
    border-radius: 8px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.15);
    width: 100%;
    max-width: 22rem;
}

.login-brand {
    font-size: 1.5rem;
    font-weight: 600;
    color: #2b3441;
    text-align: center;
    margin-bottom: 1.5rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.login-form label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #555;
    margin-top: 0.5rem;
}

.login-form input {
    padding: 0.6rem 0.75rem;
    border: 1px solid #cbd0d6;
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
}

.login-form input:focus {
    outline: none;
    border-color: #2b6cb0;
    box-shadow: 0 0 0 3px rgba(43, 108, 176, 0.15);
}

.btn-primary {
    margin-top: 1.25rem;
    background: #2b6cb0;
    color: #fff;
    padding: 0.65rem 1rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s ease;
}

.btn-primary:hover {
    background: #235a94;
}

.error-banner {
    background: #fdecea;
    color: #b91c1c;
    border: 1px solid #f5c2c0;
    padding: 0.6rem 0.75rem;
    border-radius: 4px;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    text-align: center;
}

.login-footer {
    margin-top: 1.5rem;
    text-align: center;
    color: #888;
    font-size: 0.85rem;
}

/* ---- Footer ------------------------------------------------------------ */

.footer {
    padding: 1rem 1.5rem;
    text-align: center;
    color: #888;
    font-size: 0.85rem;
    border-top: 1px solid #e2e5ea;
    background: #f9fafb;
}

/* ---- Responsive -------------------------------------------------------- */

@media (max-width: 640px) {
    .topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .topnav {
        width: 100%;
    }

    .userbar {
        width: 100%;
        justify-content: space-between;
    }

    .content {
        padding: 1rem;
    }

    .info-list {
        grid-template-columns: 1fr;
        gap: 0.25rem 0;
    }

    .info-list dt {
        margin-top: 0.5rem;
    }
}

/* =============================================================================
   Logo styling (added for logo support)
   ============================================================================= */

/* Small logo in the top bar (authenticated pages) */
.logo-small {
    height: 28px;
    width: auto;
    /* Invert the text portion so it reads on the dark slate topbar.
       If the replacement logo file works well on dark, drop this filter. */
    filter: brightness(0) invert(1);
    opacity: 0.95;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.brand-text {
    font-weight: 600;
    font-size: 1.1rem;
    letter-spacing: 0.02em;
}

/* Large logo on the login page */
.login-logo {
    text-align: center;
    margin-bottom: 1.25rem;
}

.logo-large {
    max-width: 200px;
    max-height: 90px;
    width: auto;
    height: auto;
    /* Login card is white, so no filter needed for the default placeholder. */
}

/* Mobile - shrink logo on narrow screens */
@media (max-width: 640px) {
    .logo-small {
        height: 24px;
    }
    .logo-large {
        max-width: 160px;
        max-height: 72px;
    }
}

/* =============================================================================
   Route control page
   ============================================================================= */

.route-table {
    width: 100%;
    border-collapse: collapse;
}

.route-table th,
.route-table td {
    padding: 0.75rem 0.5rem;
    text-align: left;
    border-bottom: 1px solid #e2e5ea;
    vertical-align: middle;
}

.route-table thead th {
    font-weight: 600;
    color: #555;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 2px solid #cbd0d6;
    padding-bottom: 0.5rem;
}

.route-table tbody tr:last-child td {
    border-bottom: none;
}

.route-table .mount-name {
    font-family: 'SF Mono', Menlo, Consolas, monospace;
    font-size: 0.9rem;
    color: #2b3441;
    padding-right: 1rem;
}

.route-table .current-source {
    min-width: 12rem;
}

.route-table .current-source strong {
    color: #2b6cb0;
}

.route-table .listeners {
    font-variant-numeric: tabular-nums;
    min-width: 8rem;
}

.listener-count {
    font-weight: 600;
    font-size: 1.05rem;
    color: #2b3441;
}

.route-table .change-col {
    text-align: right;
}

.route-table .route-form {
    text-align: right;
}

.muted {
    color: #888;
    font-size: 0.85rem;
    font-weight: 400;
}

/* Inline form for the change-routing controls */
.inline-form {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.route-form select {
    padding: 0.35rem 0.5rem;
    border: 1px solid #cbd0d6;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.95rem;
    background: #fff;
    color: #2b3441;
    min-width: 12rem;
}

.route-form select:disabled {
    background: #f0f2f4;
    color: #999;
    cursor: not-allowed;
}

/* Secondary button (Apply on route change) */
.btn-secondary {
    background: #46505a;
    color: #fff;
    padding: 0.4rem 0.9rem;
    border: none;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s ease;
}

.btn-secondary:hover:not(:disabled) {
    background: #2b3441;
}

.btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Primary inline button (open route control from home) */
.btn-primary-inline {
    display: inline-block;
    background: #2b6cb0;
    color: #fff;
    padding: 0.55rem 1.1rem;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: background 0.15s ease;
}

.btn-primary-inline:hover {
    background: #235a94;
    color: #fff;
}

/* Alert banners for flash messages */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    font-size: 0.95rem;
    border-left-width: 4px;
    border-left-style: solid;
}

.alert-success {
    background: #ecfdf5;
    color: #065f46;
    border-left-color: #10b981;
}

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border-left-color: #ef4444;
}

.alert code {
    background: rgba(0, 0, 0, 0.08);
    padding: 0.1em 0.3em;
    border-radius: 3px;
    font-size: 0.9em;
}

/* Responsive - collapse route table on narrow screens */
@media (max-width: 720px) {
    .route-table thead {
        display: none;
    }
    .route-table tbody tr {
        display: block;
        margin-bottom: 1.5rem;
        padding-bottom: 1rem;
        border-bottom: 2px solid #e2e5ea;
    }
    .route-table td {
        display: block;
        border-bottom: none;
        padding: 0.4rem 0;
        text-align: left !important;
    }
    .route-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #666;
        display: block;
        font-size: 0.75rem;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        margin-bottom: 0.2rem;
    }
    .inline-form {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    .route-form select {
        width: 100%;
    }
}

/* Flow arrow between source and mount in the route table */
.route-table .flow-arrow {
    width: 2rem;
    text-align: center;
    color: #9aa5b1;
    font-size: 1.1rem;
    padding: 0.75rem 0.25rem;
}

.route-table thead th.flow-arrow {
    padding: 0;
}

@media (max-width: 720px) {
    /* On narrow screens the arrow is redundant given the stacked layout */
    .route-table .flow-arrow {
        display: none;
    }
}

/* =============================================================================
   Status dashboard
   ============================================================================= */

/* Health strip at top */
.status-strip {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.9rem;
    border-radius: 20px;
    font-size: 0.9rem;
    border: 1px solid transparent;
    background: #f4f6f8;
}

.status-pill.ok {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #065f46;
}

.status-pill.error {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
    font-weight: 600;
}

.pill-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    background: currentColor;
    opacity: 0.7;
}

.pill-label {
    font-weight: 600;
}

.pill-state {
    opacity: 0.85;
    font-variant-numeric: tabular-nums;
}

/* Card header row (title + action link) */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.75rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.card-header h2 {
    margin: 0;
}

.card-action {
    font-size: 0.9rem;
    color: #2b6cb0;
    text-decoration: none;
    font-weight: 500;
}

.card-action:hover {
    text-decoration: underline;
}

/* Colored indicator dots used across the dashboard */
.indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #cbd0d6;
    vertical-align: middle;
    flex-shrink: 0;
}

.indicator.ok    { background: #10b981; box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15); }
.indicator.warn  { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15); }
.indicator.error { background: #ef4444; box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15); }
.indicator.off   { background: #cbd0d6; }

/* Source tiles - grid of connection status boxes */
.source-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.source-tile {
    padding: 0.9rem 1rem;
    border-radius: 6px;
    border: 1px solid #e2e5ea;
    background: #fafbfc;
}

.source-tile.connected {
    border-color: #a7f3d0;
    background: #f0fdf4;
}

.source-tile.disconnected {
    border-color: #e2e5ea;
    background: #fafbfc;
}

.source-tile.unknown {
    border-color: #fde68a;
    background: #fffbeb;
}

.source-tile-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.source-name {
    font-weight: 600;
    color: #2b3441;
    font-size: 0.95rem;
}

.source-tile-state {
    font-size: 0.85rem;
    color: #666;
    padding-left: 1.5rem;
}

.source-tile.connected .source-tile-state {
    color: #065f46;
    font-weight: 500;
}

/* OB1 card - special prominence */
.ob1-card {
    border-left: 4px solid #2b6cb0;
}

.ob1-state {
    margin: 0.75rem 0;
}

.big-status {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-radius: 6px;
    background: #f4f6f8;
    flex-wrap: wrap;
}

.big-status.ok {
    background: #ecfdf5;
    color: #065f46;
}

.big-status.warn {
    background: #fffbeb;
    color: #92400e;
}

.big-status.off {
    background: #f4f6f8;
    color: #4b5563;
}

.big-status .indicator {
    width: 14px;
    height: 14px;
}

.big-label {
    font-size: 1.1rem;
    font-weight: 600;
}

.big-sub {
    font-size: 0.9rem;
    opacity: 0.85;
    margin-left: auto;
}

/* Page footer */
.page-footer {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e5ea;
    font-size: 0.9rem;
    color: #666;
}

.btn-link-plain {
    color: #2b6cb0;
    text-decoration: none;
    font-weight: 500;
}

.btn-link-plain:hover {
    text-decoration: underline;
}

/* Responsive tweaks */
@media (max-width: 640px) {
    .status-strip {
        flex-direction: column;
    }
    .status-pill {
        justify-content: flex-start;
    }
    .big-sub {
        margin-left: 0;
        width: 100%;
    }
    .source-grid {
        grid-template-columns: 1fr;
    }
}

/* =============================================================================
   Per-source pastel colour scheme (source connections tiles)
   ============================================================================= */

.source-tile[data-source="onair"]    { --tile-accent: #0ea5e9; --tile-bg: #e0f2fe; }
.source-tile[data-source="harry"]    { --tile-accent: #f43f5e; --tile-bg: #ffe4e6; }
.source-tile[data-source="ron"]      { --tile-accent: #f59e0b; --tile-bg: #fef3c7; }
.source-tile[data-source="hermione"] { --tile-accent: #8b5cf6; --tile-bg: #ede9fe; }
.source-tile[data-source="neville"]  { --tile-accent: #10b981; --tile-bg: #d1fae5; }

/* Connected: full pastel background, coloured accent border */
.source-tile.connected {
    background: var(--tile-bg);
    border-color: var(--tile-accent);
    border-left-width: 4px;
}

.source-tile.connected .source-name {
    color: #1f2937;
}

.source-tile.connected .indicator {
    background: var(--tile-accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--tile-accent) 20%, transparent);
}

/* Disconnected: white background with a subtle coloured left-hint */
.source-tile.disconnected {
    background: #fff;
    border-color: #e2e5ea;
    border-left: 4px solid var(--tile-bg);
}

.source-tile.disconnected .source-name {
    color: #6b7280;
}

/* Unknown (query error): amber tint regardless of source colour */
.source-tile.unknown {
    background: #fffbeb;
    border-color: #fde68a;
    border-left: 4px solid #fbbf24;
}

/* "Show N more" collapsible section */
.source-more {
    margin-top: 0.75rem;
}

.source-more summary {
    cursor: pointer;
    display: inline-block;
    color: #2b6cb0;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.35rem 0.6rem;
    border-radius: 4px;
    user-select: none;
    list-style: none;
}

.source-more summary::-webkit-details-marker {
    display: none;
}

.source-more summary::before {
    content: "\25B8  ";  /* right-pointing triangle */
    color: #9aa5b1;
    font-size: 0.85em;
    transition: transform 0.15s ease;
    display: inline-block;
}

.source-more[open] summary::before {
    content: "\25BE  ";  /* down-pointing triangle */
}

.source-more summary:hover {
    background: #f4f6f8;
}

.source-grid-more {
    margin-top: 0.5rem;
}

/* =============================================================================
   Admin pages
   ============================================================================= */

/* Breadcrumb */
.breadcrumb {
    font-size: 0.85rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

.breadcrumb a {
    color: #2b6cb0;
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

/* Admin hub grid */
.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.admin-tile {
    display: block;
    padding: 1.25rem;
    background: #fff;
    border: 1px solid #e2e5ea;
    border-radius: 6px;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.admin-tile:hover {
    border-color: #2b6cb0;
    box-shadow: 0 2px 8px rgba(43, 108, 176, 0.1);
}

.admin-tile h2 {
    margin: 0 0 0.5rem 0;
    color: #2b6cb0;
    font-size: 1.15rem;
}

.admin-tile p {
    margin: 0;
    font-size: 0.9rem;
    color: #4b5563;
}

/* User creation form */
.user-form .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr 8rem 1fr auto;
    gap: 0.75rem;
    align-items: end;
}

.user-form label {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.85rem;
    color: #4b5563;
    font-weight: 500;
}

.user-form input,
.user-form select {
    padding: 0.4rem 0.5rem;
    border: 1px solid #cbd0d6;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.95rem;
    background: #fff;
}

@media (max-width: 900px) {
    .user-form .form-row {
        grid-template-columns: 1fr;
    }
}

/* User table */
.user-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.user-table th,
.user-table td {
    padding: 0.5rem 0.65rem;
    text-align: left;
    border-bottom: 1px solid #e2e5ea;
    vertical-align: middle;
}

.user-table thead th {
    font-weight: 600;
    color: #555;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 2px solid #cbd0d6;
}

.user-table .username {
    font-weight: 600;
    color: #2b3441;
}

.user-table .self-marker {
    color: #6b7280;
    font-weight: 400;
    font-size: 0.85em;
    margin-left: 0.35rem;
}

.user-table tr.user-disabled {
    opacity: 0.6;
}

.user-table tr.user-self {
    background: #fafbfc;
}

.user-table .ts {
    font-variant-numeric: tabular-nums;
    font-size: 0.82rem;
    color: #6b7280;
    white-space: nowrap;
}

.user-table .actions {
    text-align: right;
    white-space: nowrap;
}

.role-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.role-badge.role-admin {
    background: #fef3c7;
    color: #92400e;
}

.role-badge.role-operator {
    background: #dbeafe;
    color: #1e40af;
}

.status-active {
    color: #065f46;
    font-weight: 500;
    font-size: 0.9rem;
}

.status-disabled {
    color: #991b1b;
    font-weight: 500;
    font-size: 0.9rem;
}

/* Tiny action buttons in table rows */
.btn-tiny {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    font-size: 0.8rem;
    font-weight: 500;
    text-decoration: none;
    background: #f0f2f4;
    color: #2b3441;
    border: 1px solid #cbd0d6;
    cursor: pointer;
    font-family: inherit;
    margin-left: 0.25rem;
    transition: background 0.15s ease;
}

.btn-tiny:hover {
    background: #e2e5ea;
    text-decoration: none;
}

.btn-tiny.btn-danger {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

.btn-tiny.btn-danger:hover {
    background: #fee2e2;
}

.inline-post {
    display: inline;
    margin-left: 0.25rem;
}

/* Inline edit forms inside table rows */
.inline-edit-form {
    display: flex;
    gap: 0.4rem;
    align-items: center;
    flex-wrap: wrap;
}

.inline-edit-form input,
.inline-edit-form select {
    padding: 0.3rem 0.5rem;
    border: 1px solid #cbd0d6;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.9rem;
}

/* Audit page */
.filter-form {
    display: flex;
    gap: 1rem;
    align-items: end;
    flex-wrap: wrap;
}

.filter-form label {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.85rem;
    color: #4b5563;
    font-weight: 500;
}

.filter-form select {
    padding: 0.4rem 0.6rem;
    border: 1px solid #cbd0d6;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.95rem;
    background: #fff;
    min-width: 12rem;
}

.audit-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.audit-table th,
.audit-table td {
    padding: 0.5rem 0.65rem;
    text-align: left;
    border-bottom: 1px solid #e2e5ea;
    vertical-align: top;
}

.audit-table thead th {
    font-weight: 600;
    color: #555;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 2px solid #cbd0d6;
}

.audit-table .ts {
    font-variant-numeric: tabular-nums;
    color: #6b7280;
    white-space: nowrap;
    font-size: 0.8rem;
    min-width: 10rem;
}

.audit-table .actor {
    font-weight: 600;
    color: #2b3441;
}

.audit-table .ip {
    font-family: 'SF Mono', Menlo, Consolas, monospace;
    font-size: 0.8rem;
    color: #6b7280;
}

.action-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 600;
    background: #f0f2f4;
    color: #2b3441;
    font-family: 'SF Mono', Menlo, Consolas, monospace;
}

/* Colour-code specific action types */
.action-login .action-badge         { background: #ecfdf5; color: #065f46; }
.action-login-failed .action-badge  { background: #fef2f2; color: #991b1b; }
.action-logout .action-badge        { background: #f0f2f4; color: #4b5563; }
.action-route-change .action-badge  { background: #dbeafe; color: #1e40af; }
.action-user-created .action-badge  { background: #ecfdf5; color: #065f46; }
.action-user-disabled .action-badge { background: #fef2f2; color: #991b1b; }
.action-password-reset .action-badge { background: #fef3c7; color: #92400e; }

.details-list {
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 0.85rem;
}

.details-list li {
    padding: 0.05rem 0;
}

.detail-key {
    color: #6b7280;
    font-size: 0.85em;
}

.detail-val {
    color: #2b3441;
    font-family: 'SF Mono', Menlo, Consolas, monospace;
    font-size: 0.9em;
}

.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e5ea;
}

/* =============================================================================
   External source slot management
   ============================================================================= */

.ext-slots-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.ext-slots-table th,
.ext-slots-table td {
    padding: 0.5rem 0.65rem;
    text-align: left;
    border-bottom: 1px solid #e2e5ea;
    vertical-align: middle;
}

.ext-slots-table thead th {
    font-weight: 600;
    color: #555;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 2px solid #cbd0d6;
}

.ext-slots-table .slot-num {
    font-family: 'SF Mono', Menlo, Consolas, monospace;
    font-weight: 600;
    color: #2b3441;
    width: 4rem;
}

.ext-slots-table input[type="text"],
.ext-slots-table input[type="url"] {
    width: 100%;
    padding: 0.35rem 0.5rem;
    border: 1px solid #cbd0d6;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.9rem;
    background: #fff;
}

.ext-slots-table input[type="url"] {
    font-family: 'SF Mono', Menlo, Consolas, monospace;
    font-size: 0.82rem;
}

.ext-slots-table input:disabled {
    background: #f4f6f8;
    color: #9aa5b1;
}

.ext-slots-table .actions {
    white-space: nowrap;
    text-align: right;
    width: 5rem;
}

.ext-slot-row.configured {
    background: #f9fafb;
}

.status-unknown {
    color: #92400e;
    font-weight: 500;
    font-size: 0.85rem;
}

/* HTML forms can't span <tr> boundaries in older browsers, but modern
   ones handle it. The `contents-form` uses display: contents to allow
   the form element to wrap only the cells we care about. */
.contents-form {
    display: contents;
}

/* Ext slots panel on the status dashboard */
.ext-slot-tile {
    padding: 0.75rem 0.9rem;
    border-radius: 6px;
    border: 1px solid #e2e5ea;
    background: #fafbfc;
}

.ext-slot-tile .ext-slot-label {
    font-weight: 600;
    font-size: 0.9rem;
    color: #2b3441;
    margin-bottom: 0.2rem;
}

.ext-slot-tile .ext-slot-url {
    font-family: 'SF Mono', Menlo, Consolas, monospace;
    font-size: 0.75rem;
    color: #6b7280;
    word-break: break-all;
    line-height: 1.3;
}

.ext-slot-tile .ext-slot-num {
    display: inline-block;
    font-family: 'SF Mono', Menlo, Consolas, monospace;
    font-size: 0.7rem;
    color: #9aa5b1;
    margin-right: 0.4rem;
}

/* Info alert (blue) for advisory notices, distinct from success/error */
.alert-info {
    background: #eff6ff;
    color: #1e40af;
    border-left-color: #3b82f6;
}
