:root {
    --brand: #00a651;
    --brand-dark: #2a3b4f;
    --brand-light: #c2dbd2;
    --accent: #fef577;
    --accent-strong: #fcd73c;
    --bg: #f9f2ee;
    --card: #ffffff;
    --ink: #2a3b4f;
    --muted: #5c6b7a;
    --open: #3c78aa;
    --open-bg: rgba(173, 216, 230, 0.45);
    --claimed: #ba8c00;
    --claimed-bg: rgba(252, 215, 60, 0.45);
    --completed: #46965a;
    --completed-bg: rgba(180, 232, 190, 0.55);
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--ink);
    margin: 0;
}

h1, h2, h3, h4, h5 {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    color: var(--brand-dark);
}

label {
    color: var(--brand-dark);
    font-weight: 600;
}

a {
    color: var(--brand);
}

a:hover {
    color: #355739;
}

.button {
    background: var(--brand);
    color: #fff;
}

.button:hover,
.button:focus {
    background: #355739;
    color: #fff;
}

.button.secondary {
    background: var(--accent-strong);
    color: var(--brand);
}

.button.secondary:hover,
.button.secondary:focus {
    background: #f2c915;
    color: var(--brand);
}

.button.warning {
    background: #fcd73c;
    color: #2a3b4f;
}

.button.warning:hover,
.button.warning:focus {
    background: #f2c915;
    color: #2a3b4f;
}

.button.deactivate {
    background: #eb4f29;
    color: #fff;
}

.button.deactivate:hover,
.button.deactivate:focus {
    background: #d94824;
    color: #fff;
}

.button.danger {
    background: #e35b6d;
    color: #fff;
}

.button.danger:hover,
.button.danger:focus {
    background: #cc4f60;
    color: #fff;
}

.button.alert {
    background: #2a3b4f;
    color: #fff;
}

.button.alert:hover,
.button.alert:focus {
    background: #1f2b3a;
    color: #fff;
}

.button.hollow {
    background: transparent;
    color: var(--brand);
    border-color: var(--brand);
}

.button.hollow:hover,
.button.hollow:focus {
    background: var(--brand);
    color: #fff;
}

.button.alert {
    background: #e35b6d;
    border-color: #e35b6d;
    color: #fff;
}

.button.alert:hover,
.button.alert:focus {
    background: #cf4a5d;
    border-color: #cf4a5d;
}

.main-content {
    padding-top: 1rem;
    padding-bottom: 4rem;
}

.topbar-accent {
    height: 10px;
    background: var(--brand);
    position: sticky;
    top: 0;
    z-index: 60;
}

.topbar {
    background: #fcd73c;
    color: var(--brand-dark);
    position: sticky;
    top: 10px;
    z-index: 50;
}

.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0;
}

.brand {
    font-family: 'Inter', sans-serif;
    font-size: 1.05rem;
    color: var(--brand-dark);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.brand-icon {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    object-fit: cover;
}

.login-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 0.75rem;
}

.login-logo img {
    width: 256px;
    height: 256px;
    border-radius: 24px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
    object-fit: cover;
}

.auth-screen {
    padding-top: 2.5rem;
}

.menu-toggle {
    background: transparent;
    border: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0.4rem;
}

.menu-toggle span {
    width: 24px;
    height: 2px;
    background: var(--brand-dark);
}

.topbar-nav {
    display: none;
    flex-direction: column;
    gap: 0.5rem;
    background: #073150;
    padding: 0.75rem;
    border-radius: 10px;
    position: absolute;
    right: 1rem;
    top: 3.5rem;
}

.topbar-nav a {
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
}

.topbar-nav a.is-active {
    color: #063864;
    font-weight: 700;
    background: #fff;
}

.topbar-nav .nav-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.nav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.1rem;
    height: 1.1rem;
    padding: 0 0.3rem;
    border-radius: 999px;
    background: #e35b6d;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 1;
}

.topbar-nav a.logout {
    color: var(--brand);
}

.topbar-nav.is-open {
    display: flex;
}

.inline-form {
    display: inline-block;
    margin-left: 0.35rem;
}

.inline-edit {
    display: inline-block;
}

.inline-edit summary {
    cursor: pointer;
    list-style: none;
    display: inline-block;
}

.inline-edit summary::-webkit-details-marker {
    display: none;
}

.callout {
    border-radius: 12px;
    border: none;
    box-shadow: 0 6px 20px rgba(20, 33, 30, 0.08);
    background: var(--card);
}

.hero-card {
    background: var(--accent);
    border-left: 4px solid var(--brand);
}

.hero-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.hero-header .button {
    margin: 0;
    white-space: nowrap;
}

.map-card img,
.district-map {
    width: 100%;
    border-radius: 12px;
    border: 2px solid #e5ded5;
}

.map-wrapper {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
}

.map-editor {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
}

