/* Colours taken from the ECS logo: the deep green-black of "ECS", the tagline/water-drop
   blue, and the leaf green of the wing. */
:root {
  --brand-dark: #1c2618;
  --brand-blue: #1a7db5;
  --brand-green: #5aa232;
  --brand-leaf: #8cc63f;
  --brand-gradient: linear-gradient(90deg, #a6d07a 0%, #5aa232 30%, #2a9fd6 68%, #1a6e9e 100%);
  --bg: #f3f6f2;
  --surface: #ffffff;
  --text: #1c2a20;
  --muted: #5f6b62;
  --border: #dde5db;
  --primary: var(--brand-blue);
  --primary-hover: #14668f;
  --primary-soft: #e3f1f9;
  --danger: #c4322b;
  --danger-soft: #fdecea;
  --success: #3b8a26;
  --success-soft: #e8f4df;
  --warn: #9a6100;
  --warn-soft: #fff4dd;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: 0 0 1rem; color: var(--brand-dark); }
h2 { font-size: 1.1rem; margin: 0 0 0.75rem; color: var(--brand-dark); }
h3 { font-size: 0.95rem; margin: 1.25rem 0 0.5rem; }
code { background: var(--bg); padding: 1px 4px; border-radius: 4px; font-size: 0.85em; }

/* Top bar */
.topbar { background: #fff; color: var(--text); position: sticky; top: 0; z-index: 10; border-bottom: 1px solid var(--border); box-shadow: 0 1px 3px rgba(28, 38, 24, 0.06); }
.topbar::before { content: ''; display: block; height: 4px; background: var(--brand-gradient); }
.topbar-inner { max-width: 1600px; margin: 0 auto; padding: 4px 20px; display: flex; align-items: center; gap: 16px; min-height: 62px; }
.brand { display: flex; align-items: center; gap: 10px; white-space: nowrap; color: var(--brand-dark); font-weight: 700; }
.brand:hover { text-decoration: none; }
.brand img { height: 38px; width: auto; display: block; }
.brand-name { font-size: 0.85rem; color: var(--muted); font-weight: 600; padding-left: 10px; border-left: 1px solid var(--border); }
/* The menu wraps onto another line rather than hiding items when the window is narrow. */
.mainnav { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px; flex: 1; min-width: 0; }
.nav-menu { position: relative; }
.nav-menu summary { list-style: none; cursor: pointer; color: #3a4a3e; padding: 8px 10px; border-radius: 6px; white-space: nowrap; font-size: 0.93rem; font-weight: 500; }
/* Admin: a small menu under the signed-in user's name */
.admin-menu summary { padding: 1px 6px; font-size: 0.78rem; font-weight: 600; color: var(--muted); letter-spacing: 0.02em; }
.admin-menu .nav-menu-list a { color: #3a4a3e; padding: 8px 10px; border-radius: 6px; font-weight: 500; }
.admin-menu .nav-menu-list a:hover { background: #eef4ec; text-decoration: none; }
.admin-menu .nav-menu-list a.active { background: var(--primary-soft); color: var(--primary); }
.nav-menu summary::-webkit-details-marker { display: none; }
.nav-menu summary::after { content: '▾'; margin-left: 4px; font-size: 0.8em; color: var(--muted); }
.nav-menu summary:hover, .nav-menu[open] summary { background: #eef4ec; color: var(--brand-dark); }
.nav-menu summary.active { background: var(--primary-soft); color: var(--primary); }
.nav-menu-list { position: absolute; top: calc(100% + 4px); right: 0; z-index: 30; min-width: 220px; background: #fff; border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(28, 38, 24, 0.14); padding: 6px; display: flex; flex-direction: column; }
.mainnav a { color: #3a4a3e; padding: 9px 12px; border-radius: 7px; white-space: nowrap; font-size: 0.98rem; font-weight: 500; }
.mainnav a:hover { background: #eef4ec; color: var(--brand-dark); text-decoration: none; }
.mainnav a.active { background: var(--primary-soft); color: var(--primary); }
.navsep { width: 1px; background: var(--border); margin: 8px 6px; flex: none; }
.count { background: #e5484d; color: #fff; border-radius: 999px; padding: 0 7px; font-size: 0.75rem; margin-left: 2px; }
.usermenu { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; white-space: nowrap; }
.usermenu-row { display: flex; align-items: center; gap: 12px; }
.usermenu a { color: var(--brand-dark); font-weight: 500; }
.usermenu form { margin: 0; }
.linklike { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; padding: 0; }
.linklike:hover { color: var(--brand-dark); text-decoration: underline; }

.container { max-width: 1280px; margin: 0 auto; padding: 24px 16px 48px; }

/* Layout */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head h1 { margin-bottom: 0.25rem; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions form { margin: 0; }
.grid { display: grid; gap: 16px; margin-bottom: 16px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.two.wide-right { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid > .card { margin-bottom: 0; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card.narrow { max-width: 720px; }
/* Sign-in / first-time setup: brand panel beside the form */
body.auth-page { background: #fff; }
.auth-main { display: block; }
.auth-main > .flash { margin: 12px; }
.auth-layout { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); min-height: 100vh; }
.auth-hero {
  position: relative; overflow: hidden; color: #e7f0e9;
  padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between; gap: 32px;
  background:
    radial-gradient(circle at 15% 85%, rgba(140, 198, 63, 0.28), transparent 45%),
    radial-gradient(circle at 90% 10%, rgba(42, 159, 214, 0.30), transparent 50%),
    linear-gradient(140deg, #10241a 0%, #173b29 45%, #0f4560 100%);
}
.auth-hero::after {
  content: ''; position: absolute; right: -120px; bottom: -160px; width: 460px; height: 460px; border-radius: 50%;
  border: 40px solid rgba(255, 255, 255, 0.04); pointer-events: none;
}
.auth-hero-top img { width: min(440px, 85%); height: auto; display: block; filter: drop-shadow(0 4px 18px rgba(0, 0, 0, 0.25)); }
.auth-hero-copy h2 { color: #fff; font-size: 2rem; margin: 0 0 6px; letter-spacing: 0.01em; }
.auth-hero-copy > p { margin: 0 0 24px; font-size: 1.05rem; color: #c9dccd; }
.auth-features { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; max-width: 460px; }
.auth-features li { display: flex; gap: 12px; align-items: flex-start; }
.auth-features svg { flex: none; width: 34px; height: 34px; padding: 7px; border-radius: 9px; background: rgba(140, 198, 63, 0.16); stroke: #a6d07a; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.auth-features strong { color: #fff; }
.auth-hero-foot { margin: 0; font-size: 0.8rem; color: #8fa596; }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 48px 24px; position: relative; }
.auth-panel::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: var(--brand-gradient); }
.auth-form-wrap { width: 100%; max-width: 380px; }
.auth-form-wrap h1 { font-size: 1.75rem; margin-bottom: 4px; }
.auth-form-wrap > .muted { margin: 0 0 22px; }
.auth-form-wrap input { padding: 10px 12px; }
.auth-help { margin-top: 18px; }
.auth-mobile-logo { display: none; }
.btn-block { width: 100%; padding: 11px 14px; font-size: 1rem; }
.section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.75rem; }
.section-head h2 { margin: 0; }
.crumbs { margin: 0 0 4px; font-size: 0.85rem; color: var(--muted); }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.stat-label { font-size: 0.82rem; color: var(--muted); }
.stat-value { font-size: 1.9rem; font-weight: 700; line-height: 1.2; }
.stat-sub { font-size: 0.82rem; color: var(--muted); }

/* Forms */
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > label, .row > div { flex: 1 1 180px; }
.stack.tight { gap: 6px; }
fieldset.pick-list { flex: 1 1 220px; border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
fieldset.pick-list legend { font-weight: 500; font-size: 0.9rem; padding: 0; margin-bottom: 4px; }
.pick-list-items { border: 1px solid #cfd4dc; border-radius: 7px; padding: 6px 10px; max-height: 168px; overflow-y: auto; background: #fff; }
.pick-list-items label.check { padding: 3px 0; }
input[readonly] { background: #f0f2f5; color: var(--muted); }
.row > label.grow { flex: 3 1 260px; }
.row > label.task-no { flex: 0 1 130px; }
.task-no-tag { color: var(--muted); font-weight: 600; margin-right: 2px; white-space: nowrap; }
/* Label text flows inline (so "(optional)" stays beside it); the control inside drops to its own line. */
label { display: block; font-weight: 500; font-size: 0.9rem; }
label > input:not([type=checkbox]):not([type=radio]), label > select, label > textarea, label > .hint, label > details { display: block; margin-top: 4px; }
label.check { display: flex; flex-direction: row; align-items: center; gap: 8px; font-weight: 400; }
input, select, textarea { font: inherit; padding: 8px 10px; border: 1px solid #cfd4dc; border-radius: 7px; background: #fff; color: var(--text); width: 100%; }
input[type=checkbox] { width: auto; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }
.hint { font-size: 0.8rem; color: var(--muted); font-weight: 400; margin: 0; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; align-items: flex-end; }
.filters input[type=search] { max-width: 260px; }
.filters select, .filters label { width: auto; }
.filters label { display: flex; flex-direction: row; align-items: center; gap: 6px; }
.filters label > input:not([type=checkbox]), .filters label > select { margin-top: 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 7px; border: 1px solid #cfd4dc; background: #fff; color: var(--text); font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; }
.btn:hover { background: #f0f2f5; text-decoration: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); }
.btn.danger { background: #fff; border-color: #efb7b3; color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.small { padding: 4px 10px; font-size: 0.85rem; }
.danger-zone { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }

/* Messages */
.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; border: 1px solid transparent; }
.flash ul { margin: 0; padding-left: 18px; }
.flash-success { background: var(--success-soft); border-color: #c4e2b0; color: #2f6f1e; }
.flash-error { background: var(--danger-soft); border-color: #f2c2be; color: var(--danger); }
.flash-info { background: var(--primary-soft); border-color: #b9dcef; color: #135a83; }

/* Tables and lists */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 0.8rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.02em; }
tr:last-child td { border-bottom: 0; }
tr.inactive td { opacity: 0.6; }
.num { text-align: right; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.code-col { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--muted); width: 1%; }
th.sortable a { color: inherit; display: inline-flex; gap: 4px; align-items: center; }
th.sortable a:hover { color: var(--primary); text-decoration: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.right { text-align: right; }
td form { margin: 0; display: inline; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: 0; }
.list.compact li { padding: 6px 0; }
/* Dashboard "My open tasks": project heading, its tasks below; lines only between projects */
.list.task-groups > li { display: block; padding: 10px 0; }
.tg-project { display: inline-flex; align-items: baseline; gap: 6px; color: var(--brand-dark); }
.tg-project:hover { color: var(--primary); }
.tg-code { font-variant-numeric: tabular-nums; color: var(--muted, #5f6b5a); font-weight: 600; white-space: nowrap; }
.tg-tasks { list-style: none; margin: 4px 0 0; padding: 0 0 0 14px; border-left: 2px solid #e3ecdf; }
.tg-tasks li { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 3px 0 3px 8px; border: 0; }
.tg-task { min-width: 0; }
.tg-tasks li > span:last-child { white-space: nowrap; }
.list.tasks li { align-items: center; gap: 10px; padding: 4px 0; }
.list.tasks .task-main { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 6px; }
.list.tasks .task-main a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list.tasks .task-meta { flex: 0 0 auto; white-space: nowrap; }
.list.tasks .inline-status select { padding: 2px 6px; }
.inline-assign { margin: 0; flex: 0 0 auto; }
.people-picker.compact summary { padding: 2px 24px 2px 8px; font-size: 0.85rem; width: 150px; }
.people-picker.compact summary::after { right: 7px; }
.people-picker.compact .people-picker-list { left: auto; right: 0; width: 220px; }
.inline-status { display: flex; align-items: center; gap: 6px; }
.invoiced-note { color: var(--success); }
.bar-col { width: 30%; min-width: 120px; }
.bill-bar { display: flex; height: 8px; border-radius: 4px; background: #e8eaee; overflow: hidden; }
.bill-bar .b-sent { background: var(--success); }
.bill-bar .b-pending { background: #e2b04a; }
.invoice-add { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 12px; padding: 12px; background: var(--bg); border-radius: 8px; }
.invoice-add label, .file-add label { white-space: nowrap; }
.badge.plain { text-transform: none; }
.invoice-add label.grow { flex: 2 1 220px; }
.invoice-add .field.grow { flex: 2 1 260px; }
.invoice-picker .people-picker-list { min-width: 340px; max-height: 320px; white-space: normal; }
.inv-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 5px 0; border-bottom: 1px solid var(--border); }
.inv-row:last-child { border-bottom: 0; }
label.inv-row { justify-content: flex-start; }
.inv-row label.check { flex: 1 1 auto; min-width: 0; align-items: flex-start; padding: 0; }
.inv-row label.check input { margin-top: 3px; }
.inv-meta { display: block; }
.inv-row .pct-input { display: inline-flex; align-items: center; gap: 2px; color: var(--muted); font-size: 0.85rem; }
.inv-row .pct-input input { width: 60px; padding: 3px 4px; text-align: right; }
.inv-row .pct-input input:disabled { opacity: 0.4; }
.inv-head { display: flex; justify-content: space-between; padding: 8px 0 2px; text-transform: uppercase; letter-spacing: 0.02em; font-size: 0.72rem; }
[data-invoice-error] { color: var(--danger); }
.invoice-submit { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.invoice-submit label.check { color: var(--muted); }
ul.inv-lines { margin: 0; padding-left: 18px; }
.inv-total { margin: 4px 0; }

/* Projects: list / cards switch and project cards */
.view-switch { display: inline-flex; border: 1px solid #cfd4dc; border-radius: 8px; overflow: hidden; background: #fff; }
.view-switch a { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; color: var(--muted); font-weight: 500; }
.view-switch a + a { border-left: 1px solid #cfd4dc; }
.view-switch a:hover { background: #eef4ec; color: var(--brand-dark); text-decoration: none; }
.view-switch a.active { background: var(--primary-soft); color: var(--primary); }
.view-switch svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.project-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.project-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; border-top: 4px solid var(--brand-green); }
.project-card.is-late { border-top-color: var(--danger); }
.project-card header h2 { margin: 4px 0 2px; font-size: 1.05rem; line-height: 1.3; }
.project-card header h2 a { color: var(--brand-dark); }
.pc-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pc-badges { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.pc-due { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; padding: 8px 10px; background: var(--bg); border-radius: 7px; }
.pc-due span, .pc-due strong { white-space: nowrap; }
.pc-due strong { font-size: 0.95rem; }
.pc-progress { display: flex; flex-direction: column; gap: 4px; }
.pc-progress .progress.wide { margin-top: 0; }
.pc-tasks { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.pc-tasks li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.pc-tasks li a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.pc-tasks li span { white-space: nowrap; }
.pc-none { margin: 0; }
.proposal-table td { vertical-align: top; }
.proposal-table input.pp-num { width: 80px; }
.proposal-table input[name^=title_] { min-width: 300px; }
.proposal-table input.pp-fee { width: 110px; text-align: right; }
.pp-scope summary { cursor: pointer; color: var(--muted); max-width: 520px; }
.pp-scope textarea { margin-top: 6px; min-width: 420px; font-size: 0.85rem; }
.proposal-upload { margin: 0 0 12px; }
.proposal-upload summary { list-style: none; display: inline-flex; }
.proposal-upload summary::-webkit-details-marker { display: none; }
.proposal-upload form { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; margin-top: 8px; padding: 12px; background: var(--bg); border-radius: 8px; }
.proposal-upload input[type=file] { padding: 6px; background: #fff; flex: 1 1 240px; width: auto; }
ul.inv-lines li { padding: 1px 0; }
.invoice-actions { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.invoice-actions .review-form { align-items: flex-end; }
.invoice-actions .review-form label { flex-direction: column; white-space: nowrap; }
.invoice-actions .review-form input { width: 150px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
a.badge:hover { text-decoration: none; filter: brightness(0.95); }
.note-add, .file-add { margin-bottom: 12px; padding: 12px; background: var(--bg); border-radius: 8px; }
.file-add { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.file-add label { flex: 1 1 220px; }
.file-add .hint { flex-basis: 100%; }
.file-add input[type=file] { padding: 6px; background: #fff; }
.list.notes li, .list.files li { align-items: flex-start; }
.note-body, .file-main { min-width: 0; flex: 1 1 auto; }
.note-body p { margin: 4px 0 0; overflow-wrap: anywhere; }
.file-main a { overflow-wrap: anywhere; }
.list.files li form { margin: 0; }
.list.tasks li.done a { text-decoration: line-through; color: var(--muted); }
.details { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.details dt { color: var(--muted); }
.details dd { margin: 0; }
.pre { white-space: pre-line; }
.muted { color: var(--muted); }
.small { font-size: 0.83rem; }
.overdue { color: var(--danger); font-weight: 600; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; background: #eef0f3; color: #475467; text-transform: capitalize; vertical-align: middle; }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.status-pending, .status-planning, .status-on_hold { background: var(--warn-soft); color: var(--warn); }
.status-approved, .status-active { background: var(--success-soft); color: var(--success); }
.status-denied, .status-cancelled { background: var(--danger-soft); color: var(--danger); }
.status-completed { background: var(--primary-soft); color: var(--primary); }

.progress { display: inline-block; width: 70px; height: 6px; background: #e8eaee; border-radius: 3px; overflow: hidden; vertical-align: middle; }
.progress.wide { width: 100%; margin-top: 10px; }
.progress span { display: block; height: 100%; background: var(--success); }
.progress.over span { background: var(--danger); }

/* Approvals */
.review-item { display: flex; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.review-item:last-child { border-bottom: 0; }
.review-info { flex: 1 1 320px; }
.review-form { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
.review-form input { width: 220px; }

/* Tasks */
.task-add { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 12px; padding: 12px; background: var(--bg); border-radius: 8px; }
.task-add label, .task-add .field { flex: 1 1 130px; white-space: nowrap; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field-label { font-weight: 500; font-size: 0.9rem; }
.row > .field { flex: 1 1 180px; }
/* Checkbox dropdown for picking people */
.people-picker { position: relative; }
.people-picker summary { list-style: none; cursor: pointer; padding: 8px 30px 8px 10px; border: 1px solid #cfd4dc; border-radius: 7px; background: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; position: relative; }
.people-picker summary::-webkit-details-marker { display: none; }
.people-picker summary::after { content: '▾'; position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.people-picker[open] summary { border-color: var(--primary); }
.people-picker-list { position: absolute; z-index: 20; left: 0; right: 0; min-width: 200px; margin-top: 4px; max-height: 240px; overflow-y: auto; background: #fff; border: 1px solid #cfd4dc; border-radius: 7px; box-shadow: 0 6px 20px rgba(16, 24, 40, 0.12); padding: 6px 10px; }
.people-picker-list label.check { padding: 4px 0; font-weight: 400; }
.task-add label.task-title { flex: 1 1 100%; }
.task-add .btn { flex: 0 0 auto; }
.inline-status select { padding: 4px 8px; font-size: 0.85rem; width: auto; }
details.add-inline { margin-top: 12px; }
details.add-inline summary { list-style: none; }
details.add-inline summary::-webkit-details-marker { display: none; }
details.add-inline[open] summary { margin-bottom: 12px; }

/* Timesheet */
.week-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; margin-bottom: 16px; }
.week-strip div { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; display: flex; flex-direction: column; }
.week-strip div.today { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }

/* Calendar */
.cal-legend { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; font-size: 0.85rem; color: var(--muted); }
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cal-legend i.ev { width: 14px; height: 10px; padding: 0; margin: 0; }
.cal-filter a { padding: 2px 8px; border-radius: 6px; }
.cal-filter a.active { background: var(--primary-soft); }
.calendar { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.cal-head, .cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-head span { padding: 8px; font-size: 0.8rem; font-weight: 600; color: var(--muted); text-align: center; border-bottom: 1px solid var(--border); }
.cal-day { min-height: 110px; padding: 6px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day.weekend { background: #fafbfc; }
.cal-day.outside { background: #f6f7f9; }
.cal-day.outside .cal-date { color: #aab1bd; }
.cal-day.today .cal-date { background: var(--primary); color: #fff; border-radius: 999px; padding: 0 7px; }
.cal-date { font-size: 0.82rem; font-weight: 600; align-self: flex-start; }
.cal-dow { display: none; }
.ev { display: block; font-size: 0.75rem; padding: 2px 6px; border-radius: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.ev:hover { text-decoration: none; filter: brightness(0.96); }
.ev.off { background: #dcebff; border-left: 3px solid #3b82f6; }
.ev.off.pending { background: repeating-linear-gradient(45deg, #fff4dd, #fff4dd 4px, #fdebc4 4px, #fdebc4 8px); border-left-color: #d29a1d; }
.ev.project { background: #f3e8ff; border-left: 3px solid #8b5cf6; }
.ev.project.done { opacity: 0.55; }
.ev.task { background: #ebf5e1; border-left: 3px solid var(--brand-green); }

@media (max-width: 1700px) {
  .brand-name { display: none; }
}

@media (max-width: 1480px) {
  .topbar-inner { gap: 10px; }
  .mainnav a { padding: 8px 9px; font-size: 0.94rem; }
  .navsep { margin: 8px 3px; }
}

/* Narrower windows (or Windows display scaling): logo + name on one line, the full menu below. */
@media (max-width: 1250px) {
  .topbar-inner { flex-wrap: wrap; padding-top: 6px; padding-bottom: 6px; }
  .mainnav { order: 3; flex-basis: 100%; }
  .usermenu { margin-left: auto; }
}

@media (max-width: 900px) {
  .auth-layout { grid-template-columns: minmax(0, 1fr); }
  .auth-hero { display: none; }
  .auth-mobile-logo { display: block; width: 220px; height: auto; margin: 0 0 24px; }
  .auth-panel { align-items: flex-start; padding-top: 56px; }
  .grid.two, .grid.two.wide-right, .grid.three { grid-template-columns: minmax(0, 1fr); }
  .topbar-inner { flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
  .mainnav { order: 3; flex-basis: 100%; }
  .usermenu { margin-left: auto; }
}

@media (max-width: 640px) {
  .container { padding: 16px 16px 40px; }
  .card { padding: 16px; }
  .week-strip { grid-template-columns: repeat(4, 1fr); }
  .cal-head { display: none; }
  .cal-week { grid-template-columns: minmax(0, 1fr); }
  .cal-day { min-height: 0; border-right: 0; }
  .cal-day.outside, .cal-day.weekend:not(:has(.ev)) { display: none; }
  .cal-dow { display: inline; }
  .review-form input { width: 100%; }
  .list.tasks li { flex-wrap: wrap; row-gap: 0; }
  .list.tasks .task-main { flex-basis: 100%; }
}
