:root {
    --sidebar: #0b253c;
    --sidebar-deep: #071a2b;
    --sidebar-line: rgba(199, 221, 242, 0.18);
    --bg: #edf4fb;
    --surface: #ffffff;
    --surface-soft: #f7fbff;
    --ink: #081735;
    --muted: #526988;
    --line: #dbe6f3;
    --blue: #1677ee;
    --blue-dark: #0a58c7;
    --green: #23b67a;
    --danger: #e43f52;
    --shadow: 0 18px 44px rgba(20, 54, 96, 0.11);
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(circle at 84% 12%, rgba(55, 137, 255, 0.12), transparent 32%),
        linear-gradient(135deg, #f8fbff 0%, var(--bg) 55%, #e7f0fb 100%);
    color: var(--ink);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.45;
}

.public-auth-page {
    min-height: 100vh;
    background:
        radial-gradient(circle at 18% 16%, rgba(22, 119, 238, 0.2), transparent 34%),
        linear-gradient(135deg, #071a2b 0%, #0d3152 46%, #eaf4ff 46%, #f8fbff 100%);
}

.public-auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 28px;
}

.public-auth-card {
    width: min(520px, 100%);
    display: grid;
    gap: 22px;
    padding: 30px;
    border: 1px solid rgba(219, 230, 243, 0.78);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 28px 70px rgba(7, 26, 43, 0.26);
}

.public-brand {
    padding: 0 0 20px;
    border-bottom-color: var(--line);
    color: var(--ink);
}

.public-brand span {
    color: var(--muted);
}

.public-auth-card h1 {
    margin-bottom: 8px;
    font-size: 2.2rem;
}

.public-auth-card p {
    color: var(--muted);
}

.public-auth-form {
    display: grid;
    gap: 14px;
}

.auth-status {
    min-height: 20px;
    margin-bottom: 0;
    color: var(--danger);
    font-weight: 700;
}

.auth-link {
    color: var(--blue);
    font-weight: 700;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
}

h1,
h2,
h3,
h4,
p {
    margin-top: 0;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 292px;
    display: flex;
    flex-direction: column;
    padding: 24px 16px 22px;
    background:
        linear-gradient(180deg, rgba(15, 51, 82, 0.95), rgba(7, 25, 43, 0.98)),
        var(--sidebar);
    color: #fff;
    overflow-y: auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 14px 22px;
    border-bottom: 1px solid var(--sidebar-line);
}

.brand-mark {
    width: 58px;
    aspect-ratio: 1;
    border-radius: 17px;
    background:
        linear-gradient(145deg, #1b82ff, #2450d9);
    clip-path: polygon(50% 0, 91% 24%, 91% 76%, 50% 100%, 9% 76%, 9% 24%);
    box-shadow: inset 0 0 0 10px rgba(255, 255, 255, 0.15);
}

.brand strong {
    display: block;
    font-size: 2.35rem;
    line-height: 1;
    letter-spacing: 0;
}

.brand span {
    display: block;
    margin-top: 5px;
    color: #d8e7f5;
    font-size: 0.83rem;
}

.side-nav {
    display: grid;
    gap: 9px;
    padding: 22px 0;
    border-bottom: 1px solid var(--sidebar-line);
}

.side-nav.lower {
    margin-top: 10px;
}

.side-nav a {
    display: flex;
    align-items: center;
    gap: 16px;
    min-height: 58px;
    padding: 0 22px;
    border-radius: 8px;
    color: #eef6ff;
    text-decoration: none;
    font-size: 1.06rem;
}

.side-nav a.active {
    background: linear-gradient(135deg, #1982ff, #0e65ea);
    box-shadow: 0 12px 22px rgba(13, 103, 234, 0.36);
}

.nav-icon {
    width: 34px;
    color: #dcecff;
    font-size: 1.45rem;
    text-align: center;
}

.badge {
    margin-left: auto;
    min-width: 26px;
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    font-size: 0.8rem;
    text-align: center;
}

.sidebar-note {
    margin-top: auto;
    padding: 22px 16px 0;
    color: #e8f3ff;
    text-align: center;
}

.line-art {
    height: 78px;
    margin-bottom: 12px;
    border-bottom: 3px solid rgba(163, 198, 234, 0.65);
    clip-path: polygon(0 76%, 19% 46%, 34% 73%, 58% 34%, 80% 63%, 100% 43%, 100% 100%, 0 100%);
}

.app-shell {
    min-height: 100vh;
    margin-left: 292px;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
    min-height: 92px;
    padding: 18px 34px;
    border-bottom: 1px solid rgba(215, 226, 240, 0.8);
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(16px);
}

.search-wrap {
    width: min(520px, 48vw);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 16px;
    border: 1px solid #e0e9f5;
    border-radius: 8px;
    background: #f1f6fc;
    color: var(--muted);
}

.search-wrap span {
    font-size: 1.55rem;
}

.search-wrap input {
    width: 100%;
    min-height: 48px;
    border: 0;
    background: transparent;
    color: var(--ink);
    outline: none;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.icon-button {
    position: relative;
    width: 44px;
    height: 44px;
    background: transparent;
    color: var(--muted);
    font-size: 1.5rem;
}

.icon-button span {
    position: absolute;
    top: 2px;
    right: 1px;
    min-width: 18px;
    height: 18px;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    font-size: 0.72rem;
    line-height: 18px;
}

.account {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 270px;
    padding-inline: 14px;
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
    color: var(--ink);
}

.account-logo {
    width: 48px;
    aspect-ratio: 1;
    border-radius: 14px;
    background:
        radial-gradient(circle at 68% 38%, #20b878 0 24%, transparent 25%),
        radial-gradient(circle at 35% 62%, #0c6fe8 0 22%, transparent 23%),
        #eef5ff;
}

.language {
    background: transparent;
    color: var(--ink);
    padding: 8px 0;
}

.content {
    padding: 24px 34px 42px;
}

.breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 11px;
    margin-bottom: 12px;
    color: #48607f;
}

.breadcrumbs span:not(:last-child)::after {
    content: "›";
    margin-left: 11px;
    color: #6e83a0;
}

.hero-strip {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: start;
    margin-bottom: 22px;
}

.hero-strip h1 {
    margin-bottom: 2px;
    font-size: clamp(2rem, 4vw, 3rem);
    line-height: 1.08;
}

.hero-strip p {
    margin-bottom: 0;
    color: var(--muted);
    font-size: 1.15rem;
}

.hero-actions {
    display: grid;
    justify-items: end;
    gap: 12px;
}

.public-pill {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 14px;
    border-radius: 999px;
    background: #dcf8ed;
    color: #0b8d5b;
    font-weight: 700;
}

.stats {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: end;
}

.stats span {
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.76);
    color: var(--muted);
    box-shadow: 0 8px 20px rgba(20, 54, 96, 0.07);
}

.stats strong {
    color: var(--ink);
}

.tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    overflow: hidden;
    margin-bottom: 18px;
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.tabs.admin-tabs {
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

.tab {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 58px;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: var(--muted);
    text-decoration: none;
    font-weight: 700;
}

.tab.active {
    border-color: var(--blue);
    background: #eff6ff;
    color: var(--blue);
}

.tab.inactive {
    cursor: default;
}

.dashboard {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
}

.workspace,
.directory {
    min-width: 0;
}

.workspace,
.directory,
.panel,
.insight-card,
.quote-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: var(--shadow);
}

.workspace {
    padding: 24px;
}

.section-title {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 18px;
}

.section-title h2 {
    margin-bottom: 4px;
    font-size: 1.45rem;
}

.section-title p {
    margin-bottom: 0;
    color: var(--muted);
}

#statusMessage {
    min-height: 24px;
    color: var(--blue);
    font-weight: 700;
    text-align: right;
}

.forms-grid {
    display: grid;
    gap: 16px;
}

.page-section {
    display: none;
}

.page-section.active {
    display: block;
}

.overview-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.placeholder-panel {
    min-height: 220px;
    align-content: start;
}

.auth-panel {
    max-width: 520px;
}

.user-dashboard {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.user-dashboard .user-lists,
.user-dashboard #userProjectForm {
    grid-column: 1 / -1;
}

.compact-form {
    align-content: start;
}

.mini-list {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
}

.mini-list h4 {
    margin: 0;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    background: #f7fbff;
}

.mini-list ul {
    display: grid;
    gap: 0;
    margin: 0;
    padding: 0;
    list-style: none;
}

.mini-list li {
    display: grid;
    gap: 3px;
    padding: 11px 14px;
    border-bottom: 1px solid #eef3f9;
}

.mini-list li:last-child {
    border-bottom: 0;
}

.mini-list span {
    color: var(--muted);
    font-size: 0.86rem;
}

.admin-grid {
    display: grid;
    gap: 14px;
}

.admin-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.admin-nav a {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--muted);
    text-decoration: none;
    font-weight: 700;
}

.admin-nav a.active {
    border-color: var(--blue);
    background: #eff6ff;
    color: var(--blue);
}

.admin-crud-form {
    box-shadow: none;
}

.admin-table {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
}

.admin-table h4 {
    margin: 0;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    background: #f7fbff;
}

.table-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    min-height: 22px;
    margin-left: 8px;
    padding: 0 8px;
    border-radius: 999px;
    background: #eff6ff;
    color: var(--blue);
    font-size: 0.82rem;
}

.table-scroll {
    overflow: auto;
}

.admin-table table {
    width: 100%;
    border-collapse: collapse;
    min-width: 560px;
}

.admin-table th,
.admin-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #eef3f9;
    text-align: left;
    vertical-align: top;
}

