:root {
    --color-forest: #2d5016;
    --color-forest-light: #a8d08d;
    --color-grey: #6c757d;
    --color-yellow: #fff3cd;
    --color-red: #dc3545;
    --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    margin: 0;
    background: #f8fafc;
    color: #111827;
}

a {
    color: var(--color-forest);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.container {
    width: min(1100px, 92vw);
    margin: 0 auto;
}

.app-header {
    background: #fff;
    border-bottom: 4px solid var(--color-forest);
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(45, 80, 22, 0.08);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}

.brand {
    display: flex;
    gap: 0.75rem;
    align-items: baseline;
}

.brand-link {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--color-forest);
}

.tagline {
    font-size: 0.95rem;
    color: var(--color-grey);
}

.main-nav {
    display: flex;
    gap: 1rem;
}

.main-nav a {
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 0.4rem;
    transition: background 0.2s ease;
}

.main-nav a:hover,
.main-nav a:focus {
    background: var(--color-forest-light);
    color: #1b3610;
    text-decoration: none;
}

.nav-admin-button {
    border: 2px solid var(--color-forest);
    border-radius: 999px;
    padding: 0.3rem 0.9rem;
    font-weight: 600;
}

.nav-admin-button:hover,
.nav-admin-button:focus {
    background: var(--color-forest);
    color: #fff;
    text-decoration: none;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.admin-email-card {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.email-test-meta {
    display: flex;
    gap: 1.5rem;
    margin: 0;
}

.email-test-meta dt {
    font-weight: 700;
    color: var(--color-forest);
}

.email-test-meta dd {
    margin: 0.15rem 0 0 0;
    font-weight: 500;
    color: #111827;
}

.email-test-form {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    flex-wrap: wrap;
}

.email-test-form textarea {
    flex: 1 1 360px;
    min-width: 260px;
    border-radius: 0.6rem;
    border: 1px solid rgba(17, 24, 39, 0.15);
    padding: 0.8rem;
    font-size: 1rem;
    resize: vertical;
}

.email-test-form textarea:focus {
    outline: 2px solid var(--color-forest-light);
    border-color: var(--color-forest);
}

.email-test-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 220px;
}

.admin-id-card {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.admin-confirm-card {
    margin-top: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.admin-confirm-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    margin: 0;
}

.admin-confirm-grid dt {
    font-weight: 700;
    color: var(--color-forest);
    margin: 0;
}

.admin-confirm-grid dd {
    margin: 0.15rem 0 0;
    font-weight: 500;
    color: #111827;
}

.user-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-pill {
    display: grid;
    grid-template-columns: auto;
    gap: 0.15rem;
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--color-forest-light);
    border-radius: 0.75rem;
    background: rgba(168, 208, 141, 0.35);
}

.user-pill .welcome {
    font-size: 0.75rem;
    color: var(--color-grey);
}

.user-pill .name {
    font-weight: 600;
}

.user-pill .email {
    font-size: 0.8rem;
    color: var(--color-grey);
}

.btn-primary,
.btn-secondary,
.btn-danger,
.btn-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 0.4rem 1rem;
    font-weight: 600;
    border: 2px solid var(--color-forest);
    transition: background 0.2s ease;
}

.btn-primary {
    background: var(--color-forest);
    color: #fff;
}

.btn-primary:hover {
    background: #234010;
    text-decoration: none;
}

.btn-secondary {
    background: #6c757d;
    color: #fff;
    border-color: #6c757d;
}

.btn-secondary:hover {
    background: #545b62;
    text-decoration: none;
}

.btn-danger {
    background: var(--color-red);
    color: #fff;
    border-color: var(--color-red);
}

.btn-danger:hover {
    background: #c82333;
    text-decoration: none;
}

.btn-outline {
    background: transparent;
    color: var(--color-forest);
}

.btn-outline:hover {
    background: rgba(45, 80, 22, 0.1);
    text-decoration: none;
}

.main-content {
    padding: 2.5rem 0 3.5rem;
    min-height: calc(100vh - 200px);
}

.app-footer {
    background: #111827;
    color: #fff;
    padding: 1.5rem 0;
}

.app-footer p {
    margin: 0;
    text-align: center;
    font-size: 0.9rem;
}

