:root {
    background-color: #333333;
    --primary-color: #1976d2;
    --success-color: #388e3c;
    --warning-color: #d32f2f;
    --border-color: #e0e0e0;
    --background-color: #ffffff;
    --card-background: #ffffff;
    --section-background: #f8f9fa;
}

body {
    margin: 0;
    padding: 0;
    font-family: "Open Sans", Helvetica, Arial, sans-serif;
    font-size: 0.85rem;
}

h1,
h2,
h3,
h4,
h5 {
    margin-bottom: 1.4rem;
    margin-top: 1.4rem;
    line-height: 1.7;
}

h1:first-of-type {
    margin-top: 1rem;
}

p,
ol,
ul,
table {
    margin-bottom: 1.1rem;
    line-height: 1.7;
}

/* List styling */
ol,
ul {
    padding-left: 1.5rem;
    list-style: none;
}

ol {
    counter-reset: item;
}

ol > li {
    counter-increment: item;
    position: relative;
}

ol > li::before {
    content: counter(item) ".";
    position: absolute;
    left: -1.5rem;
    text-align: right;
}

ul li {
    position: relative;
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

ul li::before {
    content: "–"; /* em dash character */
    position: absolute;
    left: -1.5rem;
    color: #999;
    padding-right: 0.3rem;
}

/* Nested list indentation */
ol ol,
ul ul,
ol ul,
ul ol {
    margin-bottom: 0;
    padding-left: 1.5rem;
}

.container {
    background: white;
}

/* Main content wrapper */
.content-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    background: white;
}

/* Hero section */
.hero {
    width: 100%;
    height: 100svh;
    position: relative;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    margin-bottom: 0;
    overflow: hidden;
}

/* Top and bottom gradients */
.hero::before,
.hero::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    height: 50%;
    z-index: 1;
    pointer-events: none;
}

.hero::before {
    top: 0;
    /* background: linear-gradient(to bottom, rgba(0,0,0,0.9), rgba(0,0,0,0)); */
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.7) 10%,
        rgba(0, 0, 0, 0.6),
        rgba(0, 0, 0, 0)
    );
}

.hero::after {
    bottom: 0;
    /* background: linear-gradient(to top, rgba(0,0,0,0.9), rgba(0,0,0,0)); */
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.7) 10%,
        rgba(0, 0, 0, 0.6),
        rgba(0, 0, 0, 0)
    );
}

/* Hero content positioning */
.hero-content {
    position: absolute;
    top: 4rem;
    left: 4rem;
    right: 4rem;
    color: white;
    z-index: 2;
}

.company-details {
    position: absolute;
    bottom: 4rem;
    left: 4rem;
    color: white;
    z-index: 2;
}

.company-details h3 {
    font-family: "Raleway", sans-serif;
    font-weight: 300;
    font-size: 1.5rem;
    margin: 0 0 0.5rem 0;
}

.detail-blocks {
    margin-top: 1.8rem;
    margin-bottom: 1rem;
    display: flex;
    flex-direction: row;
}

.detail-blocks div {
    margin-right: 2.5rem;
}

.detail-blocks div b + p {
    margin-top: 0.4rem;
}

.future-industries {
    font-family: "Raleway", sans-serif;
    font-weight: 300;
    font-size: 1.2rem;
    margin: 0rem 0 0.2rem 0;
}

.hero h1 {
    font-family: "Raleway", sans-serif;
    font-weight: 100;
    font-size: 3.5rem;
    margin: 0 0 0.4rem 0;
    line-height: 1.2;
}

.hero h2 {
    font-family: "Open Sans", sans-serif;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 1.2rem;
    margin: 0;
    font-weight: 400;
    opacity: 0.9;
}

h1 {
    font-family: "Raleway", sans-serif;
    font-weight: 100;
    font-size: 3rem;
    line-height: 1.4;
    /* margin-bottom: 1.4rem; */
}

h2 {
    font-family: "Raleway", sans-serif;
    font-weight: 300;
    font-size: 1.6rem;
    margin-top: 2.8rem;
    margin-bottom: 1.4rem;
}

h3 {
    font-family: "Raleway", sans-serif;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.9rem;
    margin-top: 2.8rem;
    margin-bottom: 1.4rem;
}

h2 + h3 {
    margin-top: 1rem;
}

