/* ============================================================
   ModbusDB — Industrial Dark Theme
   Ported from v0 Next.js template (oklch → hsl for compat)
   ============================================================ */

/* --- Fonts (Geist via Google CDN) --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ============================================================
   Design Tokens
   ============================================================ */
:root {
    /* Background / Surface */
    --background: hsl(228 20% 10%);
    --foreground: hsl(220 10% 92%);
    --card: hsl(228 18% 14%);
    --card-foreground: hsl(220 10% 92%);
    --popover: hsl(228 18% 12%);
    --popover-foreground: hsl(220 10% 92%);

    /* Primary — teal/cyan accent */
    --primary: hsl(174 60% 42%);
    --primary-foreground: hsl(228 20% 10%);

    /* Secondary */
    --secondary: hsl(228 14% 20%);
    --secondary-foreground: hsl(220 10% 82%);

    /* Muted */
    --muted: hsl(228 14% 18%);
    --muted-foreground: hsl(220 6% 50%);

    /* Accent (same as primary) */
    --accent: hsl(174 60% 42%);
    --accent-foreground: hsl(228 20% 10%);

    /* Destructive */
    --destructive: hsl(0 70% 45%);
    --destructive-foreground: hsl(0 0% 95%);

    /* Chrome */
    --border: hsl(228 12% 22%);
    --input: hsl(228 14% 18%);
    --ring: hsl(174 60% 42%);

    /* Radius */
    --radius: 0.5rem;

    /* Fonts */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Code', Consolas, monospace;
}

/* ============================================================
   Reset & Base
   ============================================================ */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    border-color: var(--border);
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

/* FocusOnNavigate (Routes.razor) focuses the page <h1> on every navigation so screen
   reader and keyboard users land at the top of the new page rather than wherever they
   were. To be focusable the heading gets tabindex="-1", and the browser then paints its
   default outline right around the heading's block box.

   :not(:focus-visible) suppresses only that programmatic case. Anything a user actually
   focuses — by tab or by typing — still matches :focus-visible and keeps its ring, so the
   accessibility behaviour is untouched and only the stray outline goes. */
[tabindex="-1"]:focus:not(:focus-visible) {
    outline: none;
}

/* Every anchor on the site carries a class that sets its own colour. This is the safety
   net for any that doesn't: an unstyled link should land on the theme's accent, never on
   the browser's default blue, which is unreadable on this background. More specific rules
   (.navbar-links a, .footer-links a, .row-link, th.sortable a, …) still win. */
a {
    color: var(--primary);
}

body {
    font-family: var(--font-sans);
    background-color: var(--background);
    color: var(--foreground);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
}

/* ============================================================
   Layout Shell
   ============================================================ */
.app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-main {
    flex: 1;
}

/* ============================================================
   Navbar
   ============================================================ */
.navbar {
    position: sticky;
    top: 0;
    z-index: 50;
    width: 100%;
    border-bottom: 1px solid var(--border);
    background: hsla(228, 20%, 10%, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.navbar-inner {
    max-width: 80rem;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 4rem;
    padding: 0 1rem;
}

@media (min-width: 640px) {
    .navbar-inner { padding: 0 1.5rem; }
}
@media (min-width: 1024px) {
    .navbar-inner { padding: 0 2rem; }
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--foreground);
}

.navbar-brand svg {
    width: 1.5rem;
    height: 1.5rem;
    color: var(--primary);
}

.navbar-brand span {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.025em;
}

.navbar-links {
    display: none;
    align-items: center;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .navbar-links { display: flex; }
}

.navbar-links a {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--muted-foreground);
    text-decoration: none;
    transition: color 0.15s ease;
}

.navbar-links a:hover {
    color: var(--foreground);
}

/* GitHub button in nav */
.btn-github {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--foreground);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: transparent;
    text-decoration: none;
    transition: background 0.15s ease, border-color 0.15s ease;
    cursor: pointer;
}

.btn-github:hover {
    background: var(--secondary);
    border-color: var(--muted-foreground);
}

