/* pianodb — mobile-first, hand-rolled. */
:root {
  --brand: #4a3728;          /* piano rosewood */
  --brand-hover: #6b4f38;
  --accent: #b5651d;
  --bg: #fff;
  --text: #222;
  --muted: #666;
  --line: #ddd;
  --soft: #f6f4f1;
  --ok: #2e7d32;
  --warn: #b5651d;
  --bad: #c62828;
}
* { box-sizing: border-box; }
body {
  font-family: Helvetica, Arial, sans-serif;
  color: var(--text); background: var(--bg); margin: 0; font-size: 16px;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.site-header {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 8px 12px; border-bottom: 3px solid var(--brand); background: var(--soft);
}
.brand { font-weight: bold; color: var(--brand); font-size: 1.1em; }
.site-nav { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; flex: 1; }
.site-nav a {
  color: var(--brand); font-weight: 600; padding: 6px 9px; border-radius: 7px;
  font-size: 0.95em;
}
.site-nav a.active, .site-nav a:hover { background: var(--brand); color: #fff; text-decoration: none; }
.nav-spacer { flex: 1; }

main { padding: 12px; max-width: 950px; margin: 0 auto; }
h2 { margin-top: 6px; color: var(--brand); }
h3 { color: var(--brand); margin-bottom: 6px; }
small, .muted { color: var(--muted); }

.flash {
  background: #fff8e1; border: 1px solid var(--accent); border-radius: 8px;
  padding: 8px 12px; margin: 8px 0; word-break: break-word;
}

/* buttons */
.btn, button, input[type=submit] {
  display: inline-flex; justify-content: center; align-items: center;
  min-height: 44px; padding: 6px 16px; border-radius: 8px; cursor: pointer;
  background: var(--brand); color: #fff; border: none; font-size: 1em; font-weight: 600;
}
.btn:hover, button:hover { background: var(--brand-hover); text-decoration: none; color: #fff; }
.btn.secondary { background: #eee; color: var(--text); }
.btn.secondary:hover { background: #ddd; }
.btn.danger { background: var(--bad); }
.btn.small { min-height: 34px; padding: 3px 10px; font-size: 0.85em; }
.inline { display: inline; }

/* forms */
label { display: block; margin: 10px 0 3px; font-weight: 600; font-size: 0.9em; }
input[type=text], input[type=password], input[type=email], input[type=date],
input[type=time], input[type=number], input[type=search], select, textarea {
  width: 100%; max-width: 480px; padding: 9px; font-size: 1em;
  border: 1px solid var(--line); border-radius: 7px;
}
textarea { min-height: 80px; }
input[type=checkbox] { width: auto; min-height: auto; transform: scale(1.3); margin-right: 6px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > div { flex: 1; min-width: 140px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; align-items: center; }

/* tables */
table { border-collapse: collapse; width: 100%; margin: 8px 0; }
th, td { text-align: left; padding: 7px 9px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--soft); color: var(--brand); font-size: 0.85em; }
tr:hover td { background: #fafafa; }
.right { text-align: right; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* cards */
.card { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin: 10px 0; }
.card h3 { margin-top: 0; }

/* badges */
.badge { display: inline-block; padding: 1px 8px; border-radius: 20px; font-size: 0.75em;
  font-weight: 700; color: #fff; }
.badge.forsale { background: var(--ok); }
.badge.condemned { background: var(--bad); }
.badge.draft { background: #888; }
.badge.issued { background: var(--accent); }
.badge.paid { background: var(--ok); }
.badge.cancelled { background: var(--bad); }
.badge.due { background: var(--warn); }

/* dashboard tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.tile { border: 1px solid var(--line); border-radius: 10px; padding: 12px; text-align: center; }
.tile .n { font-size: 1.8em; font-weight: 800; color: var(--brand); display: block; }
.tile a { display: block; }

.thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.thumbs img { height: 90px; border-radius: 6px; border: 1px solid var(--line); object-fit: cover; }

.autocomplete-list { border: 1px solid var(--line); border-radius: 7px; background: #fff;
  position: absolute; z-index: 20; max-height: 220px; overflow-y: auto; max-width: 480px; width: 100%; }
.autocomplete-list div { padding: 8px; cursor: pointer; }
.autocomplete-list div:hover, .autocomplete-list div.sel { background: var(--soft); }
.ac-wrap { position: relative; }

/* print view */
@media print {
  .site-header, .noprint { display: none !important; }
  main { max-width: none; }
}
.invoice-box { max-width: 720px; }
.invoice-box .head { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.totals { max-width: 320px; margin-left: auto; }
