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

:root {
    --color-bg: #fafaf9;
    --color-surface: #ffffff;
    --color-text: #1c1917;
    --color-text-muted: #78716c;
    --color-primary: #1d4ed8;
    --color-primary-hover: #1e40af;
    --color-danger: #dc2626;
    --color-border: #e7e5e4;
    --color-success: #16a34a;
    --radius: 6px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

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

/* Nav */
.site-nav {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 0.75rem 1rem;
}
.nav-inner {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.nav-brand {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--color-text);
}
.nav-brand:hover { text-decoration: none; }
.nav-actions { display: flex; gap: 1rem; align-items: center; }

/* Main */
main {
    flex: 1;
    padding: 2rem 1rem;
}

/* Hero */
.hero {
    text-align: center;
    padding: 3rem 0 2rem;
}
.hero h1 { font-size: 2rem; margin-bottom: 0.5rem; }
.hero p { color: var(--color-text-muted); font-size: 1.1rem; }

/* Org grid */
.org-list { margin-top: 2rem; }
.org-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}
.org-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    color: var(--color-text);
    transition: border-color 0.15s;
}
.org-card:hover {
    border-color: var(--color-primary);
    text-decoration: none;
}
.org-card h3 { margin-bottom: 0.5rem; }
.org-card p { color: var(--color-text-muted); font-size: 0.9rem; }

/* Auth forms */
.auth-form {
    max-width: 480px;
    margin: 0 auto;
}
.auth-form h1 { margin-bottom: 1.5rem; }
.auth-form label {
    display: block;
    font-weight: 600;
    margin-top: 1rem;
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
}
.auth-form input[type="text"],
.auth-form input[type="password"],
.auth-form input[type="email"],
.auth-form input[type="url"],
.auth-form textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: inherit;
}
.auth-form small {
    display: block;
    color: var(--color-text-muted);
    margin-top: 0.25rem;
}
.auth-form button[type="submit"] {
    margin-top: 1.5rem;
    width: 100%;
}
.auth-alt {
    text-align: center;
    margin-top: 1rem;
    color: var(--color-text-muted);
}
.checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 0.5rem;
    font-weight: normal !important;
    margin-top: 1rem;
}
.checkbox-label input { width: auto; }

/* Buttons */
button, .btn {
    display: inline-block;
    padding: 0.5rem 1.25rem;
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 0.95rem;
    cursor: pointer;
    text-align: center;
}
button:hover, .btn:hover {
    background: var(--color-primary-hover);
    text-decoration: none;
}
.btn-link {
    background: none;
    color: var(--color-primary);
    padding: 0;
    border: none;
    cursor: pointer;
    font-size: inherit;
}
.btn-link:hover { text-decoration: underline; }
.btn-danger { color: var(--color-danger); }

/* Dashboard */
.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}
.post-list { margin-top: 1rem; }
.post-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
}
.post-info { display: flex; align-items: center; gap: 0.75rem; }
.post-actions { display: flex; gap: 0.75rem; align-items: center; }
.badge {
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-weight: 600;
}
.badge-published { background: #dcfce7; color: #166534; }
.badge-draft { background: #fef3c7; color: #92400e; }

/* Org profile */
.org-header { margin-bottom: 2rem; }
.org-header h1 { font-size: 1.75rem; }
.org-mission { color: var(--color-text-muted); margin-top: 0.5rem; font-size: 1.05rem; }
.org-description { margin-top: 0.75rem; }
.org-meta { display: flex; gap: 1rem; margin-top: 0.75rem; }

/* Post feed */
.post-feed h2 { margin-bottom: 1rem; }
.post-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
}
.post-card h3 { margin-bottom: 0.25rem; }
.post-card time { color: var(--color-text-muted); font-size: 0.85rem; }
.post-card p { margin-top: 0.5rem; color: var(--color-text-muted); }

/* Single post */
.post-full header { margin-bottom: 1.5rem; }
.post-full h1 { font-size: 1.75rem; }
.post-full time { color: var(--color-text-muted); }
.post-org { color: var(--color-text-muted); font-size: 0.9rem; }
.post-body { line-height: 1.8; margin-bottom: 2rem; white-space: pre-wrap; }
.post-full footer { padding-top: 1rem; border-top: 1px solid var(--color-border); }

/* Flash messages */
.flash {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}
.flash-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.flash-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }

.empty-state {
    color: var(--color-text-muted);
    text-align: center;
    padding: 2rem;
}

.rss-link::before { content: "📡 "; }

/* Footer */
.site-footer {
    border-top: 1px solid var(--color-border);
    padding: 1.5rem 1rem;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 0.85rem;
}