.btn-github svg {
    width: 1rem;
    height: 1rem;
}

/* Mobile menu toggle */
.navbar-mobile-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border: none;
    background: transparent;
    color: var(--foreground);
    cursor: pointer;
    border-radius: var(--radius);
    transition: background 0.15s ease;
}

.navbar-mobile-toggle:hover {
    background: var(--secondary);
}

@media (min-width: 768px) {
    .navbar-mobile-toggle { display: none; }
}

.navbar-mobile-toggle svg {
    width: 1.25rem;
    height: 1.25rem;
}

/* Mobile dropdown */
.navbar-mobile-menu {
    border-top: 1px solid var(--border);
    background: var(--background);
    padding: 1rem;
}

@media (min-width: 768px) {
    .navbar-mobile-menu { display: none !important; }
}

.navbar-mobile-menu a {
    display: block;
    padding: 0.5rem 0;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--muted-foreground);
    text-decoration: none;
    transition: color 0.15s ease;
}

.navbar-mobile-menu a:hover {
    color: var(--foreground);
}

/* ============================================================
   Hero Section
   ============================================================ */
.hero {
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid var(--border);
    background: var(--card);
    padding: 2rem 1rem;
}

@media (min-width: 640px) {
    .hero { padding: 3rem 1.5rem; }
}
@media (min-width: 1024px) {
    .hero { padding: 3rem 2rem; }
}

.hero-content {
    position: relative;
    max-width: 56rem;
    margin: 0 auto;
    text-align: center;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.75rem;
    margin-bottom: 1.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--primary);
    background: hsla(174, 60%, 42%, 0.1);
    border: 1px solid hsla(174, 60%, 42%, 0.3);
    border-radius: 9999px;
}

.hero-badge svg {
    width: 0.75rem;
    height: 0.75rem;
}

.hero h1 {
    font-size: 2.25rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.1;
    color: var(--foreground);
    text-wrap: balance;
}

@media (min-width: 640px) {
    .hero h1 { font-size: 3rem; }
}
@media (min-width: 1024px) {
    .hero h1 { font-size: 3.75rem; }
}

.hero p {
    max-width: 42rem;
    margin: 1.5rem auto 0;
    font-size: 1.125rem;
    color: var(--muted-foreground);
    text-wrap: pretty;
}

@media (min-width: 640px) {
    .hero p { font-size: 1.25rem; }
}

/* Device detail hero — override centering */
.hero-device {
    text-align: left;
}

.hero-device h1 {
    text-wrap: unset;
}

.hero-device p {
    margin: 0.75rem 0 0;
    max-width: none;
}

.hero-stats {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 2.5rem;
    font-size: 0.875rem;
    color: var(--muted-foreground);
}

.hero-stat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.hero-stat svg {
    width: 1rem;
    height: 1rem;
    color: var(--primary);
}

/* ============================================================
   Modbus Table Section
   ============================================================ */
.table-section {
    padding: 3rem 1rem;
}

@media (min-width: 640px) {
    .table-section { padding: 3rem 1.5rem; }
}
@media (min-width: 1024px) {
    .table-section { padding: 3rem 2rem; }
}

.table-container {
    max-width: 80rem;
    margin: 0 auto;
}

/* Toolbar: search + filters */
.table-toolbar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

