* {
    box-sizing: border-box;
}

/* The browser's default blue focus/tap outline is a plain rectangle; on
   icon buttons with transparent rounded PNG corners it shows through and
   looks broken, and on click it lingers around tiles/buttons/links too.
   Remove it everywhere by default, but keep a themed ring for keyboard
   (Tab) navigation so accessibility isn't lost. */
a,
button,
input,
textarea,
.tile,
.tab-btn {
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
.tile:focus-visible,
.tab-btn:focus-visible {
    outline: 2px solid #047857;
    outline-offset: 2px;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f2f4f7;
    font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

.card {
    background: #ffffff;
    padding: 2rem 2.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    width: 100%;
    max-width: 420px;
    margin: 2rem;
}

.login-body {
    background-image: url("images/login-background.png");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.login-card {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(6px);
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
}

h1 {
    margin-top: 0;
    font-size: 1.5rem;
    color: #1a1a1a;
}

form h2 {
    font-size: 0.95rem;
    color: #555;
    margin: 1.5rem 0 0.5rem;
    border-top: 1px solid #eee;
    padding-top: 1rem;
}

form {
    display: flex;
    flex-direction: column;
}

label {
    font-size: 0.85rem;
    color: #333;
    margin-top: 0.75rem;
    margin-bottom: 0.25rem;
}

input,
textarea {
    padding: 0.6rem 0.75rem;
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
}

input:focus,
textarea:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

button {
    margin-top: 1.5rem;
    padding: 0.7rem;
    border: none;
    border-radius: 8px;
    background: #4f46e5;
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
}

button:hover {
    background: #4338ca;
}

/* The generic button:hover rule above (element + pseudo-class) is more
   specific than a single class selector, so it was overriding the
   transparent background of these icon buttons on hover, showing an
   indigo/blue fill through their transparent PNG corners. */
button.map-icon-btn:hover,
button.settings-btn:hover,
button.search-help-side-btn:hover {
    background: none;
}

.switch-link {
    text-align: center;
    margin-top: 1.25rem;
    font-size: 0.9rem;
}

.switch-link a {
    color: #4f46e5;
    text-decoration: none;
}

.switch-link a:hover {
    text-decoration: underline;
}

ul.flash {
    list-style: none;
    padding: 0.75rem 1rem;
    margin: 0 0 1rem;
    background: #fff1f0;
    border: 1px solid #ffccc7;
    border-radius: 8px;
    color: #cf1322;
    font-size: 0.9rem;
}

ul.flash li + li {
    margin-top: 0.25rem;
}

ul.flash.flash-success {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #15803d;
}

ul.flash.floating-flash {
    position: fixed;
    top: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3000;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
    max-width: 480px;
}

/* ---------- Dashboard ---------- */

.dashboard-body {
    display: block;
    align-items: initial;
    justify-content: initial;
}

.dashboard-wrap {
    max-width: 1100px;
    margin: 0 auto;
    padding: 3rem 2rem;
}

.dashboard-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 2.5rem;
    position: relative;
}

.dashboard-header h1 {
    margin: 0;
}

.welcome-heading {
    text-align: right;
}

.logout-icon-btn {
    width: 42px;
    height: 42px;
    display: block;
    text-decoration: none;
    transition: transform 0.15s ease;
}

.logout-icon-btn img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.18));
}

.logout-icon-btn:hover {
    transform: translateY(-2px);
}

.tiles {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    justify-content: center;
    perspective: 1200px;
    max-width: 904px;
    margin: 0 auto;
}

.tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 280px;
    padding: 2.5rem 1.75rem;
    background: linear-gradient(155deg, #ffffff, #f4f5fb);
    border-radius: 20px;
    box-shadow: 0 10px 25px rgba(17, 24, 39, 0.08);
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transform-style: preserve-3d;
    transition: transform 0.2s ease-out, box-shadow 0.2s ease-out;
    will-change: transform;
}

.tile:hover {
    box-shadow: 0 30px 45px rgba(79, 70, 229, 0.25);
}