h4 {
}

/* Footer styling */
footer {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid #eee;
    color: #666;
    font-size: 0.8rem;
    text-align: center;
}

/* Table styles */
table {
    border-collapse: collapse;
    width: 100%;
    display: table;
    margin-bottom: 20px;
    border: 0;
}

/* Table wrapper for horizontal scrolling */
.table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 20px;
    position: relative;
}

/* For tables that need a minimum width */
.task-list table,
.project-summary table {
    min-width: 800px;
}

/* Header styles */
th {
    font-family: "Raleway", sans-serif;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 12px 8px;
    border: 0;
    border-bottom: 2px solid #ddd;
    background: none;
    text-align: left;
    font-size: 0.7rem;
    vertical-align: bottom;
}

/* Cell styles */
td {
    padding: 12px 8px;
    border: none;
    border-bottom: 1px solid #ddd;
    vertical-align: top;
}

/* Remove background from even rows */
tr:nth-child(even):not(.task-list-total) {
    background: none;
}

td.task-name {
    vertical-align: top;
    width: 40%;
}

.resource-type {
    border-bottom: 1px solid #ddd;
}

tr.last-resource td {
    border-bottom: 1px solid #ddd;
}

.subtotal-row td {
    border-top: none;
    border-bottom: 1px solid #ddd;
}

.subtotal-text {
    font-weight: bold;
}

.subtotal-row td.no-border {
    border: none;
}

/* Task subtotal styling */
.task-subtotal {
    background: none;
}

.task-subtotal td {
    /* padding: 16px 8px; */
    border-top: 2px solid #ddd;
    border-bottom: 1px solid #ddd;
}

/* Task list total styling */
.task-list-total {
    background: none;
    font-size: 1.1em;
}

.task-list-total td {
    /* padding: 16px 8px; */
    border-top: 2px solid #ddd;
    border-bottom: 0;
}

span.over-estimate,
span.under-estimate,
span.on-target {
    white-space: nowrap;
}

/* Variance styles */
.over-estimate {
    color: #d32f2f;
}

.under-estimate {
    color: #388e3c;
}

.on-target {
    color: #1976d2;
}

/* Signature Pad Styles */

.signature-pad-container,
.existing-signature {
    width: 100%;
    max-width: 600px;
    position: relative;
}

.signature-pad,
#signatureDisplay {
    width: 100%;
    height: 200px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    display: block;
    margin: 0;
}

.signature-controls {
    margin-top: 10px;
    text-align: center;
}

.signature-btn {
    padding: 8px 20px;
    margin: 0 5px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.signature-btn-primary {
    background: #007bff;
    color: white;
}

.signature-btn-secondary {
    background: #6c757d;
    color: white;
}

.signature-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.signature-pad.signed,
#signatureDisplay.signed {
    border-color: #28a745;
    background-color: #fff;
    opacity: 1;
}

.signature-timestamp {
    margin-top: 10px;
    text-align: center;
    color: #28a745;
    font-style: italic;
}

/* PDF Download Button */
.download-pdf-container {
    margin-top: 2rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, #f0fff4 0%, #e8f5e9 100%);
    border: 2px solid #28a745;
    border-radius: 12px;
    text-align: center;
}

.download-success-message {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    color: #1b5e20;
    font-size: 1rem;
    font-weight: 600;
}

.download-success-message svg {
    color: #28a745;
    flex-shrink: 0;
}

.btn-download-pdf {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(40, 167, 69, 0.2);
}

.btn-download-pdf:hover {
    background: #218838;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(40, 167, 69, 0.3);
}

.btn-download-pdf:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(40, 167, 69, 0.2);
}

.btn-download-pdf svg {
    flex-shrink: 0;
}

.btn-download-pdf:disabled {
    background: #9e9e9e;
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-download-pdf:disabled:hover {
    background: #9e9e9e;
    transform: none;
    box-shadow: 0 2px 4px rgba(158, 158, 158, 0.2);
}

.download-waiting-message {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 6px;
    color: #856404;
    font-size: 0.9rem;
}

.download-waiting-message .loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #ffc107;
    border-top: 2px solid #856404;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Multi-Signatory Styles */

.signature-section {
    margin-top: 3rem;
}
.signatory-block {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    background: #fafafa;
}

.signatory-block:last-child {
    margin-bottom: 0;
}

.signatory-block.signed {
    background: #f0fff4;
    border-color: #28a745;
}

.signatory-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 1rem 0;
    color: #333;
    padding-bottom: 0.5rem;
}