@media (min-width: 640px) {
    .table-toolbar {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

.search-wrapper {
    position: relative;
    max-width: 28rem;
    flex: 1;
}

.search-wrapper svg {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1rem;
    height: 1rem;
    color: var(--muted-foreground);
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 0.5rem 0.75rem 0.5rem 2.5rem;
    font-size: 0.875rem;
    font-family: var(--font-sans);
    color: var(--foreground);
    background: var(--input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-input::placeholder {
    color: var(--muted-foreground);
}

.search-input:focus {
    border-color: var(--ring);
    box-shadow: 0 0 0 2px hsla(174, 60%, 42%, 0.2);
}

/* Category filter pills */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-bar svg {
    width: 1rem;
    height: 1rem;
    color: var(--muted-foreground);
    flex-shrink: 0;
}

.filter-pills {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}

/* Anchors, not buttons: filtering is a navigation under static SSR. */
.filter-pill {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    font-family: var(--font-sans);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
    background: transparent;
    color: var(--muted-foreground);
    text-decoration: none;
}

.filter-pill:hover {
    background: var(--secondary);
    color: var(--foreground);
}

.filter-pill.active {
    background: var(--primary);
    color: var(--primary-foreground);
}

/* Results count */
.results-count {
    margin-bottom: 1rem;
    font-size: 0.875rem;
    color: var(--muted-foreground);
}

/* Table chrome */
.table-card {
    overflow: hidden;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--card);
}

.table-scroll {
    overflow-x: auto;
}

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

.data-table thead tr {
    border-bottom: 1px solid var(--border);
    background: hsla(228, 14%, 18%, 0.5);
}

.data-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted-foreground);
    white-space: nowrap;
    user-select: none;
}

/* The heading's anchor carries the click target; the th keeps the cell padding, so the
   anchor is stretched to fill it and stays a full-size hit area. */
.data-table th.sortable {
    padding: 0;
    transition: color 0.15s ease;
}

.data-table th.sortable a {
    display: block;
    padding: 0.75rem 1rem;
    color: inherit;
    text-decoration: none;
    white-space: nowrap;
}

.data-table th.sortable:hover {
    color: var(--foreground);
}

.data-table th.sortable a:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
}

.data-table th svg {
    display: inline;
    width: 1rem;
    height: 1rem;
    margin-left: 0.25rem;
    vertical-align: middle;
}

.data-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background 0.12s ease;
}

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

.data-table tbody tr:hover {
    background: hsla(228, 14%, 18%, 0.3);
}

.data-table td {
    padding: 1rem;
    font-size: 0.875rem;
    white-space: nowrap;
    color: var(--foreground);
}

.data-table td.muted {
    color: var(--muted-foreground);
}

.data-table td.mono {
    font-family: var(--font-mono);
    color: var(--muted-foreground);
}

.data-table td.bold {
    font-weight: 500;
}

/* Category badge inside table */
.category-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--primary);
    background: hsla(174, 60%, 42%, 0.1);
    border-radius: calc(var(--radius) - 2px);
}

/* Download dropdown */
.download-cell {
    text-align: right;
}

.btn-download {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.625rem;
    font-size: 0.875rem;
    font-family: var(--font-sans);
    color: var(--foreground);
    background: transparent;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.15s ease;
}

.btn-download:hover {
    background: var(--secondary);
}

.btn-download svg {
    width: 1rem;
    height: 1rem;
}

/* Download dropdown menu */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    z-index: 40;
    min-width: 10rem;
    margin-top: 0.25rem;
    padding: 0.25rem;
    background: var(--popover);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.4);
}

.dropdown.open .dropdown-menu {
    display: block;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-family: var(--font-sans);
    color: var(--foreground);
    background: transparent;
    border: none;
    border-radius: calc(var(--radius) - 2px);
    cursor: pointer;
    transition: background 0.12s ease;
    text-align: left;
}

.dropdown-item:hover {
    background: var(--secondary);
}

.dropdown-item svg {
    width: 1rem;
    height: 1rem;
    color: var(--muted-foreground);
}

/* Hidden columns on mobile */
@media (max-width: 639px) {
    .hide-mobile { display: none; }
}

/* Empty state */
.empty-state {
    padding: 3rem 1rem;
    text-align: center;
    color: var(--muted-foreground);
}

/* ============================================================
   Footer
   ============================================================ */
.site-footer {
    border-top: 1px solid var(--border);
    background: var(--card);
    padding: 3rem 1rem;
}

@media (min-width: 640px) {
    .site-footer { padding: 3rem 1.5rem; }
}
@media (min-width: 1024px) {
    .site-footer { padding: 3rem 2rem; }
}

.footer-inner {
    max-width: 80rem;
    margin: 0 auto;
}

.footer-grid {
    display: grid;
    gap: 2rem;
}

