/* 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); }

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; }

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; }
