/* FactoryTalk theme - blue gradient, white text, vibrant blue accents */
:root {
    --ft-blue-light: #00A9FF;
    --ft-blue: #007BFF;
    --ft-blue-dark: #0062cc;
    --ft-gradient-start: #00A9FF;
    --ft-gradient-end: #007BFF;
    --ft-dark: #0d47a1;
    --ft-darker: #002171;
    --ft-panel: #0d47a1;
    --ft-surface: #1565c0;
    --ft-border: #1976d2;
    --ft-text: #ffffff;
    --ft-text-muted: rgba(255, 255, 255, 0.85);
    --ft-success: #2e7d32;
    --ft-error: #c62828;
}

html, body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: linear-gradient(135deg, var(--ft-darker) 0%, var(--ft-dark) 50%, #0d47a1 100%);
    color: var(--ft-text);
    min-height: 100vh;
    margin: 0;
}

/* App shell: left sidebar + main - same background */
.app-shell {
    display: flex;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--ft-darker) 0%, var(--ft-dark) 50%, #0d47a1 100%);
}

/* Hidden checkbox drives collapse state so it works without Blazor interactivity */
.sidebar-collapse-check {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.sidebar {
    width: 220px;
    min-height: 100vh;
    background: transparent;
    border-right: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    flex-direction: column;
    transition: width 0.2s ease;
    flex-shrink: 0;
}

/* Collapsed state when checkbox is checked */
.app-shell:has(.sidebar-collapse-check:checked) .sidebar {
    width: 56px;
}

.app-shell:has(.sidebar-collapse-check:checked) .sidebar .nav-text,
.app-shell:has(.sidebar-collapse-check:checked) .sidebar .brand span:not(.brand-accent) {
    display: none;
}

.app-shell:has(.sidebar-collapse-check:checked) .sidebar .brand .brand-accent {
    margin-left: 0;
}

/* Toggle icon: show collapse (‹) when expanded, show expand (›) when collapsed */
.sidebar-toggle-collapse { display: inline; }
.sidebar-toggle-expand { display: none; }
.app-shell:has(.sidebar-collapse-check:checked) .sidebar .sidebar-toggle-collapse { display: none; }
.app-shell:has(.sidebar-collapse-check:checked) .sidebar .sidebar-toggle-expand { display: inline; }

.sidebar-header {
    min-height: 56px;
    padding: 0 0.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    gap: 0.5rem;
}

.sidebar .brand {
    font-weight: 700;
    font-size: 1.1rem;
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    overflow: hidden;
    white-space: nowrap;
}

.sidebar .brand:hover { color: rgba(255, 255, 255, 0.95); }

.sidebar .brand-accent { color: white; margin-left: 0.15rem; opacity: 0.95; }

.sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
    padding: 0;
    flex-shrink: 0;
    transition: background 0.15s;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.35);
    color: white;
}

.sidebar-nav {
    padding: 0.75rem 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.sidebar-nav a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    padding: 0.6rem 0.75rem;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: color 0.15s, background 0.15s;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    color: white;
    background: rgba(255, 255, 255, 0.2);
}

.nav-icon { font-size: 1.1rem; flex-shrink: 0; }

.nav-text { white-space: nowrap; overflow: hidden; }

.sidebar-user {
    margin-top: auto;
    flex-shrink: 0;
    padding: 0.75rem 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    color: rgba(255, 255, 255, 0.9);
}
.sidebar-user .user-name { font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.app-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 0.5rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(0, 0, 0, 0.15);
}
.app-header-user {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.9);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.main-content {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    box-sizing: border-box;
}

/* Sign portal: no navigation */
.sign-portal {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--ft-darker) 0%, var(--ft-dark) 100%);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 3rem 2rem 2rem;
}

.sign-portal-content {
    width: 100%;
    max-width: 560px;
}

.login-card {
    max-width: 24rem;
    margin: 0 auto;
}

.login-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.login-header h1 {
    margin: 0 0 0.25rem 0;
}

.login-subtitle {
    color: var(--ft-text-muted);
    margin: 0;
    font-size: 0.95rem;
}

.login-logo {
    flex-shrink: 0;
}

.login-logo img {
    max-width: 140px;
    height: auto;
    display: block;
}

.login-form .form-group {
    margin-bottom: 1rem;
}

.login-form .form-group label {
    display: block;
    margin-bottom: 0.35rem;
}

.login-form .form-group input {
    width: 100%;
    box-sizing: border-box;
}

