/* HPD OS — same look as the content app (tokens copied from its styles.css) */
:root {
  --navy: #092759; --blue: #075FE0; --blue-600: #0652c2; --blue-50: #EBF2FE; --blue-100: #D6E5FD;
  --surface: #FFFFFF; --bg: #F5F7FB; --border: #E8ECF2; --border-strong: #CDD5E1;
  --text: #0F1B2D; --muted: #475467; --faint: #5B6576;
  --green: #17803F; --green-50: #E8F6EE; --amber: #8A5A00; --amber-50: #FDF5E1; --red: #C0392B; --red-50: #FCECEC;
  --purple: #5B3FC4; --purple-50: #F0ECFD; --grey-50: #EEF1F6;
  --radius: 12px; --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(15, 27, 45, .04), 0 1px 3px rgba(15, 27, 45, .06);
  --shadow-lg: 0 12px 40px rgba(9, 39, 89, .18);
  --sidebar: 224px;
  --font: "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: var(--font); font-size: 14.5px; line-height: 1.5; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 24px; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 17px; font-weight: 600; }
h3 { font-size: 14px; font-weight: 600; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.muted { color: var(--muted); } .faint { color: var(--faint); font-size: 13px; }
.late { color: var(--red); font-weight: 600; }
.num { font-variant-numeric: tabular-nums; }
.count { color: var(--faint); font-weight: 500; font-size: .8em; margin-left: 8px; }
.ico { display: inline-flex; } .ico svg { width: 18px; height: 18px; }

/* shell */
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 16px 12px; z-index: 20; overflow-y: auto; }
.brand-logo { display: block; width: 130px; height: 96px; overflow: hidden; margin: 0 6px 8px; }
.brand-logo img { width: 152px; max-width: none; margin: -9px 0 0 -11px; display: block; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px; color: var(--muted); font-weight: 500; text-decoration: none; }
.nav a:hover { background: var(--bg); color: var(--text); }
.nav a.active { background: var(--blue-50); color: var(--blue); font-weight: 600; }
.nav a.ext { margin-top: 10px; border-top: 1px solid var(--border); border-radius: 0 0 10px 10px; padding-top: 14px; }
.nav a.ext .ico:last-child { margin-left: auto; opacity: .6; } .nav a.ext .ico:last-child svg { width: 14px; height: 14px; }
.sidebar-foot { margin-top: auto; padding: 12px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; }
.sidebar-foot strong { color: var(--text); display: block; font-weight: 600; }
.link { display: block; background: none; border: 0; padding: 6px 0 0; color: var(--blue); cursor: pointer; font-size: 13px; }
.main { margin-left: var(--sidebar); min-height: 100vh; }
.page { max-width: 1320px; margin: 0 auto; padding: 28px 32px 80px; }
.page.wide { max-width: none; } .page.narrow { max-width: 860px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.head-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* buttons and inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 9px; border: 1px solid transparent; font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap; background: var(--blue); color: #fff; }
.btn:hover { background: var(--blue-600); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--bg); }
.btn-on { background: var(--blue-50); color: var(--blue); border-color: var(--blue-100); }
.btn-on:hover { background: var(--blue-100); }
.btn-quiet { background: transparent; color: var(--muted); padding: 0 8px; }
.btn-quiet:hover { background: var(--grey-50); color: var(--text); }
.btn-danger-quiet { background: transparent; color: var(--red); }
.btn-danger-quiet:hover { background: var(--red-50); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn-lg { height: 44px; padding: 0 20px; font-size: 15px; }
.btn-icon { width: 36px; padding: 0; }
.btn .ico svg { width: 15px; height: 15px; }
.input { height: 36px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: 9px; background: var(--surface); min-width: 0; }
.input.search { width: 180px; }
.input.bare { border-color: transparent; background: transparent; width: 100%; }
.input.bare:hover, .input.bare:focus { border-color: var(--border-strong); background: var(--surface); }
textarea.input { height: auto; min-height: 96px; padding: 10px; width: 100%; resize: vertical; line-height: 1.5; }
textarea.input.big { min-height: 220px; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 9px; overflow: hidden; background: var(--surface); }
.seg button { height: 34px; padding: 0 12px; border: 0; background: none; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--muted); }
.seg button.on { background: var(--blue-50); color: var(--blue); }

/* cards, pills */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px; }
.empty-state { padding: 48px 20px; text-align: center; color: var(--muted); }
.pill { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.c-grey { background: var(--grey-50); color: var(--muted); } .c-blue { background: var(--blue-50); color: var(--blue-600); }
.c-green { background: var(--green-50); color: var(--green); } .c-amber { background: var(--amber-50); color: var(--amber); }
.c-red { background: var(--red-50); color: var(--red); } .c-purple { background: var(--purple-50); color: var(--purple); }
.chip { display: inline-flex; padding: 1px 8px; border-radius: 6px; background: var(--grey-50); color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.chips { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.people { display: inline-flex; }
.avatar { width: 24px; height: 24px; border-radius: 50%; background: var(--navy); color: #fff; font-size: 10.5px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; margin-right: -5px; border: 2px solid var(--surface); }
.tick { display: inline-block; width: 16px; height: 16px; border-radius: 4px; border: 1.5px solid var(--border-strong); vertical-align: middle; }
.tick.on { background: var(--blue); border-color: var(--blue); box-shadow: inset 0 0 0 2px #fff; }
.empty { color: #9AA3B2; }

/* table */
.table-wrap { overflow-x: auto; }
.grid { width: 100%; border-collapse: collapse; }
.grid th { text-align: left; font-size: 12px; font-weight: 600; color: var(--faint); padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; cursor: pointer; user-select: none; background: #FAFBFD; position: sticky; top: 0; }
.grid th.sorted { color: var(--blue); }
.grid td { padding: 0; border-bottom: 1px solid var(--border); border-right: 1px solid transparent; vertical-align: middle; position: relative; max-width: 340px; }
.grid tr:last-child td { border-bottom: 0; }
.grid tbody tr:hover { background: #FAFBFD; }
.grid tr.done td .cell { opacity: .55; }
.cell { padding: 9px 12px; min-height: 40px; display: flex; align-items: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell > span, .cell > a { overflow: hidden; text-overflow: ellipsis; }
td.can { cursor: text; } td.t-select.can, td.t-rel.can, td.t-user.can, td.t-users.can, td.t-bool.can, td.t-roles.can { cursor: pointer; }
td.can:hover { box-shadow: inset 0 0 0 1px var(--border-strong); }
td.first .cell { font-weight: 600; min-width: 220px; padding-right: 76px; }
td.t-money .cell { justify-content: flex-end; }
.open-btn { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); display: none; align-items: center; gap: 4px; height: 26px; padding: 0 8px; border-radius: 7px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--muted); font-size: 12px; font-weight: 600; cursor: pointer; }
.open-btn .ico svg { width: 13px; height: 13px; }
tr:hover .open-btn, .open-btn:focus-visible { display: inline-flex; }
.cell-input { width: 100%; min-width: 120px; height: 28px; margin: -4px 0; border: 1.5px solid var(--blue); border-radius: 6px; padding: 0 6px; background: var(--surface); }

/* board */
.board { display: flex; gap: 12px; align-items: flex-start; overflow-x: auto; padding-bottom: 12px; }
.kcol { flex: 0 0 272px; background: var(--grey-50); border-radius: var(--radius); padding: 10px; border: 2px solid transparent; }
.kcol.over { border-color: var(--blue); background: var(--blue-50); }
.kcol-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 10px; }
.kcol-body { display: flex; flex-direction: column; gap: 8px; min-height: 24px; }
.kcard { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 11px 12px; box-shadow: var(--shadow); cursor: grab; }
.kcard:hover { border-color: var(--border-strong); }
.kcard.dragging { opacity: .4; }
.kcard-title { font-weight: 600; line-height: 1.35; }
.kcard-sub { color: var(--faint); font-size: 12.5px; margin-top: 2px; }
.kcard-meta { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.kcard-meta:empty { display: none; }
.kcol-add { width: 100%; margin-top: 8px; height: 32px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-weight: 600; font-size: 13px; cursor: pointer; text-align: left; padding: 0 8px; }
.kcol-add:hover { background: rgba(15, 27, 45, .06); color: var(--text); }

/* pop-up menu */
.pop { position: absolute; z-index: 60; width: 280px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 6px; }
.pop-search { width: 100%; height: 34px; border: 1px solid var(--border-strong); border-radius: 8px; padding: 0 10px; margin-bottom: 6px; }
.pop-list { max-height: 300px; overflow-y: auto; display: flex; flex-direction: column; }
.pop-item { display: flex; align-items: center; gap: 6px; width: 100%; text-align: left; padding: 7px 8px; border: 0; background: none; border-radius: 7px; cursor: pointer; }
.pop-item:hover, .pop-item:focus-visible { background: var(--bg); }
.pop-item.on { background: var(--blue-50); }
.pop-item.add { color: var(--blue); font-weight: 600; } .pop-item.clear { color: var(--muted); border-top: 1px solid var(--border); border-radius: 0 0 7px 7px; margin-top: 4px; }
.pop-empty { padding: 10px; color: var(--muted); }

/* detail panel */
.drawer-scrim { position: fixed; inset: 0; background: rgba(9, 39, 89, .28); z-index: 40; }
.drawer { position: fixed; inset: 0 0 0 auto; width: min(680px, 100vw); background: var(--surface); z-index: 50; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px 0 24px; }
.drawer-kind { text-transform: capitalize; color: var(--faint); font-size: 12.5px; font-weight: 600; }
.drawer-body { overflow-y: auto; padding: 4px 24px 32px; flex: 1; }
.drawer-title { display: block; width: 100%; font-size: 22px; font-weight: 700; border: 1px solid transparent; border-radius: 8px; padding: 6px 8px; margin: 0 -8px 12px; background: transparent; }
input.drawer-title:hover, input.drawer-title:focus { border-color: var(--border-strong); }
.fields { display: flex; flex-direction: column; }
.frow { display: grid; grid-template-columns: 170px 1fr; align-items: center; gap: 8px; min-height: 38px; }
.frow.block { display: block; margin-top: 14px; }
.flabel { color: var(--faint); font-size: 13px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.frow.block .flabel { margin-bottom: 6px; font-weight: 600; color: var(--muted); }
.fval { padding: 6px 8px; border-radius: 7px; min-height: 34px; display: flex; align-items: center; }
.fval.can { cursor: pointer; } .fval.can:hover { background: var(--bg); }
.mic.live { background: var(--red-50); color: var(--red); border-color: var(--red); }
.section { margin-top: 26px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.group { margin-top: 12px; } .group h3 { font-weight: 500; color: var(--faint); font-size: 13px; }
.rel-list { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.rel-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; background: var(--surface); border: 0; border-bottom: 1px solid var(--border); text-align: left; cursor: pointer; }
.rel-item:last-child { border-bottom: 0; }
button.rel-item:hover { background: var(--bg); }
.rel-item.done .rel-title { opacity: .55; }
.rel-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.sub-editor { display: flex; flex-direction: column; gap: 8px; }
.sub-row { display: flex; gap: 8px; align-items: center; }
.sub-row .input { flex: 1; } .sub-row .pct { flex: 0 0 72px; } .ms-amt { flex: 0 0 84px; text-align: right; color: var(--muted); } .ms-paid { white-space: nowrap; font-size: 13px; }
.sub-foot { display: flex; align-items: center; gap: 12px; }
.drawer-foot { display: flex; align-items: center; gap: 8px; margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--border); }
.spacer { flex: 1; }

/* home, timeline */
.home-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 16px; align-items: start; }
.quick-add { display: flex; gap: 8px; } .grow { flex: 1; }
.year { margin-top: 28px; } .year-head { font-size: 20px; font-weight: 700; margin-bottom: 10px; }
.tl-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 16px; background: none; border: 0; border-bottom: 1px solid var(--border); text-align: left; cursor: pointer; }
.tl-item:last-child { border-bottom: 0; } .tl-item:hover { background: var(--bg); }
.tl-date { flex: 0 0 56px; color: var(--faint); font-size: 13px; font-variant-numeric: tabular-nums; }
.tl-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--border-strong); flex: none; }
.tl-dot.well { background: #1F9D55; } .tl-dot.badly { background: #D14343; } .tl-dot.mixed { background: #C98A00; }
.tl-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* toasts, login */
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 80; }
.toast { background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); font-weight: 500; }
.toast.bad { background: var(--red); }
.login-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login { width: min(380px, 100%); padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.login-logo { width: 150px; margin: -8px auto 0; }
.login label { display: flex; flex-direction: column; gap: 6px; font-weight: 500; font-size: 13.5px; color: var(--muted); }
.login input { height: 42px; border: 1px solid var(--border-strong); border-radius: 9px; padding: 0 12px; font-size: 15px; color: var(--text); }
.login-error { color: var(--red); font-weight: 500; }

@media (max-width: 860px) {
  .sidebar { position: static; width: auto; flex-direction: row; align-items: center; padding: 8px; border-right: 0; border-bottom: 1px solid var(--border); overflow-x: auto; }
  .brand, .sidebar-foot strong { display: none; }
  .nav { flex-direction: row; } .nav a { white-space: nowrap; padding: 8px 10px; } .nav a.ext { margin: 0; border: 0; padding-top: 8px; }
  .sidebar-foot { margin: 0 0 0 auto; border: 0; padding: 0 8px; white-space: nowrap; font-size: 0; } .sidebar-foot .link { font-size: 13px; padding: 0; }
  .main { margin-left: 0; } .page { padding: 20px 16px 60px; }
  .frow { grid-template-columns: 120px 1fr; } .home-grid { grid-template-columns: 1fr; }
  .open-btn { display: inline-flex; }
}
