@import url("https://fonts.googleapis.com/css2?family=Righteous&family=Montserrat:wght@300;400;500;700&display=swap");

:root {
    --bg-page: #1e293b;
    --text-primary: #f8fafc;
    --text-muted: #94a3b8;
    --border: #475569;
    --surface: #334155;
    --accent: #a71d1d;
    --accent-hover: #d93838;
    --accent-bright: #e8a4a4;
    --btn-bg: #64748b;
    --btn-bg-hover: #334155;
    --progress-track: #475569;
    --progress-overflow: #14b8a6;
    --progress-overflow-bright: #2dd4bf;
}

* {
    box-sizing: border-box;
}

html {
    line-height: 1.5;
}

body {
    margin: 0;
    min-width: 300px;
    background: var(--bg-page);
    color: var(--text-primary);
    font-family: Montserrat, sans-serif;
}

h1, h2, h3, h4, h5 {
    font-family: Righteous, sans-serif;
    font-weight: 600;
}

h1 {
    color: var(--accent);
    margin: 0 0 1rem;
    font-size: 2.25rem;
    line-height: 2.5rem;
}

h2 {
    margin: 0.5rem 0;
    font-size: 1.5rem;
    line-height: 2rem;
}

h3 {
    margin: 0.5rem 0;
    font-size: 1.25rem;
    line-height: 1.75rem;
}

a {
    color: var(--accent);
    text-decoration: underline;
}

a:hover {
    color: var(--accent-hover);
}

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

.site-header {
    padding-top: 0.5rem;
    margin-bottom: 0.25rem;
}

.site-header .container {
    padding-bottom: 0;
}

.site-title {
    color: var(--accent);
    text-decoration: none;
    font-family: Righteous, sans-serif;
    font-size: 1.25rem;
}

.header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

section {
    margin-bottom: 1.5rem;
}

.muted {
    color: var(--text-muted);
}

.hero {
    margin-top: 0;
}

.hero-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.stat-card {
    flex: 1 1 180px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 1rem;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
}

.progress-wrap {
    margin-top: 0.75rem;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}

.progress-bar {
    height: 0.75rem;
    background: var(--progress-track);
    border-radius: 9999px;
    overflow: hidden;
}

.progress-bar--over-goal {
    display: flex;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-hover));
    border-radius: 0;
    transition: width 0.3s ease;
    flex-shrink: 0;
}

.progress-bar:not(.progress-bar--over-goal) .progress-fill {
    border-radius: 9999px;
}

.progress-fill--overflow {
    background: linear-gradient(90deg, var(--progress-overflow), var(--progress-overflow-bright));
    animation: progress-overflow-pulse 2s ease-in-out infinite;
}

@keyframes progress-overflow-pulse {
    0%, 100% {
        filter: brightness(1);
    }
    50% {
        filter: brightness(1.15);
    }
}

.chart-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 1rem;
}

.chart-controls {
    margin-bottom: 0.75rem;
}

.chart-controls label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.contributors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.contributor-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.contributor-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
}

.contributor-hours {
    color: var(--accent);
    font-weight: 700;
    white-space: nowrap;
}

.thumb-wrap {
    width: 100%;
    aspect-ratio: 4 / 3;
    background: #0f172a;
    border-radius: 0.375rem;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.thumb-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.thumb-placeholder {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.filter-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.filter-list li {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.15rem 0;
    font-size: 0.875rem;
}

.filter-name {
    color: var(--text-muted);
}

.target-links {
    font-size: 0.875rem;
}

.target-links ul {
    margin: 0.25rem 0 0;
    padding-left: 1.25rem;
}

.footer-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.875rem;
}

.admin-link {
    color: var(--text-muted);
    text-decoration: none;
}

.admin-link:hover {
    color: var(--text);
}

.admin-footer {
    margin-bottom: 1rem;
}

.empty-state {
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: 0.5rem;
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
}

.alert {
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
}

.alert-error {
    background: #5c1515;
    color: var(--accent-bright);
}

.alert-success {
    background: #14532d;
    color: #bbf7d0;
}

.alert-info {
    background: #1e3a5f;
    color: #bfdbfe;
}

.btn {
    display: inline-block;
    cursor: pointer;
    background: var(--btn-bg);
    color: var(--text-primary);
    border: none;
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    font-family: inherit;
    text-decoration: none;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.btn:hover {
    background: var(--btn-bg-hover);
    color: var(--text-primary);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--border);
}

.btn-danger {
    background: var(--accent);
}

.btn-danger:hover {
    background: var(--accent-hover);
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.35rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group input[type="url"] {
    width: 100%;
    max-width: 100%;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    border: 1px solid var(--border);
    background: #0f172a;
    color: var(--text-primary);
    font-family: inherit;
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: end;
}

.admin-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

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

.target-row {
    display: grid;
    grid-template-columns: 1fr 2fr minmax(8rem, 1fr);
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

@media (max-width: 640px) {
    .target-row {
        grid-template-columns: 1fr;
    }
}

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

th, td {
    padding: 0.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
}

.login-box {
    max-width: 420px;
    margin: 2rem auto;
}

.inline-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.checkbox-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.hours-breakdown {
    list-style: none;
    margin: 0 0 0.75rem;
    padding: 0;
    font-size: 0.875rem;
}

.hours-breakdown li {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.1rem 0;
}

.filter-source {
    color: var(--text-muted);
    font-size: 0.8em;
}

.source-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 0.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    font-size: 0.875rem;
    text-transform: capitalize;
}

.thumb-preview {
    max-width: 240px;
    border-radius: 0.375rem;
    overflow: hidden;
    border: 1px solid var(--border);
}

.thumb-preview img {
    width: 100%;
    display: block;
}
