/* Novera CRM — single stylesheet, no framework, no inline styles (CSP: style-src 'self'). */
:root {
  --ink: #1b1f24; --muted: #5c6670; --line: #d9dee3; --bg: #f6f7f9; --panel: #ffffff;
  --brand: #1f3864; --brand-2: #2f5496; --accent: #0b6e4f; --warn: #8a5a00; --danger: #a12d2d;
  --radius: 6px; --font: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html { font-size: 15px; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg); line-height: 1.45; }
a { color: var(--brand-2); }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0 0 .75rem; color: var(--brand); }
h2 { font-size: 1.15rem; margin: 1.5rem 0 .5rem; color: var(--brand); }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; }
small, .muted { color: var(--muted); }

/* Layout */
.topbar { background: var(--brand); color: #fff; padding: 0 1rem; display: flex; align-items: center; gap: 1rem; height: 52px; }
.topbar .brand { font-weight: 700; color: #fff; text-decoration: none; letter-spacing: .01em; display: inline-flex; align-items: center; gap: .5rem; }
.topbar .logo-icon { height: 28px; width: auto; }
.topbar .logo-wordmark { height: 15px; width: auto; }
.topbar .logo-suffix { font-size: .95rem; font-weight: 600; color: #dfe6f3; letter-spacing: .06em; }
h1.login-logo { display: flex; align-items: center; gap: .6rem; }
h1.login-logo .logo-icon { height: 34px; width: auto; }
h1.login-logo .logo-wordmark { height: 22px; width: auto; }
h1.login-logo .logo-suffix { font-size: 1.1rem; font-weight: 600; letter-spacing: .06em; color: var(--brand-2); }
.topbar nav a { color: #dfe6f3; text-decoration: none; margin-right: .65rem; font-size: .9rem; white-space: nowrap; }
.topbar nav a:hover, .topbar nav a.active { color: #fff; text-decoration: underline; }
.topbar form.search { margin-left: auto; display: flex; gap: .4rem; }
.topbar form.search input { width: 150px; }
.topbar .user { color: #dfe6f3; font-size: .85rem; display: flex; align-items: center; gap: .5rem; white-space: nowrap; }
.topbar .user button { background: transparent; border: 1px solid #9fb0d0; color: #fff; }
.topbar .avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex: none; background: #dfe6f3; }
.topbar .avatar.initials { display: inline-flex; align-items: center; justify-content: center; font-size: .7rem; font-weight: 700; color: var(--brand); letter-spacing: .02em; }
main { max-width: 1180px; margin: 0 auto; padding: 1.25rem; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: 1rem; overflow-x: auto; }
form .row { display: flex; flex-wrap: wrap; gap: .75rem; }
form .row > div { flex: 1 1 180px; margin-bottom: .25rem; }
.grid { display: grid; gap: 1rem; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(470px, 1fr)); }
.grid.four { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; }
.stat .n { font-size: 1.6rem; font-weight: 700; color: var(--brand); display: block; }
.stat .l { color: var(--muted); font-size: .85rem; }
.toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: .75rem; }
.toolbar .spacer { flex: 1; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
footer.site { text-align: center; color: var(--muted); font-size: .8rem; padding: 1.5rem; }

/* Tables */
table { width: 100%; border-collapse: collapse; background: var(--panel); }
th, td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #eef2f7; font-weight: 600; font-size: .85rem; color: #33404d; }
tr:hover td { background: #fafbfc; }
td.num, th.num { text-align: right; white-space: nowrap; }
.table-wrap { overflow-x: auto; }

/* Forms */
form div { margin-bottom: .75rem; }
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .2rem; }
input[type=text], input[type=email], input[type=url], input[type=number], input[type=date], input[type=datetime-local], input[type=search], select, textarea {
  width: 100%; padding: .45rem .55rem; border: 1px solid #b9c2cc; border-radius: 4px; font: inherit; background: #fff;
}
textarea { min-height: 6rem; }
input[type=checkbox] { width: auto; margin-right: .4rem; }
.helptext { display: block; color: var(--muted); font-size: .82rem; margin-top: .2rem; }
.errorlist { color: var(--danger); margin: .2rem 0 0; padding-left: 1.1rem; font-size: .9rem; }
.errorlist.nonfield { margin-bottom: .75rem; }
form.inline { display: inline; }
form.inline div { display: inline; margin: 0; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem 1rem; margin: 0 0 1rem; }
legend { font-weight: 600; color: var(--brand); padding: 0 .3rem; }

/* Buttons */
button, .btn { display: inline-block; padding: .45rem .85rem; border-radius: 4px; border: 1px solid var(--brand-2); background: var(--brand-2); color: #fff; font: inherit; cursor: pointer; text-decoration: none; line-height: 1.2; }
button:hover, .btn:hover { background: var(--brand); text-decoration: none; }
.btn.secondary, button.secondary { background: #fff; color: var(--brand-2); }
.btn.danger, button.danger { background: #fff; color: var(--danger); border-color: var(--danger); }
.btn.danger:hover, button.danger:hover { background: var(--danger); color: #fff; }
.btn.small, button.small { padding: .25rem .55rem; font-size: .85rem; }
button:disabled, .btn.disabled { opacity: .5; cursor: not-allowed; }

/* Badges and messages */
.badge { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .78rem; font-weight: 600; background: #e6ebf2; color: #33404d; white-space: nowrap; }
.badge.ok { background: #e2f3ec; color: var(--accent); }
.badge.warn { background: #fff2d9; color: var(--warn); }
.badge.bad { background: #f9e3e3; color: var(--danger); }
.badge.info { background: #e3ecfa; color: var(--brand-2); }
.messages { list-style: none; padding: 0; margin: 0 0 1rem; }
.messages li { padding: .6rem .9rem; border-radius: var(--radius); margin-bottom: .5rem; border: 1px solid; }
.messages .success { background: #e2f3ec; border-color: #9fd5bd; color: #114b35; }
.messages .info { background: #e3ecfa; border-color: #b7c9ea; color: #1b3a6b; }
.messages .warning { background: #fff2d9; border-color: #f0d18f; color: #5b3d00; }
.messages .error { background: #f9e3e3; border-color: #e5a9a9; color: #5f1b1b; }
.notice { border-left: 4px solid var(--warn); background: #fff8e8; padding: .6rem .9rem; margin-bottom: 1rem; font-size: .92rem; }
.notice.privacy { border-color: var(--brand-2); background: #eef3fb; }
.notice.danger { border-color: var(--danger); background: #fdf1f1; }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; margin: 0; }
dl.kv dt { color: var(--muted); font-size: .88rem; }
dl.kv dd { margin: 0; }
.pipeline { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: .75rem; }
.pipeline .col { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem; }
.pipeline .col h3 { margin: 0 0 .4rem; font-size: .95rem; display: flex; justify-content: space-between; }
.pipeline .card { border: 1px solid var(--line); border-radius: 4px; padding: .45rem .55rem; margin-bottom: .45rem; background: #fbfcfd; font-size: .9rem; }
.pagination { display: flex; gap: .6rem; align-items: center; margin-top: .75rem; font-size: .9rem; }
.login-box { max-width: 420px; margin: 4rem auto; text-align: center; }
.login-box .btn { width: 100%; padding: .7rem; font-size: 1rem; }
pre.wrap { white-space: pre-wrap; word-break: break-word; background: #f3f5f7; padding: .6rem; border-radius: 4px; font-size: .85rem; }
.public { max-width: 560px; margin: 3rem auto; }
/* Timesheet grid */
table.grid td, table.grid th { padding: .3rem .35rem; }
table.grid input.hours { width: 4.4rem; text-align: right; padding: .3rem .35rem; }
table.grid select { min-width: 14rem; }
table.grid input[type=text] { min-width: 12rem; }
table.grid textarea.description { min-width: 24rem; min-height: 5.1rem; padding: .35rem .45rem; resize: vertical; line-height: 1.3; }  /* v0.5.1: half as tall again */
table.grid td.num input[type=checkbox] { margin: .5rem auto; display: block; }
/* Customisation (v0.3) */
label.flag { display: inline-block; margin-right: .8rem; font-weight: normal; white-space: nowrap; }
table.grid input.narrow { width: 4rem; text-align: right; }
tr.muted td { color: var(--muted); }

/* Organisation form: street-address typeahead (static/js/address-lookup.js) */
.address-suggest { list-style: none; margin: .15rem 0 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); max-width: 640px; box-shadow: 0 4px 12px rgba(0, 0, 0, .08); position: relative; z-index: 5; }
.address-suggest li[role="option"] { padding: .4rem .6rem; cursor: pointer; }
.address-suggest li[role="option"]:hover, .address-suggest li[aria-selected="true"] { background: #eef2f8; }
.address-suggest li.hint { font-size: .8rem; color: var(--muted); padding: .3rem .6rem; border-top: 1px solid var(--line); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