/* Signatory input row - side by side on desktop */
.signatory-input-row {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

@media (min-width: 900px) {
    .signatory-input-row {
        flex-direction: row;
        align-items: flex-start;
    }

    .signatory-input-row .signatory-form,
    .signatory-input-row .signatory-details-column {
        flex: 1 1 400px;
        max-width: 450px;
        margin-bottom: 0;
    }

    .signatory-input-row .signatory-signature {
        flex: 0 0 600px;
        min-width: 0;
    }
}

/* Signatory signature container */
.signatory-signature {
    display: flex;
    flex-direction: column;
}

/* Signatory details column (for signed signatories) */
.signatory-details-column {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.signatory-details-column .signatory-field {
    background: #fff;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
}

/* Signatory form fields */
.signatory-form {
    margin-bottom: 0;
}

.signatory-form .form-group {
    margin-bottom: 1rem;
}

.signatory-form label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.25rem;
    color: #333;
}

.signatory-form label .required {
    color: #dc3545;
    margin-left: 2px;
}

.signatory-form input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
    box-sizing: border-box;
}

.signatory-form input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.signatory-form .field-hint {
    display: block;
    font-size: 0.85rem;
    color: #666;
    margin-top: 0.25rem;
}

.signatory-form .field-error {
    display: block;
    font-size: 0.85rem;
    color: #dc3545;
    margin-top: 0.25rem;
}

.signatory-form .form-group.has-error input {
    border-color: #dc3545;
}

/* Signatory details (after signing) */
.signatory-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: #fff;
    border-radius: 4px;
}

.signatory-field {
    display: flex;
    flex-direction: column;
}

.signatory-field .field-label {
    font-size: 0.75rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}

.signatory-field .field-value {
    font-size: 1rem;
    color: #333;
}

/* Spinner */
.spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    vertical-align: middle;
    margin-left: 8px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Scroll Hint */
.scroll-hint {
    position: absolute;
    bottom: 3.5rem;
    right: 3.5rem;
    color: rgba(255, 255, 255, 0.8);
    z-index: 2;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.scroll-hint-hidden {
    opacity: 0;
}

.scroll-text {
    font-family: "Raleway", sans-serif;
    font-size: 1.2rem;
    letter-spacing: 1px;
}

.scroll-chevron {
    display: inline-block;
    transform: rotate(90deg);
    font-size: 2.1rem;
    line-height: 1;
    animation: chevronBounce 1.5s infinite;
}

@keyframes chevronBounce {
    0%,
    20%,
    50%,
    80%,
    100% {
        transform: rotate(90deg) translateX(0);
    }
    40% {
        transform: rotate(90deg) translateX(3px);
    }
    60% {
        transform: rotate(90deg) translateX(2px);
    }
}

/* Spinner */
.spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    margin-left: 8px;
    animation: spin 1s linear infinite;
    vertical-align: middle;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Media Queries */
@media (max-width: 1200px) {
    .content-wrapper {
        margin: 0;
        border-radius: 0;
    }

    .hero-content,
    .company-details {
        left: 2rem;
        right: 2rem;
    }

    .hero-content {
        top: 2rem;
    }

    .company-details {
        bottom: 3rem;
    }

    .detail-blocks {
        flex-direction: column;
    }

    .detail-blocks div {
        margin-bottom: 0.6rem;
    }

    .detail-blocks div:last-of-type {
        margin-bottom: 0;
    }

    .hero h1 {
        font-size: 3rem;
    }

    .hero::before {
        content: "";
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0); /* Adjust color/opacity */
        z-index: 1;
    }
}

/* Form Container in Hero Section */

.form-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    max-width: 400px;
    z-index: 2;
}

.auth-form,
.project-entry-form {
    position: relative;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    color: white;
    isolation: isolate;
}

.auth-form::before,
.project-entry-form::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    z-index: -1;
}

