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

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    min-height: 100dvh;
}

body {
    font-family: 'Noto Naskh Arabic', 'Segoe UI', Tahoma, Arial, sans-serif;
    background: #f8fdf8;
    color: #222;
    direction: rtl;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
    font-family: inherit;
    font-size: 1rem;
    max-width: 100%;
}

button,
.tab-btn,
.komite-btn,
.top-tab-btn,
.logout-btn,
.btn,
.mini-btn,
.toggle-btn,
.mobile-nav-btn {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

img,
canvas,
svg {
    max-width: 100%;
    height: auto;
}

#app-root {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

#app-root.is-hidden {
    display: none;
}

/* Header */
.app-header {
    background: linear-gradient(135deg, #1b5e20 0%, #2e7d32 60%, #388e3c 100%);
    color: #fff;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 28px;
    padding: 18px 24px;
}

.puk-logo {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    border: 4px solid #fff;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
    object-fit: cover;
    background: #fff;
    flex-shrink: 0;
}

.app-title {
    margin: 0;
    font-size: clamp(1.35rem, 4vw, 2.9rem);
    font-weight: 700;
    line-height: 1.3;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

.top-banner {
    background: #ffffff;
    display: flex;
    flex-direction: row;
    direction: ltr;
    justify-content: flex-start;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-bottom: 1px solid #c8e6c9;
    min-height: 46px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.logged-in-name {
    margin-left: auto;
    color: #1b5e20;
    font-weight: 700;
    font-size: 0.98rem;
    direction: rtl;
    padding: 6px 10px;
    white-space: nowrap;
    flex-shrink: 0;
}

.top-tab-btn,
.logout-btn,
.link-btn {
    background: transparent;
    border: none;
    color: #1b5e20;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.95rem;
    padding: 6px 10px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    flex-shrink: 0;
}

.top-tab-btn:hover,
.logout-btn:hover,
.link-btn:hover,
.top-tab-btn.active {
    background: #e8f5e9;
    text-decoration: none;
}

.notify-badge {
    background: #c62828;
    color: #fff;
    border-radius: 999px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-size: 0.72rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.logout-bar {
    display: none;
}

/* Layout */
.layout {
    display: flex;
    flex: 1;
    min-height: 0;
    position: relative;
}

.sidebar-left,
.sidebar-right {
    width: 220px;
    flex-shrink: 0;
    color: #fff;
    padding: 16px 10px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.sidebar-left {
    background: #1b5e20;
    order: 1;
}

.main-content {
    flex: 1;
    order: 2;
    background: #fff;
    padding: 22px 24px 40px;
    overflow-y: auto;
    overflow-x: hidden;
    min-width: 0;
    -webkit-overflow-scrolling: touch;
}

.sidebar-right {
    background: #2e7d32;
    order: 3;
}

.drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.drawer-close {
    display: none;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
}

.mobile-nav {
    display: none;
}

.nav-backdrop {
    display: none;
}

.group-label {
    font-size: 0.85rem;
    font-weight: 700;
    opacity: 0.9;
    margin: 4px 8px 10px;
}

.group-label.underlined {
    border-bottom: 1px solid rgba(255, 255, 255, 0.45);
    padding-bottom: 8px;
    margin-bottom: 12px;
}

.komite-divider {
    border-top: 1px solid rgba(255, 255, 255, 0.28);
    margin: 18px 8px 14px;
}

.tab-btn,
.komite-btn {
    display: block;
    width: 100%;
    text-align: right;
    background: transparent;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 9px 12px;
    margin-bottom: 4px;
    cursor: pointer;
    font-size: 0.92rem;
    line-height: 1.45;
}

.tab-btn:hover,
.komite-btn:hover,
.tab-btn.active,
.komite-btn.active {
    background: rgba(255, 255, 255, 0.18);
}

/* Panels */
.panel {
    display: none;
    max-width: 760px;
    margin: 0 auto;
}

.panel.panel-wide {
    max-width: none;
}

.placeholder-panel {
    text-align: center;
    color: #555;
    font-size: 1.15rem;
    padding: 80px 20px;
}

/* Progress */
.progress-box {
    border: 2px solid #2e7d32;
    background: #f1f8f1;
    color: #1b5e20;
    text-align: center;
    font-weight: 600;
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 22px;
    font-size: 1.05rem;
}

/* Search */
.search-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
    margin-bottom: 12px;
}

.search-row label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-weight: 600;
    flex: 1;
    min-width: 180px;
}

.search-row input,
.voter-field input,
.membership-wrap select,
.login-form input,
.age-filter input {
    border: 1px solid #a5d6a7;
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 1rem;
    background: #fff;
}

.btn {
    background: #2e7d32;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 18px;
    cursor: pointer;
    font-weight: 600;
}

.btn:hover {
    background: #1b5e20;
}

.btn-dark {
    background: #1b5e20;
}

.error-text {
    color: #c62828;
    min-height: 1.3em;
    margin: 6px 0 14px;
}

.success-text {
    color: #2e7d32;
    font-weight: 600;
    margin-top: 10px;
}

/* Voter form */
.voter-form {
    margin-top: 8px;
}

.voter-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 18px;
}

.voter-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.voter-field label {
    font-size: 0.86rem;
    color: #555;
    font-weight: 600;
}

.voter-field input[readonly] {
    background: #eee;
    color: #333;
}

.phone-confirm {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    font-size: 0.9rem;
    color: #333;
}

.membership-wrap {
    margin-top: 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 360px;
}

.membership-wrap label {
    font-weight: 600;
}

.voter-extra-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px 18px;
    margin-top: 8px;
}

.voter-extra-fields .membership-wrap {
    margin-top: 8px;
    max-width: none;
}

.voter-saved-banner {
    margin-bottom: 14px;
    padding: 10px 14px;
    border: 1px solid #a5d6a7;
    border-radius: 10px;
    background: #e8f5e9;
    color: #1b5e20;
    font-weight: 700;
}

.extra-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 18px;
    align-items: end;
    margin-bottom: 14px;
}

