:root {
    --green-950: #143b2b;
    --green-800: #1b5f43;
    --green-700: #1f7651;
    --green-600: #2b8a60;
    --green-100: #e8f4ed;
    --sand-500: #d7a948;
    --sand-100: #fbf3df;
    --ink: #24352d;
    --muted: #65736c;
    --line: #dce6e0;
    --surface: #ffffff;
    --background: #f1f6f3;
    --danger: #a63131;
    --danger-bg: #fdecec;
    --success: #216e49;
    --success-bg: #e6f5ec;
    --shadow: 0 18px 50px rgba(14, 52, 36, 0.16);
}

* {
    box-sizing: border-box;
}

html {
    color-scheme: light;
}

body {
    margin: 0;
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    line-height: 1.5;
}

a {
    color: var(--green-700);
}

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

button,
.button {
    cursor: pointer;
}

.public-body {
    min-height: 100vh;
    background:
        linear-gradient(120deg, rgba(10, 54, 40, 0.72), rgba(15, 91, 78, 0.42)),
        url('../../../beachbackground.png') center / cover fixed,
        #1f7651;
}

.public-header,
.public-footer {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #ffffff;
}

.public-header {
    min-height: 78px;
}

.public-brand {
    color: #ffffff;
    font-size: clamp(1.2rem, 3vw, 1.7rem);
    font-weight: 800;
    text-decoration: none;
    letter-spacing: 0.01em;
}

.back-link,
.public-footer a {
    color: #ffffff;
    text-decoration: none;
}

.back-link:hover,
.public-footer a:hover {
    text-decoration: underline;
}

.public-header-actions {
    display: flex;
    align-items: center;
    gap: 18px;
}

.language-switch {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: rgba(255, 255, 255, 0.62);
    font-size: 0.88rem;
    font-weight: 800;
}

.language-switch a {
    border-radius: 6px;
    padding: 4px 6px;
    color: rgba(255, 255, 255, 0.76);
    text-decoration: none;
}

.language-switch a:hover,
.language-switch a.active {
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
}

.quote-layout {
    width: min(1180px, calc(100% - 32px));
    margin: 14px auto 28px;
    display: grid;
    grid-template-columns: minmax(330px, 0.88fr) minmax(400px, 1.12fr);
    gap: 22px;
    align-items: stretch;
}

.quote-card,
.map-card {
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.97);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.quote-card {
    padding: clamp(24px, 4vw, 42px);
}