.detail-map-preview img,
.detail-map img {
    width: 100%;
    max-width: 420px;
    border-radius: 12px;
    border: 2px solid #e5ded5;
    margin-top: 0.5rem;
}

.detail-map-thumb {
    display: inline-block;
    margin-top: 0.5rem;
}

.detail-map-thumb img {
    width: 100%;
    max-width: 200px;
    border-radius: 10px;
    border: 2px solid #e5ded5;
}

.post-thumb {
    width: 70px;
    height: 70px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #e5ded5;
}

.map-editor-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: flex-end;
    margin-top: 1rem;
}

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

.map-overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.map-overlay-editor {
    pointer-events: auto;
    cursor: crosshair;
}

.map-overlay-editor .polygon-preview {
    fill: rgba(0, 166, 81, 0.2);
    stroke: #00a651;
    stroke-width: 2;
}

.map-overlay-editor .map-polygon {
    pointer-events: none;
}

.map-polygon {
    fill: rgba(173, 216, 230, 0.45);
    stroke: rgba(60, 120, 170, 0.8);
    stroke-width: 2;
}

.map-polygon.map-status-open {
    fill: rgba(173, 216, 230, 0.45);
    stroke: rgba(60, 120, 170, 0.8);
}

.map-polygon.map-status-claimed {
    fill: rgba(252, 215, 60, 0.45);
    stroke: rgba(186, 140, 0, 0.75);
}

.map-polygon.map-status-completed {
    fill: rgba(155, 125, 200, 0.75);
    stroke: rgba(110, 80, 160, 0.85);
}