@media (min-width: 768px) {
    .footer-grid { grid-template-columns: repeat(3, 1fr); }
}

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

.footer-brand svg {
    width: 1.25rem;
    height: 1.25rem;
    color: var(--primary);
}

.footer-brand span {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--foreground);
}

.footer-desc {
    margin-top: 0.75rem;
    font-size: 0.875rem;
    color: var(--muted-foreground);
}

.footer-heading {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--foreground);
}

.footer-links {
    list-style: none;
    margin-top: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.footer-links a {
    font-size: 0.875rem;
    color: var(--muted-foreground);
    text-decoration: none;
    transition: color 0.15s ease;
}

.footer-links a:hover {
    color: var(--foreground);
}

.footer-bottom {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 0.875rem;
    color: var(--muted-foreground);
}

/* ============================================================
   Hero Search Bar
   ============================================================ */
.hero-search {
    display: flex;
    max-width: 36rem;
    margin: 1.5rem auto 0;
    gap: 0.5rem;
}

.hero-search .search-wrapper {
    flex: 1;
    max-width: none;
}

.hero-search .search-input {
    height: 2.75rem;
    font-size: 1rem;
    color: var(--foreground);
    background: var(--input);
    border: 1px solid var(--border);
}

.btn-search {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    height: 2.75rem;
    padding: 0 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: var(--font-sans);
    color: var(--primary-foreground);
    background: var(--primary);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: opacity 0.15s ease;
    white-space: nowrap;
}

.btn-search:hover {
    opacity: 0.9;
}

.btn-search svg {
    width: 1rem;
    height: 1rem;
}

/* ============================================================
   Report Issue Modal
   ============================================================ */
/* A :target modal — hidden until the URL fragment names it, revealed by CSS alone. This
   is what lets the device page report an issue without a Blazor circuit or any script.
   Any link to "#" clears the target and closes it. */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    background: hsla(228, 20%, 6%, 0.8);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal-overlay:target {
    display: flex;
}

/* Click-anywhere-outside close. Sits behind the card, covering the backdrop. */
.modal-backdrop {
    position: absolute;
    inset: 0;
    cursor: default;
}

.modal-card {
    position: relative;
}

.modal-card {
    width: 100%;
    max-width: 32rem;
    margin: 1rem;
    padding: 1.5rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-card h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--foreground);
    margin-bottom: 1.25rem;
}

.modal-card label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--muted-foreground);
    margin-bottom: 0.375rem;
}

.modal-card select,
.modal-card textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-family: var(--font-sans);
    color: var(--foreground);
    background: var(--input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    outline: none;
    transition: border-color 0.15s ease;
    margin-bottom: 1rem;
}

.modal-card select:focus,
.modal-card textarea:focus {
    border-color: var(--ring);
    box-shadow: 0 0 0 2px hsla(174, 60%, 42%, 0.2);
}

.modal-card textarea {
    min-height: 6rem;
    resize: vertical;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 2.25rem;
    padding: 0 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: var(--font-sans);
    color: var(--muted-foreground);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.btn-ghost:hover {
    background: var(--secondary);
    color: var(--foreground);
}

.btn-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 2.25rem;
    padding: 0 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: var(--font-sans);
    color: var(--primary-foreground);
    background: var(--primary);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: opacity 0.15s ease;
}

.btn-submit:hover {
    opacity: 0.9;
}

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

