/* Sam for accountants: a calm, dense console in the same visual system as the client site (density 6).
   The shared base styles (/styles.css) come from web/ at publish time (see SHARED). */

.bo { min-height: 100dvh; display: flex; flex-direction: column; font-size: 14px; }
.hide-sm { display: inline; }

/* ---------- Top bar ---------- */
.bo-top {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 56px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 18px;
  background: rgb(17 17 19 / .94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.bo-top .brand { text-decoration: none; font-size: 17px; }
.bo-top .brand-mark { width: 24px; height: 24px; }
.bo-divider { width: 1px; height: 20px; background: var(--line-2); }
.bo-title { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.bo-tabs { display: flex; align-self: stretch; gap: 2px; margin-left: 10px; }
.bo-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 520;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.bo-tab .i { width: 16px; height: 16px; }
.bo-tab:hover { color: var(--text); }
.bo-tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.bo-tab[aria-selected="true"] .i { color: var(--accent); }
.bo-tab-count { font-size: 10.5px; color: var(--muted); padding: 1px 7px; border-radius: 999px; background: var(--card-2); border: 1px solid var(--line-2); }
.bo-tab-count:empty { display: none; }
.bo-user { margin-left: auto; display: flex; align-items: center; gap: 10px; min-width: 0; }
.bo-updated { font-size: 11px; color: var(--faint); white-space: nowrap; }
.bo-user .avatar { width: 28px; height: 28px; font-size: 10.5px; }
.bo-user-copy { display: grid; line-height: 1.25; min-width: 0; }
#bo-name { font-size: 13px; font-weight: 520; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
.bo-role { font-family: var(--mono); font-size: 10.5px; letter-spacing: .04em; color: var(--faint); }

/* ---------- Loading / message states ---------- */
.bo-state { flex: 1; width: min(1100px, 100%); margin: 0 auto; padding: 32px 20px; }
.bo-skeleton { display: grid; gap: 10px; }
.bo-sk-row { height: 52px; border-radius: var(--r-md); }
.bo-message-card { width: min(520px, 100%); margin: 8vh 0 0; padding: 28px; display: grid; gap: 14px; justify-items: start; border-radius: var(--r-xl); border: 1px solid var(--line-2); background: var(--card); box-shadow: var(--inset); animation: rise .6s var(--ease) both; }
.bo-message-card p { color: var(--muted); line-height: 1.65; }
.bo-message-card .actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }

/* ---------- Sign in ---------- */
.acc-signin { flex: 1; display: grid; place-items: center; padding: 48px 20px; }
.acc-signin .login-box { max-width: 400px; }

/* ---------- Segmented controls ---------- */
.segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--field); border: 1px solid var(--line-2); }
.segmented > button, .segmented label span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 28px;
  padding: 0 12px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}
.segmented > button:hover, .segmented label span:hover { color: var(--text); }
.segmented > button[aria-checked="true"], .segmented label input:checked + span { background: var(--card-2); color: var(--text); box-shadow: var(--inset), 0 0 0 1px var(--line-3); }
.segmented label { position: relative; display: flex; }
.segmented label input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segmented label input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.segmented.wide { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; }
.segmented.wide label span { width: 100%; }
.segmented .mono { font-size: 11px; color: var(--faint); }

