/* =============================================================================
   Bootstrap 5 Color Scheme — override these variables per project
   ============================================================================= */

:root {
    /* EZ360PM brand colors, sourced from the approved logo/theme assets. */
    --ez-blue:       #1f5fbf;
    --ez-blue-dark:  #184c9b;
    --ez-green:      #38b26f;
    --ez-green-dark: #2a8a55;
    --ez-navy:       #111c32;
    --ez-gradient: linear-gradient(90deg, var(--ez-blue), var(--ez-green));

    --bs-blue:    var(--ez-blue);
    --bs-indigo:  #6610f2;
    --bs-purple:  #6f42c1;
    --bs-pink:    #d63384;
    --bs-red:     #dc3545;
    --bs-orange:  #fd7e14;
    --bs-yellow:  #ffc107;
    --bs-green:   var(--ez-green);
    --bs-teal:    #20c997;
    --bs-cyan:    #0dcaf0;
    --bs-white:   #ffffff;
    --bs-gray:    #6c757d;
    --bs-gray-dark: #343a40;
    --bs-black:   #000000;

    /* Theme colors */
    --bs-primary:   var(--ez-blue);
    --bs-secondary: #6c757d;
    --bs-success:   var(--ez-green);
    --bs-info:      #0dcaf0;
    --bs-warning:   #ffc107;
    --bs-danger:    #dc3545;
    --bs-light:     #f8f9fa;
    --bs-dark:      #212529;

    /* Theme color RGB values (used by Bootstrap utilities) */
    --bs-primary-rgb:   31, 95, 191;
    --bs-secondary-rgb: 108, 117, 125;
    --bs-success-rgb:   56, 178, 111;
    --bs-info-rgb:      13, 202, 240;
    --bs-warning-rgb:   255, 193, 7;
    --bs-danger-rgb:    220, 53, 69;
    --bs-light-rgb:     248, 249, 250;
    --bs-dark-rgb:      33, 37, 41;

    /* Body */
    --bs-body-color:      #212529;
    --bs-body-bg:         #ffffff;
    --bs-body-font-family: system-ui, -apple-system, sans-serif;
    --bs-body-font-size:  1rem;
    --bs-body-line-height: 1.5;

    /* Links */
    --bs-link-color:       var(--ez-blue);
    --bs-link-hover-color: var(--ez-blue-dark);

    /* Borders */
    --bs-border-color: #dee2e6;
    --bs-border-radius: 0.375rem;

    /* Grays */
    --bs-gray-100: #f8f9fa;
    --bs-gray-200: #e9ecef;
    --bs-gray-300: #dee2e6;
    --bs-gray-400: #ced4da;
    --bs-gray-500: #adb5bd;
    --bs-gray-600: #6c757d;
    --bs-gray-700: #495057;
    --bs-gray-800: #343a40;
    --bs-gray-900: #212529;
}

/* =============================================================================
   Global styles
   ============================================================================= */

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--bs-body-font-family);
    font-size: var(--bs-body-font-size);
    line-height: var(--bs-body-line-height);
    color: var(--bs-body-color);
    background-color: var(--bs-body-bg);
}

a {
    color: var(--bs-link-color);
}

a:hover {
    color: var(--bs-link-hover-color);
}

.skip-link {
    position: fixed;
    top: 0.5rem;
    left: 0.5rem;
    z-index: 1100;
    padding: 0.6rem 0.85rem;
    color: #fff;
    background: var(--ez-navy);
    border-radius: 0.4rem;
    box-shadow: 0 4px 14px rgba(17, 28, 50, 0.25);
    text-decoration: none;
    transform: translateY(calc(-100% - 1rem));
    transition: transform 150ms ease;
}

.skip-link:focus {
    color: #fff;
    transform: translateY(0);
}

/* Primary actions start blue and sweep to green on interaction. The oversized
   gradient keeps both endpoints solid while background-position animates. */
.btn-primary,
button[type="submit"]:not(.btn) {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--ez-blue);
    --bs-btn-border-color: var(--ez-blue);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--ez-green);
    --bs-btn-hover-border-color: var(--ez-green);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--ez-green-dark);
    --bs-btn-active-border-color: var(--ez-green-dark);
    --bs-btn-disabled-bg: var(--ez-blue);
    --bs-btn-disabled-border-color: var(--ez-blue);
    background-color: var(--ez-blue);
    background-image: linear-gradient(
        90deg,
        var(--ez-blue) 0%,
        var(--ez-blue) 45%,
        var(--ez-green) 55%,
        var(--ez-green) 100%
    );
    background-position: left center;
    background-size: 220% 100%;
    border: 1px solid var(--ez-blue);
    color: #fff;
    transition: background-position 280ms ease, border-color 280ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.btn-primary:hover,