.error,
.error-message {
    background: rgba(198, 40, 40, 0.2);
    color: #ff9a9a;
    padding: 0.8rem;
    margin-bottom: 1.5rem;
    border-radius: 4px;
    font-size: 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.input-group {
    margin-bottom: 1.2rem;
}

.input-group input {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.input-group input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.input-group input:focus {
    border-color: rgba(255, 255, 255, 0.5);
    outline: none;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.15);
}

.checkbox-wrapper {
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.checkbox-wrapper input[type="checkbox"] {
    width: 1.2rem;
    height: 1.2rem;
    accent-color: #007bff;
}

.checkbox-wrapper label {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
}

button[type="submit"] {
    width: 100%;
    padding: 0.8rem;
    background: rgba(73, 121, 168, 0.9);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    isolation: isolate;
}

button[type="submit"]::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    backdrop-filter: blur(5px);
    border-radius: 4px;
    z-index: -1;
}

button[type="submit"]:hover {
    background: rgba(0, 123, 255, 0.9);
    border-color: rgba(255, 255, 255, 0.3);
}

/* Mobile Responsiveness for Forms */
@media (max-width: 768px) {
    .form-container {
        padding: 0 1rem;
    }

    .auth-form,
    .project-entry-form {
        padding: 1.5rem;
    }
}

/* Error page styles */
.error-description {
    color: rgba(255, 255, 255, 0.9);
    text-align: center;
    margin-bottom: 2rem;
    font-size: 1.1rem;
    line-height: 1.6;
}

.return-button {
    display: block;
    width: 100%;
    padding: 0.8rem;
    background: rgba(0, 123, 255, 0.8);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    font-size: 1rem;
    text-align: center;
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
    isolation: isolate;
}

.return-button::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    backdrop-filter: blur(5px);
    border-radius: 4px;
    z-index: -1;
}

.return-button:hover {
    background: rgba(0, 123, 255, 0.9);
    border-color: rgba(255, 255, 255, 0.3);
    color: white;
    text-decoration: none;
}

/* Mobile Responsiveness for Forms */
@media (max-width: 768px) {
    .form-container {
        padding: 0 1rem;
    }

    .auth-form,
    .project-entry-form {
        padding: 1.5rem;
    }
}

/* Card-based layout styles */
.cards-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.card {
    background: var(--card-background);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    transition:
        transform 0.3s ease,
        box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.12);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

/* Card header to have no margin if it's the only element */
.card-header:only-child {
    margin-bottom: 0;
}

.card-title {
    font-family: "Raleway", sans-serif;
    font-weight: 400;
    font-size: 1.1rem;
    margin: 0;
    color: #333;
    flex: 1;
    line-height: 1.4;
}

.card-variance {
    font-size: 1rem;
    white-space: nowrap;
    margin-left: 2rem;
}

.card-variance.under-estimate::before {
    content: "$";
}

.card-variance.over-estimate::before {
    content: "+$";
}

.card-variance::after {
    content: " left";
}

.card-variance.over-estimate::after {
    content: " over";
}

.progress-container {
    margin: 0;
    clear: both;
}

.progress-bar {
    height: 8px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: var(--primary-color);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-fill.over-budget::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: calc(100% * var(--progress-ratio));
    background: var(--primary-color);
    border-radius: 4px 0 0 4px;
}

.progress-fill.over-budget {
    background: var(--warning-color);
}

.estimate-marker {
    position: absolute;
    top: -4px;
    bottom: -4px;
    width: 2px;
    background: #333;
    z-index: 1;
}

.estimate-marker::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: #333;
    border-radius: 50%;
}

.progress-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: #666;
}

.metadata-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    font-size: 0.8rem;
    visibility: hidden;
    opacity: 0;
    max-height: 0;
    margin-top: 0;
    pointer-events: none;
    transition:
        opacity 0.4s ease,
        max-height 0.4s ease,
        margin-top 0.4s ease,
        visibility 0s linear 0.4s;
}

.card:hover .metadata-grid {
    visibility: visible;
    opacity: 1;
    max-height: 500px; /* Set this to a value that will accommodate your content */
    margin-top: 1rem;
    pointer-events: auto;
    transition:
        opacity 0.3s ease,
        max-height 0.4s ease,
        margin-top 0.3s ease,
        visibility 0s linear;
}

/* Resource table styles */
.resource-table {
    background: var(--section-background);
    border-radius: 4px;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    transform: translateY(10px);
    transition: transform 0.4s ease;
    min-width: 0;
    overflow-x: auto;
}