/* Report icon button */
.btn-report {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    height: 2.75rem;
    padding: 0 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: var(--font-sans);
    color: var(--muted-foreground);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.btn-report:hover {
    background: var(--secondary);
    color: var(--foreground);
    border-color: var(--muted-foreground);
}

.btn-report svg {
    width: 1rem;
    height: 1rem;
}

/* Success message */
.report-success {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: var(--primary);
    background: hsla(174, 60%, 42%, 0.1);
    border: 1px solid hsla(174, 60%, 42%, 0.3);
    border-radius: var(--radius);
    text-align: center;
}

/* ============================================================
   Register Gate (auth wall)
   ============================================================ */
.blurred-row td {
    position: relative;
}

.blur-text {
    filter: blur(5px);
    user-select: none;
    pointer-events: none;
    opacity: 0.4;
}

/* Height tracks DeviceDetail's BlurredPlaceholderRows: a data-table row is roughly
   3.4rem (1rem padding top and bottom plus the line box), so 20 placeholder rows span
   about 68rem and 40rem of gradient fades the lower ~60% of them — the same proportion
   16rem gave against the 8 rows this replaced. Raise both together, or the placeholders
   sit outside the fade as a flat band of blurred text.

   pointer-events stays none so the taller overlay cannot swallow clicks on the real
   rows it now reaches over; the card re-enables them for itself. */
.gate-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40rem;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 2rem;
    background: linear-gradient(to bottom, transparent 0%, var(--background) 70%);
    pointer-events: none;
    z-index: 10;
}

.gate-card {
    pointer-events: auto;
    text-align: center;
    padding: 1.5rem 2rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    max-width: 28rem;
}

/* ============================================================
   Utility
   ============================================================ */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ============================================================
   Blazor-specific overrides
   ============================================================ */
#blazor-error-ui {
    background: var(--destructive);
    color: var(--destructive-foreground);
    bottom: 0;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.3);
    display: none;
    left: 0;
    padding: 0.75rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    text-align: center;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.blazor-reconnect-modal {
    display: none;
}

.components-reconnect-show .blazor-reconnect-modal {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: hsla(228, 20%, 10%, 0.8);
    backdrop-filter: blur(4px);
    color: var(--muted-foreground);
    font-size: 0.875rem;
}

/* ============================================================
   Admin dashboard
   Operational screens. Reuses the existing tokens and table
   styling; adds only the stat grid and tab strip.
   ============================================================ */
/* Sidebar shell (AdminLayout / AdminSidebar) */
.admin-shell {
    display: flex;
    min-height: 100vh;
    background: var(--background);
}

.admin-sidebar {
    position: sticky;
    top: 0;
    align-self: flex-start;
    height: 100vh;
    width: 232px;
    flex: none;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.25rem 0;
    background: var(--card);
    border-right: 1px solid var(--border);
    overflow-y: auto;
}

.admin-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0 1.25rem;
    text-decoration: none;
    color: var(--foreground);
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.1;
}

.admin-brand svg {
    color: var(--primary);
    flex: none;
}

.admin-brand-sub {
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted-foreground);
}

.admin-nav {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    padding: 0 0.6rem;
}

.admin-nav-heading {
    margin: 1rem 0.6rem 0.25rem;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted-foreground);
}

.admin-nav-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.5rem 0.65rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--muted-foreground);
    text-decoration: none;
    transition: color 0.15s ease, background 0.15s ease;
}

.admin-nav-link svg {
    flex: none;
}

.admin-nav-link:hover {
    color: var(--foreground);
    background: var(--secondary);
}

.admin-nav-link.active {
    color: var(--primary);
    background: hsl(174 60% 42% / 0.12);
}

.admin-sidebar-footer {
    margin-top: auto;
    padding: 0.75rem 1.25rem 0;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.admin-user {
    font-size: 0.8125rem;
    color: var(--muted-foreground);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-sidebar-action {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--muted-foreground);
    text-decoration: none;
    transition: color 0.15s ease;
}

.admin-sidebar-action:hover {
    color: var(--foreground);
}

.admin-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

@media (max-width: 820px) {
    .admin-shell {
        flex-direction: column;
    }

    .admin-sidebar {
        position: static;
        height: auto;
        width: auto;
        flex-direction: row;
        align-items: center;
        gap: 1rem;
        padding: 0.6rem 1rem;
        overflow-x: auto;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .admin-brand {
        padding: 0;
    }
    .admin-brand br { display: none; }
    .admin-brand-sub { display: none; }

    .admin-nav {
        flex-direction: row;
        flex-wrap: nowrap;
        padding: 0;
        gap: 0.15rem;
    }
    .admin-nav-heading { display: none; }
    .admin-nav-link span { display: none; }
    .admin-nav-link { padding: 0.5rem; }

    .admin-sidebar-footer {
        margin: 0 0 0 auto;
        padding: 0;
        border-top: none;
        flex-direction: row;
        gap: 0.75rem;
        white-space: nowrap;
    }
    .admin-user { display: none; }
}

.admin-header {
    padding: 2rem 2rem 0;
}

.admin-title {
    font-size: 1.5rem;
    color: var(--foreground);
    margin-bottom: 1rem;
}

.admin-tabs {
    display: flex;
    gap: 0.25rem;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
}

.admin-tab {
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--muted-foreground);
    text-decoration: none;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.admin-tab:hover {
    color: var(--foreground);
}

.admin-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
    gap: 1rem;
    padding: 1.5rem 2rem 0;
}

.stat-card {
    padding: 1rem 1.25rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted-foreground);
}