/* ---------- Queue ---------- */
.bo-main { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); height: calc(100dvh - 56px); }
.bo-list { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); }
.bo-list-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.bo-search { position: relative; flex: 1; min-width: 0; }
.bo-search .i { position: absolute; left: 10px; top: 50%; margin-top: -8px; width: 16px; height: 16px; color: var(--faint); pointer-events: none; }
.bo-search input { min-height: 34px !important; padding: 6px 10px 6px 32px !important; font-size: 13.5px !important; border-radius: 9px !important; }
/* Ticket status filters: Open, New, In progress, Waiting on client, Done (with counts). */
.bo-filters { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.bo-filters button { flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px; border-radius: 999px; border: 1px solid var(--line-2); background: transparent; color: var(--muted); font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.bo-filters button:hover { color: var(--text); border-color: var(--line-3); }
.bo-filters button[aria-checked="true"] { color: var(--text); background: var(--card-2); border-color: var(--accent-line); box-shadow: var(--inset); }
.bo-filters .mono { font-size: 10.5px; color: var(--faint); }
.bo-filters .mono:empty { display: none; }
.bo-table { flex: 1; min-height: 0; overflow: auto; }
.bo-row {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1.1fr) 168px 116px 56px;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 54px;
  padding: 6px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
  text-align: left;
  color: var(--text-2);
}
.bo-row-head { position: sticky; top: 0; z-index: 1; min-height: 34px; padding-top: 0; padding-bottom: 0; background: var(--bg); font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.bo-row .num { text-align: right; }
button.bo-row { transition: transform .3s var(--ease); }
button.bo-row:hover { background: var(--hover); }
button.bo-row[aria-selected="true"] { background: var(--card-2); box-shadow: inset 2px 0 0 var(--accent); color: var(--text); }
button.bo-row { animation: rise .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 30ms); }
.cell-main { display: grid; min-width: 0; gap: 1px; }
.cell-main strong { font-weight: 530; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell-main small { font-size: 12px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell-age { font-family: var(--mono); font-size: 12px; color: var(--muted); text-align: right; }
.bo-list-empty { display: grid; gap: 8px; justify-items: start; padding: 36px 18px; color: var(--muted); font-size: 13.5px; }
.bo-list-empty strong { color: var(--text); font-weight: 540; font-size: 15px; }
.bo-list-error { margin: 14px; }

.pill .i { width: 12px; height: 12px; }
.pill.dashed { border-style: dashed; }

/* ---------- Detail ---------- */
.bo-detail { position: relative; min-height: 0; overflow: auto; padding: 20px 26px 0; outline: none; }
.bo-empty { display: grid; gap: 10px; justify-items: start; max-width: 340px; margin: 12vh auto 0; color: var(--muted); font-size: 13.5px; line-height: 1.6; }
.bo-empty .h3 { color: var(--text); }
.bo-back { display: none; margin: -4px 0 10px -10px; }
.bo-detail-head { display: grid; gap: 12px; padding-bottom: 18px; border-bottom: 1px solid var(--line); animation: rise .45s var(--ease) both; }
.bo-detail-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.bo-detail-title h2 { font-size: 22px; font-weight: 550; letter-spacing: -.032em; line-height: 1.2; }
.bo-detail-sub { margin-top: 3px; color: var(--muted); font-size: 13.5px; }
.bo-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.bo-meta { display: flex; gap: 6px 18px; flex-wrap: wrap; font-family: var(--mono); font-size: 11.5px; color: var(--faint); }
.bo-meta b { font-weight: 450; color: var(--muted); }
.bo-actions { display: flex; gap: 8px; flex-wrap: wrap; flex-shrink: 0; }
.bo-section { padding: 18px 0; border-bottom: 1px solid var(--line); animation: rise .5s var(--ease) both; }
.bo-section:nth-of-type(2) { animation-delay: 40ms; }
.bo-section:nth-of-type(3) { animation-delay: 80ms; }
.bo-section:nth-of-type(4) { animation-delay: 120ms; }
.bo-section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; font-family: var(--mono); font-size: 10.5px; font-weight: 450; letter-spacing: .09em; text-transform: uppercase; color: var(--faint); }
.bo-request { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text); font-size: 14.5px; line-height: 1.65; }
.bo-muted { color: var(--faint); font-size: 13px; }
.bo-steps { list-style: none; counter-reset: step; margin: 0; padding: 0; }
.bo-steps li { counter-increment: step; display: grid; grid-template-columns: 30px minmax(0, 1fr); padding: 7px 0; font-size: 14px; color: var(--text-2); line-height: 1.55; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.bo-steps li:last-child { border-bottom: 0; }
.bo-steps li::before { content: counter(step, decimal-leading-zero); font-family: var(--mono); font-size: 11.5px; color: var(--accent); padding-top: 2px; }
.bo-improvements { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.bo-improvements li { padding: 10px 12px; border-radius: var(--r-md); border: 1px solid var(--warn-line); background: var(--warn-soft); font-size: 14px; line-height: 1.55; color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; }
.bo-improvements small { display: block; margin-top: 4px; font-family: var(--mono); font-size: 11px; color: var(--warn); }
.bo-callout { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 12px; padding: 10px 12px; border-radius: var(--r-md); border: 1px solid var(--warn-line); background: var(--warn-soft); color: #ecd2ad; font-size: 13px; line-height: 1.55; }
.bo-callout .i { width: 16px; height: 16px; margin-top: 2px; color: var(--warn); }
.bo-callout.danger { border-color: var(--danger-line); background: var(--danger-soft); color: #f0c8c1; }
.bo-callout.danger .i { color: var(--danger); }
.bo-callout.info { border-color: var(--accent-line); background: var(--accent-soft); color: var(--text-2); }
.bo-callout.info .i { color: var(--accent); }

/* Conversation with the client */
.bo-thread { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.bo-msg { max-width: 88%; padding: 9px 12px; border-radius: var(--r-md); border: 1px solid var(--line-2); background: var(--card); animation: rise .4s var(--ease) both; }
.bo-msg.from-accountant { justify-self: end; background: var(--card-2); border-color: var(--accent-line); }
.bo-msg.is-held { border-style: dashed; border-color: var(--warn-line); background: var(--warn-soft); }
.bo-msg-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 3px; }
.bo-msg-head strong { font-size: 12.5px; font-weight: 540; color: var(--text); }
.bo-msg-head small { font-family: var(--mono); font-size: 10.5px; color: var(--faint); white-space: nowrap; }
.bo-msg-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.55; color: var(--text-2); }
.bo-msg-held { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; line-height: 1.5; color: #ecd2ad; }
.bo-msg-held .i { width: 15px; height: 15px; margin-top: 2px; color: var(--warn); flex-shrink: 0; }
.bo-reply { display: flex; gap: 8px; align-items: flex-end; }
.bo-reply textarea { flex: 1; min-height: 44px; resize: vertical; font-size: 14px; }
.bo-reply .primary { flex-shrink: 0; }

.bo-files { display: grid; }
.bo-file { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); }
.bo-file:last-child { border-bottom: 0; }
.bo-file .file-glyph { width: 30px; height: 30px; border-radius: 8px; }
.bo-file .file-main strong { font-size: 13.5px; }
.bo-file-actions { display: flex; align-items: center; gap: 6px; }
.bo-file-note { grid-column: 2 / -1; font-size: 12.5px; line-height: 1.5; color: var(--warn); }
.bo-file.is-skipped .file-glyph, .bo-file.is-error .file-glyph { color: var(--warn); border-color: var(--warn-line); background: var(--warn-soft); }
.bo-file input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); }
.bo-file-check { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); cursor: pointer; }

.bo-dropzone {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  padding: 14px;
  border-radius: var(--r-lg);
  border: 1px dashed var(--line-3);
  background: var(--field);
  cursor: pointer;
  font-size: 13.5px;
  color: var(--muted);
}
.bo-dropzone strong { display: block; color: var(--text); font-weight: 530; }
.bo-dropzone .dropzone-icon { margin: 0; }
.bo-dropzone:hover, .bo-dropzone.dragging { border-color: var(--accent); background: var(--accent-soft); }
.bo-dropzone:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.bo-dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.bo-finish { position: sticky; bottom: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 -26px; padding: 14px 26px max(16px, env(safe-area-inset-bottom)); background: rgb(17 17 19 / .94); backdrop-filter: blur(8px); border-top: 1px solid var(--line); }
.bo-finish p { font-size: 13px; color: var(--muted); }

/* ---------- Admin ---------- */
.bo-admin { flex: 1; width: min(1240px, 100%); margin: 0 auto; padding: 22px 20px 48px; display: grid; gap: 16px; align-content: start; }
.bo-admin-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.bo-card { padding: 20px; border-radius: var(--r-xl); border: 1px solid var(--line-2); background: var(--card); box-shadow: var(--inset); animation: rise .55s var(--ease) both; }
.bo-card:nth-child(2) { animation-delay: 60ms; }
.bo-users { animation-delay: 120ms; }
.bo-card-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 18px; }
.bo-card-head p { font-size: 13px; color: var(--muted); margin-top: 2px; line-height: 1.5; }
.bo-card-head.row { justify-content: space-between; align-items: center; }
.bo-card .meta-list { margin-bottom: 18px; }
.role-field { border: 0; padding: 0; margin: 0 0 18px; min-width: 0; }
.role-field legend { padding: 0; margin-bottom: 8px; font-size: 13px; font-weight: 520; color: var(--text-2); }
.upload-progress { display: flex; align-items: center; gap: 12px; margin: -4px 0 16px; }
.upload-progress .progress { flex: 1; height: 4px; }
.upload-progress .mono { font-size: 12px; color: var(--muted); min-width: 40px; text-align: right; }
.bo-users-table { margin: 0 -20px -20px; }
.bo-urow { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr) 110px 120px 108px 96px; align-items: center; gap: 12px; min-height: 46px; padding: 6px 20px; border-top: 1px solid var(--line); font-size: 13.5px; color: var(--text-2); }
.bo-urow.bo-row-head { position: static; min-height: 34px; background: transparent; font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.bo-urow > span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bo-urow .num { text-align: right; font-family: var(--mono); font-size: 12px; color: var(--faint); }
.bo-urow .mono-cell { font-family: var(--mono); font-size: 12px; color: var(--muted); }

/* ---------- Complete dialog ---------- */
#complete-dialog { width: min(520px, calc(100% - 28px)); }
.complete-files { list-style: none; margin: 16px 0; padding: 0; border-top: 1px solid var(--line); }
.complete-files li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.complete-files li span { display: inline-flex; align-items: center; gap: 8px; min-width: 0; overflow-wrap: anywhere; }
.complete-files li span .i { width: 15px; height: 15px; color: var(--faint); }
.complete-files small { font-family: var(--mono); font-size: 11px; color: var(--faint); white-space: nowrap; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .bo-row { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 164px 112px 48px; }
  .bo-urow { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) 100px 110px 100px; }
  .bo-urow > :last-child { display: none; }
}

