html {
    font-size: 14px;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

html {
    position: relative;
    min-height: 100%;
}

body {
    margin-bottom: 60px;
}

/* ── Tendrone brand constants (theme-independent) ───────────────────── */
:root {
    --td-accent:      #f6a623;
    --td-accent-dark: #c78012;
}

/* ── Navbar (always dark regardless of theme) ───────────────────────── */
.td-navbar {
    background-color: #1F1F1F;
}

.navbar .nav-link {
    color: #E0E0E0 !important;
}

.navbar .nav-link:hover {
    color: #FFFFFF !important;
}

/* ── Cards (shared structure) ───────────────────────────────────────── */
.card {
    border-radius: 8px;
}

/* Inner documents card — no border, flush top */
.card.card-documents {
    border: none !important;
    box-shadow: none !important;
    border-top-left-radius: 0 !important;
    border-top-right-radius: 0 !important;
}

.card.card-documents .card-header {
    border-top-left-radius: 0 !important;
    border-top-right-radius: 0 !important;
}

/* ── Edit button ────────────────────────────────────────────────────── */
.btn-edit {
    color:            #fff !important;
    background-color: #3a7bd5 !important;
    border-color:     #2f67b2 !important;
}

.btn-edit:hover,
.btn-edit:focus {
    background-color: #2f67b2 !important;
    border-color:     #25548f !important;
}

/* ── Focus outlines ─────────────────────────────────────────────────── */
.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem rgba(246, 166, 35, 0.4);
}

/* Table header accent underline — gold in dark, none needed in light (navy bg handles it) */
[data-bs-theme="dark"] .table thead th {
    border-bottom: 2px solid var(--td-accent);
}

/* ── Status badges ──────────────────────────────────────────────────── */
.status-badge {
    padding:       4px 10px;
    border-radius: 8px;
    font-size:     0.75rem;
    font-weight:   600;
}