.extra-filters label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-weight: 600;
}

.extra-filters select {
    min-width: 160px;
    padding: 6px 8px;
    border: 1px solid #c8e6c9;
    border-radius: 8px;
}

.login-logs-wrap {
    overflow-x: auto;
}

.login-logs-table .ua-cell {
    max-width: 280px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.82rem;
    color: #555;
}

.login-logs-table .row-online {
    background: #f1f8e9;
}

.log-status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
}

.log-status.status-online {
    background: #c8e6c9;
    color: #1b5e20;
}

.log-status.status-offline {
    background: #eceff1;
    color: #455a64;
}

.log-status.status-failed {
    background: #ffcdd2;
    color: #b71c1c;
}

.calendar-wrap {
    margin-top: 8px;
}

.calendar-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 14px;
}

.calendar-title {
    font-weight: 800;
    min-width: 160px;
    text-align: center;
}

.calendar-form-box {
    margin: 14px 0;
    padding: 14px;
    border: 1px solid #c8e6c9;
    border-radius: 12px;
    background: #fafdfa;
}

.calendar-day-list {
    margin-top: 16px;
}

.cal-weekdays,
.cal-days {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 6px;
}

.cal-head {
    text-align: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: #2e7d32;
    padding: 4px;
}

.cal-cell {
    min-height: 88px;
    border: 1px solid #c8e6c9;
    border-radius: 10px;
    background: #fff;
    padding: 6px;
    text-align: right;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cal-cell.muted {
    opacity: 0.45;
}

.cal-cell.selected {
    border-color: #2e7d32;
    box-shadow: 0 0 0 2px rgba(46, 125, 50, 0.2);
}

.cal-daynum {
    font-weight: 800;
    font-size: 0.95rem;
}

.cal-cell-events {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cal-event-chip {
    display: block;
    font-size: 0.72rem;
    background: #e8f5e9;
    color: #1b5e20;
    border-radius: 6px;
    padding: 2px 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cal-more {
    font-size: 0.72rem;
    color: #666;
}

.save-row {
    margin-top: 18px;
}

/* Dashboard */
.toggle-row,
.group-row,
.age-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 14px;
}

.toggle-btn {
    background: #e8f5e9;
    color: #1b5e20;
    border: 1px solid #a5d6a7;
    border-radius: 8px;
    padding: 8px 14px;
    cursor: pointer;
    font-weight: 600;
}

.toggle-btn.active {
    background: #2e7d32;
    color: #fff;
    border-color: #2e7d32;
}

.mini-btn {
    background: #c8e6c9;
    color: #1b5e20;
    border: none;
    border-radius: 6px;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
}

.checklist {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 6px 12px;
    background: #f1f8f1;
    border: 1px solid #c8e6c9;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 14px;
    max-height: 240px;
    overflow-y: auto;
}

.checklist label {
    display: flex;
    gap: 6px;
    align-items: center;
    font-size: 0.9rem;
}

.stat-block {
    background: #f8fdf8;
    border: 1px solid #c8e6c9;
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 16px;
}

.stat-block h3 {
    margin: 0 0 10px;
    color: #1b5e20;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 12px;
    min-width: 280px;
}

.data-table th,
.data-table td {
    border: 1px solid #c8e6c9;
    padding: 8px 10px;
    text-align: right;
}

.data-table th {
    background: #e8f5e9;
    color: #1b5e20;
}

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

.group-summary li {
    display: flex;
    justify-content: space-between;
    padding: 8px 10px;
    border-bottom: 1px solid #e8f5e9;
}

.chart-wrap {
    max-width: 520px;
    margin: 24px auto;
}

.chart-wrap h3 {
    text-align: center;
    color: #1b5e20;
}

.export-wrap,
.filter-export {
    text-align: center;
    margin: 18px auto 8px;
}

.filter-export {
    background: #f1f8f1;
    border: 1px dashed #2e7d32;
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 18px;
}

.filter-info {
    color: #333;
    margin-bottom: 10px;
}

.hidden {
    display: none !important;
}

.app-footer {
    background: #c8e6c9;
    color: #1b5e20;
    text-align: center;
    font-size: 0.85rem;
    padding: 10px;
}

/* Login overlay */
.login-overlay {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, #1b5e20 0%, #2e7d32 60%, #388e3c 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    padding: 20px;
}

.login-overlay.is-hidden {
    display: none;
}

.login-card {
    background: #fff;
    width: min(420px, 100%);
    border-radius: 16px;
    padding: 28px 24px 24px;
    text-align: center;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.25);
}

.login-card .puk-logo {
    width: 110px;
    height: 110px;
    margin: 0 auto 12px;
}

.login-card h1 {
    margin: 0 0 18px;
    color: #1b5e20;
    font-size: 1.7rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-align: right;
}

.password-field {
    position: relative;
    width: 100%;
}

.password-field input {
    width: 100%;
    box-sizing: border-box;
    padding-left: 44px;
}

.password-toggle {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    border: none;
    background: transparent;
    color: #2e7d32;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    padding: 0;
}

.password-toggle:hover {
    background: #e8f5e9;
}

.password-toggle svg {
    width: 22px;
    height: 22px;
    display: block;
}

.password-toggle .hidden {
    display: none;
}

.login-form button {
    margin-top: 6px;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 80;
    padding: 20px;
}

.modal-overlay.is-hidden {
    display: none;
}

.modal-card {
    background: #fff;
    border-radius: 12px;
    padding: 22px;
    width: min(420px, 100%);
    text-align: center;
}

.modal-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 16px;
}