.stat-value {
    font-family: var(--font-mono);
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--foreground);
    line-height: 1.2;
    margin-top: 0.375rem;
}

.stat-value.accent {
    color: var(--primary);
}

.stat-sub {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    margin-top: 0.25rem;
}

.admin-section {
    padding: 1.5rem 2rem;
}

.admin-section h2 {
    font-size: 1rem;
    color: var(--foreground);
    margin-bottom: 0.75rem;
}

.admin-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.admin-toolbar label {
    font-size: 0.8125rem;
    color: var(--muted-foreground);
}

.admin-toolbar input[type="date"],
.admin-toolbar input[type="text"],
.admin-toolbar select {
    padding: 0.375rem 0.5rem;
    font-size: 0.8125rem;
    font-family: inherit;
    color: var(--foreground);
    background: var(--input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.admin-toolbar input:focus,
.admin-toolbar select:focus {
    outline: 2px solid var(--ring);
    outline-offset: -1px;
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    cursor: pointer;
}

.feed-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    background: var(--muted);
    color: var(--primary);
    flex-shrink: 0;
}

.pill {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-radius: 999px;
    background: var(--muted);
    color: var(--muted-foreground);
}

.pill.open {
    background: hsl(38 90% 50% / 0.15);
    color: hsl(38 90% 60%);
}

.pill.resolved {
    background: hsl(174 60% 42% / 0.15);
    color: var(--primary);
}

.pill.miss {
    background: hsl(0 70% 45% / 0.15);
    color: hsl(0 70% 65%);
}

@media (max-width: 640px) {
    .admin-header,
    .stat-grid,
    .admin-section {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}


/* ============================================================
   Static SSR link chrome
   Sorting, filtering, paging and row navigation are all plain anchors now, so the
   styles that used to live in inline style="" attributes on buttons live here.
   ============================================================ */

/* Device links inside a table row read as text, not as links. */
.row-link {
    color: var(--foreground);
    text-decoration: none;
}

.row-link:hover {
    color: var(--primary);
}

/* "Clear search" / "Browse all" beside the results count. */
.text-link {
    color: var(--primary);
    text-decoration: none;
}

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

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.25rem;
}

.page-link {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.875rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--foreground);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
}

.page-link:hover {
    background: var(--secondary);
}

.page-link.disabled {
    color: var(--muted-foreground);
    opacity: 0.5;
    pointer-events: none;
}

.page-status {
    font-size: 0.8125rem;
    color: var(--muted-foreground);
}

/* Outcome banner for a form round-trip (e.g. ?reported=1 after an issue report).
   Replaces the in-modal success/failure state, which needed a live component to show. */
.page-banner {
    max-width: 72rem;
    margin: 1rem auto 0;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.page-banner.success {
    color: var(--foreground);
    background: hsla(174, 60%, 42%, 0.12);
    border-color: hsla(174, 60%, 42%, 0.4);
}

.page-banner.error {
    color: var(--destructive-foreground);
    background: var(--destructive);
    border-color: var(--destructive);
}

/* The Report Issue trigger is an anchor now, not a button. */
a.btn-report {
    text-decoration: none;
}