.tile-icon {
    width: 190px;
    height: 190px;
    margin-bottom: 1.25rem;
    filter: drop-shadow(0 10px 15px rgba(0, 0, 0, 0.15));
    transition: transform 0.2s ease-out;
}

.tile-icon img,
.tile-icon svg {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.tile:hover .tile-icon {
    transform: translateZ(30px) scale(1.05);
}

.tile h2 {
    margin: 0 0 0.5rem;
    font-size: 1.1rem;
    color: #1a1a1a;
    border-top: none;
    padding-top: 0;
}

.tile p {
    margin: 0;
    font-size: 0.85rem;
    color: #667085;
}

.about-panel {
    max-width: 904px;
    margin: 2.5rem auto 0;
    box-sizing: border-box;
    background: #ffffff;
    border-radius: 20px;
    padding: 2.25rem 2.5rem;
    box-shadow: 0 10px 25px rgba(17, 24, 39, 0.06);
}

.about-panel h2 {
    margin: 0 0 1rem;
    font-size: 1.15rem;
    color: #111827;
}

.about-panel p {
    margin: 0 0 1rem;
    color: #4b5563;
    line-height: 1.7;
    max-width: 760px;
}

.about-panel p:last-child {
    margin-bottom: 0;
}

.about-panel a {
    color: #047857;
    font-weight: 600;
    text-decoration: none;
}

.about-panel a:hover {
    text-decoration: underline;
}

/* ---------- Site logo banner (identical placement on every page) ---------- */

.site-logo-banner {
    display: flex;
    justify-content: center;
    padding: 1.75rem 1rem 0.5rem;
    position: relative;
    z-index: 150;
}

.site-logo-banner img {
    height: 52px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
}

@media (max-width: 560px) {
    .site-logo-banner img {
        height: 40px;
    }
}

/* ---------- Climate Intelligence section (dashboard) ---------- */

.climate-intel-section {
    max-width: 900px;
    margin: 2.5rem auto 0;
    background: #ffffff;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(17, 24, 39, 0.06);
}

.climate-intel-block {
    padding: 2.5rem 2.75rem;
}

.climate-intel-title {
    margin: 0 0 1.1rem;
    font-size: 1.6rem;
    font-weight: 700;
    color: #111827;
}

.climate-intel-block p {
    margin: 0 0 1.1rem;
    max-width: 720px;
    color: #4b5563;
    line-height: 1.75;
    font-size: 1rem;
}

.climate-intel-block p:last-child {
    margin-bottom: 0;
}

.climate-intel-image img {
    display: block;
    width: 100%;
    height: auto;
}

.climate-intel-tagline {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 1.75rem;
}

.climate-intel-tagline span {
    background: #ecfdf5;
    color: #047857;
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.01em;
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
}

.climate-intel-contact {
    margin-top: 1.25rem;
    font-size: 0.85rem;
    color: #9ca3af;
}

.climate-intel-contact a {
    color: #047857;
    font-weight: 600;
    text-decoration: none;
}

.climate-intel-contact a:hover {
    text-decoration: underline;
}

@media (max-width: 640px) {
    .climate-intel-block {
        padding: 1.75rem 1.5rem;
    }

    .climate-intel-title {
        font-size: 1.3rem;
    }
}

/* ---------- Beta shell ---------- */

.beta-body {
    display: block;
    align-items: initial;
    justify-content: initial;
}

.beta-shell {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2.5rem 2rem 4rem;
}

.topbar-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 1.75rem;
    position: relative;
}

.topbar-top-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    align-self: flex-start;
}

.project-context-label {
    font-weight: 700;
    font-size: 1.05rem;
    color: #111827;
}

.icon-tooltip-wrap.top-back-wrap {
    width: auto;
    justify-content: flex-start;
}

.icon-tooltip-wrap.auth-back-wrap {
    /* Mirrors .beta-shell's own centering (max-width: 1200px, margin: 0
       auto, 2rem side padding) so this button lines up with the back
       button on beta-shell pages (e.g. /projects/<id>/analysis) at any
       viewport width, not just the one it was measured at. */
    position: fixed;
    top: 128px;
    left: max(32px, calc((100vw - 1200px) / 2 + 32px));
    z-index: 10;
}