.district-card {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.district-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.badge {
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.status-open {
    background: var(--open-bg);
    color: var(--open);
}

.status-claimed {
    background: var(--claimed-bg);
    color: var(--claimed);
}

.status-completed {
    background: var(--completed-bg);
    color: var(--completed);
}

.badge.badge-type-social {
    background: rgba(235, 79, 41, 0.18);
    color: #eb4f29;
}

.badge.badge-type-print {
    background: rgba(125, 59, 78, 0.18);
    color: #7d3b4e;
}

.badge.badge-type-event {
    background: rgba(6, 56, 100, 0.18);
    color: #063864;
}

.badge.badge-type-flyer {
    background: rgba(0, 166, 81, 0.18);
    color: #00a651;
}

.badge.badge-type-post {
    background: rgba(252, 215, 60, 0.35);
    color: #7a5a00;
}

.claim-info {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.claim-person {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.claim-person.open-slot {
    padding: 0.4rem 0.6rem;
    border-radius: 8px;
    background: #fff6cc;
    color: #7a5a00;
    font-weight: 600;
}

.avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.avatar.large {
    width: 64px;
    height: 64px;
}

.avatar.placeholder {
    background: var(--brand);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.profile-avatar {
    margin-bottom: 1rem;
}

.complete-form {
    border-top: 1px solid #efe8df;
    padding-top: 0.75rem;
}

.inventory-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.inventory-grid .label {
    display: block;
    font-size: 0.75rem;
    color: var(--muted);
}

.inventory-grid .value {
    font-size: 1.3rem;
}

.inventory-grid .value.low {
    color: #b00020;
}

.warning-text {
    color: #b00020;
    font-weight: 600;
}

.velocity-chart {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.velocity-row {
    display: grid;
    grid-template-columns: 60px 1fr;
    gap: 0.5rem;
    align-items: center;
}

.velocity-row .bar {
    background: var(--accent);
    color: var(--brand-dark);
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-size: 0.75rem;
}

.notification-list {
    list-style: none;
    margin: 0;
}

.notification-list li {
    border-bottom: 1px solid #efe8df;
    padding: 0.5rem 0;
}

.notification-list em {
    display: block;
    font-size: 0.75rem;
    color: var(--muted);
}

.chat-messages {
    max-height: 480px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
    background: #f6efe9;
    border: 1px solid #e6ddd6;
    border-radius: 12px;
    padding: 0.75rem;
}

.chat-message {
    padding: 0.75rem;
    border-radius: 10px;
    background: #ffffff;
    border: 1px solid #e6ddd6;
}

.chat-message.announcement {
    border-left: 4px solid var(--accent-strong);
    background: #fff7c2;
}

.chat-message em {
    font-size: 0.75rem;
    color: var(--muted);
}

.chat-timestamp {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.chat-timestamp .chat-date,
.chat-timestamp .chat-time {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.chat-timestamp .chat-sep {
    color: var(--muted);
}

.chat-icon {
    width: 12px;
    height: 12px;
}

.badge.badge-new {
    background: #e35b6d;
    color: #fff;
    margin-left: 0.35rem;
}

.badge.badge-private {
    background: rgba(6, 56, 100, 0.18);
    color: #063864;
    margin-left: 0.35rem;
}

.admin-subnav {
    margin-top: 0.75rem;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.admin-actions form {
    margin: 0;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.status-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 4px 12px;
    font-size: 0.7rem;
    text-align: center;
    letter-spacing: 0.02em;
    color: #2A3B4F;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(4px);
    z-index: 20;
}

.status-bar .status-sep {
    margin: 0 0.5rem;
    color: #8c98a8;
}

.district-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 1rem;
}

.volunteer-row .volunteer-edit,
.volunteer-row .volunteer-edit-cancel {
    display: none;
}

.volunteer-row.is-editing .volunteer-view,
.volunteer-row.is-editing .volunteer-edit-toggle {
    display: none;
}

.volunteer-row.is-editing .volunteer-edit,
.volunteer-row.is-editing .volunteer-edit-cancel {
    display: inline-block;
}

.volunteer-row input.volunteer-edit,
.volunteer-row select.volunteer-edit {
    min-width: 160px;
}

.button.join-buddy {
    background-color: #FCD73C;
    color: #2A3B4F;
}

.button.join-buddy:hover,
.button.join-buddy:focus {
    background-color: #f3cb2a;
    color: #2A3B4F;
}

.claim-row .claim-edit {
    display: none;
}

.claim-row.is-editing .claim-view,
.claim-row.is-editing .claim-edit-toggle {
    display: none;
}

.claim-row.is-editing .claim-edit {
    display: inline-flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.dashboard-signup-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.dashboard-signup-form input[type="date"] {
    min-width: 160px;
}

.planned-list {
    margin: 0;
    padding-left: 1.1rem;
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.text-link {
    font-weight: 600;
    text-decoration: none;
}

.timeline-section {
    margin-top: 1rem;
}

.timeline-columns {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.timeline-columns .timeline-section {
    margin-top: 0;
}

.timeline-section-completed {
    background: #f4f1ee;
    border-radius: 12px;
    padding: 0.75rem;
}

.timeline-day {
    border-top: 1px solid #e6ddd6;
    padding-top: 0.75rem;
    margin-top: 0.75rem;
}

.timeline-date {
    font-weight: 600;
    color: var(--brand-dark);
    margin-bottom: 0.5rem;
    padding-left: 0.5rem;
}

.timeline-section h6 {
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #fff;
    background: var(--brand);
    padding: 0.3rem 0.6rem;
    border-radius: 999px;
    display: inline-block;
    margin-bottom: 0.75rem;
}

.timeline-item {
    display: grid;
    grid-template-columns: 64px 1fr;
    gap: 0.75rem;
    padding: 0.6rem 0;
    padding-left: 0.5rem;
    border-left: 3px solid var(--brand);
}

.timeline-item.type-social {
    border-color: #eb4f29;
}

.timeline-item.type-print {
    border-color: #7d3b4e;
}

.timeline-item.type-event {
    border-color: #063864;
}

.timeline-item.type-flyer {
    border-color: var(--brand);
}

.timeline-item.type-post {
    border-color: #fcd73c;
}

.timeline-time {
    font-weight: 600;
    color: var(--brand-dark);
}

.timeline-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.timeline-icon-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 999px;
    border: 1px solid #e6ddd6;
    color: var(--brand-dark);
    text-decoration: none;
    background: #fff;
}

.timeline-icon-link:hover,
.timeline-icon-link:focus {
    background: var(--accent);
    color: var(--brand-dark);
}

.icon-search {
    width: 14px;
    height: 14px;
}

.timeline-status {
    font-size: 0.75rem;
    color: var(--muted);
}

.timeline-meta {
    font-size: 0.85rem;
    color: var(--muted);
}

.timeline-meta-who {
    color: #8a93a3;
    font-weight: 700;
}

.timeline-summary {
    margin-top: 0.3rem;
    font-size: 0.85rem;
}

.timeline-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.4rem;
}

.timeline-actions form {
    margin: 0;
}

.post-grid {
    display: grid;
    gap: 1rem;
}

.post-card {
    padding: 0.75rem;
    border-radius: 12px;
    background: #fff;
    border: 1px solid #eee4dd;
}

.post-card img {
    width: 50%;
    border-radius: 10px;
    margin-bottom: 0.5rem;
}

.post-title {
    font-weight: 700;
}

.post-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.post-preference {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: flex-end;
}

@media (min-width: 640px) {
    .post-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.share-link input,
.callout input[type="text"] {
    width: 100%;
}

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

.install-body {
    background: #f5f1ea;
    min-height: 100vh;
    padding-top: 2rem;
}

@media (min-width: 768px) {
    .timeline-columns {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1.5rem;
    }

    .topbar-nav {
        display: flex !important;
        position: static;
        flex-direction: row;
        background: transparent;
        padding: 0;
        gap: 1rem;
    }
    .topbar-nav a {
        color: var(--brand-dark);
    }
    .menu-toggle {
        display: none;
    }
}

@media (max-width: 767px) {
    .topbar-nav a.is-active {
        color: #063864;
        background: #fff;
        border-radius: 6px;
        width: 100%;
        justify-content: flex-start;
    }
}