.card:hover .resource-table,
.card:hover .time-entries-table {
    transform: translateY(0);
}

.resource-header {
    display: grid;
    grid-template-columns: minmax(80px, 1.5fr) minmax(60px, 1fr) minmax(
            80px,
            1.5fr
        );
    gap: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    color: #666;
    font-size: 0.75rem;
    min-width: min-content;
}

.resource-row {
    display: grid;
    grid-template-columns: minmax(80px, 1.5fr) minmax(60px, 1fr) minmax(
            80px,
            1.5fr
        );
    gap: 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
    min-width: min-content;
}

.resource-row:last-of-type {
    border-bottom: 0;
    padding-bottom: 0;
}

.resource-value {
    color: #333;
}

.resource-value.hours {
    text-align: center;
}

.resource-value.cost {
    text-align: right;
}

/* Time entries table styles */
.time-entries-table {
    background: var(--section-background);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    transform: translateY(10px);
    transition: transform 0.4s ease;
    min-width: 0;
    overflow: hidden;
}

.time-entries-table:has(.time-row) {
    display: flex;
    flex-direction: column;
    height: 205px;
}

.time-entries-table-content {
    min-width: 0;
    overflow-x: auto;
}

.time-entries-table:has(.time-row) .time-entries-table-content {
    overflow-y: auto;
    overflow-x: auto;
    flex: 1;
}

.time-entries-table-content > div:not(.time-row) {
    padding: 0.5rem;
    text-align: center;
    color: #666;
    font-size: 0.8rem;
}

.time-header {
    display: none;
}

.time-entries-table:has(.time-row) .time-header {
    display: grid;
    grid-template-columns:
        minmax(80px, 90px) minmax(60px, 70px) minmax(80px, 100px)
        minmax(50px, 60px) 1fr;
    gap: 0.75rem;
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    color: #666;
    font-size: 0.75rem;
    position: sticky;
    top: 0;
    background: var(--section-background);
    z-index: 1;
}

.time-row {
    display: grid;
    grid-template-columns:
        minmax(80px, 90px) minmax(60px, 70px) minmax(80px, 100px)
        minmax(50px, 60px) 1fr;
    gap: 0.75rem;
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    color: #333;
}

.time-row:last-child {
    border-bottom: none;
}

/* Remove duplicate mobile styles that were at the bottom */
@media (max-width: 768px) {
    .card {
        padding: 1rem;
    }

    .resource-header,
    .resource-row {
        gap: 0.5rem;
    }

    .time-header,
    .time-row {
        gap: 0.5rem;
        padding: 0.5rem;
    }
}