.login-actions {
    margin-top: 1.25rem;
    text-align: right;
}

.login-error {
    margin-bottom: 1rem;
}

.change-password-form .form-group {
    margin-bottom: 1rem;
}
.change-password-form .form-group label {
    display: block;
    margin-bottom: 0.35rem;
}
.change-password-form .form-group input {
    width: 100%;
    box-sizing: border-box;
}

.card-ft {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    backdrop-filter: blur(8px);
}

.card-ft-compact {
    padding: 1rem;
    margin-bottom: 1rem;
}

.card-ft-compact h3 {
    margin-bottom: 0.75rem;
}

.card-ft h2, .card-ft h3 {
    margin-top: 0;
    color: var(--ft-blue-light);
    font-weight: 600;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 0.5rem;
}

.reports-results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.reports-results-header h3 {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
}

.form-compact .form-group {
    margin-bottom: 0.5rem;
}

.form-compact .form-group:last-of-type {
    margin-bottom: 0;
}

.form-compact label {
    font-size: 0.85rem;
    margin-bottom: 0.15rem;
}

.form-compact input,
.form-compact select,
.form-compact textarea {
    padding: 0.4rem 0.6rem;
    font-size: 0.95rem;
}

.btn-ft-primary {
    background: var(--ft-blue-light);
    color: white !important;
    border: none;
    padding: 0.5rem 1.25rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.15s, background 0.15s;
}

.btn-ft-primary:hover {
    filter: brightness(1.15);
    background: var(--ft-blue);
}

.btn-ft-secondary {
    background: white;
    color: var(--ft-blue) !important;
    border: none;
    padding: 0.5rem 1.25rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.15s, box-shadow 0.15s;
}

.btn-ft-secondary:hover {
    filter: brightness(0.98);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.btn-ft-outline {
    background: transparent;
    color: var(--ft-blue-light);
    border: 2px solid var(--ft-blue-light);
    padding: 0.5rem 1.25rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: background 0.15s, color 0.15s;
}

.btn-ft-outline:hover {
    background: var(--ft-blue-light);
    color: white;
}

.form-ft input, .form-ft select, .form-ft textarea,
input.form-ft, select.form-ft, textarea.form-ft {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    color: var(--ft-text);
    padding: 0.5rem 0.75rem;
    width: 100%;
    font-size: 1rem;
    box-sizing: border-box;
}

.form-ft input::placeholder,
.form-ft textarea::placeholder,
input.form-ft::placeholder,
textarea.form-ft::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.form-ft input:focus, .form-ft select:focus, .form-ft textarea:focus,
input.form-ft:focus, select.form-ft:focus, textarea.form-ft:focus {
    outline: none;
    border-color: var(--ft-blue-light);
    box-shadow: 0 0 0 2px rgba(0, 169, 255, 0.35);
}

/* Dropdown option list: dark background and light text so list is readable (avoids white-on-white) */
.form-ft select,
select.form-ft,
.line-item-form select {
    color-scheme: dark;
}
.form-ft select option,
select.form-ft option,
.line-item-form select option {
    background-color: var(--ft-dark);
    color: #ffffff;
}

.form-ft label {
    display: block;
    margin-bottom: 0.25rem;
    color: var(--ft-text-muted);
    font-size: 0.9rem;
}

.form-ft .form-group { margin-bottom: 1rem; }

.new-report-customer-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem 0.75rem;
    align-items: start;
}
.new-report-customer-grid .form-group {
    min-width: 0;
    margin-bottom: 0;
}
.new-report-customer-grid .form-group label {
    margin-bottom: 0.2rem;
    font-size: 0.9rem;
}
.new-report-customer-grid .form-group input,
.new-report-customer-grid .form-group textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 0.4rem 0.5rem;
}
.new-report-customer-grid .form-group-full-width {
    grid-column: 1 / -1;
}

.new-report-details-card {
    padding: 1rem 1.5rem;
}
.new-report-details-card h3 {
    padding-bottom: 0.35rem;
    margin-bottom: 0.35rem;
}
.new-report-details-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
    align-items: flex-end;
}
.new-report-details-row .form-group {
    margin-bottom: 0;
}
.new-report-details-row .form-group:first-child {
    flex: 1;
    min-width: 20rem;
}
.new-report-details-row .form-group input,
.new-report-details-row .form-group select {
    padding: 0.4rem 0.5rem;
    box-sizing: border-box;
}
.new-report-details-row .form-group label {
    margin-bottom: 0.2rem;
    font-size: 0.9rem;
}
.new-report-details-row .form-group:first-child input {
    width: 100%;
    max-width: 36rem;
}
.new-report-notes-group {
    margin-top: 0.75rem;
    margin-bottom: 0;
}
.new-report-notes-group label {
    margin-bottom: 0.2rem;
    font-size: 0.9rem;
}
.new-report-notes-group textarea {
    width: 100%;
    min-width: 100%;
    max-width: 56rem;
    box-sizing: border-box;
    padding: 0.4rem 0.5rem;
}