.eyebrow {
    margin-bottom: 6px;
    color: var(--green-700);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

h1,
h2,
h3 {
    margin-top: 0;
    color: var(--green-950);
    line-height: 1.18;
}

.quote-card h1 {
    margin-bottom: 10px;
    font-size: clamp(2rem, 5vw, 3.2rem);
    letter-spacing: -0.04em;
}

.lead {
    margin: 0 0 28px;
    color: var(--muted);
}

.stack-form {
    display: grid;
    gap: 12px;
}

.stack-form label,
.field-label {
    margin-top: 4px;
    font-weight: 700;
    color: var(--ink);
}

input,
select,
textarea {
    width: 100%;
    min-height: 46px;
    border: 1px solid #cbd9d1;
    border-radius: 10px;
    background: #ffffff;
    color: var(--ink);
    padding: 10px 12px;
}

textarea {
    min-height: 105px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    outline: 3px solid rgba(43, 138, 96, 0.18);
    border-color: var(--green-600);
}

input:disabled,
select:disabled {
    background: #eef2ef;
    color: #87928c;
    cursor: not-allowed;
}

.select-search {
    min-height: 39px;
    margin-bottom: -8px;
    border-style: dashed;
    background: #f7faf8;
    font-size: 0.92rem;
}

.button {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: 10px;
    padding: 10px 16px;
    font-weight: 750;
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.button:hover {
    transform: translateY(-1px);
}

.button:disabled {
    opacity: 0.62;
    cursor: wait;
    transform: none;
}

.button-primary {
    background: var(--green-700);
    color: #ffffff;
    box-shadow: 0 8px 20px rgba(31, 118, 81, 0.22);
}

.button-primary:hover {
    background: var(--green-800);
}

.button-large {
    min-height: 52px;
    margin-top: 8px;
    font-size: 1.04rem;
}

.button-whatsapp {
    margin-top: 16px;
    background: #1f9d55;
    color: #ffffff;
}

.button-secondary {
    border: 1px solid var(--green-700);
    background: #ffffff;
    color: var(--green-700);
}

.button-danger {
    border: 1px solid #d9a4a4;
    background: #ffffff;
    color: var(--danger);
}

.button-quiet {
    min-height: 36px;
    padding: 7px 12px;
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

.button-link {
    min-height: auto;
    border: 0;
    background: transparent;
    color: var(--green-700);
    padding: 0 0 0 8px;
    text-decoration: underline;
}

.quote-result {
    margin-top: 24px;
    border: 1px solid #b8dec8;
    border-radius: 16px;
    padding: 22px;
    background: linear-gradient(145deg, var(--green-100), #ffffff);
    text-align: center;
}

.result-label {
    color: var(--green-800);
    font-weight: 700;
}

.result-price {
    margin: 3px 0;
    color: var(--green-950);
    font-size: clamp(2rem, 7vw, 3rem);
    font-weight: 850;
    letter-spacing: -0.04em;
}

.result-detail {
    font-weight: 700;
}

.result-note {
    margin-top: 5px;
    color: var(--muted);
    font-size: 0.88rem;
}

.map-card {
    display: flex;
    min-height: 630px;
    flex-direction: column;
}

.map-heading {
    padding: 24px 28px 12px;
}

.map-heading h2 {
    margin-bottom: 0;
}

#map,
#location-map {
    width: 100%;
    min-height: 480px;
    flex: 1;
    background: #dfeae4;
}

#location-map {
    min-height: 360px;
    border: 1px solid var(--line);
    border-radius: 12px;
}

.map-message {
    margin: 0;
    padding: 12px 20px;
    color: var(--muted);
    background: #ffffff;
    font-size: 0.88rem;
}

.public-footer {
    padding: 18px 0 26px;
    font-size: 0.9rem;
}

.alert {
    margin: 16px 0;
    border-radius: 10px;
    padding: 12px 14px;
}

.alert-error {
    border: 1px solid #edc7c7;
    background: var(--danger-bg);
    color: var(--danger);
}

.alert-success {
    border: 1px solid #bce0ca;
    background: var(--success-bg);
    color: var(--success);
}

.notice {
    border-left: 4px solid var(--sand-500);
    padding: 11px 14px;
    background: var(--sand-100);
    color: #625127;
}

/* Administración */
.admin-body {
    min-height: 100vh;
    background: var(--background);
}

.admin-topbar {
    min-height: 64px;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px max(20px, calc((100vw - 1220px) / 2));
    background: var(--green-950);
    color: #dcebe4;
}

.admin-topbar form {
    margin-left: auto;
}

.admin-brand {
    color: #ffffff;
    font-size: 1.2rem;
    font-weight: 800;
    text-decoration: none;
}

.admin-nav {
    display: flex;
    gap: 6px;
    padding: 10px max(20px, calc((100vw - 1220px) / 2));
    overflow-x: auto;
    border-bottom: 1px solid var(--line);
    background: #ffffff;
}

.admin-nav a {
    flex: 0 0 auto;
    border-radius: 8px;
    padding: 8px 11px;
    color: #415249;
    font-weight: 650;
    text-decoration: none;
}

.admin-nav a.active,
.admin-nav a:hover {
    background: var(--green-100);
    color: var(--green-800);
}

.admin-main {
    width: min(1220px, calc(100% - 32px));
    margin: 24px auto 60px;
}

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

.page-heading h1 {
    margin-bottom: 18px;
    font-size: clamp(1.7rem, 4vw, 2.4rem);
}

.panel {
    margin-bottom: 20px;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 22px;
    background: var(--surface);
    box-shadow: 0 8px 24px rgba(22, 66, 46, 0.06);
}

.narrow-panel {
    max-width: 620px;
    margin-right: auto;
    margin-left: auto;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 10px;
    margin-bottom: 18px;
}

.toolbar > * {
    width: auto;
}

.toolbar input[type="search"] {
    min-width: min(340px, 100%);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.stat-card {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 18px;
    background: #ffffff;
}

.stat-value {
    color: var(--green-950);
    font-size: 2rem;
    font-weight: 850;
}

.stat-label {
    color: var(--muted);
    font-size: 0.9rem;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 11px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

th {
    background: #f4f8f5;
    color: #415249;
    font-size: 0.84rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.status {
    display: inline-flex;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 0.8rem;
    font-weight: 750;
}

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

.status-inactive,
.status-pending {
    background: #f1f1f1;
    color: #666666;
}

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

.form-grid .full {
    grid-column: 1 / -1;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 9px;
}

.check-row input {
    width: auto;
    min-height: 0;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    margin-top: 18px;
}

.rate-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(120px, 1fr));
    gap: 12px;
}

.rate-grid label {
    font-size: 0.87rem;
}

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

.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 18px;
}

.pagination a,
.pagination span {
    min-width: 38px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 7px 10px;
    background: #ffffff;
    text-align: center;
    text-decoration: none;
}

.pagination .current {
    border-color: var(--green-700);
    background: var(--green-700);
    color: #ffffff;
}

.search-results {
    display: grid;
    gap: 8px;
    margin-top: 10px;
}

.search-result {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 9px;
    background: #ffffff;
    text-align: left;
}

.excel-steps ol {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    padding-left: 22px;
}

.excel-summary {
    display: grid;
    grid-template-columns: repeat(6, minmax(110px, 1fr));
    gap: 10px;
    margin: 18px 0;
}

.excel-summary > div {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 13px;
    background: #f7faf8;
}

.excel-summary strong,
.excel-summary span {
    display: block;
}

.excel-summary strong {
    color: var(--green-950);
    font-size: 1.45rem;
}

.excel-summary span {
    color: var(--muted);
    font-size: 0.82rem;
}

.excel-preview-table {
    margin-top: 18px;
}

@media (max-width: 850px) {
    .quote-layout {
        grid-template-columns: 1fr;
    }

    .map-card {
        min-height: 500px;
    }

    #map {
        min-height: 390px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .rate-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .excel-steps ol,
    .excel-summary {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 560px) {
    .public-header,
    .public-footer,
    .quote-layout,
    .admin-main {
        width: min(100% - 20px, 1180px);
    }

    .public-header {
        min-height: 64px;
    }

    .public-header-actions {
        gap: 9px;
    }

    .language-switch {
        gap: 3px;
        font-size: 0.78rem;
    }

    .language-switch a {
        padding: 3px 4px;
    }

    .back-link {
        font-size: 0.88rem;
    }

    .quote-card,
    .map-card,
    .panel {
        border-radius: 14px;
    }

    .quote-card,
    .panel {
        padding: 18px;
    }

    .map-card {
        min-height: 430px;
    }

    #map {
        min-height: 330px;
    }

    .admin-topbar > span {
        display: none;
    }

    .form-grid,
    .stats-grid,
    .rate-grid,
    .excel-steps ol,
    .excel-summary {
        grid-template-columns: 1fr;
    }

    .toolbar > * {
        width: 100%;
    }
}

/* Vista más compacta para computadoras */
@media (min-width: 851px) {
    .public-header {
        min-height: 62px;
    }

    .quote-layout {
        width: min(1100px, calc(100% - 32px));
        margin-top: 6px;
        gap: 18px;
        align-items: start;
    }

    .quote-card {
        padding: 26px 30px;
    }

    .quote-card h1 {
        font-size: 2.5rem;
    }

    .lead {
        margin-bottom: 18px;
        font-size: 0.95rem;
    }

    .stack-form {
        gap: 9px;
    }

    .quote-result {
        margin-top: 16px;
        padding: 16px;
    }

    .result-price {
        font-size: 2.45rem;
    }

    .button-whatsapp {
        margin-top: 11px;
    }

    .map-card {
        min-height: 560px;
    }

    .map-heading {
        padding: 18px 22px 10px;
    }
}