/* Section header styles */
.section-header {
    padding: 1.5rem 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section-title {
    font-family: "Raleway", sans-serif;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.9rem;
    margin: 0;
}

.section-budget {
    font-size: 0.9rem;
    color: #666;
}

.section-budget strong {
    color: #333;
    font-weight: 600;
}

/* Variance styles */
.variance {
    font-size: 0.8rem;
}

.over-estimate {
    color: var(--warning-color);
}

.under-estimate {
    color: var(--success-color);
}

/* Media Queries for card layout */
@media (max-width: 768px) {
    h1 {
        font-size: 2.4rem;
        line-height: 1.2;
    }

    h2 {
        font-size: 1.4rem; /* needs smaller for mobile */
    }

    h3,
    .section-title {
        font-size: 0.8rem; /* needs smaller for mobile */
    }

    h4 {
        font-size: 0.7rem; /* needs smaller for mobile */
    }

    .detail-blocks {
        display: none;
    }

    .tagline {
        margin-top: 1.7rem;
    }

    .scroll-hint {
        top: 35%;
        left: 2.5rem;
        bottom: unset;
        right: unset;
    }

    .card {
        padding: 1rem;
    }

    .time-entries-table:has(.time-row) {
        display: block;
        overflow: auto;
    }

    .time-entries-table:has(.time-row) .time-entries-table-content {
        display: block;
        overflow: visible;
    }

    .time-entries-table:has(.time-row) .time-header,
    .time-row {
        min-width: 600px;
        grid-template-columns: 80px 60px 90px 60px minmax(200px, 1fr);
        gap: 0.5rem;
        padding: 0.5rem;
    }

    .time-entries-table:has(.time-row) .time-header {
        position: static;
        background: none;
    }

    .resource-header,
    .resource-row {
        grid-template-columns: 1.2fr 0.8fr 1.2fr;
    }
}

/* Fixed Fee Card Styles (Simplified) */
.fixed-fee-simple {
    font-size: 1rem;
    color: #626262;
}

.fee-type-label {
    display: block;
    font-size: 0.7rem;
    color: #6c757d;
    margin-top: 0.2rem;
    font-weight: 500;
}

/* ========================================
   PRINT STYLES
   ======================================== */

/* Print-specific TTF fonts for better Chrome PDF rendering */
@media print {
    @font-face {
        font-family: "Open Sans";
        font-weight: 300;
        font-style: normal;
        src: url("/fonts/OpenSans-Light.ttf") format("truetype");
    }

    @font-face {
        font-family: "Open Sans";
        font-weight: 400;
        font-style: normal;
        src: url("/fonts/OpenSans-Regular.ttf") format("truetype");
    }

    @font-face {
        font-family: "Open Sans";
        font-weight: 600;
        font-style: normal;
        src: url("/fonts/OpenSans-SemiBold.ttf") format("truetype");
    }

    @font-face {
        font-family: "Raleway";
        font-weight: 100;
        font-style: normal;
        src: url("/fonts/Raleway-Thin.ttf") format("truetype");
    }

    @font-face {
        font-family: "Raleway";
        font-weight: 200;
        font-style: normal;
        src: url("/fonts/Raleway-ExtraLight.ttf") format("truetype");
    }

    @font-face {
        font-family: "Raleway";
        font-weight: 300;
        font-style: normal;
        src: url("/fonts/Raleway-Light.ttf") format("truetype");
    }

    @font-face {
        font-family: "Raleway";
        font-weight: 400;
        font-style: normal;
        src: url("/fonts/Raleway-Regular.ttf") format("truetype");
    }

    @font-face {
        font-family: "Raleway";
        font-weight: 600;
        font-style: normal;
        src: url("/fonts/Raleway-SemiBold.ttf") format("truetype");
    }
}

/* --- Page Setup --- */
@page {
    size: A4;
    margin-top: 2.5cm;
    margin-bottom: 2.5cm;
    margin-left: 0;
    margin-right: 0;

    @top-left {
        content: "Statement of Work";
        font-family: "Open Sans", sans-serif;
        font-size: 9pt;
        color: rgb(124, 124, 124);
        margin-left: 2cm;
        margin-top: 0.5cm;
    }

    @top-right {
        content: "Private and Confidential";
        font-family: "Open Sans", sans-serif;
        font-size: 9pt;
        color: rgb(124, 124, 124);
        margin-right: 2cm;
        margin-top: 0.5cm;
    }

    @bottom-left {
        content: "© Artificer Legal Pty Ltd";
        font-family: "Open Sans", sans-serif;
        font-size: 9pt;
        color: rgb(124, 124, 124);
        margin-left: 2cm;
        margin-bottom: 0.5cm;
    }

    @bottom-right {
        content: "Page " counter(page) " of " counter(pages);
        font-family: "Open Sans", sans-serif;
        font-size: 9pt;
        color: rgb(124, 124, 124);
        margin-right: 2cm;
        margin-bottom: 0.5cm;
    }
}

/* First page (cover) - no margins, no headers/footers */
@page :first {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;

    @top-left {
        content: none;
    }
    @top-right {
        content: none;
    }
    @bottom-left {
        content: none;
    }
    @bottom-right {
        content: none;
    }
}

@media print {
    /* --- Base Resets --- */
    :root {
        background-color: unset;
    }

    html,
    body {
        width: 100%;
        margin: 0;
        padding: 0;
        font-size: 8pt;
    }

    body {
        min-height: 0 !important;
        /* Fix Chrome PDF font rendering issues with WOFF2 */
        /*text-rendering: geometricPrecision;
        font-variant-ligatures: none;
        -webkit-font-smoothing: antialiased;*/
    }

    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* Reset container for print */
    .container {
        width: 100%;
        max-width: none;
        margin: 0;
        padding: 0;
        background: transparent;
        overflow: visible;
    }

    /* --- Cover Page --- */
    .hero {
        width: 100%;
        height: 100vh;
        min-height: 297mm;
        page-break-after: always;
        position: relative;
        margin: 0 !important;
        padding: 0 !important;
        overflow: hidden;
        background-color: #000 !important; /* Fallback if image fails */
        background-size: cover !important;
        background-position: center !important;
        box-sizing: border-box;
    }

    /* Override any mobile styles for print */
    .hero-content,
    .company-details {
        left: 4.5rem !important;
        right: 4.5rem !important;
    }

    .hero-content {
        top: 3.5rem !important;
    }

    .company-details {
        bottom: 4.5rem !important;
    }

    .hero h1 {
        font-size: 3.6rem !important;
        font-weight: 100 !important;
        margin: 0 !important;
    }

    .hero h2 {
        font-size: 1.6rem !important;
    }

    .detail-blocks {
        flex-direction: row !important;
        display: flex !important;
        margin-top: 1.8rem !important;
        margin-bottom: 1.8rem !important;
        font-size: 0.85rem !important;
    }

    .detail-blocks div {
        margin-right: 2.5rem !important;
        margin-bottom: 0 !important;
    }

    .detail-blocks div p {
        margin-bottom: 0;
    }

    .tagline {
        font-size: 0.85rem !important;
    }

    /* Keep the gradients visible (for regular print) */
    .hero::before,
    .hero::after {
        display: block !important;
        height: 50% !important;
    }

    .hero::before {
        background: linear-gradient(
            to bottom,
            rgba(0, 0, 0, 0.7) 10%,
            rgba(0, 0, 0, 0.6),
            rgba(0, 0, 0, 0)
        ) !important;
    }

    .hero::after {
        background: linear-gradient(
            to top,
            rgba(0, 0, 0, 0.7) 10%,
            rgba(0, 0, 0, 0.6),
            rgba(0, 0, 0, 0)
        ) !important;
    }

    /* Hide CSS gradients when image has gradients baked in (PDF generation) */
    .hero-composited::before,
    .hero-composited::after {
        display: none !important;
    }

    /* --- Content Wrapper --- */
    .content-wrapper {
        max-width: none;
        padding: 0 2cm;
        margin: 0;
    }

    /* --- Typography Controls --- */
    p {
        orphans: 3;
        widows: 3;
    }

    li {
        orphans: 3;
        widows: 3;
    }

    /* Print heading adjustments */
    h1 {
        margin-bottom: 1.8rem;
    }

    h2 {
        margin-top: 2.2rem;
        margin-bottom: 1.8rem;
    }

    h3 {
        font-size: 1rem;
        margin-top: 2.2rem;
        margin-bottom: 1.6rem;
    }

    h4 {
        font-size: 0.95rem;
        margin-bottom: 1rem;
    }

    /* Prevent headings from being alone at bottom of page */
    h1,
    h2,
    h3,
    h4,
    h5,
    h6 {
        break-after: avoid;
        page-break-after: avoid;
        break-inside: avoid;
    }

    /* Keep the next element with its header */
    h1 + *,
    h2 + *,
    h3 + *,
    h4 + *,
    h5 + *,
    h6 + * {
        break-before: avoid;
        page-break-before: avoid;
    }

    /* Keep paragraphs with their following lists */
    p + ul,
    p + ol {
        break-before: avoid;
        page-break-before: avoid;
    }

    p:has(+ ul),
    p:has(+ ol) {
        break-after: avoid;
        page-break-after: avoid;
        margin-bottom: 0.5rem;
    }

    /* Keep first list items with the paragraph */
    p + ul > li:first-child,
    p + ol > li:first-child {
        break-before: avoid;
        page-break-before: avoid;
    }

    /* --- Task Cards --- */
    .card {
        page-break-inside: avoid;
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }

    .card:hover {
        transform: none;
        box-shadow: none;
    }

    .card-title {
        font-size: 0.95rem;
    }

    /* Show metadata grid in print (always expanded) */
    .metadata-grid {
        visibility: visible !important;
        opacity: 1 !important;
        max-height: none !important;
        margin-top: 1rem !important;
        pointer-events: auto;
    }

    /* Remove transform animations for print */
    .resource-table {
        transform: none !important;
    }

    /* Hide time entries table in print */
    .time-entries-table {
        display: none !important;
    }

    /* --- Section Headers --- */
    .section-header {
        page-break-after: avoid;
        break-after: avoid;
    }

    /* Allow breaking within cards-grid but not individual cards */
    .cards-grid {
        page-break-inside: auto;
        break-inside: auto;
    }

    /* --- Tables --- */
    table {
        page-break-inside: auto;
        break-inside: auto;
    }

    thead {
        display: table-header-group;
        break-after: avoid; /* Keep header with first data row */
    }

    thead tr {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    tbody tr:first-child {
        break-before: avoid; /* Don't separate from header */
        page-break-before: avoid;
    }

    td,
    th {
        break-inside: avoid; /* Don't break within cells */
        page-break-inside: avoid;
    }

    tfoot {
        display: table-footer-group;
    }

    .table-wrapper {
        overflow: visible;
    }

    /* Project summary / totals table */
    .project-summary {
        page-break-inside: avoid;
        break-inside: avoid;
    }

    .project-summary table,
    .totals-table {
        /*font-size: 0.75rem;*/
        table-layout: fixed;
        width: 100%;
        min-width: 0;
    }

    .totals-table .over-estimate,
    .totals-table .under-estimate {
        display: block;
    }

    .project-summary th,
    .project-summary td,
    .totals-table th,
    .totals-table td {
        padding: 6px 8px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Fixed column widths for totals table */
    .project-summary th:first-child,
    .project-summary td:first-child,
    .totals-table th:first-child,
    .totals-table td:first-child {
        width: 35%;
    }

    .project-summary th:not(:first-child),
    .project-summary td:not(:first-child),
    .totals-table th:not(:first-child),
    .totals-table td:not(:first-child) {
        width: auto;
        text-align: right;
    }

    /* --- Signature Section --- */
    .signature-section {
        margin-top: 2rem;
    }

    /* Hide signature controls (buttons) */
    .signature-controls {
        display: none !important;
    }

    /* Hide PDF download button and waiting message */
    .download-pdf-container,
    .download-waiting-message {
        display: none !important;
    }

    /* Show signature canvas with border */
    .signature-pad,
    #signatureDisplay {
        border: 1px solid #333;
    }

    /* --- Signatory Blocks for Print --- */
    .signatory-block {
        padding: 0.5rem 0.75rem;
        margin-bottom: 0.75rem;
        page-break-inside: avoid;
        break-inside: avoid;
    }

    .signatory-title {
        font-size: 0.8rem;
        margin-bottom: 0.4rem;
    }

    /* Side-by-side layout: details next to signature */
    .signatory-input-row {
        display: flex;
        flex-direction: row;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .signatory-input-row .signatory-details-column,
    .signatory-input-row .signatory-form {
        flex: 1 1 45%;
        min-width: 0;
        max-width: 55%;
    }

    .signatory-input-row .signatory-signature {
        flex: 1 1 45%;
        min-width: 0;
        max-width: 50%;
    }

    /* Compact form fields for print */
    .signatory-form .form-group {
        margin-bottom: 0.4rem;
    }

    .signatory-form label {
        font-size: 0.65rem;
        margin-bottom: 0.1rem;
    }

    .signatory-form input {
        padding: 0.2rem 0.4rem;
        font-size: 0.7rem;
    }

    .signatory-form .field-hint {
        font-size: 0.55rem;
    }

    /* Smaller signature pad for print - maintain 3:1 aspect ratio */
    .signatory-signature .signature-pad,
    .signatory-signature .existing-signature,
    .signatory-signature canvas {
        height: 120px !important;
        width: 360px !important; /* 120px * 3 to maintain 3:1 ratio */
        aspect-ratio: 3 / 1;
        max-width: 100%;
    }

    /* Compact details styling */
    .signatory-details-column .signatory-field {
        padding: 0.2rem 0.4rem;
    }

    .signatory-field .field-label {
        font-size: 0.55rem;
    }

    .signatory-field .field-value {
        font-size: 0.7rem;
    }

    /* Compact timestamp */
    .signatory-signature .signature-timestamp {
        font-size: 0.65rem;
        margin-top: 0.2rem;
    }

    /* --- Elements to Hide --- */
    .scroll-hint,
    .variation-banner,
    #loading-indicator,
    .loading-spinner,
    footer {
        display: none !important;
    }

    /* --- Links --- */
    a {
        text-decoration: none;
        color: inherit;
    }
}
