:root {
    --primary: #b8860b;
    --secondary: #8b0000;
    --bg: #1a1008;
    --card-bg: #2a1a10;
    --text: #f5e6c8;
    --muted: #a08060;
    --border: #3a2818;
    --success: #2e7d32;
    --error: #c62828;
    --input-bg: #1a1008;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

#app {
    max-width: 600px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

#nav-bar {
    display: flex;
    gap: 0;
    background: var(--card-bg);
    border-bottom: 2px solid var(--primary);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    flex-wrap: wrap;
}

.nav-item {
    flex: 1;
    text-align: center;
    padding: 12px 8px;
    color: var(--text);
    text-decoration: none;
    font-size: 0.85rem;
    border: none;
    background: none;
    cursor: pointer;
    transition: background 0.2s;
    min-width: 60px;
}

.nav-item:hover, .nav-item.active {
    background: var(--primary);
    color: var(--bg);
}

.nav-btn {
    color: var(--secondary);
    font-weight: 600;
}

main#view {
    flex: 1;
    padding: 16px;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 16px;
}

.card h1 {
    color: var(--primary);
    margin-bottom: 8px;
    font-size: 1.5rem;
}

.card h2 {
    color: var(--primary);
    margin-bottom: 12px;
    font-size: 1.2rem;
}

form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 16px;
}

label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.9rem;
    color: var(--muted);
}

input, textarea, select {
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    color: var(--text);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

input:focus, textarea:focus, select:focus {
    border-color: var(--primary);
}

button {
    border: none;
    border-radius: 8px;
    padding: 12px 20px;
    font-size: 1rem;
    cursor: pointer;
    transition: opacity 0.2s;
}

button:hover { opacity: 0.85; }

.btn-primary {
    background: var(--primary);
    color: var(--bg);
    font-weight: 600;
}

.btn-secondary {
    background: var(--border);
    color: var(--text);
}

.btn-danger {
    background: var(--secondary);
    color: #fff;
}

.muted { color: var(--muted); }
.small { font-size: 0.8rem; }

.warning {
    background: rgba(184, 134, 11, 0.15);
    border: 1px solid var(--primary);
    border-radius: 8px;
    padding: 16px;
    margin-top: 16px;
    font-size: 0.85rem;
}

.warning strong { color: var(--primary); }

.error-msg {
    background: rgba(198, 40, 40, 0.15);
    border: 1px solid var(--error);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
    color: var(--error);
    font-size: 0.9rem;
}

.success-msg {
    background: rgba(46, 125, 50, 0.15);
    border: 1px solid var(--success);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
    color: var(--success);
    font-size: 0.9rem;
}

.magic-link-box {
    background: var(--input-bg);
    border: 1px solid var(--primary);
    border-radius: 8px;
    padding: 16px;
    margin: 16px 0;
    word-break: break-all;
    font-family: monospace;
    font-size: 0.85rem;
    color: var(--primary);
}

.list-item {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 8px;
}

.profile-field {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.profile-field:last-child { border-bottom: none; }

.profile-label { color: var(--muted); }
.profile-value { color: var(--text); font-weight: 500; }

.role-fieldset {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
}

.role-fieldset legend {
    color: var(--muted);
    font-size: 0.9rem;
    padding: 0 8px;
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-direction: row;
    margin-right: 16px;
    font-size: 0.95rem;
    color: var(--text);
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
}

.role-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 8px 0;
}

.user-name {
    font-weight: 600;
    font-size: 1.05rem;
}

.user-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.user-actions button {
    font-size: 0.85rem;
    padding: 6px 12px;
}

.event-item {
    cursor: pointer;
    transition: border-color 0.2s;
}

.event-item:hover {
    border-color: var(--primary);
}

.event-title {
    font-weight: 600;
    font-size: 1.05rem;
}

.event-date {
    color: var(--primary);
    font-size: 1.1rem;
    margin: 8px 0;
}

.event-desc {
    margin: 12px 0;
    white-space: pre-wrap;
}

.filter-row {
    margin: 12px 0;
}

.form-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.rsvp-section {
    margin-top: 20px;
}

.rsvp-buttons {
    display: flex;
    gap: 8px;
}

.rsvp-btn {
    flex: 1;
    background: var(--border);
    color: var(--text);
    padding: 10px;
    text-align: center;
    border: 2px solid transparent;
    border-radius: 8px;
}

.rsvp-btn.active {
    background: var(--primary);
    color: var(--bg);
    font-weight: 600;
    border-color: var(--primary);
}

.registrations {
    margin-top: 20px;
}

.reg-group {
    margin-bottom: 12px;
}

.reg-label {
    color: var(--primary);
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 4px;
}

.reg-name {
    padding: 2px 0;
    font-size: 0.95rem;
}

.compose {
    margin-bottom: 16px;
}

.compose textarea {
    width: 100%;
    margin-bottom: 8px;
    resize: vertical;
}

.post-item {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 10px;
}

.post-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 6px;
}

.post-author {
    font-weight: 600;
    font-size: 0.95rem;
}

.post-content {
    white-space: pre-wrap;
    word-break: break-word;
    margin: 4px 0;
}

.post-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.small-btn {
    font-size: 0.8rem;
    padding: 4px 10px;
}

.reply-form {
    margin-top: 10px;
    padding: 10px;
    background: var(--input-bg);
    border-radius: 8px;
}

.reply-form textarea {
    width: 100%;
    margin-bottom: 8px;
    resize: vertical;
}

.reply-item {
    margin-top: 10px;
    padding-left: 16px;
    border-left: 2px solid var(--border);
}

.poll-item {
    margin-bottom: 12px;
}

.poll-question {
    font-weight: 600;
    font-size: 1.05rem;
    margin-bottom: 4px;
}

.poll-options {
    margin: 10px 0;
}

.poll-option {
    display: flex;
    align-items: center;
    padding: 6px 0;
    cursor: pointer;
}

.poll-option-text {
    margin-left: 8px;
}

.poll-results {
    margin-top: 12px;
}

.poll-result {
    margin-bottom: 8px;
}

.poll-result-label {
    font-size: 0.9rem;
    margin-bottom: 2px;
}

.poll-bar-bg {
    background: var(--input-bg);
    border-radius: 4px;
    height: 8px;
    overflow: hidden;
}

.poll-bar {
    background: var(--primary);
    height: 100%;
    transition: width 0.3s;
}

.poll-option-input-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.poll-option-input-row input {
    flex: 1;
}

.form-row {
    margin-top: 8px;
}

.notif-badge {
    display: inline-block;
    background: var(--secondary);
    color: #fff;
    border-radius: 10px;
    font-size: 0.7rem;
    padding: 1px 6px;
    margin-left: 4px;
    min-width: 18px;
    text-align: center;
}

#notif-bell {
    position: relative;
}

.notif-send-form {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.notif-item {
    border-left: 3px solid var(--primary);
}

.notif-item.read {
    border-left-color: var(--border);
    opacity: 0.7;
}

.notif-title {
    font-weight: 600;
}

.notif-body {
    margin: 4px 0;
    white-space: pre-wrap;
}

@media (max-width: 400px) {
    .nav-item { font-size: 0.75rem; padding: 10px 4px; }
    main#view { padding: 12px; }
    .card { padding: 16px; }
}