.btn-primary:focus-visible,
button[type="submit"]:not(.btn):hover,
button[type="submit"]:not(.btn):focus-visible {
    background-color: var(--ez-green);
    background-position: right center;
    border-color: var(--ez-green);
    color: #fff;
}

.btn-primary:active,
button[type="submit"]:not(.btn):active {
    background-color: var(--ez-green-dark);
    background-position: right center;
    border-color: var(--ez-green-dark);
    transform: translateY(1px);
}

.btn-primary:disabled,
.btn-primary.disabled {
    background-position: left center;
    opacity: 0.65;
}

.btn-success {
    --bs-btn-bg: var(--ez-green);
    --bs-btn-border-color: var(--ez-green);
    --bs-btn-hover-bg: var(--ez-green-dark);
    --bs-btn-hover-border-color: var(--ez-green-dark);
    --bs-btn-active-bg: var(--ez-green-dark);
    --bs-btn-active-border-color: var(--ez-green-dark);
}

/* =============================================================================
   Layout
   ============================================================================= */

.app-body {
    min-height: 100vh;
    background: #f4f6f8;
}

.app-header {
    min-height: 68px;
    background: #fff;
    border-bottom: 3px solid transparent;
    border-image: var(--ez-gradient) 1;
    box-shadow: 0 2px 12px rgba(17, 28, 50, 0.1);
    --bs-navbar-color: var(--ez-navy);
    --bs-navbar-hover-color: var(--ez-blue);
}

.app-header form {
    margin: 0;
}

.header-timer {
    margin-left: auto;
    margin-right: 1rem;
}

.header-timer__running {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    color: var(--ez-navy);
}

.header-timer__running a {
    color: var(--ez-blue);
    font-weight: 700;
    text-decoration: none;
}