.status-Scheduled { background-color: #17a2b8; color: #fff; }
.status-Completed { background-color: #28a745; color: #fff; }
.status-Cancelled { background-color: #dc3545; color: #fff; }
.status-Draft     { background-color: #6c757d; color: #fff; }
.status-Sent      { background-color: #ffc107; color: #000; }
.status-Paid      { background-color: #198754; color: #fff; }


/* ════════════════════════════════════════════════════════════════════
   DARK THEME
   Bootstrap 5.3 handles most element colours via data-bs-theme="dark".
   These rules cover Tendrone-specific overrides only.
   ════════════════════════════════════════════════════════════════════ */

/* Bootswatch Slate uses larger padding than Flatly/Bootstrap default on both
   buttons and form controls. Normalise so all form elements are the same size
   in both themes. */
[data-bs-theme="dark"] .btn:not(.btn-sm):not(.btn-lg) {
    padding: .375rem .75rem;
    font-size: 1rem;
    line-height: 1.5;
}

[data-bs-theme="dark"] .form-control:not(.form-control-sm):not(.form-control-lg),
[data-bs-theme="dark"] .form-select:not(.form-select-sm):not(.form-select-lg) {
    padding: .375rem .75rem;
    font-size: 1rem;
    line-height: 1.5;
}

/* ── Dark mode button colours ───────────────────────────────────────────
   TABLE action buttons get vivid colours so each action is distinct.
   Utility buttons OUTSIDE tables (Filter, Clear, New job…) stay neutral.

   Table:   outline-primary → blue #4dabf7 | outline-light → teal #2dd4bf
            outline-secondary → amber #fbbf24 | outline-danger → red
   Outside: all outline variants → neutral grey #9a9a9a
   ─────────────────────────────────────────────────────────────────────── */

/* Table action buttons — vivid */
[data-bs-theme="dark"] .table .btn-outline-primary {
    color: #4dabf7 !important; border-color: #4dabf7 !important; background-color: transparent !important;
}
[data-bs-theme="dark"] .table .btn-outline-primary:hover {
    color: #fff !important; background-color: #4dabf7 !important; border-color: #4dabf7 !important;
}
[data-bs-theme="dark"] .table .btn-outline-light {
    color: #2dd4bf !important; border-color: #2dd4bf !important; background-color: transparent !important;
}
[data-bs-theme="dark"] .table .btn-outline-light:hover {
    color: #fff !important; background-color: #2dd4bf !important; border-color: #2dd4bf !important;
}
[data-bs-theme="dark"] .table .btn-outline-secondary {
    color: #fbbf24 !important; border-color: #fbbf24 !important; background-color: transparent !important;
}
[data-bs-theme="dark"] .table .btn-outline-secondary:hover {
    color: #1a1a1a !important; background-color: #fbbf24 !important; border-color: #fbbf24 !important;
}
[data-bs-theme="dark"] .table .btn-outline-danger {
    border-color: #dc3545; color: #ff6b7c;
}
[data-bs-theme="dark"] .table .btn-outline-danger:hover {
    background-color: #dc3545; color: #fff;
}

/* Utility buttons outside tables — neutral grey */
[data-bs-theme="dark"] .btn-outline-primary:not(.table *),
[data-bs-theme="dark"] .btn-outline-light:not(.table *),
[data-bs-theme="dark"] .btn-outline-secondary:not(.table *) {
    color: #e6e6e6 !important; border-color: #9a9a9a !important; background-color: transparent !important;
}
[data-bs-theme="dark"] .btn-outline-primary:not(.table *):hover,
[data-bs-theme="dark"] .btn-outline-light:not(.table *):hover,
[data-bs-theme="dark"] .btn-outline-secondary:not(.table *):hover {
    color: #fff !important; background-color: rgba(255,255,255,0.1) !important; border-color: #e6e6e6 !important;
}

/* Cards — gold accent in dark mode */
[data-bs-theme="dark"] .card {
    border-top: 4px solid var(--td-accent);
}

[data-bs-theme="dark"] .card-header {
    background: linear-gradient(to bottom, var(--td-accent), var(--td-accent-dark));
    color: #fff !important;
    font-weight: 600;
}

/* Primary button — gold in dark mode.
   background-image: none strips Bootswatch Slate's dark gradient which
   sits on top of background-color and makes the button look like an outline. */
[data-bs-theme="dark"] .btn-primary {
    background-color:  var(--td-accent) !important;
    background-image:  none !important;
    border-color:      var(--td-accent-dark) !important;
    color:             #212529 !important;
}

[data-bs-theme="dark"] .btn-primary:hover,
[data-bs-theme="dark"] .btn-primary:focus {
    background-color:  var(--td-accent-dark) !important;
    background-image:  none !important;
    border-color:      var(--td-accent-dark) !important;
    color:             #fff !important;
}

[data-bs-theme="dark"] body {
    background-color: #2b2f33;
}

[data-bs-theme="dark"] .card {
    border-color: rgba(255, 255, 255, 0.1);
}

/* Table */
[data-bs-theme="dark"] .table thead th {
    background-color: #343a40;
    color: #f8f9fa;
}

[data-bs-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd) > * {
    background-color: rgba(255, 255, 255, 0.015);
}

[data-bs-theme="dark"] .table-hover tbody tr:hover > * {
    background-color: rgba(246, 166, 35, 0.08);
}

/* Date picker icon — gold tint */
[data-bs-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator,
[data-bs-theme="dark"] input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    filter: invert(65%) sepia(75%) saturate(500%) hue-rotate(355deg) brightness(1.2);
}

[data-bs-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator:hover,
[data-bs-theme="dark"] input[type="datetime-local"]::-webkit-calendar-picker-indicator:hover {
    filter: invert(65%) sepia(75%) saturate(600%) hue-rotate(355deg) brightness(1.4);
    cursor: pointer;
}


/* ════════════════════════════════════════════════════════════════════
   LIGHT THEME  (Bootswatch Flatly — matches AgrimapPortal palette)
   Flatly handles most element colours. These rules layer Tendrone-
   specific overrides on top.
   ════════════════════════════════════════════════════════════════════ */

/* Body: subtle off-white behind Flatly's white cards */
[data-bs-theme="light"] body {
    background-color: #f0f3f4;
}

/* Cards: navy top border + shadow (mirrors dark mode's gold top border) */
[data-bs-theme="light"] .card {
    border-top: 4px solid #2c3e50;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

/* Card headers: Flatly navy (matches portal's navbar colour) */
[data-bs-theme="light"] .card-header {
    background: #2c3e50;
    color: #fff !important;
    font-weight: 600;
}

/* Table column headers: light bg with a strong navy top border to divide from the dark card-header */
[data-bs-theme="light"] .table thead th {
    background-color: #dde3e8;
    color: #2c3e50;
    font-weight: 700;
    border-top: 3px solid #2c3e50 !important;
}

/* Hover: subtle navy tint */
[data-bs-theme="light"] .table-hover tbody tr:hover > * {
    background-color: rgba(44, 62, 80, 0.05);
}

/* ── Light mode button colours ──────────────────────────────────────────
   Mirror the dark theme's differentiated button palette, translated to
   colours that read well on a light background.

   btn-outline-primary  (Costing, View) → Flatly navy  #2c3e50
   btn-outline-light    (Details, Open) → Flatly blue  #2980b9
   btn-outline-secondary (Edit, Clear)  → mid-grey     #6c757d
   btn-outline-danger   (Delete)        → red (unchanged — already works)
   ─────────────────────────────────────────────────────────────────────── */

[data-bs-theme="light"] .btn-outline-primary {
    color:            #2c3e50 !important;
    border-color:     #2c3e50 !important;
    background-color: transparent !important;
}
[data-bs-theme="light"] .btn-outline-primary:hover,
[data-bs-theme="light"] .btn-outline-primary:focus {
    color:            #fff !important;
    background-color: #2c3e50 !important;
    border-color:     #2c3e50 !important;
}

[data-bs-theme="light"] .btn-outline-light {
    color:            #2980b9 !important;
    border-color:     #2980b9 !important;
    background-color: transparent !important;
}
[data-bs-theme="light"] .btn-outline-light:hover,
[data-bs-theme="light"] .btn-outline-light:focus {
    color:            #fff !important;
    background-color: #2980b9 !important;
    border-color:     #2980b9 !important;
}

[data-bs-theme="light"] .btn-outline-secondary {
    color:            #6c757d !important;
    border-color:     #6c757d !important;
    background-color: transparent !important;
}
[data-bs-theme="light"] .btn-outline-secondary:hover,
[data-bs-theme="light"] .btn-outline-secondary:focus {
    color:            #fff !important;
    background-color: #6c757d !important;
    border-color:     #6c757d !important;
}

/* ── Map set page full screen (3 October 2026): map, layer list and side tabs together ── */
.td-survey:fullscreen { background: var(--bs-body-bg); margin: 0; padding: .75rem; overflow: auto; width: 100%; height: 100%; }
.td-survey:fullscreen > .col-lg-8 { flex: 0 0 auto; width: calc(100% - 420px); }
.td-survey:fullscreen > .col-lg-4 { flex: 0 0 auto; width: 420px; max-height: calc(100vh - 1.5rem); overflow: auto; }
.td-survey:fullscreen #map { height: calc(100vh - 5.5rem) !important; }

/* "portal" marker (16 November 2026): labels whose values the client sees in the portal. */
.portal-mark { display: inline-block; margin-left: .35rem; padding: 0 .4rem; font-size: .68rem; font-weight: 600; line-height: 1.35rem; vertical-align: middle; text-transform: lowercase; color: var(--bs-info-text-emphasis, #055160); background: var(--bs-info-bg-subtle, #cff4fc); border: 1px solid var(--bs-info-border-subtle, #9eeaf9); border-radius: 999px; }

/* Cancelled lead interactions (16 November 2026): struck through and faded, buttons left alone */
tr.interaction-cancelled > td:not(:last-child) { text-decoration: line-through; opacity: .6; }
