/* Abitus Costing Tool: login and project list. Colours match the original Costing Tool. */
:root {
  --bg: #f6f7f9; --surface: #ffffff; --surface-2: #f2f3f6;
  --border: #e3e5ea; --border-strong: #cbced8;
  --text: #1a1d29; --text-2: #5b6072; --text-3: #8b8f9e;
  --accent: #02237b; --accent-bg: #eef0f9;
  --orange: #fa8537; --orange-dark: #e06b1f;
  --green: #1f8a4c; --green-bg: #e8f6ec;
  --amber: #a15c00; --amber-bg: #fdf1de;
  --red: #c62828; --red-bg: #fceceb;
  --radius: 8px;
  --shadow-md: 0 4px 16px rgba(16, 20, 40, .08);
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; background: var(--bg); color: var(--text); }
h1 { font-size: 22px; margin: 0 0 12px; }
a { color: var(--accent); }
button, .button {
  font: inherit; font-size: 14px; padding: 8px 14px; border-radius: var(--radius); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none; display: inline-block; line-height: 1.3;
}
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.link { border: none; background: none; color: var(--accent); padding: 4px 0; text-decoration: underline; }
button:disabled { opacity: .6; cursor: default; }
input { font: inherit; padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); color: var(--text); width: 100%; }
input:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--orange); outline-offset: 1px; }
.hint { color: var(--text-2); font-size: 13px; }
.loading { text-align: center; margin-top: 20vh; }
.muted { color: var(--text-3); }
.form-error { color: var(--red); background: var(--red-bg); border-radius: var(--radius); padding: 8px 10px; margin: 0; font-size: 14px; }

/* Sign-in */
.auth-card { max-width: 420px; margin: 10vh auto; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 28px; box-shadow: var(--shadow-md); }
.brand { font-weight: 700; color: var(--accent); letter-spacing: .01em; margin-bottom: 18px; }
.auth-card .brand { border-bottom: 3px solid var(--orange); padding-bottom: 10px; }
.stack { display: grid; gap: 12px; }
.stack label { display: grid; gap: 4px; font-size: 13px; color: var(--text-2); }
.steps { padding-left: 20px; display: grid; gap: 10px; }
.qr { margin: 10px 0; }
.qr img { width: 180px; height: 180px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 6px; }
.secret { display: block; word-break: break-all; background: var(--surface-2); padding: 8px; border-radius: var(--radius); font-size: 13px; }

/* App pages */
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 20px; background: var(--surface); border-bottom: 3px solid var(--orange); }
.topbar .brand { margin: 0; }
.who { display: flex; gap: 12px; align-items: center; font-size: 14px; color: var(--text-2); }
.page { max-width: 1400px; margin: 0 auto; padding: 20px; }
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.page-head h1 { margin: 0; }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.actions input { width: 280px; max-width: 100%; }
.segmented { display: inline-flex; }
.segmented button { border-radius: 0; margin-left: -1px; }
.segmented button:first-child { border-radius: 8px 0 0 8px; margin-left: 0; }
.segmented button:last-child { border-radius: 0 8px 8px 0; }
.segmented button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; position: relative; }
.empty { background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius); padding: 24px; text-align: center; color: var(--text-2); }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
table.projects { border-collapse: collapse; width: 100%; font-size: 14px; }
.projects th, .projects td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.projects th { background: var(--surface-2); font-weight: 600; color: var(--text-2); font-size: 12.5px; }
.projects td.desc { white-space: normal; min-width: 220px; }
.projects .num { text-align: right; font-variant-numeric: tabular-nums; }
.projects tbody tr { cursor: pointer; }
.projects tbody tr:hover { background: var(--accent-bg); }
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--text-2); }
.pill.approved { background: var(--green-bg); color: var(--green); }
.pill.draft { background: var(--accent-bg); color: var(--accent); }
.pill.superseded { background: var(--surface-2); color: var(--text-3); }
.pill.review { background: var(--amber-bg); color: var(--amber); }

/* Header navigation */
.mainnav { display: flex; gap: 4px; margin-right: auto; margin-left: 24px; }
.mainnav a { padding: 6px 12px; border-radius: var(--radius); color: var(--text-2); text-decoration: none; font-size: 14px; font-weight: 600; }
.mainnav a:hover { background: var(--surface-2); color: var(--text); }
.mainnav a[aria-current] { background: var(--accent-bg); color: var(--accent); }

/* Admin */
h2 { font-size: 17px; margin: 0 0 10px; }
select { font: inherit; font-size: 14px; padding: 7px 8px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); color: var(--text); }
button.small { font-size: 13px; padding: 4px 10px; }
button.danger { color: var(--red); border-color: #e9b4b1; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tabs a { padding: 8px 14px; color: var(--text-2); text-decoration: none; font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs a[aria-current] { color: var(--accent); border-bottom-color: var(--orange); }
.notice { border-radius: var(--radius); padding: 9px 12px; margin-bottom: 12px; font-size: 14px; }
.notice.ok { background: var(--green-bg); color: var(--green); }
.notice.error { background: var(--red-bg); color: var(--red); }
.section-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 12px; }
.section-head .hint { margin: 0; max-width: 820px; }
.panel, .result-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 14px; }
.result-card { border-left: 4px solid var(--green); }
.result-card dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 12px 0; }
.result-card dt { color: var(--text-2); font-size: 13px; }
.result-card dd { margin: 0; }
.result-card code { font-size: 17px; letter-spacing: .04em; background: var(--surface-2); padding: 3px 8px; border-radius: 6px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 10px; }
.form-grid label { display: grid; gap: 4px; font-size: 13px; color: var(--text-2); }
table.grid { border-collapse: collapse; width: 100%; font-size: 14px; }
.grid th, .grid td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.grid thead th { background: var(--surface-2); font-weight: 600; color: var(--text-2); font-size: 12.5px; white-space: nowrap; }
.grid tbody th { font-weight: 600; white-space: nowrap; }
.grid .hint { font-size: 12px; margin-top: 2px; }
.grid input.cell { min-width: 140px; padding: 6px 8px; }
.grid .email { white-space: nowrap; }
.grid .email { color: var(--text-2); }
.grid .nowrap { white-space: nowrap; }
.grid .row-actions .btns { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; min-width: 150px; }
.grid .row-actions button { white-space: nowrap; }
.people tr.inactive td { background: var(--surface-2); }
.people tr.inactive input, .people tr.inactive select { color: var(--text-3); }
.perms td, .perms thead th + th { text-align: center; }
.perms select { min-width: 84px; }
.perms select.access-full { background: var(--green-bg); border-color: #b5dcc3; }
.perms select.access-view { background: var(--accent-bg); border-color: #c7cde8; }
.perms select.access-none { color: var(--text-3); }

@media (max-width: 640px) {
  .mainnav { margin-left: 8px; }
  .section-head { flex-direction: column; }
  .auth-card { margin: 16px; padding: 20px; }
  .page { padding: 16px; }
  .topbar { padding: 10px 16px; }
}