.back-icon-btn {
    width: 40px;
    height: 40px;
    display: block;
    text-decoration: none;
    transition: transform 0.15s ease;
}

.back-icon-btn img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.18));
}

.back-icon-btn:hover {
    transform: translateX(-2px);
}

.app-topbar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: nowrap;
}

.tab-nav-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
}

.tab-nav {
    display: flex;
    align-items: flex-end;
    gap: 0.35rem;
    flex-wrap: nowrap;
    min-width: 0;
}

.tab-nav-secondary {
    display: flex;
    gap: 0.5rem;
    flex-wrap: nowrap;
    justify-content: flex-end;
    min-width: 0;
}

.tab-btn-secondary {
    position: static;
    top: auto;
    padding: 0.5rem 0.9rem;
    border-radius: 999px;
    background: rgba(4, 120, 87, 0.07);
    border: 1px solid rgba(4, 120, 87, 0.18);
    color: #047857;
    opacity: 1;
    font-size: 0.8rem;
    box-shadow: none;
}

.tab-btn-secondary svg {
    width: 15px;
    height: 15px;
}

.tab-btn-secondary:hover:not(.active) {
    background: rgba(4, 120, 87, 0.14);
    top: auto;
    opacity: 1;
}

.tab-btn-secondary.active {
    background: #047857;
    border-color: #047857;
    color: #ffffff;
    box-shadow: 0 6px 14px rgba(4, 120, 87, 0.3);
}

.tab-btn {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.75rem 1.1rem;
    border: 1px solid transparent;
    border-bottom: none;
    border-radius: 12px 12px 0 0;
    background: rgba(17, 24, 39, 0.04);
    color: #6b7280;
    font-size: 0.88rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    position: relative;
    top: 5px;
    opacity: 0.85;
    transition: all 0.25s ease;
}

.tab-btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.tab-btn:hover:not(.active) {
    background: rgba(17, 24, 39, 0.07);
    top: 2px;
    opacity: 1;
}

.tab-btn.active {
    background: #ffffff;
    color: #047857;
    border-color: #e5e7eb;
    top: 0;
    opacity: 1;
    box-shadow: 0 -8px 16px rgba(17, 24, 39, 0.05);
}

.user-menu {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    position: relative;
}

.username-column {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.username {
    font-weight: 600;
    color: #1a1a1a;
    font-size: 0.92rem;
}

.settings-btn {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    margin: 0;
    border: none;
    background: none;
    padding: 0;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.settings-btn img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.18));
    transition: transform 0.35s ease;
}

.settings-btn:hover {
    transform: translateY(-2px);
}

.settings-btn.open img {
    transform: rotate(60deg);
}

.logout-quick-btn {
    display: block;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.logout-quick-btn img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.18));
}

.logout-quick-btn:hover {
    transform: translateY(-2px);
}

.settings-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 270px;
    background: #ffffff;
    border: 1px solid #eef0f3;
    border-radius: 14px;
    box-shadow: 0 20px 45px rgba(17, 24, 39, 0.16);
    padding: 0.5rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.98);
    transform-origin: top right;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
    z-index: 50;
}

.settings-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.65rem;
    border-radius: 10px;
    text-decoration: none;
    color: #1f2937;
    font-size: 0.88rem;
    font-weight: 500;
    transition: background 0.15s ease;
}

.dropdown-item.as-button {
    width: 100%;
    border: none;
    background: none;
    text-align: left;
    font-family: inherit;
    cursor: pointer;
}

.dropdown-item:hover {
    background: #ecfdf5;
}

.dd-icon {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: #ecfdf5;
    color: #047857;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.dd-icon svg {
    width: 17px;
    height: 17px;
}

.dd-icon.icon-img {
    background: none;
}

.dd-icon.icon-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 8px;
}

