:root {
    --ink: #171915;
    --muted: #596158;
    --paper: #f7f5ef;
    --panel: #fffdf7;
    --line: #d8d1c1;
    --green: #285c47;
    --gold: #c8952e;
    --rust: #9a5136;
    --steel: #516a7a;
}

* {
    box-sizing: border-box;
}

body {
    background: var(--paper);
    color: var(--ink);
    font-family: Arial, Helvetica, sans-serif;
    margin: 0;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

.site-header,
.admin-header {
    align-items: center;
    display: flex;
    gap: 18px;
    justify-content: space-between;
    padding: 18px clamp(18px, 4vw, 56px);
}

.site-header {
    background: #18211d;
    color: #fffdf7;
}

.admin-header {
    background: #fffdf7;
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 5;
}

.brand {
    align-items: center;
    display: inline-flex;
    font-weight: 800;
    gap: 10px;
}

.brand span {
    align-items: center;
    background: var(--gold);
    border-radius: 8px;
    color: var(--ink);
    display: inline-flex;
    height: 34px;
    justify-content: center;
    width: 34px;
}

nav {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
}

.hero {
    align-items: center;
    background:
        linear-gradient(110deg, rgba(22, 24, 21, 0.9), rgba(40, 92, 71, 0.66)),
        linear-gradient(135deg, #1b2d27, #6d7e82 55%, #d8bc77);
    color: #fffdf7;
    display: grid;
    gap: clamp(32px, 6vw, 72px);
    grid-template-columns: minmax(0, 1fr) minmax(310px, 470px);
    min-height: 78vh;
    padding: 72px clamp(18px, 4vw, 56px);
}

.hero-copy {
    max-width: 680px;
}

.eyebrow {
    color: var(--gold);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0;
    margin: 0 0 12px;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    font-size: clamp(46px, 7vw, 86px);
    line-height: 0.95;
    margin-bottom: 20px;
}

h2 {
    font-size: clamp(28px, 3vw, 44px);
    line-height: 1.05;
    margin-bottom: 16px;
}

h3 {
    margin-bottom: 8px;
}

.hero p,
.muted {
    color: var(--muted);
    line-height: 1.6;
}

.hero p {
    color: rgba(255, 253, 247, 0.82);
    font-size: 18px;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 26px;
}

.btn {
    align-items: center;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    font-weight: 800;
    justify-content: center;
    min-height: 42px;
    padding: 11px 16px;
}

.btn.primary {
    background: var(--gold);
    color: var(--ink);
}

.btn.ghost,
.btn.small {
    background: #eef1ec;
    color: var(--ink);
}

.btn.danger {
    background: #9a341f;
    color: #fff;
    width: 100%;
}

.btn.small {
    min-height: 34px;
    padding: 7px 10px;
}

.radar-card {
    aspect-ratio: 1 / 0.86;
    background: rgba(8, 18, 18, 0.54);
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 8px;
    overflow: hidden;
    padding: 18px;
    position: relative;
}

.radar-top {
    display: flex;
    justify-content: space-between;
    position: relative;
    z-index: 2;
}

.radar-lines {
    inset: 72px 20px 50px;
    position: absolute;
}

.radar-lines i {
    background: linear-gradient(90deg, transparent, #f0c968, transparent);
    display: block;
    height: 2px;
    margin-bottom: 34px;
}

.target {
    border: 2px solid #f0c968;
    border-radius: 999px;
    position: absolute;
}

.target.one {
    height: 76px;
    right: 20%;
    top: 42%;
    width: 76px;
}

.target.two {
    bottom: 23%;
    height: 46px;
    left: 24%;
    width: 46px;
}

.section {
    padding: 78px clamp(18px, 4vw, 56px);
}

.split,
.request {
    display: grid;
    gap: 32px;
    grid-template-columns: minmax(0, 0.8fr) minmax(320px, 1.2fr);
    margin: 0 auto;
    max-width: 1180px;
}

.cards {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.cards article,
.panel,
.login-card,
.stat-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.cards article,
.panel {
    padding: 18px;
}

.request {
    background: #e9ece6;
    max-width: none;
}

.form {
    display: grid;
    gap: 13px;
}

.form label {
    color: #4f584f;
    display: grid;
    font-size: 13px;
    font-weight: 800;
    gap: 7px;
}

input,
select,
textarea {
    background: #fff;
    border: 1px solid #cfc8b8;
    border-radius: 6px;
    min-height: 42px;
    padding: 10px 12px;
    width: 100%;
}

textarea {
    resize: vertical;
}

footer {
    align-items: center;
    background: #171915;
    color: #fffdf7;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    padding: 24px clamp(18px, 4vw, 56px);
}

.flash {
    border-radius: 8px;
    margin-bottom: 16px;
    padding: 12px 14px;
}

.flash.success {
    background: #dff0e4;
    color: #22543d;
}

.flash.error {
    background: #f7d8d0;
    color: #8a2d1b;
}

.login-screen {
    align-items: center;
    display: flex;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    margin: 0 auto;
    max-width: 430px;
    padding: 24px;
    width: 100%;
}

.login-card.wide {
    max-width: 620px;
}

.login-card h1 {
    font-size: 38px;
    margin-top: 28px;
}

.admin {
    background: #f3f1ea;
}

.admin-shell {
    margin: 0 auto;
    max-width: 1280px;
    padding: 28px clamp(14px, 3vw, 38px) 56px;
}

.admin-title {
    align-items: center;
    display: flex;
    gap: 18px;
    justify-content: space-between;
    margin-bottom: 18px;
}

.admin-title h1 {
    font-size: 46px;
    margin: 0;
}

.import-form,
.search-form,
.stage-form {
    align-items: center;
    display: flex;
    gap: 10px;
}

.stats {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    margin-bottom: 18px;
}

.stat-card {
    padding: 14px;
}

.stat-card span,
.stat-card small {
    color: var(--muted);
    display: block;
}

.stat-card strong {
    display: block;
    font-size: 28px;
    margin: 5px 0;
}

.admin-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: 330px minmax(0, 1fr);
}

.detail-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: minmax(0, 1fr) 360px;
    margin-bottom: 16px;
}

.stack {
    display: grid;
    gap: 16px;
}

.table-tools {
    border-bottom: 1px solid var(--line);
    margin: -18px -18px 0;
    padding: 14px 18px;
}

.lead-row {
    align-items: center;
    display: grid;
    gap: 14px;
    grid-template-columns: minmax(240px, 1fr) 150px 100px 80px;
    padding: 15px 0;
}

.lead-row + .lead-row,
.note + .note,
.document-row + .document-row {
    border-top: 1px solid #ebe5d8;
}

.lead-title {
    color: var(--green);
    font-weight: 800;
}

.lead-row p,
.lead-row small,
.note small,
.document-row small,
.empty {
    color: var(--muted);
}

.lead-row p {
    margin: 4px 0;
}

.lead-value {
    font-weight: 800;
}

.note,
.document-row {
    padding: 13px 0;
}

.document-row strong,
.document-row small {
    display: block;
}

.summary-list {
    display: grid;
    gap: 8px 18px;
    grid-template-columns: 120px 1fr;
    margin: 0;
}

.summary-list dt {
    color: var(--muted);
    font-weight: 800;
}

.summary-list dd {
    margin: 0;
}

.invoice-item {
    align-items: center;
    display: grid;
    gap: 14px;
    grid-template-columns: minmax(0, 1fr) 160px;
}

.invoice-item span {
    font-weight: 800;
    text-align: right;
}

.invoice-item p {
    color: var(--muted);
    margin: 5px 0 0;
}

.invoice-total {
    align-items: center;
    border-top: 2px solid var(--line);
    display: flex;
    font-size: 20px;
    justify-content: flex-end;
    gap: 18px;
    margin-top: 16px;
    padding-top: 16px;
}

.invoice-workspace {
    display: grid;
    gap: 18px;
}

.invoice-builder {
    background: #fbfaf7;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}

.invoice-builder label {
    color: #516a7a;
    display: grid;
    font-size: 15px;
    font-weight: 800;
    gap: 8px;
}

.invoice-builder input,
.invoice-builder select,
.invoice-builder textarea {
    border-color: #d8e0e3;
    color: #0d3140;
    font-size: 18px;
    font-weight: 700;
}

.invoice-subject {
    background: #fff;
    border-bottom: 1px solid #e0e6e8;
    padding: 22px 28px;
}

.invoice-subject input {
    border: 0;
    min-height: 32px;
    padding: 0;
}

.invoice-top {
    display: grid;
    gap: 26px;
    grid-template-columns: minmax(0, 1fr) minmax(330px, 0.9fr);
    padding: 28px;
}

.client-select input {
    border: 2px solid #8ca1a8;
    box-shadow: 0 0 0 3px rgba(81, 106, 122, 0.16);
    min-height: 66px;
}

.client-picker {
    position: relative;
}

.client-menu {
    background: #fff;
    border: 1px solid #d8e0e3;
    border-radius: 8px;
    box-shadow: 0 18px 40px rgba(12, 31, 38, 0.16);
    left: 0;
    margin-top: 8px;
    max-height: 320px;
    overflow: auto;
    padding: 8px;
    position: absolute;
    right: 0;
    top: 100%;
    z-index: 10;
}

.client-menu button {
    background: #fff;
    border: 0;
    border-radius: 6px;
    color: #0d3140;
    cursor: pointer;
    display: block;
    padding: 11px 12px;
    text-align: left;
    width: 100%;
}

.client-menu button:hover,
.client-menu button:focus {
    background: #eef4f2;
}

.client-menu-new {
    border-bottom: 1px solid #e0e6e8 !important;
    color: #2f8522 !important;
    font-weight: 800;
    margin-bottom: 6px;
}

.client-menu-option strong,
.client-menu-option span {
    display: block;
}

.client-menu-option span,
.client-menu-empty {
    color: var(--muted);
    font-size: 13px;
    margin-top: 3px;
}

.client-menu-empty {
    padding: 12px;
}

.client-extra {
    display: grid;
    gap: 12px;
    margin-top: 18px;
}

.invoice-meta {
    display: grid;
    gap: 0;
}

.invoice-meta label {
    align-items: center;
    border-bottom: 1px solid #d8e0e3;
    display: grid;
    gap: 18px;
    grid-template-columns: 150px minmax(0, 1fr);
    min-height: 72px;
}

.invoice-meta input,
.invoice-meta select {
    min-height: 46px;
}

.date-row input {
    color: #2f8a25;
    text-decoration: underline;
}

.product-panel {
    background: #fff;
    border: 1px solid #d8e0e3;
    border-radius: 8px;
    margin: 24px 28px 0;
    padding: 44px 28px 28px;
}

.product-panel h2 {
    color: #07303f;
    font-size: 32px;
    margin-bottom: 34px;
}

.product-row {
    display: grid;
    gap: 12px;
    grid-template-columns: minmax(260px, 1fr) 150px 150px 150px;
}

.product-row label,
.product-description {
    background: #fff;
    border: 1px solid #d8e0e3;
    border-radius: 8px;
    padding: 10px 14px;
}

.product-row input,
.product-description textarea {
    border: 0;
    min-height: 30px;
    padding: 0;
}

.product-row output {
    align-items: center;
    color: #0d3140;
    display: flex;
    font-size: 18px;
    font-weight: 800;
    min-height: 30px;
}

.product-description {
    margin-top: 12px;
}

.product-description textarea {
    font-weight: 700;
    min-height: 180px;
}

.invoice-actions {
    align-items: center;
    background: #fff;
    border-top: 1px solid #d8e0e3;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 28px;
    padding: 18px 28px;
}

.invoice-actions .primary {
    background: #2f8522;
    color: #fff;
    min-width: 190px;
}

.invoice-actions .ghost {
    background: #fff;
    border: 1px solid #d8e0e3;
    color: #2f8522;
}

.compact {
    margin-top: 0;
}

.schedule-layout {
    grid-template-columns: 330px minmax(0, 1fr);
}

.calendar-title {
    background: #fff;
    border: 1px solid #c8c8c8;
    border-bottom: 0;
    border-radius: 8px 8px 0 0;
    margin-bottom: 0;
    padding: 10px 14px 6px;
}

.calendar-heading h1 {
    color: #2d2d2f;
    font-size: 30px;
    font-weight: 400;
    line-height: 1;
    margin: 0;
}

.calendar-heading strong {
    font-weight: 800;
}

.calendar-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.calendar-view-switch {
    align-items: center;
    border: 1px solid #d2d2d2;
    border-radius: 7px;
    display: inline-flex;
    margin-right: 8px;
    overflow: hidden;
}

.calendar-view-switch a,
.calendar-today-button,
.calendar-nav-button {
    align-items: center;
    background: #fff;
    border: 1px solid #d2d2d2;
    color: #2d2d2f;
    display: inline-flex;
    font-size: 13px;
    justify-content: center;
    min-height: 22px;
}

.calendar-view-switch a {
    border: 0;
    padding: 3px 9px;
}

.calendar-view-switch a.active {
    background: #f0f0f0;
    font-weight: 800;
}

.calendar-today-button {
    border-radius: 7px;
    padding: 2px 12px;
}

.calendar-nav-button {
    border-radius: 7px;
    font-size: 20px;
    line-height: 1;
    width: 22px;
}

.calendar-panel {
    background: #fff;
    border-color: #c8c8c8;
    border-radius: 0 0 8px 8px;
    overflow: visible;
    padding: 0;
}

.calendar-tools {
    display: none;
}

.calendar-grid {
    display: grid;
    gap: 0;
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

.calendar-label {
    align-items: center;
    background: #fff;
    border-bottom: 1px solid #c8c8c8;
    color: #333;
    display: flex;
    font-size: 16px;
    font-weight: 400;
    justify-content: flex-end;
    min-height: 34px;
    padding: 0 12px;
}

.calendar-day {
    background: #fff;
    border-bottom: 1px solid #e4e4e4;
    border-right: 1px solid #e4e4e4;
    min-height: 80px;
    padding: 8px 10px;
    position: relative;
}

.calendar-day:nth-child(7n + 1),
.calendar-label:nth-child(7n + 1) {
    border-left: 0;
}

.calendar-day:nth-child(7n),
.calendar-label:nth-child(7n) {
    border-right: 0;
}

.week-grid .calendar-day {
    min-height: 430px;
}

.weekend-day,
.muted-day {
    background: #f4f4f4;
}

.muted-day .day-number {
    color: #b9b9b9;
}

.day-number {
    align-items: center;
    border-radius: 999px;
    color: #2d2d2f;
    display: inline-flex;
    float: right;
    font-size: 16px;
    font-weight: 400;
    height: 26px;
    justify-content: center;
    min-width: 26px;
    padding: 0 6px;
}

.selected-day .day-number {
    background: #ff3838;
    color: #fff;
    font-weight: 800;
}

.job-chip {
    background: #e9f1ec;
    border-left: 3px solid var(--green);
    border-radius: 4px;
    clear: both;
    color: var(--ink);
    display: block;
    font-size: 12px;
    line-height: 1.25;
    margin-top: 31px;
    overflow: hidden;
    padding: 5px 6px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.job-chip + .job-chip {
    margin-top: 4px;
}

.job-chip span {
    color: var(--green);
    font-weight: 800;
    margin-right: 4px;
}

.add-job-link {
    clear: both;
    color: #2f8522;
    display: none;
    font-size: 12px;
    font-weight: 800;
    margin-top: 6px;
}

.selected-day .add-job-link,
.calendar-day:hover .add-job-link {
    display: block;
}

.day-job-form {
    background: #fff;
    border: 1px solid #d8e0e3;
    border-radius: 7px;
    clear: both;
    display: grid;
    gap: 7px;
    margin-top: 8px;
    padding: 9px;
}

.day-job-form h3 {
    font-size: 15px;
    margin-bottom: 0;
}

.day-job-form label {
    color: var(--muted);
    display: grid;
    font-size: 11px;
    font-weight: 800;
    gap: 3px;
}

.day-job-form input,
.day-job-form select,
.day-job-form textarea {
    border-radius: 5px;
    font-size: 13px;
    min-height: 32px;
    padding: 6px;
}

.time-pair {
    display: grid;
    gap: 6px;
    grid-template-columns: 1fr 1fr;
}

.day-layout {
    align-items: start;
    display: grid;
    gap: 16px;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 430px);
}

.day-layout > .panel:only-child {
    grid-column: 1 / -1;
}

.day-empty {
    margin: 18px 0 0;
}

.day-job-list {
    display: grid;
    gap: 10px;
    padding-top: 16px;
}

.day-job-card {
    background: #fff;
    border: 1px solid var(--line);
    border-left: 5px solid var(--green);
    border-radius: 8px;
    display: grid;
    gap: 5px;
    padding: 14px;
}

.day-job-card strong {
    font-size: 20px;
}

.day-job-card span,
.day-job-card small,
.day-job-card em {
    color: var(--muted);
    font-style: normal;
}

.day-add-form {
    position: sticky;
    top: 92px;
}

.team-layout {
    align-items: start;
    display: grid;
    gap: 16px;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
}

.team-list {
    display: grid;
    gap: 10px;
    padding-top: 16px;
}

.team-card {
    align-items: center;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: flex;
    gap: 14px;
    justify-content: space-between;
    padding: 14px;
}

.team-card div {
    display: grid;
    gap: 4px;
}

.team-card strong {
    font-size: 20px;
}

.team-card span,
.team-card small {
    color: var(--muted);
}

.team-form {
    position: sticky;
    top: 92px;
}

.annotation-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.annotation-canvas {
    background: #efe9dd;
    border: 1px solid var(--line);
    border-radius: 8px;
    min-height: 220px;
    touch-action: none;
    width: 100%;
}

.photo-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.photo-grid figure {
    background: #f8f5ed;
    border: 1px solid var(--line);
    border-radius: 8px;
    margin: 0;
    overflow: hidden;
}

.photo-grid img {
    display: block;
    height: auto;
    width: 100%;
}

.photo-grid figcaption {
    color: var(--muted);
    padding: 10px;
}

code {
    background: #eee8dc;
    border-radius: 4px;
    padding: 2px 5px;
}

@media (max-width: 920px) {
    .hero,
    .split,
    .request,
    .admin-grid,
    .schedule-layout,
    .detail-grid,
    .day-layout,
    .team-layout {
        grid-template-columns: 1fr;
    }

    .stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .lead-row {
        align-items: start;
        grid-template-columns: 1fr;
    }

    .invoice-top,
    .product-row {
        grid-template-columns: 1fr;
    }

    .invoice-meta label {
        grid-template-columns: 1fr;
        padding: 12px 0;
    }

    .admin-title,
    footer {
        align-items: flex-start;
        flex-direction: column;
    }

    .calendar-title {
        align-items: center;
        flex-direction: row;
        flex-wrap: wrap;
    }

    .calendar-panel {
        overflow-x: visible;
    }

    .day-add-form,
    .team-form {
        position: static;
    }
}

@media (max-width: 560px) {
    .site-header,
    .admin-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .cards,
    .stats {
        grid-template-columns: 1fr;
    }

    .import-form,
    .search-form {
        align-items: stretch;
        flex-direction: column;
    }
}