.flash-stack {
    display: grid;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.flash {
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    border-left: 4px solid var(--color-forest);
    background: rgba(168, 208, 141, 0.25);
}

.flash-success {
    border-color: var(--color-forest);
}

.flash-error {
    border-color: var(--color-red);
    background: rgba(220, 53, 69, 0.1);
}

.card {
    background: #fff;
    border-radius: 0.75rem;
    padding: 1.25rem;
    box-shadow: 0 8px 24px rgba(17, 24, 39, 0.08);
    border: 1px solid rgba(17, 24, 39, 0.05);
}

.card + .card {
    margin-top: 1rem;
}

.form-stack {
    display: grid;
    gap: 0.75rem;
    margin-top: 1rem;
}

.form-stack label {
    font-weight: 600;
}

.form-stack input {
    padding: 0.65rem 0.8rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 1rem;
}

.form-stack input:focus {
    border-color: var(--color-forest);
    outline: 2px solid rgba(45, 80, 22, 0.25);
    outline-offset: 2px;
}

.hint {
    font-size: 0.85rem;
    color: var(--color-grey);
}

.post-form-hint {
    margin-top: 1.5rem;
    font-size: 0.9rem;
    color: var(--color-grey);
}

.button-stack {
    display: grid;
    gap: 0.75rem;
    margin-top: 1.25rem;
}

.button-stack .btn-primary,
.button-stack .btn-outline {
    width: 100%;
    text-align: center;
    padding: 0.75rem 1rem;
    font-size: 1rem;
}

.form-stack {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-top: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 600;
    color: var(--color-forest);
}

.form-group input,
.form-group select,
.form-group textarea {
    border: 1px solid rgba(17, 24, 39, 0.15);
    border-radius: 0.6rem;
    padding: 0.6rem 0.75rem;
    font-size: 0.95rem;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: 2px solid var(--color-forest-light);
    border-color: var(--color-forest);
}

.form-group small {
    font-size: 0.85rem;
    color: var(--color-grey);
}

.btn-large {
    padding: 0.85rem 1.5rem;
    font-size: 1.05rem;
}

.hero {
    margin-bottom: 2rem;
}

.marketing-grid {
    display: grid;
    gap: 1.25rem;
    margin-top: 2.5rem;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    align-items: stretch;
}

.marketing-grid .card {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin: 0;
}

.marketing-grid .card + .card {
    margin-top: 0;
}

.match-grid {
    margin-top: 1.5rem;
}

.match-card ul {
    list-style: none;
    margin: 0 0 1rem 0;
    padding: 0;
    display: grid;
    gap: 0.35rem;
}

.match-card .match-account {
    display: grid;
    gap: 0.35rem;
    margin-bottom: 1rem;
}

.match-select {
    margin-top: auto;
}

.match-none {
    margin-top: 2rem;
    display: grid;
    gap: 0.75rem;
}

.match-back-link {
    margin: 0;
}

.package-list {
    margin-bottom: 2rem;
}

.package-grid {
    display: flex;
    gap: 1.25rem;
    margin-top: 0.75rem;
    align-items: stretch;
}

.package-column {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.6rem;
    text-align: center;
}

.package-label {
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--color-forest);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.package-card {
    border: 1px solid #d1d5db;
    border-radius: 0.85rem;
    padding: 1.35rem 1.5rem;
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, background 0.2s ease, opacity 0.2s ease;
    outline: none;
    color: inherit;
}

.package-price {
    font-weight: 600;
    color: var(--color-forest);
    font-size: 1rem;
    padding: 0.4rem 0.6rem;
    border-radius: 999px;
    display: inline-flex;
    align-self: center;
    background: rgba(45, 80, 22, 0.12);
    min-width: 120px;
    justify-content: center;
}

.package-card:hover {
    border-color: var(--color-forest-light);
    box-shadow: 0 16px 32px rgba(45, 80, 22, 0.12);
    transform: translateY(-2px);
}

.package-card.active {
    border-color: var(--color-forest);
    background: rgba(45, 80, 22, 0.08);
    box-shadow: 0 18px 36px rgba(45, 80, 22, 0.18);
}

.package-card.inactive {
    opacity: 0.55;
}

.package-card:focus-visible {
    outline: 3px solid var(--color-forest-light);
}

.product-detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1.25rem;
    margin-top: 1.25rem;
}

@media (min-width: 720px) {
    .product-detail-grid {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }
}

.product-addons,
.product-custom {
    background: #f3f4f6;
    border-radius: 0.85rem;
    padding: 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.product-addons h4,
.product-custom h4 {
    margin: 0;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-grey);
}

.addon-list,
.custom-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.addon-row,
.custom-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.addon-row label {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin: 0;
    font-weight: 500;
}

.addon-name {
    font-size: 0.95rem;
}

.addon-price {
    font-weight: 600;
    color: var(--color-forest);
}