.admin-table th {
    color: #455d7c;
    font-size: 0.82rem;
    text-transform: uppercase;
}

.table-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.csv-panel {
    grid-column: 1 / -1;
}

.csv-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: end;
}

.csv-hint {
    margin-bottom: 0;
    color: var(--muted);
    font-size: 0.88rem;
    overflow-wrap: anywhere;
}

.app-shell[data-page="home"] .forms-grid,
.app-shell[data-page="user"] .forms-grid,
.app-shell[data-page="requests"] .forms-grid,
.app-shell[data-page="offers"] .forms-grid,
.app-shell[data-page="messages"] .forms-grid,
.app-shell[data-page="settings"] .forms-grid,
.app-shell[data-page="admin_login"] .forms-grid,
.app-shell[data-page="admin"] .forms-grid,
.app-shell[data-page="admin_register"] .forms-grid,
.app-shell[data-page="admin_users"] .forms-grid,
.app-shell[data-page="admin_organizations"] .forms-grid,
.app-shell[data-page="admin_projects"] .forms-grid,
.app-shell[data-page="admin_requests"] .forms-grid,
.app-shell[data-page="admin_offers"] .forms-grid {
    display: none;
}

.app-shell[data-page="organizations"] .project-panel,
.app-shell[data-page="projects"] .organization-panel {
    display: none;
}

