:root {
  --brand: #353936;        /* OneQ charcoal */
  --accent: #B78D4B;       /* OneQ gold */
  --brand-tint: #f1efe9;   /* warm light grey */
  --ink: #2b2f2e;
  --muted: #6b6f6d;
  --line: #e4e6e4;
  --bg: #f6f6f4;
  --danger: #b42318;
  --ok: #067647;
  --radius: 10px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.45;
}

/* ---------- top nav ---------- */
.nav {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.18);
}
.nav-inner {
  max-width: 1120px; margin: 0 auto; padding: 0 20px;
  display: flex; align-items: center; gap: 6px; height: 56px;
}
.nav .brand {
  font-weight: 700; font-size: 18px; letter-spacing: .2px;
  margin-right: 18px; display: flex; align-items: center; gap: 10px;
  color: #fff; text-decoration: none;
}
.nav .brand img { height: 26px; width: auto; display: block; }
.nav a.link {
  color: rgba(255,255,255,.85); text-decoration: none;
  padding: 8px 12px; border-radius: 8px; font-weight: 500;
}
.nav a.link:hover { background: rgba(255,255,255,.12); color: #fff; }
.nav a.link.active { background: rgba(255,255,255,.14); color: #fff; box-shadow: inset 0 -3px 0 var(--accent); }
.nav .spacer { flex: 1; }

/* ---------- layout ---------- */
.wrap { max-width: 1120px; margin: 26px auto; padding: 0 20px; }
h1 { font-size: 24px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 0 0 14px; }
.subtitle { color: var(--muted); margin: 0 0 22px; }

.card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; margin-bottom: 20px; box-shadow: 0 1px 2px rgba(16,24,40,.04);
}
.card h2 { border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
@media (max-width: 720px) { .grid2, .grid3 { grid-template-columns: 1fr; } }

/* ---------- forms ---------- */
label { display: block; font-weight: 600; font-size: 13px; margin: 0 0 5px; color: #374151; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=color], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid #d0d5dd; border-radius: 8px;
  font: inherit; color: var(--ink); background: #fff;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint);
}
input[type=color] { padding: 4px; height: 40px; }
.field { margin-bottom: 14px; }
.row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.row .field { flex: 1; min-width: 120px; margin-bottom: 0; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  border: 1px solid transparent; border-radius: 8px; padding: 9px 16px;
  font: inherit; font-weight: 600; text-decoration: none; color: #fff;
  background: var(--brand);
}
.btn:hover { filter: brightness(1.08); }
.btn.secondary { background: #fff; color: var(--ink); border-color: #d0d5dd; }
.btn.secondary:hover { background: #f9fafb; filter: none; }
.btn.ghost { background: transparent; color: var(--muted); border-color: transparent; padding: 6px 10px; }
.btn.ghost:hover { color: var(--danger); background: #fef3f2; }
.btn.lg { padding: 12px 22px; font-size: 16px; }
.btn.block { width: 100%; justify-content: center; }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; }
.tbl-wrap { overflow-x: auto; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { background: var(--brand-tint); color: #344054; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
tbody tr:hover { background: #fafbfc; }
td.num, th.num { text-align: right; }
.muted { color: var(--muted); }
/* Category section header inside the quote line-item table. */
tr.group-row td {
  background: var(--brand-tint); color: var(--brand);
  font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .5px;
  border-bottom: 1px solid var(--line); border-top: 2px solid var(--brand);
}
tr.group-row .group-count { font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--muted); }
tr.group-row .group-subtotal { float: right; font-variant-numeric: tabular-nums; text-transform: none; }

.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #f3ecdd; color: #8a6a2f; }

/* ---------- alerts ---------- */
.alert { padding: 11px 14px; border-radius: 8px; margin-bottom: 16px; font-weight: 500; }
.alert.err { background: #fef3f2; color: var(--danger); border: 1px solid #fecdca; }
.alert.ok  { background: #ecfdf3; color: var(--ok); border: 1px solid #abefc6; }
.alert.info{ background: #eff8ff; color: #175cd3; border: 1px solid #b2ddff; }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: var(--brand); }
.login-card { background: #fff; width: 360px; max-width: 92vw; border-radius: 14px; padding: 30px 28px; box-shadow: 0 12px 40px rgba(0,0,0,.25); }
.login-card h1 { text-align: center; margin-bottom: 20px; color: var(--brand); }

/* ---------- misc ---------- */
.stat { font-size: 30px; font-weight: 700; color: var(--accent); }
.stat-label { color: var(--muted); font-size: 13px; }
.actions { display: flex; gap: 8px; }
.inline-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
details.editor { margin: 0; }
details.editor > summary { cursor: pointer; color: var(--brand); font-weight: 600; font-size: 13px; list-style: none; }
details.editor > summary::-webkit-details-marker { display: none; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