.custom-row .custom-name {
    font-weight: 500;
    font-size: 0.95rem;
    flex: 1;
}

.custom-row .custom-input {
    flex: 0 0 160px;
    display: flex;
    justify-content: flex-end;
}

.custom-row input[type="text"],
.custom-row input[type="number"] {
    width: 100%;
    padding: 0.4rem 0.65rem;
    border-radius: 0.55rem;
    border: 1px solid #d1d5db;
    font-size: 0.95rem;
}

.custom-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    width: 100%;
    cursor: pointer;
    font-weight: 500;
}

.custom-toggle-row input[type="checkbox"] {
    transform: scale(1.05);
}

.selection-card {
    margin-top: 1.5rem;
}

.selection-header {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.selection-empty {
    margin: 0.5rem 0 0;
}

.selection-list {
    list-style: none;
    margin: 0.75rem 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.selection-list li {
    padding: 0.55rem 0.85rem;
    border-radius: 0.65rem;
    border: 1px solid rgba(17, 24, 39, 0.08);
    background: #f8fafc;
    font-weight: 600;
    color: #111827;
}

.product-locked {
    opacity: 0.7;
    border-left: 4px solid var(--color-forest);
}

.product-locked .product-price {
    color: var(--color-grey);
    font-style: italic;
    font-size: 0.85rem;
}

.job-edit-add-products {
    margin-top: 1.5rem;
}

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

.small {
    font-size: 0.85rem;
}

.order-layout {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.order-main {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.address-card {
    flex: 0 0 320px;
    max-width: 360px;
}

.map-card {
    flex: 1 1 520px;
}

.map-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 0.5rem;
}

.map-header .btn-outline {
    padding: 0.35rem 0.85rem;
    font-size: 0.9rem;
}

.map-frame {
    height: 520px;
    border-radius: 0.75rem;
    overflow: hidden;
}

.order-secondary {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.secondary-card {
    flex: 1 1 240px;
}

.coords-preview {
    height: 140px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    background: #f1f5f9;
    border: 1px solid rgba(17, 24, 39, 0.1);
}

.order-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.order-actions p {
    margin: 0;
}

.form-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.form-row .form-group {
    flex: 1 1 160px;
}

.required label::after {
    content: " *";
    color: var(--color-red);
}

.job-page {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.job-layout {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.job-sidebar {
    flex: 0 0 320px;
    max-width: 360px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.job-main {
    flex: 1 1 520px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.job-notes .notes-section + .notes-section {
    margin-top: 1rem;
    border-top: 1px solid #e5e7eb;
    padding-top: 1rem;
}

.job-notes .notes-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.job-notes .notes-list li {
    padding: 0.35rem 0;
    border-bottom: 1px solid #eef2f7;
}

.job-notes .notes-list li:last-child {
    border-bottom: none;
}

.job-notes .note-name {
    font-weight: 600;
    color: #1f2937;
    display: block;
}

.job-notes .note-value {
    display: block;
    margin-top: 0.125rem;
    color: #374151;
    word-break: break-word;
    white-space: pre-wrap;
}

.job-notes .notes-empty {
    color: #6b7280;
    font-style: italic;
}

.job-worker-notes textarea {
    width: 100%;
    resize: vertical;
    min-height: 160px;
}

.worker-notes-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.worker-notes-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.worker-notes-status {
    font-size: 0.9rem;
    color: var(--color-grey);
}

.worker-notes-status.success {
    color: var(--color-forest);
}

.worker-notes-status.error {
    color: var(--color-red);
}

.worker-notes-hint {
    margin: 0;
    font-size: 0.85rem;
    color: var(--color-grey);
}

.job-map {
    flex: 1 1 520px;
}

#jobMap {
    height: 420px;
    border-radius: 0.75rem;
    overflow: hidden;
}

.job-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.job-actions form {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.button-group {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
}

.job-actions-grid .actions-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    text-align: center;
}

.job-actions-grid .actions-heading {
    grid-column: 1 / -1;
    font-weight: 700;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-forest);
}

.job-actions-grid .action-cell {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: center;
}

.job-actions-grid .action-meta {
    min-height: 1.4rem;
    font-size: 0.85rem;
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    width: 100%;
    padding: 0 0.25rem;
}

.job-actions-grid .action-btn {
    width: 100%;
}

.job-geojson textarea {
    min-height: 180px;
}

.job-geometry-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.job-geojson {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.job-geojson-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.job-geojson-download {
    align-self: flex-start;
}

.job-centroid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.centroid-value {
    margin: 0;
}

.centroid-empty {
    margin: 0;
    color: var(--color-grey);
}

.text-prewrap {
    white-space: pre-wrap;
    word-break: break-word;
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(17, 24, 39, 0.08);
}

.table th,
.table td {
    padding: 0.85rem 1rem;
    text-align: left;
}

.table thead {
    background: rgba(45, 80, 22, 0.08);
    color: #1b3610;
    font-weight: 600;
}

.table tbody tr:nth-child(every) {
    background: rgba(17, 24, 39, 0.02);
}

.table tbody tr:hover {
    background: rgba(168, 208, 141, 0.25);
}

.form-grid {
    display: grid;
    gap: 1.5rem;
}

.form-group {
    display: grid;
    gap: 0.35rem;
}

.job-edit-page {
    display: grid;
    gap: 1.5rem;
}

.job-edit-form .form-grid {
    margin-bottom: 2rem;
}

.job-edit-help {
    margin: 0.75rem 0 0;
    color: var(--color-grey);
}

.job-edit-extras {
    display: grid;
    gap: 1rem;
    margin-bottom: 2rem;
}

.job-edit-extras-header h3 {
    margin: 0;
}

.job-edit-extras-header p {
    margin: 0.35rem 0 0;
    color: var(--color-grey);
}

.extra-field-row {
    display: grid;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid rgba(17, 24, 39, 0.1);
    border-radius: 0.75rem;
    background: #f9fafb;
}

.extra-field-name,
.extra-field-value {
    display: grid;
    gap: 0.35rem;
}

.job-edit-actions {
    justify-content: flex-start;
}

.job-edit-actions .btn-outline {
    border-color: rgba(17, 24, 39, 0.3);
    color: var(--color-grey);
}

.job-edit-actions .btn-outline:hover {
    border-color: var(--color-forest);
    color: var(--color-forest);
}

.job-edit-link {
    text-align: center;
}

.job-edit-link .btn-primary {
    min-width: 160px;
}

@media (min-width: 720px) {
    .extra-field-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

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

input,
select,
textarea {
    border: 1px solid rgba(17, 24, 39, 0.15);
    border-radius: 0.6rem;
    padding: 0.6rem 0.75rem;
    font-size: 0.95rem;
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--color-forest-light);
    border-color: var(--color-forest);
}

.button-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.button-row-note {
    margin-top: 1rem;
    font-size: 0.95rem;
    color: var(--color-grey);
}

.alert-info {
    background: var(--color-yellow);
    border-left: 4px solid #d97706;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
}

.not-found-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    text-align: center;
}

.not-found-hero {
    width: 100%;
    max-width: 820px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    text-align: center;
    padding: 2.5rem;
}

.not-found-eyebrow {
    margin: 0;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.25em;
    color: var(--color-grey);
}

.not-found-hero h1 {
    margin: 0;
    font-size: clamp(2rem, 4vw, 2.75rem);
    color: var(--color-forest);
}

.not-found-lede {
    margin: 0;
    font-size: 1.25rem;
}

.not-found-body {
    margin: 0;
    font-size: 1rem;
    color: #374151;
    line-height: 1.6;
}

.not-found-btn {
    align-self: center;
    min-width: 200px;
}

.not-found-graphic {
    width: 100%;
    display: flex;
    justify-content: center;
}

.not-found-graphic img {
    width: min(640px, 92vw);
    border-radius: 1.25rem;
    background: #fff;
    box-shadow: 0 25px 65px rgba(17, 24, 39, 0.12);
    padding: 0.75rem;
}

.not-found-actions {
    width: 100%;
    display: flex;
    justify-content: center;
}

.not-found-actions .btn-primary {
    min-width: 200px;
}

@media (max-width: 960px) {
    .header-inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .main-nav {
        flex-wrap: wrap;
    }

    .user-meta {
        align-self: stretch;
        justify-content: space-between;
        width: 100%;
    }
}

@media (max-width: 640px) {
    .main-nav {
        width: 100%;
        justify-content: space-between;
    }

    .user-meta {
        flex-direction: column;
        align-items: stretch;
    }

    .user-pill {
        width: 100%;
    }

    .not-found-hero {
        padding: 1.75rem;
    }

    .not-found-graphic img {
        padding: 0.5rem;
    }
}

/* Upsell Banner */
.upsell-banner {
    background-color: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    margin-bottom: 1.25rem;
    text-align: center;
    color: #475569;
    font-size: 0.9rem;
    line-height: 1.5;
}
