/* Mowbill: plain CSS, no build step. */

:root {
    --green: #2f7d32;
    --green-dark: #23602a;
    --red: #b3261e;
    --text: #1f2421;
    --muted: #6b726d;
    --line: #dde3de;
    --bg: #f6f8f6;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: var(--text);
    background: var(--bg);
}

a { color: var(--green-dark); }

.topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem 1.5rem;
    padding: .75rem 1.25rem;
    background: #fff;
    border-bottom: 1px solid var(--line);
}
.topbar .brand { font-weight: 700; font-size: 1.1rem; text-decoration: none; color: var(--green); }
.topbar nav a { margin-right: 1rem; text-decoration: none; }
.topbar .who { margin-left: auto; display: flex; align-items: center; gap: .75rem; color: var(--muted); }

/* Company menu: short top bar, the current section underlined; folds behind "Menu" on phones */
.nav-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.5rem; flex: 1; }
.main-nav a { display: inline-block; margin-right: .9rem; padding: .2rem 0; color: var(--text); text-decoration: none; border-bottom: 2px solid transparent; }
.main-nav a:hover { color: var(--green-dark); }
.main-nav a.active { color: var(--green-dark); font-weight: 600; border-bottom-color: var(--green); }
.nav-toggle { position: absolute; opacity: 0; pointer-events: none; }
.nav-toggle-label { display: none; margin-left: auto; padding: .3rem .8rem; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
.user-menu { position: relative; }
.user-menu summary { cursor: pointer; list-style: none; }
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary::after { content: " \25BE"; }
.user-menu-items { position: absolute; right: 0; top: 1.8rem; z-index: 10; min-width: 11rem; padding: .5rem .9rem; background: #fff;
    border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 4px 14px rgba(0,0,0,.08); }
.user-menu-items a, .user-menu-items button { display: block; padding: .3rem 0; }
.user-menu-items form { margin: 0; }
@media (max-width: 760px) {
    .nav-toggle-label { display: inline-block; }
    .nav-wrap { display: none; flex-basis: 100%; flex-direction: column; align-items: stretch; }
    .nav-toggle:checked ~ .nav-wrap { display: flex; }
    .main-nav a { display: block; margin: 0; padding: .55rem 0; border-bottom: 1px solid var(--line); }
    .main-nav a.active { border-bottom-color: var(--line); border-left: 3px solid var(--green); padding-left: .5rem; }
    .topbar .who { margin-left: 0; }
    .user-menu-items { position: static; box-shadow: none; border: 0; padding: .25rem 0 0 .75rem; }
}

/* Tabs at the top of a section (Customers | Properties; Invoices | Billing | Balances | To print) */
.tabs { display: flex; flex-wrap: wrap; gap: .25rem; margin: -.5rem 0 1.25rem; border-bottom: 1px solid var(--line); }
.tabs a { padding: .45rem .9rem; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--green-dark); }
.tabs a.active { color: var(--green-dark); font-weight: 600; border-bottom-color: var(--green); }

/* Settings page */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.settings-card { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 1rem 1.2rem; }
.settings-card h2 { font-size: 1.05rem; margin: 0 0 .5rem; }
.settings-card ul { list-style: none; margin: 0; padding: 0; }
.settings-card li { padding: .55rem 0; border-top: 1px solid var(--line); }
.settings-card li:first-child { border-top: 0; }
.settings-card li > a { font-weight: 600; }
.settings-card li span:last-child { display: block; color: var(--muted); font-size: .9rem; }

main { max-width: 960px; margin: 0 auto; padding: 1.5rem 1.25rem 3rem; }

h1 { font-size: 1.5rem; margin: 0 0 1rem; }

.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.page-head h1 { margin: 0; }

.narrow { max-width: 380px; margin: 2rem auto; }