.new-report-customer-card {
    padding: 1rem 1.5rem;
}
.new-report-customer-card h3 {
    padding-bottom: 0.35rem;
    margin-bottom: 0.35rem;
}

/* Collapsible report details section */
.collapsible-section {
    overflow: hidden;
}
.collapsible-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.5rem 0.75rem;
    margin: -0.5rem -0.75rem 0;
    border: none;
    background: transparent;
    color: var(--ft-text);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    border-radius: 6px;
}
.collapsible-section-header:hover {
    background: rgba(0, 0, 0, 0.05);
}
.collapsible-section-title {
    flex: 1;
}
.collapsible-section-chevron {
    font-size: 0.75rem;
    opacity: 0.8;
}
.collapsible-section-body {
    margin-top: 0.5rem;
}
.collapsible-section:not(.is-expanded) .collapsible-section-body {
    display: none;
}
.collapsible-section.is-expanded .collapsible-section-body {
    display: block;
}

/* Single unified report + customer card — 5-column grid, constrained width */
.new-report-unified {
    padding: 0.5rem 1rem;
    max-width: 52rem;
}
.report-entry-header-card.collapsible-section {
    max-width: 52rem;
}
.new-report-unified-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.25rem 0.5rem;
    align-items: start;
}
.new-report-unified-grid .form-group {
    min-width: 0;
    margin-bottom: 0;
}
.new-report-unified-grid .form-group label {
    margin-bottom: 0.1rem;
    font-size: 0.8rem;
    display: block;
}
.new-report-unified-grid .form-group input,
.new-report-unified-grid .form-group textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 0.25rem 0.35rem;
    font-size: 0.875rem;
}
.new-report-unified-grid .form-group textarea {
    resize: vertical;
    min-height: 2.25rem;
}
/* Row 1: Report Title (3 cols) / SO Number (2 cols) */
.new-report-unified-grid .new-report-title-col {
    grid-column: span 3;
}
.new-report-unified-grid .new-report-so-col {
    grid-column: span 2;
}
/* Row 2: Company Name (3 cols) / Site Name (2 cols) */
.new-report-unified-grid .new-report-company-col {
    grid-column: span 3;
}
.new-report-unified-grid .new-report-site-col {
    grid-column: span 2;
}
/* Row 3: Contact Name / Contact Email / Contact Phone (1 col each) */
/* Row 4: Address (3 cols, 3 rows) + Postcode (1 col) aligned with address top */
.new-report-unified-grid .new-report-address {
    grid-column: span 3;
}
.new-report-unified-grid .new-report-address textarea {
    min-height: 4.5rem;
}
.new-report-unified-grid .new-report-postcode {
    grid-column: span 1;
    align-self: start;
}
/* Row 5: Notes full width, 5 rows high, expandable */
.new-report-unified-grid .new-report-notes-bottom {
    grid-column: 1 / -1;
    margin-top: 0.25rem;
}
.report-details-save-row {
    margin-top: 0.75rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
}
.report-details-save-msg {
    margin-left: 0.5rem;
    font-size: 0.9rem;
    color: #fff;
    font-weight: bold;
}
.new-report-unified-grid .new-report-notes-textarea {
    max-width: 100%;
    min-height: 7.5rem;
    resize: vertical;
}
@media (max-width: 900px) {
    .new-report-unified-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .new-report-unified-grid .new-report-title-col,
    .new-report-unified-grid .new-report-company-col {
        grid-column: span 2;
    }
    .new-report-unified-grid .new-report-so-col,
    .new-report-unified-grid .new-report-site-col {
        grid-column: span 1;
    }
    .new-report-unified-grid .new-report-address {
        grid-column: span 2;
    }
    .new-report-unified-grid .new-report-postcode {
        grid-column: span 1;
    }
}
@media (max-width: 700px) {
    .new-report-unified-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .new-report-unified-grid .new-report-title-col,
    .new-report-unified-grid .new-report-so-col,
    .new-report-unified-grid .new-report-company-col,
    .new-report-unified-grid .new-report-site-col,
    .new-report-unified-grid .new-report-address,
    .new-report-unified-grid .new-report-postcode {
        grid-column: span 2;
    }
}
@media (max-width: 420px) {
    .new-report-unified-grid {
        grid-template-columns: 1fr;
    }
    .new-report-unified-grid .new-report-title-col,
    .new-report-unified-grid .new-report-so-col,
    .new-report-unified-grid .new-report-company-col,
    .new-report-unified-grid .new-report-site-col,
    .new-report-unified-grid .new-report-address,
    .new-report-unified-grid .new-report-postcode {
        grid-column: span 1;
    }
}