.panel {
    display: grid;
    gap: 14px;
    padding: 18px;
    box-shadow: none;
}

.organization-panel {
    background: linear-gradient(180deg, #fff, #fafdff);
}

.project-panel {
    background: #fff;
}

.panel-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.panel-heading h3 {
    margin-bottom: 0;
    font-size: 1.18rem;
}

label {
    display: grid;
    gap: 7px;
    color: #455d7c;
    font-size: 0.94rem;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid #d5e1ef;
    border-radius: 8px;
    padding: 11px 13px;
    background: #f9fbfe;
    color: var(--ink);
    outline: none;
}

textarea {
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(22, 119, 238, 0.14);
}

.field-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.field-row.three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.project-media {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    gap: 18px;
}

.photo-preview {
    min-height: 206px;
    border-radius: 8px;
    background:
        linear-gradient(160deg, rgba(15, 37, 64, 0.05), rgba(15, 37, 64, 0.1)),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='420' height='320' viewBox='0 0 420 320'%3E%3Crect width='420' height='320' fill='%23dbe9f6'/%3E%3Cpath d='M0 226 84 160l54 40 77-84 66 69 41-37 98 78v94H0z' fill='%239ab4cf'/%3E%3Ccircle cx='322' cy='82' r='42' fill='%23f7c948'/%3E%3Cpath d='M44 220h332v82H44z' fill='%236d8da6'/%3E%3Cpath d='M92 118h205l35 102H60z' fill='%23ffffff'/%3E%3Cpath d='M112 138h166l20 62H91z' fill='%232f7ee6' opacity='.45'/%3E%3C/svg%3E") center/cover;
    box-shadow: inset 0 -48px 70px rgba(10, 31, 56, 0.18);
}

.media-fields {
    display: grid;
    gap: 12px;
}

fieldset {
    display: flex;
    gap: 14px;
    margin: 0;
    padding: 12px;
    border: 1px solid #d5e1ef;
    border-radius: 8px;
    background: #f9fbfe;
}

legend {
    padding: 0 7px;
    color: #455d7c;
    font-weight: 700;
}

.choice {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--ink);
    font-weight: 400;
}