.header-timer__description {
    max-width: 180px;
    overflow: hidden;
    color: #66788a;
    font-size: 0.8rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.brand-cluster,
.company-identity {
    display: flex;
    align-items: center;
}

.brand-cluster {
    min-width: 0;
    gap: 0.85rem;
}

.product-brand {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    text-decoration: none;
}

.product-logo {
    display: block;
    width: 86px;
    height: 52px;
    object-fit: contain;
}

.company-identity {
    min-width: 0;
    gap: 0.55rem;
    padding-left: 0.85rem;
    border-left: 1px solid #dce4ec;
    color: var(--ez-navy);
    font-weight: 700;
}

.company-name {
    max-width: 210px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.timer-clock {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.company-logo {
    width: 34px;
    height: 34px;
    border-radius: 6px;
    object-fit: contain;
    background: #fff;
}

.app-layout {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    min-height: calc(100vh - 68px);
}

.app-sidebar {
    padding: 1.25rem 0.75rem;
    background: #fff;
    border-right: 1px solid var(--bs-border-color);
}

.quick-note {
    padding: 0 0.25rem 1rem;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--bs-border-color);
}

.quick-note textarea {
    width: 100%;
    min-height: 76px;
    margin-bottom: 0.5rem;
    resize: vertical;
    font-size: 0.85rem;
}

.quick-note input[type="text"],
.quick-note input[type="email"],
.quick-note select {
    width: 100%;
    margin-bottom: 0.4rem;
    font-size: 0.85rem;
}

.quick-note label,
.quick-note summary {
    color: #56697b;
    font-size: 0.75rem;
    font-weight: 600;
}

.quick-note details {
    margin: 0.2rem 0 0.5rem;
}

.quick-note details[open] summary {
    margin-bottom: 0.4rem;
}

.quick-note__name {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0.35rem;
}

.quick-note__error {
    margin-bottom: 0.4rem;
    color: var(--bs-danger);
    font-size: 0.8rem;
    font-weight: 600;
}

.quick-note .errorlist {
    margin: -0.2rem 0 0.4rem;
}

.note-lead {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
    color: var(--ez-navy);
}

.note-lead span {
    color: #66788a;
    font-size: 0.9rem;
}

.app-sidebar .nav {
    gap: 0.25rem;
}

.app-sidebar .nav-link {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    padding: 0.65rem 0.8rem;
    color: #34495e;
    border-radius: 0.4rem;
    font-weight: 600;
}

.app-sidebar .nav-link:hover {
    color: var(--ez-blue-dark);
    background: linear-gradient(90deg, rgba(31, 95, 191, 0.1), rgba(56, 178, 111, 0.08));
}

.app-main {
    width: 100%;
    max-width: 1440px;
    padding: 2rem;
}

.page-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.page-heading h1,
.auth-card h1 {
    margin: 0;
    color: var(--ez-navy);
}

.eyebrow {
    margin: 0 0 0.25rem;
    color: #66788a;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.empty-dashboard {
    padding: 4rem 2rem;
    text-align: center;
    background: #fff;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.75rem;
}

.empty-dashboard > .bi {
    color: #547a9d;
    font-size: 2.5rem;
}

.empty-dashboard h2 {
    margin: 1rem 0 0.5rem;
    color: #17324d;
    font-size: 1.35rem;
}

.empty-dashboard p {
    margin: 0;
    color: #66788a;
}

.content-card {
    padding: 1.25rem;
    background: #fff;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.65rem;
}

.content-card h2 {
    margin: 0 0 1rem;
    color: #26445f;
    font-size: 1.1rem;
}

.content-card h3 {
    margin-top: 1.25rem;
    font-size: 1rem;
}

.narrow-card { max-width: 640px; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.detail-wide { grid-column: 1 / -1; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 0.75rem; }
.section-heading h2 { margin: 0; }
.item-list { display: grid; }
.item-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.85rem 0.25rem; color: #263d50; text-decoration: none; border-bottom: 1px solid #e8edf1; }
.item-row:last-child { border-bottom: 0; }
.item-row:hover { color: #0a58ca; }
.item-row span { min-width: 0; }
.item-row small, .detail-row small { display: block; margin-top: 0.2rem; color: #6c7d8d; }
.detail-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: 0.75rem 0; border-bottom: 1px solid #e8edf1; }
.detail-row:last-child { border-bottom: 0; }
.button-group { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem; }
.button-group form { margin: 0; }
.status-badge { display: inline-block; padding: 0.1rem 0.4rem; color: #215b3a; background: #dcefe4; border-radius: 999px; font-size: 0.7rem; }
.status-badge--paused { color: #8a5a00; background: #fdecc8; }
.muted, .help-text { color: #6c7d8d; }
.empty-state { padding: 2rem; color: #6c7d8d; text-align: center; }
.note-row { padding: 1rem 0; border-bottom: 1px solid #e8edf1; }
.note-row:last-child { border-bottom: 0; }
.note-row--archived { opacity: 0.65; }
.note-body { margin-bottom: 0.5rem; }
.client-tabs .nav-tabs { margin-bottom: 1rem; }
.client-tabs .tab-content { padding-top: 0.25rem; }
.tab-count { display: inline-block; min-width: 1.2rem; padding: 0.05rem 0.35rem; margin-left: 0.3rem; color: #56697b; background: #eef1f4; border-radius: 999px; font-size: 0.7rem; }
.nav-tabs .nav-link.active .tab-count { color: #fff; background: var(--ez-blue); }
.note-meta { display: flex; gap: 0.75rem; margin-bottom: 0.75rem; color: #6c7d8d; font-size: 0.8rem; }
.note-source { padding: 1rem 1.25rem; background: #f5f8fa; border-left: 4px solid #7b9ab5; }
.running-card { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.25rem; margin-bottom: 1rem; color: #17324d; background: #e7f4eb; border: 1px solid #b9dbc4; border-radius: 0.65rem; }
.running-card small { display: block; color: #587064; }
.running-actions { display: flex; align-items: center; gap: 1rem; }
.running-actions .timer-clock { font-size: 1.4rem; }
.running-actions form { margin: 0; }
.filter-bar { display: flex; align-items: end; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1rem; }
.filter-bar .form-field { min-width: 150px; }
.time-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 1rem; padding: 0.9rem 0; border-bottom: 1px solid #e8edf1; }
.time-row:last-child { border-bottom: 0; }
.time-row small { display: block; margin-top: 0.2rem; color: #6c7d8d; }
.time-value { min-width: 115px; text-align: right; }
.pagination-nav { display: flex; justify-content: center; gap: 1rem; padding: 1rem; }
.invoice-list-total { flex: 0 0 auto; text-align: right; }
.public-link { padding: 0.8rem 1rem; margin-bottom: 1rem; overflow-wrap: anywhere; background: #eef5fa; border-radius: 0.5rem; }
.invoice-document { max-width: 1000px; padding: 2rem; margin-bottom: 1rem; background: #fff; border: 1px solid #dfe5ea; border-radius: 0.5rem; }
.invoice-document__header { display: flex; justify-content: space-between; gap: 2rem; padding-bottom: 1.5rem; border-bottom: 2px solid #17324d; }
.invoice-document__header h2 { margin: 0 0 0.5rem; color: #17324d; font-size: 1.35rem; }
.invoice-identity { display: grid; align-content: start; justify-items: end; }
.invoice-identity > span { color: #6c7d8d; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.invoice-identity > strong { color: #17324d; font-size: 1.5rem; }
.invoice-identity > small { margin-top: 0.35rem; }
.invoice-parties { display: grid; grid-template-columns: 1fr 1fr auto; gap: 1.5rem; padding: 1.5rem 0; }
.invoice-parties h3, .invoice-text h3 { color: #6c7d8d; font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; }
.invoice-dates { display: grid; gap: 0.75rem; text-align: right; }
.invoice-dates span { display: block; color: #6c7d8d; font-size: 0.75rem; }
.invoice-lines-wrap { overflow-x: auto; }
.invoice-lines { width: 100%; border-collapse: collapse; }
.invoice-lines th { padding: 0.65rem; color: #fff; background: #17324d; font-size: 0.8rem; }
.invoice-lines td { padding: 0.75rem 0.65rem; border-bottom: 1px solid #e1e7eb; vertical-align: top; }
.invoice-lines th:not(:first-child), .invoice-lines td:not(:first-child) { text-align: right; }
.invoice-lines td small { display: block; color: #6c7d8d; }
.line-actions { white-space: nowrap; }
.line-actions a { margin-right: 0.75rem; }
.line-actions form { display: inline; }
.link-button { padding: 0; color: var(--bs-link-color); background: transparent; border: 0; }
.link-button:hover { color: var(--bs-link-hover-color); text-decoration: underline; }
.invoice-summary { width: min(100%, 340px); margin: 1rem 0 1rem auto; }
.invoice-summary > div { display: flex; justify-content: space-between; padding: 0.35rem 0; }
.invoice-summary__total, .invoice-summary__balance { margin-top: 0.3rem; padding-top: 0.65rem !important; border-top: 1px solid #9aa9b5; font-size: 1.05rem; }
.invoice-summary__balance { color: #17324d; font-size: 1.15rem; }
.invoice-text { margin-top: 1.5rem; }
.invoice-panel { max-width: 1000px; margin-bottom: 1rem; }
.invoice-panel .inline-form, .inline-form { display: inline; }
.warning-panel { border-color: #e4bb62; background: #fff9e9; }
.danger-zone { max-width: 1000px; padding: 1rem; text-align: right; }
.danger-zone a { color: var(--bs-danger); }
.public-document-body { padding: 2rem 1rem; background: #eef2f5; }
.public-document-shell { max-width: 1000px; margin: auto; }
.public-document-shell .invoice-document { margin: 0; }
.public-document-actions { display: flex; justify-content: flex-end; align-items: center; gap: 1rem; padding: 1rem 0; }
.closed-document-notice { padding: 1rem; margin-bottom: 1rem; color: #712b29; background: #f8d7da; border-radius: 0.5rem; }
.accepted-document-notice { padding: 1rem; margin-bottom: 1rem; color: #215b3a; background: #dff3e6; border-radius: 0.5rem; }
.paid-notice { color: #215b3a; font-weight: 700; }
.proposal-section { padding: 1rem 0; border-top: 1px solid #e1e7eb; }
.proposal-section h2 { color: #17324d; font-size: 1.2rem; }
.rich-text > :last-child { margin-bottom: 0; }
.proposal-response { max-width: 1000px; margin-top: 1rem; }
.compact-form { margin-top: 1rem; padding: 0; }
.draft-readiness { display: grid; grid-template-columns: minmax(220px, 0.8fr) minmax(300px, 1.2fr); gap: 1.5rem; max-width: 1000px; margin-bottom: 1rem; }
.draft-readiness h2 { margin-bottom: 0; }
.readiness-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem 1rem; margin: 0; padding: 0; list-style: none; color: #66788a; }
.readiness-list .is-ready { color: #215b3a; }
.workflow-warning { max-width: 1000px; margin-bottom: 1rem; padding: 0.85rem 1rem; color: #664d03; background: #fff3cd; border: 1px solid #ffecb5; border-radius: 0.5rem; }
.line-item-preview { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 1.5rem; padding: 0.75rem 1rem; background: #f5f8fb; border-radius: 0.4rem; color: #66788a; }
.line-item-preview strong { margin-left: 0.35rem; color: var(--ez-navy); }
.time-attachment-form { display: grid; gap: 1rem; }
.time-entry-choices { display: grid; gap: 0.5rem; }
.time-entry-choice { display: flex; align-items: flex-start; gap: 0.65rem; padding: 0.75rem; background: #f8fafc; border: 1px solid var(--bs-border-color); border-radius: 0.4rem; cursor: pointer; }
.time-entry-choice:has(input:checked) { background: #eef6ff; border-color: var(--ez-blue); }
.time-entry-choice input { margin-top: 0.2rem; }
.calculation-preview { margin-top: 0.5rem; padding: 0.65rem 0.75rem; color: var(--ez-navy); background: #eef6ff; border-radius: 0.35rem; font-weight: 700; }
.ordering-actions { display: inline-flex; align-items: center; gap: 0.4rem; }
.access-note { max-width: 1000px; margin: -0.5rem 0 1rem; color: #66788a; font-size: 0.85rem; }
.section-divider { display: flex; align-items: center; justify-content: center; margin: 1rem 0; color: #66788a; font-weight: 700; }
.inline-line-editor-row td { padding-top: 0; border-top: 0; }
.inline-line-editor summary { width: fit-content; color: var(--ez-blue); cursor: pointer; font-weight: 700; }
.inline-line-editor[open] summary { margin-bottom: 0.75rem; }
.workflow-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1rem 2rem; align-items: center; margin-bottom: 1rem; }
.workflow-actions h2, .workflow-actions p { margin-bottom: 0.35rem; }
.workflow-actions__more { grid-column: 1 / -1; }
.workflow-actions__more summary { width: fit-content; color: var(--ez-blue); cursor: pointer; font-weight: 700; }
.workflow-actions__more .button-group { margin-top: 0.75rem; }
.success-panel { border-color: #8fc5a2; background: #f2fbf5; }
.filter-links { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 1rem; }
.filter-links a { padding-bottom: 0.2rem; text-decoration: none; border-bottom: 2px solid transparent; }
.filter-links a:hover { border-bottom-color: #9cb1c3; }
.filter-links a.is-active, .filter-links a[aria-current="page"] { color: var(--ez-navy); border-bottom-color: var(--ez-blue); font-weight: 700; }
.integration-state { display: inline-block; padding: 0.25rem 0.65rem; border-radius: 999px; font-weight: 700; }
.integration-state--ready { color: #215b3a; background: #dff3e6; }
.integration-state--off { color: #712b29; background: #f8d7da; }
.metric-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.metric-grid--compact { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.metric-card { display: grid; align-content: start; min-height: 115px; padding: 1rem; color: #31465a; background: #fff; border: 1px solid #dfe5ea; border-radius: 0.6rem; text-decoration: none; box-shadow: 0 2px 8px rgba(22, 39, 55, 0.04); }
.metric-card:hover { color: var(--ez-navy); border-color: #9cb1c3; }
.metric-card > span { color: #66788a; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; }
.metric-card > strong { margin-top: 0.35rem; color: var(--ez-navy); font-size: 1.7rem; }
.metric-card > small { margin-top: auto; color: #66788a; }
.metric-card--money { border-color: #8fc5a2; background: #f2fbf5; }
.dashboard-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.dashboard-grid .content-card { min-width: 0; }
.page-total { color: var(--ez-navy); font-size: 1.8rem; }
.month-nav { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.85rem 1rem; margin-bottom: 1rem; background: #fff; border: 1px solid #dfe5ea; border-radius: 0.5rem; }
.month-nav form { display: flex; align-items: center; gap: 0.5rem; margin: 0; }
.month-nav input[type="month"] { width: auto; }
.danger-link { color: var(--bs-danger); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; max-width: 960px; }
.structured-form { display: grid; gap: 1.25rem; max-width: 960px; }
.form-section { padding: 0 0 1.25rem; border: 0; border-bottom: 1px solid var(--bs-border-color); }
.form-section legend { grid-column: 1 / -1; margin-bottom: 0; color: var(--ez-navy); font-size: 1.05rem; font-weight: 700; }
.form-error-summary { padding: 0.75rem 1rem; color: #842029; background: #f8d7da; border: 1px solid #f5c2c7; border-radius: 0.4rem; }
.required-marker { color: var(--bs-danger); }
.form-field { min-width: 0; }
.form-field label { display: block; margin-bottom: 0.3rem; font-weight: 600; }
.form-field input:not([type="checkbox"]), .form-field select, .form-field textarea { width: 100%; max-width: none; }
.form-field--error input, .form-field--error select, .form-field--error textarea { border-color: var(--bs-danger); }
.errorlist { margin: 0.35rem 0 0; padding: 0; color: var(--bs-danger); list-style: none; font-size: 0.85rem; }
.checkbox-label { display: flex !important; align-items: center; gap: 0.5rem; }
.form-actions { grid-column: 1 / -1; display: flex; gap: 0.5rem; padding-top: 0.5rem; }
address { font-style: normal; }

.auth-body {
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(31, 95, 191, 0.1), transparent 32rem),
        radial-gradient(circle at bottom right, rgba(56, 178, 111, 0.1), transparent 32rem),
        #f4f7fa;
}

.auth-header {
    padding: 1.25rem 2rem;
}

.auth-brand {
    display: inline-flex;
    align-items: center;
}

.auth-brand img {
    display: block;
    width: 130px;
    height: auto;
}

.auth-main {
    width: min(100% - 2rem, 440px);
    margin: 4rem auto;
}

.auth-card {
    padding: 2rem;
    background: #fff;
    border: 1px solid var(--bs-border-color);
    border-top: 3px solid var(--ez-blue);
    border-radius: 0.75rem;
    box-shadow: 0 14px 36px rgba(17, 28, 50, 0.1);
}

.auth-card form {
    margin-top: 1.5rem;
}

/* =============================================================================
   Messages — map Django message tags to Bootstrap alert colors
   ============================================================================= */

.messages {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem;
}

.message {
    padding: 0.75rem 1rem;
    border-radius: var(--bs-border-radius);
    margin-bottom: 0.5rem;
}

.message--success { background: #d1e7dd; color: #0a3622; }
.message--error   { background: #f8d7da; color: #58151c; }
.message--warning { background: #fff3cd; color: #664d03; }
.message--info    { background: #cff4fc; color: #055160; }

/* =============================================================================
   Forms
   ============================================================================= */

form p {
    margin-bottom: 0.75rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
    display: block;
    width: 100%;
    max-width: 400px;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
    font-size: 1rem;
}

button[type="submit"]:not(.btn) {
    padding: 0.5rem 1.25rem;
    border-radius: var(--bs-border-radius);
    font-size: 1rem;
    cursor: pointer;
}

@media (max-width: 767.98px) {
    .app-layout {
        display: block;
    }

    .app-sidebar {
        padding: 0.5rem;
        border-right: 0;
        border-bottom: 1px solid var(--bs-border-color);
    }

    .app-sidebar .nav {
        gap: 0.25rem;
    }

    .app-main {
        padding: 1.25rem;
    }

    .detail-grid,
    .form-grid,
    .dashboard-grid,
    .draft-readiness,
    .readiness-list,
    .workflow-actions {
        grid-template-columns: 1fr;
    }

    .workflow-actions__more { grid-column: auto; }

    .line-item-preview { justify-content: flex-start; flex-wrap: wrap; }

    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .month-nav { flex-wrap: wrap; }

    .detail-wide,
    .form-actions {
        grid-column: auto;
    }

    .auth-main {
        margin-top: 2rem;
    }

    .app-header {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .company-name {
        max-width: 150px;
    }

    .header-timer {
        order: 3;
        width: 100%;
        margin: 0;
    }

    .header-timer__running {
        justify-content: center;
    }

    .time-row {
        grid-template-columns: 1fr auto;
    }

    .invoice-document { padding: 1rem; }
    .invoice-document__header, .invoice-parties { grid-template-columns: 1fr; flex-direction: column; }
    .invoice-identity { justify-items: start; }
    .invoice-dates { text-align: left; }

    .time-row > .button-group {
        grid-column: 1 / -1;
        justify-self: start;
    }
}

@media (max-width: 575.98px) {
    .product-logo {
        width: 40px;
        height: 40px;
        border-radius: 10px;
    }

    .brand-cluster {
        gap: 0.55rem;
    }

    .company-identity {
        gap: 0.4rem;
        padding-left: 0.55rem;
    }

    .company-logo {
        width: 30px;
        height: 30px;
    }

    .company-name {
        max-width: 105px;
        font-size: 0.85rem;
    }

    .auth-header {
        padding: 1rem;
        text-align: center;
    }

    .auth-brand img {
        width: 112px;
    }
}

@media print {
    @page {
        margin: 0.5in;
    }

    .public-document-body {
        padding: 0;
        background: #fff;
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }

    .public-document-shell {
        max-width: none;
        margin: 0;
    }

    .public-document-actions,
    .proposal-response {
        display: none !important;
    }

    .public-document-shell .invoice-document {
        max-width: none;
        padding: 0;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .invoice-lines-wrap {
        overflow: visible;
    }

    .invoice-lines tr,
    .invoice-summary,
    .invoice-text,
    .proposal-section,
    .closed-document-notice,
    .accepted-document-notice {
        break-inside: avoid;
    }

    .public-document-shell a {
        color: inherit;
        text-decoration: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .skip-link,
    .btn-primary,
    button[type="submit"]:not(.btn) {
        transition: none;
    }
}

/* AI assistant */
.assistant-drawer {
    --bs-offcanvas-width: min(440px, 100vw);
}

.assistant-transcript {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: #f6f8fb;
}

.assistant-composer {
    padding: 1rem;
    background: #fff;
}

.assistant-disclaimer {
    color: #6c757d;
    font-size: 0.75rem;
}

.assistant-message,
.assistant-action-card {
    max-width: 92%;
    margin-bottom: 0.85rem;
    padding: 0.8rem 0.9rem;
    border: 1px solid #dfe5ec;
    border-radius: 0.8rem;
    background: #fff;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.assistant-message--user {
    margin-left: auto;
    border-color: #c8d8f2;
    background: #eaf2ff;
}

.assistant-message--error {
    border-color: #e5b8bd;
    background: #fff3f4;
    color: #842029;
}

.assistant-action-card {
    border-color: #f1cf7a;
    background: #fffaf0;
}

.assistant-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.65rem;
}

.assistant-link,
.assistant-suggestion {
    display: inline-flex;
    align-items: center;
    border: 1px solid #cbd7e6;
    border-radius: 999px;
    padding: 0.25rem 0.6rem;
    background: #fff;
    color: #1f5fbf;
    font-size: 0.82rem;
    text-decoration: none;
}

.assistant-suggestion {
    margin: 0.15rem 0.1rem 0.15rem 0;
}

.assistant-link:hover,
.assistant-suggestion:hover {
    border-color: #1f5fbf;
    background: #edf4ff;
}

@media (max-width: 575.98px) {
    .assistant-open-button {
        padding-inline: 0.55rem;
    }
}

.assistant-action-card--external {
    border-color: var(--bs-warning-border-subtle, #ffe69c);
    box-shadow: 0 0 0 1px rgba(255, 193, 7, 0.12);
}

.assistant-final-review {
    background: var(--bs-warning-bg-subtle, #fff3cd);
    border-radius: 0.5rem;
    padding: 0.65rem 0.75rem 0.65rem 2.1rem;
}

.assistant-insights {
    padding: 0.85rem 1rem;
    background: var(--bs-tertiary-bg);
    max-height: 16rem;
    overflow-y: auto;
}

.assistant-insights-heading {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--bs-secondary-color);
    margin-bottom: 0.45rem;
}

.assistant-insight {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.65rem 0;
    border-top: 1px solid var(--bs-border-color);
}

.assistant-insight:first-of-type {
    border-top: 0;
}

.assistant-insight-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex: 0 0 auto;
}