.dropdown-item.logout {
    margin-top: 0.35rem;
    padding-top: 0.75rem;
    border-top: 1px solid #f1f2f4;
    color: #b91c1c;
}

.dropdown-item.logout .dd-icon {
    background: #fef2f2;
    color: #b91c1c;
}

.tab-content {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    margin-top: -1px;
    padding: 2.5rem;
    min-height: 340px;
    box-shadow: 0 10px 30px rgba(17, 24, 39, 0.06);
    position: relative;
    z-index: 1;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
    animation: tabFadeIn 0.25s ease;
}

@keyframes tabFadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tab-panel h2 {
    margin: 0 0 0.75rem;
    color: #111827;
    font-size: 1.3rem;
}

.tab-panel p {
    margin: 0;
    color: #4b5563;
    line-height: 1.6;
    max-width: 640px;
}

/* ---------- Analysis panels (Climate Change Scenarios, etc.) ---------- */

.analysis-stack {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 1.5rem;
    max-width: 1150px;
}

.analysis-block {
    display: flex;
    align-items: stretch;
    gap: 1.25rem;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 1.25rem;
}

.analysis-block-main {
    flex: 1;
    min-width: 0;
    position: relative;
    background: #ffffff;
    border-radius: 12px;
    padding: 0.75rem;
    box-sizing: border-box;
}

.analysis-block-caption {
    margin: 0.5rem 0 0;
    text-align: center;
    font-size: 0.85rem;
    color: #374151;
}

.analysis-block-caption strong {
    color: #111827;
}

.spei-band-tooltip {
    position: fixed;
    z-index: 4000;
    background: #262626;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.35rem 0.65rem;
    border-radius: 8px;
    pointer-events: none;
    white-space: nowrap;
}

.spei-current-values {
    margin-top: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.spei-current-values-location {
    margin: 0 0 0.25rem;
    font-size: 0.9rem;
    color: #111827;
}

.spei-current-value-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.5rem 1rem;
    padding: 0.6rem 0.75rem;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    font-size: 0.85rem;
}

.spei-current-value-ssp {
    font-weight: 700;
    color: #111827;
    min-width: 90px;
}

.spei-current-value-period {
    color: #374151;
}

.spei-value-band {
    color: #6b7280;
    font-size: 0.8rem;
}

.analysis-chart-img {
    display: block;
    width: 100%;
    height: auto;
}

.analysis-block-side {
    flex-shrink: 0;
    width: 150px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
}

.analysis-block-label {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6b7280;
    text-align: left;
}

.analysis-block-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.analysis-variant-switch {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    width: 100%;
}

.analysis-variant-btn {
    margin-top: 0;
    padding: 0.5rem 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #ffffff;
    color: #374151;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.analysis-variant-btn:hover {
    border-color: #9ca3af;
}

.analysis-variant-btn.active {
    background: #047857;
    border-color: #047857;
    color: #ffffff;
}

.analysis-help-btn {
    width: 40px;
    height: 40px;
    margin: 0;
}

.analysis-block-actions .icon-tooltip-wrap.analysis-report-wrap {
    width: auto;
    flex-shrink: 0;
}

.analysis-report-btn {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 12px;
    background: #10b981;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
}

.analysis-report-btn svg {
    width: 20px;
    height: 20px;
}

button.analysis-report-btn:hover {
    background: #059669;
}

.analysis-report-btn.active {
    background: #047857;
}

button.analysis-report-btn.active:hover {
    background: #065f46;
}

.analysis-icon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
    margin-top: 1.75rem;
    max-width: 900px;
}

.analysis-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    padding: 1.4rem 0.75rem;
    border-radius: 14px;
    border: 1px solid #eef0f3;
    background: #ffffff;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 500;
    color: #4b5563;
    min-height: 128px;
}

.analysis-icon-slot {
    width: 52px;
    height: 52px;
    border-radius: 13px;
    border: 2px dashed #d1d5db;
    background: #f9fafb;
}

.empty-tile {
    border-style: dashed;
    border-color: #e5e7eb;
    background: transparent;
}