@media (max-width: 900px) {
  .bo-main { grid-template-columns: 1fr; grid-template-rows: auto; height: auto; min-height: calc(100dvh - 56px); }
  .bo-main .bo-detail { display: none; }
  .bo-main.show-detail .bo-list { display: none; }
  .bo-main.show-detail .bo-detail { display: block; }
  .bo-back { display: inline-flex; }
  .bo-detail { overflow: visible; }
  .bo-list { border-right: 0; }
  .bo-table { overflow: visible; }
}

@media (max-width: 767px) {
  .hide-sm { display: none; }
  .bo-top { padding: 0 12px; gap: 10px; }
  .bo-divider, .bo-title, .bo-updated { display: none; }
  .bo-tabs { margin-left: 2px; }
  .bo-tab { padding: 0 8px; }
  .bo-list-head { padding: 10px 12px; }
  .bo-row { grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; padding: 12px; }
  .bo-row-head { display: none; }
  .bo-row > :nth-child(2) { grid-column: 1; grid-row: 2; }
  .bo-row > :nth-child(3) { grid-column: 2; grid-row: 1; justify-self: end; }
  .bo-row > :nth-child(4) { grid-column: 2; grid-row: 2; justify-self: end; }
  .bo-row > :nth-child(5) { display: none; }
  .bo-row > :nth-child(1) small { display: none; }
  .bo-row > :nth-child(2) strong { font-weight: 400; font-size: 13px; color: var(--muted); }
  .bo-row > :nth-child(2) small { display: none; }
  .bo-detail { padding: 14px 14px 0; }
  .bo-detail-title { flex-direction: column; }
  .bo-filters { padding: 8px 12px; }
  .bo-msg { max-width: 100%; }
  .bo-reply { flex-direction: column; align-items: stretch; }
  .bo-finish { margin: 0 -14px; padding: 12px 14px max(14px, env(safe-area-inset-bottom)); flex-direction: column; align-items: stretch; }
  .bo-finish .primary { width: 100%; }
  .bo-admin { padding: 16px 12px 40px; }
  .bo-admin-grid { grid-template-columns: 1fr; }
  .bo-card { padding: 16px; }
  .bo-users-table { margin: 0 -16px -16px; }
  .bo-urow { grid-template-columns: minmax(0, 1fr) auto; padding: 10px 16px; gap: 4px 10px; }
  .bo-urow.bo-row-head { display: none; }
  .bo-urow > :nth-child(1) { grid-column: 1; }
  .bo-urow > :nth-child(2) { grid-column: 1; grid-row: 2; font-size: 12.5px; color: var(--faint); }
  .bo-urow > :nth-child(3) { grid-column: 2; grid-row: 1; justify-self: end; }
  .bo-urow > :nth-child(4) { display: none; }
  .bo-urow > :nth-child(5) { grid-column: 2; grid-row: 2; justify-self: end; }
  .bo-message-card { margin-top: 4vh; padding: 22px; }
}