.btn-ghost {
    background: #eee;
    color: #333;
}

.panel-heading {
    color: #1b5e20;
    margin: 0 0 16px;
}

.account-form,
.report-send-box {
    background: #f8fdf8;
    border: 1px solid #c8e6c9;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 18px;
}

.account-form h3,
.report-send-box h3 {
    margin: 0 0 12px;
    color: #1b5e20;
}

.account-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 14px;
    margin-bottom: 12px;
}

.account-form label,
.report-send-box label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-weight: 600;
    font-size: 0.9rem;
}

.account-form input,
.account-form select,
.account-form textarea,
.report-send-box textarea,
.report-send-box input[type="file"] {
    border: 1px solid #a5d6a7;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 0.95rem;
    background: #fff;
}

.help-text {
    color: #555;
    font-size: 0.88rem;
    margin: 0 0 10px;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 520px;
}

#users-table-wrap,
.login-logs-wrap,
#dashboard-content,
.stat-block {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.users-table th,
.users-table td {
    border: 1px solid #c8e6c9;
    padding: 8px;
    text-align: right;
    vertical-align: middle;
}

.users-table th {
    background: #e8f5e9;
    color: #1b5e20;
}

.row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.row-actions input {
    width: 130px;
    border: 1px solid #a5d6a7;
    border-radius: 6px;
    padding: 5px 8px;
}

.report-card {
    border: 1px solid #c8e6c9;
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 10px;
    background: #fff;
}

.report-card.unread {
    background: #fff8e1;
    border-color: #fbc02d;
}

.report-meta {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 8px;
    color: #333;
}

.file-link {
    color: #1b5e20;
    font-weight: 600;
    margin-left: 10px;
}

.modal-wide {
    width: min(520px, 100%);
    text-align: right;
}

.share-list {
    max-height: 280px;
    margin: 12px 0;
}

@media (max-width: 600px) {
    .account-form-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 980px) {
    .mobile-nav {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        padding: 10px 12px;
        background: #e8f5e9;
        border-bottom: 1px solid #c8e6c9;
        position: sticky;
        top: 0;
        z-index: 40;
    }

    .mobile-nav-btn {
        background: #2e7d32;
        color: #fff;
        border: none;
        border-radius: 10px;
        padding: 12px 10px;
        font-weight: 700;
        cursor: pointer;
        font-size: 0.95rem;
    }

    .mobile-nav-btn[aria-expanded="true"] {
        background: #1b5e20;
    }

    .nav-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 55;
        border: none;
        padding: 0;
        margin: 0;
        cursor: pointer;
    }

    .nav-backdrop.is-hidden {
        display: none;
    }

    .layout {
        flex-direction: column;
    }

    .main-content {
        width: 100%;
        order: unset;
        padding: 14px 12px 28px;
    }

    .sidebar-left,
    .sidebar-right {
        position: fixed;
        top: 0;
        bottom: 0;
        width: min(300px, 86vw);
        max-width: 100%;
        z-index: 60;
        padding: 14px 10px 24px;
        box-shadow: 0 0 24px rgba(0, 0, 0, 0.25);
        transition: transform 0.22s ease;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }

    .sidebar-left {
        right: 0;
        left: auto;
        transform: translateX(105%);
        order: unset;
    }

    .sidebar-right {
        left: 0;
        right: auto;
        transform: translateX(-105%);
        order: unset;
    }

    body.drawer-left-open .sidebar-left,
    body.drawer-right-open .sidebar-right {
        transform: translateX(0);
    }

    body.drawer-open {
        overflow: hidden;
    }

    .drawer-close {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .tab-btn,
    .komite-btn {
        width: 100%;
        padding: 12px 12px;
        font-size: 0.95rem;
    }
}

@media (max-width: 700px) {
    .app-header {
        flex-direction: column;
        gap: 12px;
        text-align: center;
        padding: 14px 12px;
    }

    .puk-logo {
        width: 78px;
        height: 78px;
        border-width: 3px;
    }

    .app-title {
        font-size: 1.35rem;
    }

    .top-banner {
        padding: 8px 10px;
        gap: 4px;
    }

    .top-tab-btn,
    .logout-btn {
        font-size: 0.82rem;
        padding: 8px 8px;
    }

    .logged-in-name {
        font-size: 0.85rem;
    }

    .search-row label {
        min-width: 100%;
    }

    .btn,
    .mini-btn {
        min-height: 42px;
    }

    .voter-extra-fields {
        grid-template-columns: 1fr;
    }

    .extra-filters label,
    .extra-filters select {
        width: 100%;
        min-width: 0;
    }

    .age-filter,
    .toggle-row,
    .group-row,
    .activity-filters,
    .calendar-toolbar {
        gap: 8px;
    }

    .calendar-toolbar {
        justify-content: center;
    }

    .calendar-title {
        min-width: 0;
        width: 100%;
        order: -1;
    }

    .cal-head {
        font-size: 0.68rem;
        padding: 2px 0;
    }

    .cal-cell {
        min-height: 52px;
        padding: 4px;
        border-radius: 8px;
    }

    .cal-daynum {
        font-size: 0.85rem;
    }

    .cal-event-chip {
        display: none;
    }

    .cal-more {
        font-size: 0.65rem;
    }

    .modal-overlay {
        align-items: flex-end;
        padding: 0;
    }

    .modal-card,
    .modal-wide {
        width: 100%;
        max-height: min(92vh, 920px);
        overflow-y: auto;
        border-radius: 16px 16px 0 0;
        padding: 18px 14px calc(18px + env(safe-area-inset-bottom, 0px));
    }

    .login-card {
        padding: 22px 16px 18px;
    }

    .login-card .puk-logo {
        width: 88px;
        height: 88px;
    }

    .login-card h1 {
        font-size: 1.35rem;
    }

    .stat-block,
    #dashboard-content,
    #users-table-wrap,
    .login-logs-wrap,
    .report-list,
    .activity-list {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .chart-wrap {
        max-width: 100%;
        overflow: hidden;
    }

    .chart-wrap canvas {
        max-width: 100% !important;
        height: auto !important;
    }

    .row-actions {
        display: flex;
        flex-direction: column;
        gap: 6px;
        align-items: stretch;
    }

    .row-actions input {
        width: 100%;
        min-width: 0;
    }

    .org-card {
        width: min(240px, 100%);
    }

    .activity-type-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
}

.org-edit-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 8px 18px;
}

.org-chart {
    direction: ltr;
    padding: 10px 8px 30px;
    overflow-x: auto;
}

.org-tree {
    --org-line: #2e7d32;
    --org-line-w: 3px;
    --org-gap: 28px;
    width: min(1040px, 100%);
    margin: 0 auto;
}

.org-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 2px solid #2e7d32;
    border-radius: 14px;
    padding: 14px;
    width: 240px;
    box-sizing: border-box;
    direction: rtl;
    position: relative;
    z-index: 1;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.org-card.is-manager {
    width: 280px;
    border-width: 3px;
    padding: 16px;
}

.org-card img,
.org-photo-placeholder {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    object-fit: cover;
    background: #e8f5e9;
    border: 3px solid #a5d6a7;
}

.org-card.is-manager img,
.org-card.is-manager .org-photo-placeholder {
    width: 168px;
    height: 168px;
}

.org-photo-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #2e7d32;
    font-weight: 700;
    font-size: 2rem;
}