.other-tile {
    cursor: pointer;
    font-family: inherit;
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #047857;
    transition: background 0.2s ease, transform 0.15s ease;
}

.other-tile:hover {
    background: #d1fae5;
    transform: translateY(-2px);
}

.other-icon-slot {
    border: none;
    background: #047857;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.other-icon-slot svg {
    width: 22px;
    height: 22px;
}

.hidden-shell {
    display: none;
}

/* ---------- Field selection map modal ---------- */

.map-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 6.5rem 1.5rem 1.5rem;
}

.map-modal-backdrop.hidden {
    display: none;
}

.map-modal {
    background: #ffffff;
    border-radius: 18px;
    width: 100%;
    max-width: 980px;
    padding: 1.75rem;
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.35);
}

.map-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.map-modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
    color: #111827;
}

.map-modal-close {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: #f3f4f6;
    color: #4b5563;
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s ease;
}

.map-modal-close:hover {
    background: #e5e7eb;
}

.map-modal-intro {
    margin: 0 0 1.25rem;
    color: #6b7280;
    font-size: 0.9rem;
}

.map-search-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.map-search-field {
    flex: 1;
    height: 44px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 0 0.75rem;
}

.search-icon {
    width: 18px;
    height: 18px;
    color: #9ca3af;
    flex-shrink: 0;
}

.map-search-field input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 0;
    font-size: 0.9rem;
}

.map-search-field input:focus {
    outline: none;
    box-shadow: none;
}

.search-help-side-btn {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    margin: 0;
    border: none;
    padding: 0;
    background: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-help-side-btn img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.search-go-btn {
    margin-top: 0;
    height: 34px;
    align-self: center;
    padding: 0 1rem;
    border: none;
    border-radius: 8px;
    background: #047857;
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.search-go-btn:hover {
    background: #065f46;
}

.map-icon-btn.search-help-btn {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    align-self: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-feedback {
    min-height: 1.1rem;
    margin: 0 0 0.75rem;
    font-size: 0.8rem;
    color: #b91c1c;
}

.map-modal-body {
    display: flex;
    gap: 1.25rem;
}

.field-map-wrap {
    position: relative;
    flex: 1;
    height: 460px;
}

.field-map {
    width: 100%;
    height: 100%;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
}

.map-help-float {
    position: absolute;
    bottom: 14px;
    left: 14px;
    width: 44px;
    height: 44px;
    z-index: 500;
}

.map-side-panel {
    width: 130px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.9rem;
}

.icon-tooltip-wrap {
    position: relative;
    display: flex;
    justify-content: center;
    width: 100%;
}

.user-menu .icon-tooltip-wrap {
    width: auto;
    flex-shrink: 0;
}

.add-area-large {
    width: 100%;
    height: 110px;
}

.map-icon-btn {
    width: 64px;
    height: 64px;
    border: none;
    background: none;
    padding: 0;
    cursor: pointer;
    position: relative;
    transition: transform 0.15s ease;
}

.map-icon-btn img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.16));
}

.map-icon-btn:hover {
    transform: translateY(-2px);
}

.plus-badge {
    position: absolute;
    bottom: -6px;
    right: -6px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #047857;
    color: #fff;
    font-size: 0.9rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(4, 120, 87, 0.4);
}

.help-btn {
    width: 44px;
    height: 44px;
}

.icon-tooltip {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(-4px);
    background: #262626;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.4rem 0.65rem;
    border-radius: 8px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
    z-index: 10;
}

.icon-tooltip-wrap:hover .icon-tooltip {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.area-price-box {
    width: 100%;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 0.85rem 0.75rem;
    margin-top: 0.25rem;
}

.area-price-row {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.area-price-row + .area-price-row {
    margin-top: 0.75rem;
}

.area-price-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #9ca3af;
}

.area-price-value {
    font-size: 0.88rem;
    font-weight: 700;
    color: #111827;
}

.map-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1.25rem;
}

.drawing-hint {
    font-size: 0.85rem;
    color: #047857;
    font-weight: 500;
}

