@font-face {
  font-family: "CRM Field Sans";
  src: url("fonts/NotoSans-Regular.ttf") format("truetype");
  font-display: swap;
  font-weight: 400 600;
}
@font-face {
  font-family: "CRM Field Sans";
  src: url("fonts/NotoSans-Bold.ttf") format("truetype");
  font-display: swap;
  font-weight: 650 900;
}
:root {
  color-scheme: light;
  --paper: #f7f8f6;
  --surface: #fff;
  --ink: #172b3b;
  --muted: #526471;
  --line: #cdd7dc;
  --green: #247554;
  --green-soft: #dceee6;
  --blue: #246b91;
  font-family: "CRM Field Sans", sans-serif;
  font-synthesis: none;
}
* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); }
body { margin: 0; color: var(--ink); font-size: 14px; line-height: 1.5; letter-spacing: 0; }
button, input { font: inherit; }
a { color: var(--blue); text-underline-offset: 3px; }
::selection { background: #b8d7e6; color: #102a3a; }
:focus-visible { outline: 3px solid #0f72a6; outline-offset: 3px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #9aabb4; border: 2px solid var(--paper); }
.skip-link { position: absolute; top: 8px; left: 8px; z-index: 10; padding: 8px 12px; background: white; transform: translateY(-200%); }
.skip-link:focus { transform: none; }
.topbar { display: flex; align-items: center; gap: 16px; min-height: 72px; padding: 14px 32px; border-bottom: 1px solid var(--line); background: var(--surface); }
.brand { display: inline-flex; gap: 10px; align-items: center; color: var(--ink); font-size: 19px; text-decoration: none; }
.brand img { width: 30px; height: 30px; }
.test-label { color: #735218; padding: 3px 8px; border: 1px solid #d5c28e; border-radius: 4px; background: #f6ecd4; font-size: 11px; }
.logout { margin-left: auto; }
.tabs { display: flex; gap: 28px; padding-inline: max(32px, calc((100% - 1120px) / 2)); border-bottom: 1px solid var(--line); background: white; }
.tabs a { padding-block: 14px; color: var(--muted); border-bottom: 2px solid transparent; text-decoration: none; }
.tabs a[aria-current] { color: var(--ink); border-bottom-color: var(--green); font-weight: 700; }
.tabs a:hover { color: var(--blue); }
.content { width: min(1120px, calc(100% - 64px)); margin: 36px auto 64px; }
.login-layout { min-height: calc(100svh - 72px); display: grid; place-items: center; padding: 40px 24px 80px; }
.login-form { width: min(100%, 360px); }
h1 { margin: 0; font-size: 26px; line-height: 1.3; font-weight: 700; }
.login-form h1 { margin-bottom: 30px; font-size: 28px; }
.field { display: grid; gap: 8px; margin-bottom: 20px; }
.field label { font-weight: 650; }
.field input { width: 100%; height: 46px; padding: 10px 12px; color: var(--ink); background: var(--surface); border: 1px solid #758992; border-radius: 4px; caret-color: var(--green); }
.field input:hover { border-color: var(--green); }
.button { display: inline-flex; justify-content: center; align-items: center; min-height: 40px; padding: 8px 16px; border: 1px solid transparent; border-radius: 4px; font-weight: 650; text-decoration: none; cursor: pointer; }
.button.primary { color: white; background: var(--green); border-color: var(--green); }
.button.primary:hover { background: #1b5b41; }
.button.secondary { color: var(--ink); background: white; border-color: #8fa1aa; }
.button.secondary:hover { background: #edf2f5; }
.button.full { width: 100%; min-height: 46px; }
.button:disabled { opacity: .6; cursor: wait; }
.safety-note { margin-top: 24px; color: var(--muted); font-size: 12px; text-align: center; }
.form-error { padding: 12px; color: #912f25; border: 1px solid #d8a19a; border-radius: 4px; background: #fff0ec; }
.page-heading { display: flex; align-items: center; gap: 14px; margin-bottom: 32px; }
.status { display: inline-block; padding: 3px 8px; color: #155536; background: var(--green-soft); border-radius: 4px; font-size: 11px; white-space: nowrap; }
.count { color: var(--muted); font-size: 16px; font-variant-numeric: tabular-nums; }
.identity { display: flex; gap: 20px; align-items: center; padding-bottom: 28px; border-bottom: 1px solid var(--line); }
.identity h2 { margin: 0; font-size: 22px; line-height: 1.35; overflow-wrap: anywhere; }
.identity p { margin: 6px 0 0; color: var(--muted); }
.avatar { display: grid; place-items: center; flex: 0 0 56px; width: 56px; height: 56px; color: #155536; background: var(--green-soft); border-radius: 6px; font-size: 20px; font-weight: 700; }
.profile-data { max-width: 680px; margin: 0; }
.profile-data > div { display: grid; grid-template-columns: 180px minmax(0,1fr); gap: 20px; padding: 18px 0; border-bottom: 1px solid var(--line); }
dt { color: var(--muted); }
dd { margin: 0; overflow-wrap: anywhere; }
.data-value { font-variant-numeric: tabular-nums; }
.activity { margin-top: 40px; max-width: 680px; }
.activity h2 { margin: 0 0 16px; font-size: 17px; }
.activity-list > div { display: flex; justify-content: space-between; gap: 20px; padding: 12px 0; border-top: 1px solid var(--line); }
time { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; }
.staff-list { width: 100%; border-collapse: collapse; }
.staff-list thead, .staff-list tbody { display: block; }
.staff-list th { text-align: left; font-weight: 400; }
.staff-list td, .staff-list th { padding: 0; min-width: 0; }
.mobile-field-label { display: none; }
.staff-header, .staff-row { display: grid; grid-template-columns: minmax(260px,2.4fr) minmax(140px,1fr) 110px 84px; align-items: center; gap: 20px; }
.staff-header { padding: 12px 16px; color: var(--muted); font-size: 12px; background: #edf2f5; }
.staff-row { padding: 22px 16px; border-bottom: 1px solid var(--line); }
.staff-person h2 { margin: 0; font-size: 14px; font-weight: 650; overflow-wrap: anywhere; }
.staff-person p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.error-page { padding-block: 48px; }
.error-page p { margin-bottom: 28px; color: var(--muted); }
@media (max-width: 720px) {
  .topbar { min-height: 64px; padding: 12px 16px; gap: 10px; }
  .brand { font-size: 17px; gap: 7px; }
  .test-label { font-size: 10px; padding: 3px 6px; }
  .logout .button { padding-inline: 10px; }
  .tabs { padding-inline: 20px; gap: 24px; }
  .content { width: calc(100% - 40px); margin-top: 28px; }
  .login-layout { min-height: calc(100svh - 64px); }
  h1 { font-size: 23px; }
  .identity { align-items: flex-start; gap: 14px; }
  .identity h2 { font-size: 18px; }
  .avatar { flex-basis: 46px; width: 46px; height: 46px; font-size: 17px; }
  .profile-data > div { grid-template-columns: 130px minmax(0,1fr); gap: 12px; }
  .staff-list thead { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .mobile-field-label { display: block; color: var(--muted); font-size: 11px; }
  .staff-department .mobile-field-label { display: inline; font-size: inherit; }
  .staff-row { grid-template-columns: minmax(0,1fr) 84px; gap: 10px; padding-inline: 0; }
  .staff-person { grid-column: 1 / -1; }
  .staff-department { grid-column: 1 / -1; font-size: 12px; color: var(--muted); }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }

.tabs { flex-wrap: wrap; row-gap: 0; }
.workspace { width: min(1440px, calc(100% - 64px)); }
.spread { justify-content: space-between; flex-wrap: wrap; gap: 16px; }
.spread h1 { overflow-wrap: anywhere; }
.object-filter { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 28px; }
select, textarea { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid #758992; border-radius: 4px; padding: 10px 12px; max-width: 100%; }
select { min-height: 44px; }
textarea { width: 100%; resize: vertical; }
.object-filter select { min-width: 0; width: min(440px, 100%); }
.director-queues { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 40px; margin: 36px 0 44px; }
.director-queues h2, .form-section h2, .history h2, .invoice-actions h2 { margin: 0 0 14px; font-size: 18px; }
.queue-total { margin: 0 0 16px; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.queue-row { display: flex; justify-content: space-between; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.queue-row:hover strong { color: var(--blue); }
.queue-row small { display: block; margin-top: 5px; color: var(--muted); }
.queue-row > strong { white-space: nowrap; }
.queue-row > span { min-width: 0; overflow-wrap: anywhere; }
.board { position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: 240px; gap: 16px; overflow-x: auto; max-width: 100%; padding: 4px 0 20px; scroll-snap-type: x proximity; }
.object-filter #stage { width: 220px; }
.board-column { min-width: 0; scroll-snap-align: start; padding-top: 12px; border-top: 2px solid var(--line); }
.board-column h2 { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-size: 14px; margin: 0 0 18px; }
.board-column .count { font-size: 13px; }
.purchase-card { padding: 16px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); margin-bottom: 12px; overflow-wrap: anywhere; }
.purchase-card h3 { font-size: 15px; margin: 8px 0; }
.purchase-card p { margin: 8px 0; font-size: 12px; color: var(--muted); }
.purchase-card small { font-size: 11px; color: var(--muted); }
.purchase-card a { color: var(--ink); }
.purchase-card a:hover { color: var(--blue); }
.urgent { display: inline-block; color: #912f25; background: #fff0ec; padding: 2px 6px; border-radius: 3px; font-size: 11px; }
.empty, .muted { color: var(--muted); }
.empty { margin: 16px 0; font-size: 13px; }
.record-row { padding: 20px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.record-row h2, .record-row h3 { font-size: 16px; margin: 5px 0; }
.record-row p { margin: 6px 0 0; color: var(--muted); }
.record-row small { color: var(--muted); }
.entry-form { max-width: 640px; }
.field select { width: 100%; }
.field input[type=file] { height: auto; min-height: 46px; padding: 8px; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 20px; }
.form-section { margin-top: 40px; }
.detail-data { margin: 0; max-width: 760px; }
.detail-data > div { display: grid; grid-template-columns: 180px minmax(0,1fr); gap: 24px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.invoice-layout { display: grid; grid-template-columns: minmax(0,1fr) 320px; gap: 48px; }
.invoice-actions { border-top: 2px solid var(--green); padding-top: 18px; }
.invoice-actions > p { margin-bottom: 24px; }
.invoice-actions .button { width: 100%; white-space: normal; }
.invoice-state { white-space: normal; }
.secondary-action { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 16px; }
.secondary-action summary { cursor: pointer; color: var(--blue); }
.secondary-action form { padding-top: 20px; }
.history { margin-top: 48px; max-width: 900px; }
.history-row { padding: 16px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.history-row > div { display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.history-row p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.notice { padding: 12px 0; border-bottom: 1px solid var(--line); }
.notice.success, .paid-note { color: #155536; }
[hidden] { display: none !important; }
.record-links { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; margin-top: 18px; }
.project-nav { padding: 20px 0; border-block: 1px solid var(--line); }
.department-row { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 18px 0; border-bottom: 1px solid var(--line); }
.department-row span { color: var(--muted); font-variant-numeric: tabular-nums; }
.task-summary { display: flex; flex-wrap: wrap; gap: 14px 28px; padding: 18px 0; margin-bottom: 32px; border-block: 1px solid var(--line); }
.task-summary strong { padding-left: 8px; color: var(--ink); }
.filter-grid { display: grid; grid-template-columns: minmax(0,2fr) repeat(2,minmax(0,1fr)); gap: 20px; }
.filter-options { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 24px; }
.task-filter-main { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.task-filter-main .field { flex: 1; min-width: 220px; margin-bottom: 0; }
.task-filter-main .segmented { margin-top: 10px; }
.task-filter-main > .button { align-self: flex-end; }
.task-extra-filters { margin-top: 20px; }
.task-extra-filters > summary { color: var(--blue); cursor: pointer; }
.task-extra-filters[open] > summary { margin-bottom: 22px; }
.segmented { display: flex; flex-wrap: wrap; gap: 14px; margin: 0; padding: 10px 14px; border: 1px solid var(--line); border-radius: 4px; }
.segmented legend { color: var(--muted); font-size: 12px; padding-inline: 4px; }
.check, .segmented label { display: inline-flex; align-items: center; gap: 8px; }
input[type=checkbox], input[type=radio] { accent-color: var(--green); width: 18px; height: 18px; margin: 0; }
.record-group { margin-top: 36px; }
.record-group > h2 { font-size: 18px; margin: 0 0 6px; overflow-wrap: anywhere; }
.task-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 20px; }
.task-row-state { display: flex; align-items: flex-start; gap: 10px; padding-top: 4px; }
.task-board { margin-top: 20px; }
.task-board .board-column > h3 { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; margin: 0 0 18px; }
.task-board .purchase-card h4 { font-size: 15px; margin: 8px 0; }
.task-discussion { max-width: 900px; }
.comment-form { margin-top: 24px; }
.overdue { color: #912f25; }
.plain-text, .message-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.task-action + .task-action { padding-top: 20px; margin-top: 20px; border-top: 1px solid var(--line); }
.messenger-workspace { width: min(1440px, calc(100% - 64px)); }
.messenger { display: grid; grid-template-columns: 280px minmax(0,1fr); border-block: 1px solid var(--line); min-height: 620px; }
.chat-rooms { padding: 20px 20px 20px 0; border-right: 1px solid var(--line); }
.chat-rooms h2 { font-size: 16px; margin: 0 0 22px; }
.chat-rooms .field label { font-size: 12px; }
.chat-room { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 6px 10px; padding: 16px 12px; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.chat-room[aria-current] { background: var(--green-soft); }
.chat-room:hover { background: #edf2f5; }
.chat-room small { grid-column: 1/-1; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-room strong { overflow-wrap: anywhere; }
.unread { align-self: start; min-width: 24px; padding: 2px 6px; background: var(--green); color: white; font-size: 11px; text-align: center; border-radius: 4px; font-variant-numeric: tabular-nums; }
.chat-thread { min-width: 0; display: flex; flex-direction: column; padding-left: 28px; }
.thread-heading { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px 20px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.thread-heading h2 { font-size: 18px; margin: 0; overflow-wrap: anywhere; }
.mobile-rooms-link { display: none; }
.chat-scroll { height: 390px; min-height: 220px; overflow-y: auto; overscroll-behavior: contain; padding-right: 12px; }
.message { position: relative; padding: 18px 44px 18px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.message header { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: baseline; }
.message header strong { font-size: 13px; }
.message-body { margin: 8px 0 0; max-width: 72ch; }
.message-body:empty { display: none; }
.message blockquote { margin: 12px 0 0; border-left: 1px solid #758992; padding: 0 14px; color: var(--muted); font-size: 12px; }
.message blockquote p { max-height: 56px; overflow: hidden; margin: 4px 0; }
.message-context, .message-file { display: block; margin-top: 10px; }
.icon-button { display: inline-flex; justify-content: center; align-items: center; width: 36px; height: 36px; padding: 8px; color: var(--ink); background: var(--surface); border: 1px solid #8fa1aa; border-radius: 4px; cursor: pointer; flex-shrink: 0; }
.icon-button:hover { background: #edf2f5; }
.reply-button { position: absolute; right: 0; top: 14px; }
.chat-status { min-height: 22px; color: var(--muted); font-size: 12px; margin: 10px 0; }
.chat-status[data-error] { color: #912f25; }
.chat-composer { border-top: 1px solid var(--line); padding: 18px 0; }
.chat-composer .field { margin-bottom: 12px; }
.chat-composer textarea { min-height: 72px; max-height: 240px; }
.composer-tools { display: flex; gap: 20px; align-items: flex-end; flex-wrap: wrap; }
.composer-tools .field { flex: 1; min-width: 200px; margin: 0; }
.composer-tools label { font-size: 12px; }
.composer-tools .button { gap: 10px; min-height: 46px; }
.composer-tools .button img { filter: brightness(0) invert(1); }
.reply-preview, .composer-context { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 0 12px; margin: 0; color: var(--muted); }
.reply-preview span { overflow-wrap: anywhere; font-size: 12px; }
.older-messages { display: flex; margin: 12px auto; }
.new-messages { align-self: center; margin-top: 12px; }
@media (max-width: 900px) {
  .messenger { grid-template-columns: 220px minmax(0,1fr); }
  .chat-thread { padding-left: 20px; }
  .filter-grid { grid-template-columns: minmax(0,1fr); gap: 0; }
}
@media (max-width: 900px) {
  .invoice-layout { grid-template-columns: minmax(0,1fr); gap: 32px; }
  .invoice-actions { max-width: 640px; }
}
@media (max-width: 720px) {
  .workspace { width: calc(100% - 40px); }
  .tabs { column-gap: 20px; }
  .tabs a { padding-block: 12px; font-size: 13px; }
  .director-queues { grid-template-columns: minmax(0,1fr); gap: 28px; }
  .form-grid { grid-template-columns: minmax(0,1fr); gap: 0; }
  .detail-data > div { grid-template-columns: 120px minmax(0,1fr); gap: 14px; }
  input, select, textarea { font-size: 16px !important; }
  .queue-row { flex-wrap: wrap; }
  .task-row { grid-template-columns: minmax(0,1fr); gap: 8px; }
  .task-row-state { padding: 0; }
  .messenger-workspace { width: calc(100% - 40px); }
  .messenger { display: block; min-height: 0; }
  .chat-rooms { display: none; border: 0; padding: 20px 0; }
  .show-rooms .chat-rooms { display: block; }
  .show-rooms .chat-thread { display: none; }
  .chat-thread { padding-left: 0; }
  .mobile-rooms-link { display: block; flex-basis: 100%; }
  .chat-scroll { height: min(44svh,390px); min-height: 220px; padding-right: 8px; }
  .thread-heading h2 { font-size: 16px; }
  .composer-tools { gap: 12px; }
  .composer-tools .field { flex-basis: 100%; min-width: 0; }
  .composer-tools .button { width: 100%; }
  .message header strong { font-size: 12px; }
}