.org-person {
    font-weight: 700;
    color: #1b5e20;
    min-height: 1.35em;
    text-align: center;
}

.org-title {
    font-size: 0.85rem;
    color: #555;
    min-height: 2.6em;
    line-height: 1.3;
    text-align: center;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.org-card input[type="text"] {
    width: 100%;
    border: 1px solid #a5d6a7;
    border-radius: 6px;
    padding: 5px 7px;
    font-size: 0.82rem;
    box-sizing: border-box;
}

.org-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    min-height: 28px;
}

.org-photo-label {
    cursor: pointer;
}

.org-manager-row {
    display: flex;
    justify-content: center;
    position: relative;
    padding-bottom: var(--org-gap);
}

.org-manager-row::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 0;
    width: var(--org-line-w);
    height: var(--org-gap);
    background: var(--org-line);
    transform: translateX(-50%);
}

.org-level {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: start;
    position: relative;
}

.org-level::before {
    content: '';
    position: absolute;
    top: 0;
    left: calc(25% - (var(--org-line-w) / 2));
    width: calc(50% + var(--org-line-w));
    height: var(--org-line-w);
    background: var(--org-line);
}

.org-level-deputies {
    padding-bottom: var(--org-gap);
}

.org-level-deputies::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    width: var(--org-line-w);
    height: 100%;
    background: var(--org-line);
    transform: translateX(-50%);
}