.choice input {
    width: auto;
}

.primary {
    min-height: 44px;
    padding: 0 16px;
    background: var(--blue);
    color: #fff;
}

.link-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.primary:hover {
    background: var(--blue-dark);
}

.ghost {
    min-height: 40px;
    padding: 0 13px;
    border: 1px solid #d5e1ef;
    background: #eff6ff;
    color: var(--blue);
}

.danger {
    background: transparent;
    color: var(--danger);
    padding-inline: 0;
}

.directory {
    display: grid;
    align-content: start;
    gap: 14px;
    padding: 18px;
}

.section-title.compact {
    margin-bottom: 0;
}

.records {
    display: grid;
    gap: 11px;
    max-height: 520px;
    overflow: auto;
    padding-right: 3px;
}

.record {
    padding: 14px;
    border: 1px solid #dce8f5;
    border-radius: 8px;
    background: #fff;
}

.record.project {
    border-left: 4px solid var(--blue);
}

.record h4 {
    margin: 0 0 6px;
    font-size: 1rem;
}

.record p {
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 0.91rem;
}

.meta {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 10px;
}

.meta span {
    display: inline-flex;
    max-width: 100%;
    padding: 4px 8px;
    border-radius: 999px;
    background: #eff6ff;
    color: #1d5daa;
    font-size: 0.77rem;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.empty {
    padding: 18px;
    border: 1px dashed #c7d7ea;
    border-radius: 8px;
    color: var(--muted);
    text-align: center;
}

.insight-card,
.quote-card {
    padding: 18px;
    box-shadow: none;
}

.insight-card h3 {
    margin-bottom: 16px;
}

.indicator-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.indicator-grid span {
    display: grid;
    gap: 4px;
    padding: 0 12px;
    border-left: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.8rem;
}

.indicator-grid span:first-child {
    border-left: 0;
    padding-left: 0;
}

.indicator-grid strong {
    color: var(--ink);
    font-size: 1.25rem;
}

.quote-card {
    display: flex;
    gap: 14px;
    align-items: start;
    background: linear-gradient(135deg, #f7fbff, #eaf4ff);
}

.quote-card strong {
    color: var(--blue);
    font-size: 3rem;
    line-height: 1;
}

.quote-card p {
    margin-bottom: 0;
    color: #45617f;
    font-size: 1.06rem;
}

.hidden {
    display: none;
}

@media (max-width: 1240px) {
    .dashboard,
    .project-media {
        grid-template-columns: 1fr;
    }

    .directory {
        grid-row: auto;
    }
}

@media (max-width: 980px) {
    .sidebar {
        position: static;
        width: auto;
        min-height: auto;
    }

    .sidebar-note {
        display: none;
    }

    .app-shell {
        margin-left: 0;
    }

    .topbar,
    .hero-strip {
        display: grid;
        grid-template-columns: 1fr;
    }

    .search-wrap {
        width: 100%;
    }

    .hero-actions {
        justify-items: start;
    }
}

@media (max-width: 720px) {
    .content,
    .topbar {
        padding-inline: 16px;
    }

    .tabs,
    .field-row,
    .field-row.three,
    .overview-grid,
    .user-dashboard,
    .csv-form,
    .indicator-grid {
        grid-template-columns: 1fr;
    }

    .user-dashboard .user-lists,
    .user-dashboard #userProjectForm {
        grid-column: auto;
    }

    .top-actions,
    .account {
        flex-wrap: wrap;
    }

    fieldset {
        display: grid;
    }
}