.report-entry-unified-edit {
    grid-column: 1 / -1;
    min-width: 0;
}

.table-ft {
    width: 100%;
    border-collapse: collapse;
}

.table-ft th, .table-ft td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.table-ft th {
    background: rgba(0, 0, 0, 0.2);
    color: var(--ft-blue-light);
    font-weight: 600;
}

.table-ft tr:hover td { background: rgba(255, 255, 255, 0.05); }

.table-ft-compact th,
.table-ft-compact td {
    padding: 0.4rem 0.6rem;
    font-size: 0.9rem;
}

.table-ft-compact th {
    font-size: 0.85rem;
}

.reports-results-table th,
.reports-results-table td {
    padding: 0.3rem 0.5rem;
    font-size: 0.875rem;
}
.reports-results-table th {
    font-size: 0.8rem;
}
.reports-results-table .reports-action-row {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    white-space: nowrap;
}
.reports-results-table .reports-action-row .btn-ft-outline,
.reports-results-table .reports-action-row .btn-sm {
    padding: 0.2rem 0.45rem;
    font-size: 0.8rem;
}

.line-entries-table th,
.line-entries-table td {
    padding: 0.15rem 0.4rem;
    font-size: 0.8rem;
}

.line-entries-table th {
    font-size: 0.75rem;
}