.org-branch-card,
.org-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    padding-top: var(--org-gap);
    z-index: 1;
}

.org-branch-card::before,
.org-col::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    width: var(--org-line-w);
    height: calc(var(--org-gap) + 2px);
    background: var(--org-line);
    transform: translateX(-50%);
}


.org-col {
    min-width: 0;
}

.org-col h3 {
    color: #1b5e20;
    margin: 0 0 12px;
    min-height: 1.4em;
    line-height: 1.4;
}

.org-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 14px 12px;
    justify-items: center;
    align-items: start;
    width: 100%;
    padding: 0 8px 8px;
    box-sizing: border-box;
}

.org-level-units > .org-col:first-child .org-grid {
    grid-template-columns: 1fr;
    justify-items: center;
    max-width: 280px;
    margin: 0 auto;
}

.org-level-units .org-card {
    min-height: 250px;
}

.org-extra-deputies {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    position: relative;
    z-index: 1;
    padding-top: 8px;
}

.org-empty {
    color: #777;
    font-size: 0.9rem;
    padding: 8px;
}

@media (max-width: 700px) {
    .org-level {
        grid-template-columns: 1fr;
    }

    .org-level::before,
    .org-level-deputies::after {
        display: none;
    }
}

@media (max-width: 600px) {
    .voter-grid {
        grid-template-columns: 1fr;
    }
}