.continue-btn {
    padding: 0.7rem 1.5rem;
    border: none;
    border-radius: 10px;
    background: #047857;
    color: #fff;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, opacity 0.2s ease;
}

.continue-btn:hover:not(:disabled) {
    background: #065f46;
}

.continue-btn:disabled {
    background: #d1d5db;
    cursor: not-allowed;
}

/* ---------- Help modal ---------- */

.help-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 1.5rem;
}

.help-modal-backdrop.open {
    display: flex;
}

.help-modal {
    background: #ffffff;
    border-radius: 16px;
    width: 100%;
    max-width: 480px;
    padding: 1.75rem;
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.35);
}

.report-issue-modal {
    max-width: 640px;
}

.report-issue-form-view {
    display: flex;
    flex-direction: column;
}

.report-issue-form-view[hidden] {
    display: none;
}

.report-issue-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 0.6rem;
}

.report-issue-textarea {
    width: 100%;
    box-sizing: border-box;
    min-height: 260px;
    resize: vertical;
}

.report-issue-select {
    width: 100%;
    box-sizing: border-box;
    padding: 0.6rem 0.75rem;
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    background: #fff;
    color: #1a1a1a;
    margin-bottom: 1rem;
}

.report-issue-select:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.help-steps {
    margin: 0.5rem 0 0;
    padding-left: 1.2rem;
    color: #374151;
    font-size: 0.9rem;
    line-height: 1.7;
}

.help-steps li + li {
    margin-top: 0.5rem;
}

/* ---------- Tutorial (multi-step help) modal ---------- */

.tutorial-modal {
    max-width: 420px;
}

.tutorial-steps {
    position: relative;
    margin-top: 0.25rem;
}

.tutorial-step {
    display: none;
}

.tutorial-step.active {
    display: block;
}

.tutorial-step-img {
    display: block;
    width: 100%;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    margin-bottom: 1rem;
}

.tutorial-step p {
    margin: 0;
    color: #374151;
    font-size: 0.92rem;
    line-height: 1.6;
}

.tutorial-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1.5rem;
}

.tutorial-dots {
    display: flex;
    gap: 0.4rem;
}

.tutorial-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #d1d5db;
    cursor: pointer;
    transition: background 0.2s ease;
}

.tutorial-dot.active {
    background: #047857;
}

.tutorial-nav-buttons {
    display: flex;
    gap: 0.6rem;
}

.tutorial-nav-btn {
    border: 1px solid #d1d5db;
    background: #fff;
    color: #374151;
    border-radius: 10px;
    padding: 0.5rem 1.1rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, opacity 0.2s ease;
}

.tutorial-nav-btn:hover {
    background: #f3f4f6;
}

.tutorial-nav-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.tutorial-nav-btn-primary {
    border: none;
    background: #047857;
    color: #fff;
}

.tutorial-nav-btn-primary:hover {
    background: #065f46;
}

/* ---------- Order confirmation modal (Create New Project) ---------- */

.order-confirm-modal {
    max-width: 560px;
}

.order-summary-box {
    margin-top: 1.1rem;
    padding: 1rem 1.1rem;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
}

.order-summary-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: #4b5563;
    padding: 0.3rem 0;
}

.order-summary-row.order-summary-total {
    margin-top: 0.3rem;
    padding-top: 0.6rem;
    border-top: 1px solid #e5e7eb;
    font-weight: 700;
    font-size: 1rem;
    color: #111827;
}

.order-billing-section {
    margin-top: 1.5rem;
}

.order-billing-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.order-billing-header h3 {
    margin: 0;
    font-size: 0.95rem;
    color: #111827;
}

.order-billing-hint {
    margin: 0.2rem 0 0.75rem;
    color: #9ca3af;
    font-size: 0.8rem;
}