.line-entry-actions-cell {
    white-space: nowrap;
    padding-left: 0.35rem !important;
    padding-right: 0.35rem !important;
    vertical-align: middle;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.line-entry-actions-cell .btn-line-action {
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
    line-height: 1.3;
    border-radius: 4px;
    border: 1px solid transparent;
    cursor: pointer;
    font-weight: 500;
    flex-shrink: 0;
}

.line-entry-actions-cell .btn-line-edit {
    background: #f9a825;
    border-color: #f57f17;
    color: #1a1a1a;
}
.line-entry-actions-cell .btn-line-edit:hover {
    background: #ffb74d;
    border-color: #f9a825;
    color: #1a1a1a;
}

.line-entry-actions-cell .btn-line-delete {
    background: var(--ft-error);
    border-color: #b71c1c;
    color: #fff;
}
.line-entry-actions-cell .btn-line-delete:hover {
    background: #d32f2f;
    border-color: var(--ft-error);
    color: #fff;
}

.report-summary {
    display: flex;
    gap: 2rem;
    margin-top: 0.75rem;
    padding: 0.6rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    font-size: 0.95rem;
}

.report-summary strong {
    color: var(--ft-blue-light);
    margin-right: 0.35rem;
}

.report-empty-msg {
    color: var(--ft-text-muted);
    margin: 0.75rem 0 0 0;
    font-size: 0.9rem;
}

.btn-sm {
    padding: 0.25rem 0.5rem !important;
    font-size: 0.8rem !important;
}

.badge-ft {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-draft { background: rgba(255, 255, 255, 0.2); color: var(--ft-text-muted); }
.badge-finalized { background: rgba(0, 169, 255, 0.4); color: #b3e5fc; }
.badge-signed { background: rgba(46, 125, 50, 0.5); color: #c8e6c9; }

#blazor-error-ui {
    background: var(--ft-blue);
    color: white;
}

h1:focus { outline: none; }

.valid.modified:not([type=checkbox]) { outline: 1px solid var(--ft-success); }
.invalid { outline: 1px solid var(--ft-error); }
.validation-message { color: #ffcdd2; }

.blazor-error-boundary {
    background: var(--ft-error);
    padding: 1rem;
    color: white;
}

.darker-border-checkbox.form-check-input { border-color: rgba(255, 255, 255, 0.3); }

.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
    color: var(--ft-text-muted);
}

.search-bar {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.reports-search-card {
    padding: 0.75rem 1rem;
}
.reports-search-card h3 {
    margin-bottom: 0.5rem;
    padding-bottom: 0.35rem;
}
.reports-search-card .search-bar {
    margin-bottom: 0;
}

.line-item-form {
    --line-control-height: 2.25rem;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.5rem 0.75rem;
    margin-bottom: 0.75rem;
}

.line-item-form .form-group { margin-bottom: 0; }
.line-item-form .form-group label { display: block; }

/* Same height and horizontal alignment for all entry controls */
.line-item-form .form-group input,
.line-item-form .form-group select {
    height: var(--line-control-height);
    min-height: var(--line-control-height);
    box-sizing: border-box;
    padding-top: 0;
    padding-bottom: 0;
}

.line-item-form-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.line-item-form-actions .btn-icon {
    width: var(--line-control-height);
    height: var(--line-control-height);
    min-width: var(--line-control-height);
    min-height: var(--line-control-height);
    flex-shrink: 0;
}

.line-item-form-actions .btn-icon-confirm {
    background: var(--ft-success);
    border-color: #1b5e20;
    color: #fff;
}
.line-item-form-actions .btn-icon-confirm:hover {
    background: #388e3c;
    border-color: var(--ft-success);
    color: #fff;
}

.line-item-form-actions .btn-icon-cancel {
    background: var(--ft-error);
    border-color: #b71c1c;
    color: #fff;
}
.line-item-form-actions .btn-icon-cancel:hover {
    background: #d32f2f;
    border-color: var(--ft-error);
    color: #fff;
}

.line-item-form-actions .btn-icon-add {
    background: var(--ft-success);
    border-color: #1b5e20;
    color: #1b5e20;
    font-size: 1.25rem;
    font-weight: 300;
    line-height: 1;
}
.line-item-form-actions .btn-icon-add:hover {
    background: #388e3c;
    border-color: var(--ft-success);
    color: #0d3d0d;
}

.btn-icon {
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    border: 1px solid var(--ft-border);
    background: var(--ft-surface);
    color: var(--ft-text);
    cursor: pointer;
    font-size: 1.1rem;
    flex-shrink: 0;
}
.btn-icon:hover {
    background: var(--ft-surface-hover);
    border-color: var(--ft-border-strong);
}
.btn-icon:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-icon-sm {
    border: 1px solid var(--ft-border);
    background: var(--ft-surface);
    color: var(--ft-text);
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s, border-color 0.15s;
}

.btn-icon-sm:hover {
    background: var(--ft-surface-hover);
    border-color: var(--ft-border-strong);
}

.report-entry-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    align-items: start;
}

.report-entry-customer h3,
.report-entry-report h3 {
    margin-top: 0;
}

/* Read-only header block: Customer + Report details as summary, not data entry */
.report-entry-header-card {
    background: var(--ft-surface);
    border-color: var(--ft-border);
}
.report-entry-section-title {
    margin: 0 0 0.5rem 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--ft-text);
    text-transform: none;
    letter-spacing: 0;
}
.report-dl-header.report-dl {
    gap: 0.2rem 1rem;
    font-size: 0.875rem;
}
.report-dl-header dt {
    color: var(--ft-text-muted);
    font-size: 0.8rem;
    font-weight: 500;
}
.report-dl-header dd {
    white-space: pre-wrap;
    word-break: break-word;
}

.report-dl {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.2rem 1.25rem;
    margin: 0;
    font-size: 0.9rem;
}

.report-dl dt {
    color: var(--ft-text-muted);
    font-size: 0.85rem;
}

.report-dl dd {
    margin: 0;
}

.form-compact .report-dl {
    gap: 0.15rem 1rem;
}

/* Time entry: icon trigger + popup with scrollable hour/minute */
.time-entry-trigger {
    display: flex;
    align-items: stretch;
    gap: 0.5rem;
    height: var(--line-control-height);
}

.time-entry-trigger input {
    height: 100%;
    min-height: 0;
    box-sizing: border-box;
}

.time-entry-trigger .time-picker-btn,
.time-entry-trigger .btn-icon {
    width: var(--line-control-height);
    height: var(--line-control-height);
    min-width: var(--line-control-height);
    min-height: var(--line-control-height);
    flex-shrink: 0;
}
.time-entry-input {
    min-width: 4rem;
    width: 4.5rem;
    font-variant-numeric: tabular-nums;
}
.time-entry-display {
    display: inline-block;
    min-width: 4rem;
    padding: 0.35rem 0.6rem;
    background: var(--ft-surface);
    border: 1px solid var(--ft-border);
    border-radius: 4px;
    font-variant-numeric: tabular-nums;
}
.time-picker-btn {
    flex-shrink: 0;
}
.time-picker-row {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}
.time-sep {
    font-weight: 600;
    color: var(--ft-text-muted);
}
.time-select {
    min-width: 3.5rem;
}
.time-select-scroll {
    overflow-y: auto;
    overflow-x: hidden;
}
.time-picker-popup {
    max-width: 12rem;
    padding: 1rem;
}
.time-picker-popup-title {
    margin: 0 0 0.75rem 0;
    font-size: 0.95rem;
}
.time-picker-popup-body {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 1rem;
}
.time-picker-popup-body select {
    min-width: 3.5rem;
    background-color: transparent;
}
/* Time listbox: transparent option backgrounds so card shows through; selected option has subtle highlight */
.time-picker-popup-body select option {
    background-color: transparent;
    color: #ffffff;
}
.time-picker-popup-body select option:checked {
    background-color: rgba(0, 169, 255, 0.35);
    color: #fff;
}
.time-picker-popup-actions {
    display: flex;
    justify-content: flex-end;
}

/* Type picker popup: same as time picker, list wide enough for option labels */
.type-picker-popup {
    max-width: 20rem;
}
.type-picker-popup .time-picker-popup-body select,
.type-picker-list {
    min-width: 16rem;
    background-color: transparent;
}
.type-picker-popup select option {
    background-color: transparent;
    color: #ffffff;
}
.type-picker-popup select option:checked {
    background-color: rgba(0, 169, 255, 0.35);
    color: #fff;
}
.time-entry-trigger .type-picker-display {
    min-width: 10rem;
    height: 100%;
    min-height: 0;
    box-sizing: border-box;
    display: flex;
    align-items: center;
}
/* Type field: click the text to open popup (no separate button) */
.time-entry-trigger.type-picker-trigger {
    cursor: pointer;
}

/* Type dropdown in Time & expenses (when used as fallback): same look as time picker popups */
.line-item-form select {
    background-color: transparent;
}
.line-item-form select option {
    background-color: transparent;
    color: #ffffff;
}
.line-item-form select option:checked {
    background-color: rgba(0, 169, 255, 0.35);
    color: #fff;
}

.form-ft-readonly {
    display: inline-block;
    min-height: 2.25rem;
    padding: 0.35rem 0.6rem;
    background: var(--ft-surface);
    border: 1px solid var(--ft-border);
    border-radius: 4px;
    color: var(--ft-text);
}

/* Time entry row: Hours box same height as Date/Type/Start/End controls */
.line-item-form .hours-control-wrap {
    height: var(--line-control-height);
    display: flex;
    align-items: center;
}
.line-item-form .hours-control-wrap .form-ft-readonly {
    min-height: 0;
    height: 100%;
    display: flex;
    align-items: center;
    box-sizing: border-box;
    line-height: 1.25;
    padding-top: 0;
    padding-bottom: 0;
}

@media (max-width: 768px) {
    .report-entry-layout {
        grid-template-columns: 1fr;
    }
}


.search-bar input { max-width: 280px; }

.action-row {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
}

.action-row-split {
    justify-content: space-between;
}

.report-top-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.report-status-badge {
    display: inline-flex;
    align-items: center;
}

.btn-ft-green {
    background: var(--ft-success);
    color: white !important;
    border: none;
    padding: 0.5rem 1.25rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: filter 0.15s;
}

.btn-ft-green:hover {
    filter: brightness(1.15);
}

.btn-ft-green:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.report-bottom-actions {
    margin-top: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    justify-content: space-between;
}

.report-bottom-actions .action-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

.report-bottom-actions .btn-ft,
.report-bottom-actions a.btn-ft {
    min-height: 2.5rem;
    padding: 0.5rem 1.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    line-height: 1.25;
}

.report-bottom-actions a.btn-ft {
    text-decoration: none;
}

.report-bottom-actions .btn-ft-danger {
    color: var(--ft-error);
}

.report-bottom-actions .btn-ft-danger:hover {
    color: var(--ft-error);
    border-color: var(--ft-error);
    background: rgba(244, 67, 54, 0.15);
}

.sign-link-inline {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.sign-link-inline label {
    display: block;
    width: 100%;
    margin-bottom: 0;
    font-size: 0.85rem;
    color: var(--ft-text-muted);
}

.sign-link-inline .sign-link-box {
    min-width: 16rem;
}

.sign-link-box {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 6px;
    padding: 0.75rem 1rem;
    font-family: ui-monospace, monospace;
    font-size: 0.9rem;
    word-break: break-all;
    color: var(--ft-text);
}

/* Sign portal signature capture */
/* Sign report form card */
.sign-form-card {
    margin-top: 0;
}

.sign-form-card + .sign-report-summary {
    margin-top: 1.5rem;
}

.sign-form-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.sign-form-title-row .sign-form-title {
    margin: 0;
}

.sign-form-title {
    margin: 0 0 0.35rem 0;
    font-size: 1.35rem;
    font-weight: 600;
}

.sign-form-meta {
    color: var(--ft-text-muted);
    margin: 0 0 0.25rem 0;
    font-size: 0.95rem;
}

.sign-form-customer {
    margin: 0 0 1.25rem 0;
}

.sign-form .form-group {
    margin-bottom: 1rem;
}

.sign-form .form-group label {
    display: block;
    margin-bottom: 0.35rem;
    text-align: left;
}

.sign-form .form-group input,
.sign-form .form-group textarea {
    width: 100%;
    box-sizing: border-box;
}

.form-group-notes label {
    margin-bottom: 0.35rem;
}

.sign-notes-input {
    display: block;
    width: 100%;
    text-align: left;
    resize: vertical;
}

.sign-tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.sign-tabs button {
    background: none;
    border: none;
    color: var(--ft-text-muted);
    padding: 0.5rem 1rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    font-size: 0.95rem;
}

.sign-tabs button:hover { color: var(--ft-text); }

.sign-tabs button.active {
    color: var(--ft-blue-light);
    border-bottom-color: var(--ft-blue-light);
}

.signature-type-box {
    min-height: 80px;
    border: 2px dashed rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.08);
    font-family: 'Segoe Script', 'Brush Script MT', cursive;
    font-size: 1.75rem;
    color: var(--ft-text);
    width: 100%;
    box-sizing: border-box;
}

.signature-type-box:empty::before { content: "Type your signature here"; color: var(--ft-text-muted); }

.signature-canvas-wrap {
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    background: #fff;
    touch-action: none;
}

.signature-canvas-wrap canvas {
    display: block;
    width: 100%;
    height: 160px;
    cursor: crosshair;
}

.signature-preview {
    margin-top: 1rem;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    text-align: center;
    min-height: 60px;
}

.signature-preview img {
    max-width: 100%;
    max-height: 80px;
    display: block;
    margin: 0 auto;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    margin: 0;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-content {
    max-width: 28rem;
    width: 100%;
}

.confirm-finalize-modal {
    max-width: 24rem;
    padding: 1.25rem;
}
.confirm-finalize-title {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
}
.confirm-finalize-message {
    margin: 0 0 1.25rem 0;
    font-size: 0.9rem;
    color: var(--ft-text);
    line-height: 1.4;
}
.confirm-finalize-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}
.confirm-finalize-modal .btn-ft-danger {
    color: var(--ft-error);
    border-color: var(--ft-error);
}
.confirm-finalize-modal .btn-ft-danger:hover {
    color: var(--ft-error);
    border-color: var(--ft-error);
    background: rgba(244, 67, 54, 0.15);
}

/* Admin data management */
.admin-data-hint {
    margin: 0 0 1rem 0;
    font-size: 0.9rem;
    color: var(--ft-text-muted);
}
.admin-edit-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
    align-items: flex-end;
}
.admin-edit-form .form-group {
    margin-bottom: 0;
}
.admin-edit-form .form-group label {
    display: block;
    margin-bottom: 0.2rem;
    font-size: 0.85rem;
}
.admin-delete-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.report-signature-block { margin-bottom: 1rem; }
.report-signature-image-wrap {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: var(--ft-surface);
    border: 1px solid var(--ft-border);
    border-radius: 6px;
    display: inline-block;
}
.report-signature-image {
    display: block;
    max-width: 320px;
    max-height: 120px;
    object-fit: contain;
}

/* Dashboard */
.dashboard-search-hint {
    margin: 0 0 0.75rem 0;
    font-size: 0.9rem;
    color: var(--ft-text-muted);
}
.dashboard-search-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 1rem;
}
.dashboard-search-row .dashboard-search-group {
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}
.dashboard-search-row .dashboard-search-group label {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
}
.dashboard-search-row .dashboard-search-group .form-ft,
.dashboard-search-row .dashboard-search-group input.form-ft {
    height: 2.25rem;
    min-height: 2.25rem;
    box-sizing: border-box;
    padding: 0.35rem 0.5rem;
}
.dashboard-search-btn {
    height: 2.25rem;
    min-height: 2.25rem;
    padding: 0.35rem 0.75rem;
    box-sizing: border-box;
}
.dashboard-search-sep {
    width: 1px;
    min-width: 1px;
    height: 2.25rem;
    background: var(--ft-border);
    margin: 0 0.25rem;
    align-self: flex-end;
}
.dashboard-date-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 1rem;
}
.dashboard-summary {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.dashboard-card {
    background: var(--ft-surface);
    border: 1px solid var(--ft-border);
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.dashboard-card-label {
    font-size: 0.85rem;
    color: var(--ft-text-muted);
}
.dashboard-card-value {
    font-size: 1.5rem;
    font-weight: 600;
}
.dashboard-charts {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}
.dashboard-chart-card {
    overflow: hidden;
}
@media (min-width: 900px) {
    .dashboard-charts {
        grid-template-columns: repeat(2, 1fr);
    }
    .dashboard-charts .dashboard-chart-card:first-child {
        grid-column: 1 / -1;
    }
}

/* Report detail – time & expenses mobile-friendly (narrow viewport) */
@media (max-width: 768px) {
    .report-top-row {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    .report-top-row .btn-ft-outline {
        min-height: 44px;
        padding: 0.6rem 1rem;
        display: inline-flex;
        align-items: center;
    }
    .action-row {
        flex-wrap: wrap;
        gap: 0.75rem;
    }
    .action-row .btn-ft-primary,
    .action-row .btn-ft-outline {
        min-height: 44px;
        padding: 0.75rem 1.25rem;
        flex: 1 1 auto;
        min-width: 0;
    }
    .line-item-form {
        --line-control-height: 2.75rem;
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    .line-item-form .form-group {
        margin-bottom: 0;
        width: 100%;
    }
    .line-item-form .form-group input,
    .line-item-form .form-group select {
        width: 100%;
        min-height: var(--line-control-height);
        height: var(--line-control-height);
    }
    .line-item-form .time-entry-trigger {
        width: 100%;
        min-height: var(--line-control-height);
    }
    .line-item-form .time-entry-trigger input,
    .line-item-form .time-entry-trigger .form-ft-readonly {
        flex: 1;
        min-width: 0;
    }
    .line-item-form .time-entry-trigger .time-picker-btn,
    .line-item-form .time-entry-trigger .btn-icon {
        width: var(--line-control-height);
        height: var(--line-control-height);
        min-width: var(--line-control-height);
        min-height: var(--line-control-height);
    }
    .line-item-form .hours-control-wrap {
        min-height: var(--line-control-height);
    }
    .line-item-form-actions {
        width: 100%;
        justify-content: flex-start;
        margin-top: 0.25rem;
    }
    .line-item-form-actions .btn-icon,
    .line-item-form-actions .btn-icon-add,
    .line-item-form-actions .btn-icon-confirm,
    .line-item-form-actions .btn-icon-cancel {
        width: 2.75rem;
        height: 2.75rem;
        min-width: 2.75rem;
        min-height: 2.75rem;
        font-size: 1.25rem;
    }
    .line-entries-table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -0.5rem 1rem;
    }
    .line-entries-table {
        min-width: 520px;
    }
    .line-entries-table th,
    .line-entries-table td {
        padding: 0.4rem 0.5rem;
        font-size: 0.85rem;
    }
    .line-entry-actions-cell {
        min-height: 44px;
    }
    .line-entry-actions-cell .btn-line-action {
        min-height: 44px;
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }
    .time-picker-popup,
    .type-picker-popup {
        max-width: min(20rem, 90vw);
        padding: 1.25rem;
    }
    .time-picker-popup-body select,
    .type-picker-popup .time-picker-popup-body select {
        min-height: 44px;
        font-size: 1rem;
    }
    .time-picker-popup-actions .btn-ft-primary,
    .type-picker-popup .time-picker-popup-actions .btn-ft-primary {
        min-height: 44px;
        padding: 0.75rem 1.5rem;
    }
    .new-report-unified-grid {
        grid-template-columns: 1fr;
    }
}
