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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 0 20px 20px;
}

body > nav,
.admin-header {
    width: calc(100% + 40px);
    margin-left: -20px;
    margin-right: -20px;
    background: rgba(15, 23, 42, 0.96);
    color: white;
}

.admin-nav {
    max-width: none;
    width: 100%;
    margin: 0 auto;
}

.admin-brand {
    color: white;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.admin-brand-logo {
    display: block;
    height: 2.5rem;
    width: auto;
}

.container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 40px;
    /* Full-width admin chrome (body keeps horizontal padding). */
    max-width: none;
    width: 100%;
    margin-top: 20px;
}

/* Aliases kept for templates; all admin pages use the same full width. */
.container.container-wide,
.container.container-full {
    max-width: none;
}

/* Shared browse board: filter sidebar + main content (Matches, Match Listeners) */
.admin-filter-layout {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}

@media (max-width: 900px) {
    .admin-filter-layout {
        grid-template-columns: 1fr;
    }
}

.admin-filter-sidebar {
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    background: #f8fafc;
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 2rem);
    overflow: auto;
}

.admin-filter-main {
    min-width: 0;
}

/* Shared test-match card highlight (Matches, Match Listeners) */
.admin-card--test {
    background: #fffbeb;
    box-shadow: inset 3px 0 0 #f59e0b;
}

body.admin-wide {
    align-items: center;
}

@media (max-width: 640px) {
    .container {
        padding: 24px;
    }
}

.links {
    margin-top: 30px;
}

.links a {
    display: inline-block;
    margin-right: 15px;
    margin-bottom: 10px;
    padding: 10px 20px;
    background: #667eea;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    transition: background 0.3s;
}

.links a:hover {
    background: #5568d3;
}

.api-link {
    background: #48bb78;
}

.api-link:hover {
    background: #38a169;
}

.result-card {
    background: #f7fafc;
    border-left: 4px solid #667eea;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 6px;
}

.result-card h2 {
    color: #667eea;
    font-size: 1.2em;
    margin-bottom: 10px;
}

.result-value {
    font-size: 1.5em;
    font-weight: bold;
    color: #333;
}

.back-link {
    display: inline-block;
    margin-top: 20px;
    padding: 10px 20px;
    background: #667eea;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    transition: background 0.3s;
}

.back-link:hover {
    background: #5568d3;
}

/* Above feature modals (z-50) so ? help works from inside edit dialogs. */
.admin-field-help-modal {
    z-index: 70;
}

.admin-toast {
    position: fixed;
    bottom: 1.25rem;
    left: 50%;
    transform: translateX(-50%) translateY(0.5rem);
    z-index: 80;
    max-width: min(24rem, calc(100vw - 2rem));
    padding: 0.55rem 0.95rem;
    border-radius: 0.5rem;
    background: #1e293b;
    color: #f8fafc;
    font-size: 0.8125rem;
    line-height: 1.35;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.22);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.admin-toast.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.admin-toast[data-variant="error"] {
    background: #7f1d1d;
    color: #fef2f2;
}

[x-cloak] {
    display: none !important;
}

/* Local day-range presets (admin_day_range macro) */
.admin-day-preset {
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #334155;
    border-radius: 9999px;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    line-height: 1.25rem;
}

.admin-day-preset.is-active {
    border-color: #4f46e5;
    background: #eef2ff;
    color: #3730a3;
    font-weight: 600;
}

/* Status pills (AdminMatchStatus.badgeClasses) — colors come from Tailwind utilities */
.admin-status-badge {
    letter-spacing: 0.01em;
}

a.admin-status-badge {
    text-decoration: none;
}

a.admin-status-badge:hover {
    text-decoration: underline;
}

/* Brand sponsor pills (Matches / History / Brand Sponsorships) */
.admin-sponsor-logo {
    width: 1.1rem;
    height: 1.1rem;
    object-fit: contain;
    border-radius: 0.15rem;
    background: #fff;
    flex-shrink: 0;
}

.admin-sponsor-pill {
    text-decoration: none;
}

/* Plain × dismiss for modal headers (not a bordered button). */
.admin-modal-dismiss {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin: 0;
    padding: 0.1rem;
    border: 0;
    background: transparent;
    color: #94a3b8;
    font-size: 1.5rem;
    font-weight: 400;
    line-height: 1;
    cursor: pointer;
}

.admin-modal-dismiss:hover {
    color: #0f172a;
    background: transparent;
}

.admin-modal-dismiss:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
    border-radius: 0.25rem;
}

/* Concise field subtext; details live in AdminFieldHelp modals */
.help {
    margin: 0.25rem 0 0;
    font-size: 0.7rem;
    line-height: 1.35;
    color: #64748b;
}

.admin-icon-btn,
.admin-copy-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 1.5rem;
    height: 1.5rem;
    padding: 0;
    border: 1px solid #cbd5e1;
    border-radius: 0.375rem;
    background: #fff;
    color: #475569;
    cursor: pointer;
    line-height: 1;
    text-decoration: none;
}

.admin-icon-btn:hover,
.admin-copy-icon-btn:hover {
    background: #f8fafc;
    color: #1e293b;
    border-color: #94a3b8;
}

.admin-icon-btn:disabled,
.admin-copy-icon-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.admin-icon-btn svg,
.admin-copy-icon-btn svg {
    width: 0.875rem;
    height: 0.875rem;
    display: block;
}

.admin-field-help-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1rem;
    height: 1rem;
    padding: 0;
    border: 1px solid #cbd5e1;
    border-radius: 9999px;
    background: #fff;
    color: #475569;
    font-size: 0.625rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
}

.admin-field-help-btn:hover {
    background: #f1f5f9;
    color: #1e293b;
}

.admin-field-help-table-wrap {
    overflow-x: auto;
    margin-top: 0.25rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
}

.admin-field-help-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
    line-height: 1.4;
}

.admin-field-help-table th,
.admin-field-help-table td {
    padding: 0.4rem 0.6rem;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid #e2e8f0;
}

.admin-field-help-table th {
    background: #f8fafc;
    font-weight: 600;
    color: #334155;
    white-space: nowrap;
}

.admin-field-help-table tr:last-child td {
    border-bottom: none;
}

.admin-field-help-table td.admin-field-help-code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-weight: 600;
    color: #0f172a;
    white-space: nowrap;
    width: 4.5rem;
}