.activity-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: end;
    margin-bottom: 16px;
}

.activity-filters label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-weight: 600;
    color: #1b5e20;
    font-size: 0.9rem;
}

.activity-filters input[type="date"] {
    border: 1px solid #a5d6a7;
    border-radius: 8px;
    padding: 6px 8px;
}

.activity-stats {
    background: #f1f8f1;
    border: 1px solid #c8e6c9;
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 16px;
}

.activity-total {
    margin-bottom: 8px;
    color: #1b5e20;
}

.activity-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.activity-chip {
    background: #fff;
    border: 1px solid #c8e6c9;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 0.85rem;
}

.activity-post-box {
    margin-bottom: 20px;
}

.activity-type-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    margin-bottom: 12px;
}

.activity-type-option {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    color: #1b5e20;
}

.activity-rank-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-bottom: 18px;
}

.activity-rank-list {
    list-style: none;
    padding: 0;
    margin: 0;
    border: 1px solid #c8e6c9;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
}

.activity-rank-list li {
    display: grid;
    grid-template-columns: minmax(0, 2fr) 3rem 0.55fr;
    align-items: center;
    column-gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid #e8f5e9;
}

.activity-rank-list li:last-child {
    border-bottom: none;
}

.activity-rank-list .linkish {
    background: none;
    border: none;
    color: #1b5e20;
    font-weight: 700;
    cursor: pointer;
    text-align: right;
    padding: 0;
    font-size: 0.98rem;
    justify-self: stretch;
}

.activity-rank-list .linkish:hover {
    text-decoration: underline;
}

.activity-rank-count {
    color: #1b5e20;
    font-size: 1.2rem;
    font-weight: 800;
    text-align: center;
    justify-self: center;
}

.activity-pie-wrap {
    margin-top: 8px;
}

.activity-unit-detail {
    margin: 16px 0;
    padding: 14px;
    border: 1px solid #c8e6c9;
    border-radius: 12px;
    background: #fafdfa;
}

.activity-unit-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.activity-card {
    border: 1px solid #c8e6c9;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 10px;
    background: #fff;
}

.activity-card-head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
}

.activity-badge {
    background: #e8f5e9;
    color: #1b5e20;
    border-radius: 999px;
    padding: 3px 10px;
    font-size: 0.82rem;
    font-weight: 700;
}

.activity-meta {
    color: #666;
    font-size: 0.85rem;
    margin-bottom: 6px;
}

.activity-desc {
    margin: 0 0 8px;
    white-space: pre-wrap;
}

.activity-files {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.activity-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

@media (max-width: 700px) {
    .activity-rank-grid {
        grid-template-columns: 1fr;
    }
}