.link-btn {
    margin-top: 0;
    padding: 0;
    border: none;
    background: none;
    color: #047857;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

button.link-btn:hover {
    background: none;
    text-decoration: underline;
}

.order-billing-input[readonly] {
    background: #f9fafb;
    color: #4b5563;
    cursor: default;
}

.order-binding-notice {
    margin: 1.25rem 0 0;
    padding: 0.85rem 1rem;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 10px;
    color: #92400e;
    font-size: 0.82rem;
    line-height: 1.55;
}

@media (max-width: 720px) {
    .map-modal-body {
        flex-direction: column;
    }

    .map-side-panel {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }

    .area-price-box {
        width: 100%;
    }
}

/* Below this width, tabs shrink to icon-only (no label) instead of wrapping
   onto a new line, so they always stay in a single row next to each other. */
@media (max-width: 880px) {
    .tab-btn span {
        display: none;
    }

    .tab-btn,
    .tab-btn-secondary {
        padding: 0.7rem;
        gap: 0;
    }
}

/* ---------- Profile / Billing / Existing Projects pages ---------- */

.page-header-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.75rem;
    position: relative;
}

.page-header-row h1 {
    margin: 0;
}

.page-header-row .top-back-wrap {
    margin-bottom: 0;
}

.page-intro {
    margin: -1rem 0 1.75rem;
    color: #6b7280;
    font-size: 0.9rem;
}

.settings-panel {
    background: #ffffff;
    border-radius: 20px;
    padding: 2rem 2.25rem;
    box-shadow: 0 10px 25px rgba(17, 24, 39, 0.06);
    margin-bottom: 1.75rem;
}

.settings-panel h2 {
    margin: 0 0 1.25rem;
    font-size: 1.05rem;
    color: #111827;
}

.settings-form {
    max-width: 640px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.25rem 1.5rem;
}

.form-field {
    display: flex;
    flex-direction: column;
}

.readonly-field p {
    margin: 0.25rem 0 0;
    padding: 0.6rem 0.75rem;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    color: #4b5563;
    font-size: 1rem;
}

.inline-form {
    flex-direction: row;
    align-items: flex-end;
    gap: 1rem;
    max-width: 480px;
}

.inline-form .form-field {
    flex: 1;
}

.inline-form button {
    margin-top: 0;
    flex-shrink: 0;
}

.table-wrap {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.data-table th {
    text-align: left;
    padding: 0.7rem 0.85rem;
    border-bottom: 2px solid #e5e7eb;
    color: #6b7280;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.data-table td {
    padding: 0.75rem 0.85rem;
    border-bottom: 1px solid #f1f2f4;
    color: #1f2937;
    white-space: nowrap;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.empty-row {
    text-align: center;
    color: #9ca3af;
    font-style: italic;
}

.project-row {
    cursor: pointer;
    transition: background 0.15s ease;
}

.project-row:hover {
    background: #f9fafb;
}

.project-row.selected {
    background: #ecfdf5;
}

.editable-cell {
    cursor: text;
    position: relative;
}

.editable-cell .cell-text {
    display: inline-block;
    border-bottom: 1px dashed #d1d5db;
    min-width: 40px;
    min-height: 1.2em;
}

.editable-cell:hover .cell-text {
    border-bottom-color: #047857;
}

.cell-edit-input {
    padding: 0.3rem 0.5rem;
    border: 1px solid #047857;
    border-radius: 6px;
    font-size: 0.88rem;
    width: 100%;
    min-width: 140px;
}

.cell-edit-input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(4, 120, 87, 0.15);
}

.project-result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1.25rem;
}