/* Buttons */
button, .button {
    display: inline-block;
    padding: .5rem 1rem;
    border: 1px solid var(--green);
    border-radius: 6px;
    background: var(--green);
    color: #fff;
    font: inherit;
    text-decoration: none;
    cursor: pointer;
}
button:hover, .button:hover { background: var(--green-dark); }
button.danger { background: var(--red); border-color: var(--red); }
button.link { background: none; border: 0; padding: 0; color: var(--green-dark); text-decoration: underline; }
button.big { padding: .7rem 1.4rem; font-size: 1.05rem; font-weight: 600; }
.button.secondary, button.secondary { background: #fff; color: var(--green-dark); }
.button.secondary:hover, button.secondary:hover { background: #eef6ef; }
.button.small, button.small { padding: .3rem .7rem; font-size: .9rem; }
button.link.danger-link { color: var(--red); }
.receipts { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 1rem; }
.receipt { margin: 0; width: 180px; }
.receipt img { width: 180px; height: 180px; object-fit: cover; border: 1px solid #c9d1cb; border-radius: 6px; background: #fff; }
.receipt-file { display: flex; align-items: center; justify-content: center; width: 180px; height: 180px; border: 1px solid #c9d1cb;
                border-radius: 6px; background: #fff; font-weight: 600; text-decoration: none; }
.receipt figcaption { font-size: .85rem; margin-top: .3rem; overflow-wrap: anywhere; }
.category-totals { width: auto; min-width: 320px; }
.pl td:first-child { white-space: nowrap; }
.pl .total-col { background: #f3f6f4; }
.pl-section td { font-weight: 700; padding-top: 1rem; border-bottom: 0; }
.pl-total td { border-top: 1px solid #1f2421; font-weight: 600; }
.pl-net td { border-top: 2px solid #1f2421; font-weight: 700; font-size: 1.05rem; }
.pl-net.profit td { color: var(--green-dark); }
.pl-net.loss td { color: var(--red); }
.day { background: #fff; border: 1px solid #dfe5e1; border-radius: 8px; padding: .6rem 1rem; margin-bottom: .8rem; }
.day.today { border: 2px solid var(--green); }
.day-head { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; }
.day-head h2 { margin: 0; font-size: 1.1rem; }
.day-head .actions { margin-left: auto; }
.stops { margin: .5rem 0 0; padding-left: 1.6rem; }
.stops li { padding: .45rem 0; border-top: 1px solid #edf1ee; }
.crew-notes { background: #fff8e1; padding: .2rem .5rem; border-radius: 4px; margin-top: .2rem; display: inline-block; }
.to-place { background: #fff8e1; border: 1px solid #f0dca0; border-radius: 8px; padding: .6rem 1rem; margin-bottom: 1rem; }
.to-place h2 { margin: 0 0 .2rem; font-size: 1.1rem; }
.tick-box { display: inline-block; width: 1.1rem; height: 1.1rem; border: 2px solid #1f2421; border-radius: 3px; }
.tick-box.ticked { line-height: .95rem; text-align: center; font-weight: 700; color: var(--green-dark); border-color: var(--green-dark); }   /* already marked done */
.route-sheet td { vertical-align: top; }
.crew-tag { color: #fff; }
.crew-report { background: #e8f1fb; padding: .2rem .5rem; border-radius: 4px; margin-top: .2rem; display: inline-block; }
.visit-actions { margin-top: .3rem; display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.stops li.visit-done { background: #f1f8f1; }
.stops li.visit-skipped { background: #f6f6f6; }
/* My route (crew phone view) */
.route-head h1 { margin: 0; }
.stop-card { background: #fff; border: 1px solid #dfe5e1; border-radius: 10px; padding: .8rem 1rem; margin-bottom: .9rem; }
.stop-card.done { background: #eef7ee; border-color: #b9dcbb; }
.stop-card.skipped { background: #f5f5f5; }
.stop-title { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; font-size: 1.05rem; }
.stop-num { display: inline-flex; align-items: center; justify-content: center; width: 1.8rem; height: 1.8rem; border-radius: 50%; background: var(--green); color: #fff; font-weight: 700; }
.stop-card.done .stop-num { background: #8bb88e; }
.big-tap { padding: .75rem 1.2rem; font-size: 1.05rem; margin: .4rem 0; }
.done-button { min-width: 9rem; }
.stop-actions { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-top: .4rem; }
.skip-form select { padding: .6rem; font-size: 1rem; }
.stop-status { margin-top: .4rem; }
.stop-more { margin-top: .5rem; }
.stop-more textarea { width: 100%; }
.auth-box { max-width: 480px; }
.qr { display: block; margin: .5rem 0; background: #fff; border: 1px solid #dfe5e1; border-radius: 6px; padding: 6px; }
.setup-key { font-size: 1.05rem; letter-spacing: .05em; background: #f3f6f4; padding: .15rem .4rem; border-radius: 4px; }
.mono li { font-family: ui-monospace, Consolas, monospace; font-size: .85rem; overflow-wrap: anywhere; }
.tag-amber { background: #fff1d6; color: #8a5a00; }
.add-box { margin: .5rem 0 1rem; }
.add-box[open] { background: #fafcfa; border: 1px solid #dfe5e1; border-radius: 8px; padding: .6rem .8rem; }
.add-box summary { list-style: none; cursor: pointer; display: inline-block; }
.add-box summary::-webkit-details-marker { display: none; }
.equipment-hours input { max-width: 8rem; }
.move-day { display: inline-block; }
.move-day[open] { display: block; width: 100%; background: #fafcfa; border: 1px solid #dfe5e1; border-radius: 8px; padding: .6rem .8rem; margin: .4rem 0; }
.move-day summary { list-style: none; cursor: pointer; display: inline-block; }
.move-day summary::-webkit-details-marker { display: none; }
.visit-photo { width: 110px; height: 110px; object-fit: cover; border-radius: 6px; margin: .3rem .3rem 0 0; border: 1px solid #c9d1cb; }
button.danger-outline, .button.danger-outline { background: #fff; color: var(--red); border-color: var(--red); }
button.danger-outline:hover, .button.danger-outline:hover { background: #fcebea; }
.status-line { margin: .3rem 0 0; color: var(--muted); }
.sent-list { list-style: none; padding: 0; margin: 0 0 1rem; }
.sent-list li { padding: .45rem 0; border-bottom: 1px solid #e3e8e4; }
.page-foot { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 1rem; margin: 2rem 0 1rem; }
.void-box summary { list-style: none; display: inline-block; cursor: pointer; }
.void-box summary::-webkit-details-marker { display: none; }
.void-box[open] summary { margin-bottom: .75rem; }
.void-box .form { max-width: 480px; }
.draft-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin: 1rem 0 2rem; }
@media (max-width: 600px) {
    .draft-footer { flex-direction: column-reverse; align-items: stretch; }   /* phones: Issue on top, Delete below */
}
.pay-choices { margin: .9rem 0 1.75rem; }

form.inline { display: inline; margin: 0; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; }

/* Forms */
.form { max-width: 640px; }
.field { margin-bottom: 1rem; flex: 1 1 160px; }
.field label { display: block; font-weight: 600; margin-bottom: .25rem; }
.field input[type=text], .field input[type=email], .field input[type=tel], .field input[type=password], .field input[type=number], .field input[type=month], .field input[type=date], .field select, .field textarea {
    width: 100%;
    padding: .5rem .6rem;
    border: 1px solid var(--line);
    border-radius: 6px;
    font: inherit;
    background: #fff;
}
.field.has-error input { border-color: var(--red); }
.field .error { color: var(--red); font-size: .9rem; margin-top: .25rem; }
.field label.check { font-weight: normal; display: flex; align-items: center; gap: .5rem; }
.row { display: flex; flex-wrap: wrap; gap: 0 1rem; }
fieldset { border: 1px solid var(--line); border-radius: 6px; padding: 1rem 1rem 0; margin: 0 0 1rem; }
legend { font-weight: 600; padding: 0 .25rem; }

.filters { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.filters input[type=search], .filters select { padding: .45rem .6rem; border: 1px solid var(--line); border-radius: 6px; font: inherit; }
.filters input[type=search] { flex: 1 1 220px; }

/* Flash messages */
.flash { padding: .65rem .9rem; border-radius: 6px; margin-bottom: 1rem; }
.flash-success { background: #e5f3e6; border: 1px solid #b9dcbb; }
.flash-error { background: #fbe9e8; border: 1px solid #f0c4c1; }

/* Tables */
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: 6px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .6rem .8rem; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: .85rem; color: var(--muted); font-weight: 600; }
tbody tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Detail list */
.details { display: grid; grid-template-columns: 160px 1fr; gap: .5rem 1rem; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 1rem; }
.details dt { color: var(--muted); }
.details dd { margin: 0; }
@media (max-width: 520px) { .details { grid-template-columns: 1fr; } .details dd { margin-bottom: .5rem; } }

.muted { color: var(--muted); }
.field select:disabled, .field input:disabled { background: var(--bg); color: var(--muted); }
.row-actions a { margin-right: .75rem; }
.section-head { margin-top: 2rem; }
h2 { font-size: 1.2rem; margin: 0; }
.tag { display: inline-block; padding: 0 .4rem; border-radius: 4px; background: #e5f3e6; color: var(--green-dark); font-size: .8rem; font-weight: 600; vertical-align: middle; }
.notice { padding: .65rem .9rem; border-radius: 6px; margin-bottom: 1rem; background: #fff8e1; border: 1px solid #f1dfa4; font-size: .9rem; }
td.wrap { white-space: normal; }
.tag-muted { background: #eceff0; color: var(--muted); }
.tag-red { background: #fbe9e8; color: var(--red); }

/* Invoice document */
.invoice-doc { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 1.5rem; margin-bottom: 1.5rem; }
.invoice-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.invoice-from { font-weight: 700; font-size: 1.15rem; }
.invoice-meta { text-align: right; }
.invoice-title { font-size: 1.4rem; font-weight: 700; letter-spacing: .05em; color: var(--green-dark); }
.invoice-bill { margin-bottom: 1.5rem; }
.invoice-doc .table-wrap { border: 0; }
.invoice-totals { width: auto; min-width: 280px; margin: 1rem 0 0 auto; }
.invoice-totals td { border: 0; padding: .25rem .8rem; white-space: normal; }
.invoice-total td { border-top: 2px solid var(--text); font-weight: 700; font-size: 1.1rem; }
.invoice-notes, .invoice-footer { margin-top: 1.5rem; }
.invoice-footer { color: var(--muted); text-align: center; }
.void-form { margin-bottom: 1.5rem; }

@media print {
    .topbar, .no-print, .flash { display: none !important; }
    body { background: #fff; }
    main { max-width: none; padding: 0; }
    .invoice-doc { border: 0; padding: 0; }
}
.month-grid { display: grid; grid-template-columns: repeat(6, minmax(60px, 1fr)); gap: .25rem .75rem; margin-bottom: .5rem; }
@media (max-width: 520px) { .month-grid { grid-template-columns: repeat(4, 1fr); } }
fieldset.has-error { border-color: var(--red); }
fieldset .error { color: var(--red); font-size: .9rem; }
.balance-box { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: .9rem 1rem; margin-bottom: 1rem; }
.balance-amount { font-size: 1.25rem; font-weight: 700; }
td.late { color: var(--red); font-weight: 600; }
tr.muted td { color: var(--muted); }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Mowbill admin's read-only support view: a red bar on every page */
.support-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem;
    padding: 0.5rem 1rem; background: #b3261e; color: #fff; }
.support-bar button { background: #fff; color: #b3261e; border-color: #fff; }
.support-bar button:hover { background: #fcebea; }
.flash-warning { background: #fff6dd; border: 1px solid #f0dc9c; }

/* Footer with the legal links, and the legal pages */
.site-footer { max-width: 1100px; margin: 2rem auto 1rem; padding: 0 1rem; font-size: .85rem; color: var(--muted); }
.site-footer a { color: var(--muted); }
.legal { max-width: 46rem; line-height: 1.55; }
.legal h2 { font-size: 1.1rem; margin-top: 1.6rem; }
label.check { display: flex; gap: .5rem; align-items: flex-start; font-weight: normal; }
label.check input { margin-top: .25rem; }
.back-link { margin: -.5rem 0 .75rem; font-size: .9rem; }
.back-link a { text-decoration: none; }

/* Home page */
.home-card { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 1rem 1.2rem; margin-bottom: 1rem; }
.home-card h2 { font-size: 1.05rem; margin: 0 0 .6rem; }
.home-card .card-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .5rem; }
.attention { list-style: none; margin: 0; padding: 0; }
.attention li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .25rem 1rem; padding: .5rem 0 .5rem .8rem;
    border-top: 1px solid var(--line); border-left: 3px solid #e0a800; }
.attention li:first-child { border-top: 0; }
.attention a { white-space: nowrap; }
.all-clear { margin: 0; color: var(--green-dark); font-weight: 600; }
.crew-progress { list-style: none; margin: 0; padding: 0; }
.crew-progress li { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; padding: .35rem 0; }
.progress { display: inline-block; width: 9rem; height: .55rem; background: #eceff0; border-radius: 4px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--green); }
.money-table td, .money-table th { padding: .35rem .5rem; }
.small-print { font-size: .85rem; margin: .5rem 0 0; }
.record-payment { margin-top: .9rem; }
.record-payment select { max-width: 16rem; }
.recent-payments { list-style: none; margin: 0; padding: 0; }
.recent-payments li { display: flex; flex-wrap: wrap; gap: .4rem .9rem; padding: .35rem 0; border-top: 1px solid var(--line); }
.recent-payments li:first-child { border-top: 0; }
.recent-payments .num { margin-left: auto; }
