:root {
    --ink: #16202e;
    --muted: #5b6b82;
    --border: #dbe2eb;
    --bg: #f5f7fa;
    --accent: #0f1a2e;
    --accent-2: #f2a63b;
}

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

.page {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px 60px;
}

.site-header {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 28px 0 20px;
    border-bottom: 1px solid var(--border);
}

.brand-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.brand-logo {
    height: 28px;
    width: auto;
    display: block;
}

.brand {
    font-weight: 700;
    font-size: 1.3rem;
    color: var(--accent);
    text-decoration: none;
}

.tagline {
    color: var(--muted);
    font-size: 0.9rem;
}

main {
    padding-top: 24px;
}

h1 {
    margin: 0 0 6px;
    font-size: 1.8rem;
}

p.sub {
    color: var(--muted);
    margin: 0 0 32px;
}

.app-group {
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
    scroll-margin-top: 20px;
}

.app-group:last-child {
    border-bottom: none;
}

.app-group h2 {
    margin: 0 0 4px;
    font-size: 1.25rem;
    color: var(--accent);
}

.app-desc {
    color: var(--muted);
    font-size: 0.9rem;
    margin: 0 0 12px;
}

.guide-list {
    list-style: none;
    margin: 0 0 8px;
    padding: 0;
    column-count: 3;
    column-gap: 28px;
    column-rule: 1px solid var(--border);
}

.guide-list li {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    break-inside: avoid;
}

.guide-list a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.guide-list a:hover {
    text-decoration: underline;
}

.guide-desc {
    color: var(--muted);
    font-size: 0.9rem;
}

.empty {
    color: var(--muted);
}

/* Any image, anywhere (inline guide Body content and the attached-images strip alike) -
   never wider than its container, and never distorted, on any viewport. */
img {
    max-width: 100%;
    height: auto;
}

.back-link-inline {
    display: inline-block;
    color: var(--muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 16px;
}

.back-link-inline:hover {
    color: var(--accent);
}

.guide-body {
    line-height: 1.65;
    max-width: 68ch;
}

.guide-body :first-child {
    margin-top: 0;
}

.guide-images {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 24px;
}

.guide-images img {
    border: 1px solid var(--border);
    border-radius: 8px;
}

.site-footer {
    margin-top: 40px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.85rem;
}

/* Admin */
.admin-nav {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
}

.admin-nav a {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
}

.admin-nav a:hover {
    color: var(--accent);
}

.admin-nav .back-link {
    margin-left: auto;
}

table.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 24px;
    font-size: 0.9rem;
}

table.admin-table th, table.admin-table td {
    text-align: left;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
}

table.admin-table th {
    color: var(--muted);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-inactive {
    color: var(--muted);
    font-size: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 6px;
}

.admin-form {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    max-width: 520px;
    margin-bottom: 24px;
}

.admin-form label {
    display: block;
    font-size: 0.82rem;
    font-weight: 650;
    margin: 12px 0 4px;
    color: var(--ink);
}

.admin-form label:first-child {
    margin-top: 0;
}

.admin-form input[type=text], .admin-form input[type=number], .admin-form input[type=url], .admin-form textarea, .admin-form select {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 0.9rem;
    box-sizing: border-box;
    font-family: inherit;
}

.admin-form .checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
}

.admin-form .checkbox-row label {
    margin: 0;
}

.btn {
    display: inline-block;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--ink);
    border-radius: 8px;
    padding: 7px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}

.btn:hover {
    background: var(--bg);
}

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.btn-primary:hover {
    opacity: 0.9;
}

.btn-danger {
    color: #b3261e;
    border-color: #f0c9c6;
}

.btn-row {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.field-error {
    color: #b3261e;
    font-size: 0.8rem;
    margin-top: 4px;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem 1rem 1rem 1.2rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred."
}

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

/* Responsive - phones and narrow tablets */
@media (max-width: 640px) {
    .page {
        padding: 0 14px 40px;
    }

    h1 {
        font-size: 1.5rem;
    }

    .guide-list {
        /* Two hairline-separated columns are cramped on a phone width and force awkward
           mid-word wrapping - a single column reads far better and still uses the full width. */
        column-count: 1;
    }

    .guide-list li {
        padding: 10px 0;
    }

    .brand-row span[style] {
        margin-left: 0 !important;
        width: 100%;
        justify-content: flex-end;
    }

    /* Turns the table into a horizontally-scrollable strip instead of forcing the whole
       page body to scroll sideways - the columns themselves stay full-size and legible. */
    table.admin-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .admin-form {
        max-width: 100%;
    }

    .admin-nav {
        flex-wrap: wrap;
        row-gap: 8px;
    }

    .admin-nav .back-link {
        margin-left: 0;
    }
}