.result-item {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.muted-note {
    margin: 1.5rem 0 0;
    color: #9ca3af;
    font-size: 0.82rem;
    font-style: italic;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.secondary-btn {
    margin-top: 0;
    padding: 0.7rem 1.25rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #ffffff;
    color: #374151;
    font-size: 0.95rem;
    cursor: pointer;
}

.secondary-btn:hover {
    background: #f3f4f6;
}

@media (max-width: 640px) {
    .form-grid {
        grid-template-columns: 1fr;
    }

    .inline-form {
        flex-direction: column;
        align-items: stretch;
    }
}

/* ---------- My Current Projects (map overview) ---------- */

.page-title {
    margin: 0 0 1.5rem;
    font-size: 1.4rem;
    color: #111827;
}

.projects-overview-body {
    display: flex;
    gap: 1.5rem;
    align-items: stretch;
}

.projects-map-wrap {
    position: relative;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.projects-map {
    width: 100%;
    height: 480px;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
}

.projects-list-panel {
    width: 320px;
    flex-shrink: 0;
    background: #ffffff;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 10px 25px rgba(17, 24, 39, 0.06);
    display: flex;
    flex-direction: column;
}

.projects-list-panel h2 {
    margin: 0 0 1.1rem;
    font-size: 1rem;
    color: #111827;
}

.projects-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    overflow-y: auto;
}

.project-list-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    border: 1px solid #eef0f3;
    background: #f9fafb;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.project-list-link {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    text-decoration: none;
}

.shapefile-jump-btn {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    color: #047857;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.shapefile-jump-btn svg {
    width: 16px;
    height: 16px;
}

.shapefile-jump-btn:hover {
    background: #ecfdf5;
    border-color: #a7f3d0;
}

.project-list-item:hover {
    background: #ecfdf5;
    border-color: #a7f3d0;
    transform: translateY(-1px);
}

.project-list-item.selected {
    background: #fff7ed;
    border-color: #fdba74;
    box-shadow: 0 0 0 2px #fb923c inset;
}

.project-list-name {
    font-weight: 600;
    color: #111827;
    font-size: 0.9rem;
}

.project-list-area {
    font-size: 0.78rem;
    color: #6b7280;
    white-space: nowrap;
}

@media (max-width: 900px) {
    .projects-overview-body {
        flex-direction: column;
    }

    .projects-list-panel {
        width: 100%;
    }

    .projects-map {
        height: 380px;
    }
}

.report-generate-block {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
    margin-top: 1.5rem;
}

.report-generate-label {
    font-size: 0.68rem;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
    text-align: left;
}

.report-generate-buttons {
    display: flex;
    gap: 0.4rem;
}

.report-btn {
    padding: 0.35rem 0.7rem;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    color: #374151;
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.report-btn:hover {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #047857;
}

/* ---------- CLIMETRA landing / app picker ---------- */

.landing-body {
    display: block;
    align-items: initial;
    justify-content: initial;
    min-height: 100vh;
    background-color: #ffffff;
    background-image: url("images/agmetra-background.png");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

.landing-wrap {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
}

.landing-intro {
    text-align: center;
    margin-bottom: 2.5rem;
}

.landing-logo {
    display: block;
    width: 120px;
    height: auto;
    margin: 0 auto 1.25rem;
}

.landing-intro h1 {
    margin: 0 0 0.6rem;
    font-size: 2rem;
    color: #111827;
}

.landing-intro p {
    margin: 0;
    color: #4b5563;
    font-size: 1.05rem;
}

.app-picker-grid {
    display: flex;
    gap: 1.75rem;
    flex-wrap: wrap;
    justify-content: center;
}

.app-picker-tile {
    width: 230px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(6px);
    border-radius: 20px;
    padding: 1.75rem 1.5rem 1.5rem;
    box-shadow: 0 15px 35px rgba(17, 24, 39, 0.12);
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.1rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.app-picker-tile img {
    width: 100%;
    height: 140px;
    object-fit: contain;
}

.app-picker-tile:not(.disabled):hover {
    transform: translateY(-6px);
    box-shadow: 0 25px 45px rgba(4, 120, 87, 0.25);
}

.app-picker-cta {
    padding: 0.5rem 1.1rem;
    border-radius: 999px;
    background: #047857;
    color: #fff;
    font-size: 0.85rem;
    font-weight: 700;
}

.app-picker-tile.disabled {
    cursor: default;
}

.app-picker-tile.disabled img {
    filter: grayscale(1);
    opacity: 0.55;
}

.app-picker-badge {
    padding: 0.5rem 1.1rem;
    border-radius: 999px;
    background: #f3f4f6;
    color: #6b7280;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

@media (max-width: 640px) {
    .app-picker-tile {
        width: 100%;
        max-width: 280px;
    }
}
