:root {
  --ink: #073f66;
  --navy: #064a78;
  --blue: #0d5f93;
  --sky: #eaf5fb;
  --gold: #f07918;
  --green: #2f7d52;
  --amber: #c75f12;
  --paper: #ffffff;
  --mist: #f3f6f8;
  --line: #dce6ed;
  --text: #21384b;
  --muted: #6c7f8d;
  --shadow: 0 22px 70px rgba(7, 63, 102, 0.12);
}

body:not([data-role="broker"]) .broker-only {
  display: none !important;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--mist);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.login-screen {
  position: relative;
  display: grid;
  min-height: 100vh;
  place-items: center;
  overflow: hidden;
  padding: 28px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(234, 245, 251, 0.86)),
    radial-gradient(circle at 18% 18%, rgba(240, 121, 24, 0.18), transparent 28%),
    radial-gradient(circle at 86% 76%, rgba(6, 74, 120, 0.18), transparent 30%),
    #f7fafc;
}

.login-lines {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(118deg, transparent 0 38%, rgba(240, 121, 24, 0.75) 38.2% 38.8%, transparent 39%),
    linear-gradient(123deg, transparent 0 55%, rgba(6, 74, 120, 0.7) 55.1% 55.7%, transparent 56%),
    linear-gradient(135deg, transparent 0 72%, rgba(240, 121, 24, 0.45) 72.1% 72.5%, transparent 73%);
  pointer-events: none;
}

.login-card {
  position: relative;
  z-index: 1;
  width: min(540px, 100%);
  padding: 34px;
  border: 1px solid rgba(220, 230, 237, 0.92);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 28px 80px rgba(7, 63, 102, 0.16);
}

.login-logo {
  display: block;
  width: min(420px, 100%);
  margin: 0 auto 28px;
}

.join-button {
  display: grid;
  place-items: center;
  min-height: 42px;
  text-decoration: none;
}

.login-footer-brand {
  position: absolute;
  left: 50%;
  bottom: 24px;
  z-index: 1;
  display: grid;
  gap: 6px;
  justify-items: center;
  transform: translateX(-50%);
}

.login-footer-brand img {
  width: 168px;
  max-width: 44vw;
  height: auto;
  opacity: 0.82;
}

.login-footer-brand span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.logout-link {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--navy);
  background: rgba(255, 255, 255, 0.92);
  font-weight: 800;
  text-decoration: none;
  box-shadow: var(--shadow);
}

.login-form,
.request-form {
  display: grid;
  gap: 14px;
}

.request-dialog {
  width: min(560px, calc(100vw - 32px));
  border: 0;
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 24px 80px rgba(7, 63, 102, 0.24);
}

.request-dialog::backdrop {
  background: rgba(7, 63, 102, 0.35);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 28px 22px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.88);
  border-right: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
}

.logo-brand {
  display: block;
  padding: 4px 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
}

.brand-logo {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 4px;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 2px solid var(--navy);
  border-radius: 8px;
  color: white;
  background: var(--navy);
  font-size: 24px;
  font-weight: 800;
}

.login-help {
  margin: 0;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 21px;
  letter-spacing: 0;
}

.brand small,
.sidebar-panel p,
.sidebar-panel .eyebrow {
  color: var(--muted);
}

.brand {
  color: var(--ink);
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  border: 0;
  border-radius: 8px;
  color: var(--text);
  background: transparent;
  text-align: left;
}

.nav-badge {
  min-width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  padding: 0 7px;
  color: white;
  background: var(--orange);
  font-size: 12px;
  font-weight: 900;
}

.nav-item:hover,
.nav-item.active {
  color: var(--ink);
  background: #eaf5fb;
  box-shadow: inset 4px 0 0 var(--gold);
}

.broker-link {
  margin-top: 14px;
  border: 2px solid var(--navy);
  box-shadow: none;
}

.sidebar-panel {
  margin-top: auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.sidebar-panel h2 {
  margin: 4px 0;
  color: var(--ink);
  font-size: 18px;
}

.main-content {
  padding: 32px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
}

.topbar h1 {
  margin: 3px 0 0;
  color: var(--ink);
  font-size: clamp(28px, 4vw, 44px);
}

.topbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.eyebrow {
  margin: 0;
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.primary-button,
.subtle-button,
.danger-button,
.icon-button,
.file-row button,
.file-action-button,
.agent-table button,
.inline-form button {
  min-height: 42px;
  border-radius: 8px;
  font-weight: 800;
}

.primary-button {
  border: 0;
  padding: 0 18px;
  color: white;
  background: var(--navy);
  box-shadow: 0 10px 20px rgba(6, 74, 120, 0.18);
}

.danger-button {
  border: 0;
  padding: 0 18px;
  color: white;
  background: #b42318;
  box-shadow: 0 10px 20px rgba(180, 35, 24, 0.18);
}

.compact-select {
  display: grid;
  gap: 6px;
  min-width: min(100%, 320px);
  color: var(--ink);
  font-weight: 900;
}

.compact-select select {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: white;
  color: var(--text);
  font-weight: 800;
}

.onboarding-card {
  max-width: 760px;
}

.topbar .primary-button {
  background: var(--gold);
}

.subtle-button,
.file-row button,
.file-action-button,
.agent-table button,
.inline-form button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  padding: 0 14px;
  color: var(--navy);
  background: white;
  text-decoration: none;
}

.subtle-button:hover,
.file-row button:hover,
.file-action-button:hover,
.agent-table button:hover,
.inline-form button:hover {
  border-color: var(--gold);
  color: var(--amber);
}

.icon-button {
  min-width: 42px;
  border: 0;
  color: white;
  background: var(--gold);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.metric-card,
.panel {
  border: 1px solid rgba(220, 227, 238, 0.9);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 12px 34px rgba(7, 63, 102, 0.07);
}

.metric-card {
  padding: 20px;
}

.clickable-card {
  cursor: pointer;
}

.clickable-card:hover,
.clickable-card:focus-visible {
  border-color: var(--orange);
  outline: none;
  box-shadow: 0 14px 34px rgba(240, 121, 24, 0.16);
}

.metric-card span,
.metric-card small {
  display: block;
  color: var(--muted);
}

.metric-card strong {
  display: block;
  margin: 8px 0;
  color: var(--ink);
  font-size: 30px;
}

.content-grid,
.message-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 18px;
  margin-bottom: 18px;
}

.dashboard-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: stretch;
}

.dashboard-card {
  min-height: 0;
}

.dashboard-card[draggable="true"] .panel-header {
  cursor: grab;
}

.dashboard-card.drag-over {
  outline: 2px dashed var(--gold);
  outline-offset: 4px;
  background: #fff7ef;
}

.panel {
  padding: 22px;
}

.panel.full {
  max-width: 1120px;
}

.panel.wide {
  min-width: 0;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.collapsible-panel.is-collapsed > :not(.panel-header) {
  display: none !important;
}

.collapse-toggle {
  flex: 0 0 auto;
}

.dashboard-notice-stack {
  display: grid;
  gap: 18px;
}

.dashboard-notice-stack h3 {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 17px;
}

.compact-header {
  margin-bottom: 10px;
}

.mini-broadcast-form {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.mini-broadcast-form textarea {
  min-height: 70px;
}

.panel h2 {
  margin: 4px 0 0;
  color: var(--ink);
  font-size: 22px;
}

.bar-chart {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  align-items: end;
  height: 240px;
  gap: 14px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.bar-chart span {
  position: relative;
  min-width: 0;
  height: var(--height);
  border-radius: 8px 8px 0 0;
  background: linear-gradient(180deg, var(--gold), var(--navy));
}

.bar-chart em {
  position: absolute;
  right: 50%;
  bottom: calc(100% + 6px);
  transform: translateX(50%);
  color: var(--ink);
  font-size: 11px;
  font-style: normal;
  white-space: nowrap;
}

.bar-chart b {
  position: absolute;
  bottom: -28px;
  left: 0;
  right: 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.notice-list,
.note-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.notice-list article,
.notice-thread,
.note-list li,
.file-row,
.agent-table > div,
.message-person,
.bubble {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.notice-list article,
.notice-thread,
.note-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px;
  gap: 8px;
  align-items: start;
  padding: 14px;
}

.note-list li span,
.note-list li small {
  grid-column: 1;
}

.note-action-menu {
  grid-column: 2;
  grid-row: 1 / span 2;
}

.notice-list p,
.notice-thread p {
  margin: 6px 0;
}

.notice-thread {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 104px;
  gap: 10px;
}

.notice-action-menu,
.comment-action-menu {
  align-self: start;
  padding: 8px;
  font-size: 12px;
}

.notice-list small {
  color: var(--blue);
  font-weight: 800;
}

.note-form,
.upload-box,
.broadcast-form,
.user-admin-form,
.watercooler-form {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-weight: 800;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--text);
  background: white;
}

input[type="file"] {
  padding: 10px;
}

.drop-upload,
.mini-upload {
  display: grid;
  gap: 8px;
  border: 2px dashed #adc3d4;
  border-radius: 8px;
  padding: 18px;
  color: var(--ink);
  background: #fbfdff;
  text-align: center;
  transition: 160ms ease;
}

.drop-upload input,
.mini-upload input,
.attachment-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.drop-upload.drag-over,
.mini-upload.drag-over {
  border-color: var(--gold);
  background: #fff7ef;
}

.transaction-upload-form {
  align-items: stretch;
}

.transaction-dropzone {
  min-height: 132px;
  place-content: center;
}

.field-missing input,
.field-missing select,
.field-missing textarea,
.drop-upload.field-missing {
  border-color: #c94f28 !important;
  box-shadow: 0 0 0 3px rgba(201, 79, 40, 0.14);
}

.file-section.drag-over,
.file-section summary.drag-over {
  outline: 2px dashed var(--gold);
  outline-offset: 4px;
  background: #fff7ef;
}

.file-subfolder {
  margin-left: 18px;
}

.inline-folder-input {
  margin: 10px 0;
  border-color: var(--gold);
}

.inline-folder-editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  margin: 10px 0;
}

.inline-folder-editor .inline-folder-input {
  margin: 0;
}

.section-action-menu {
  max-width: 140px;
}

.upload-title {
  font-size: 15px;
  font-weight: 900;
  text-transform: uppercase;
}

.upload-copy,
.file-label {
  color: var(--muted);
  font-size: 14px;
}

.file-label {
  font-weight: 800;
}

.mini-upload {
  min-height: 42px;
  justify-content: center;
  padding: 10px;
}

.attachment-button {
  display: inline-grid;
  min-height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--navy);
  background: white;
  font-weight: 800;
}

textarea {
  resize: vertical;
}

.file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px;
  margin-bottom: 10px;
}

.transaction-submission {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 10px;
  background: white;
}

.transaction-submission summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px;
  cursor: pointer;
}

.transaction-submission summary span:first-child {
  display: grid;
  gap: 4px;
}

.transaction-file-stack {
  padding: 0 12px 12px;
}

.compact-file-row {
  margin-bottom: 8px;
  background: #fbfdff;
}

.file-accordion {
  display: grid;
  gap: 10px;
}

.file-accordion details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.file-accordion summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  color: var(--ink);
  font-weight: 900;
  cursor: pointer;
}

.section-actions {
  margin-left: auto;
}

.file-accordion details .file-row {
  margin: 0 12px 10px;
}

.file-row small {
  color: var(--muted);
}

.file-thumb {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: cover;
  background: #f7fafc;
}

.file-thumb-icon {
  display: inline-grid;
  place-items: center;
  color: var(--blue);
  font-size: 11px;
  font-weight: 900;
}

.preview-dialog {
  width: min(920px, calc(100vw - 32px));
  border: 0;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 24px 70px rgba(7, 63, 102, 0.24);
}

.preview-frame,
.preview-media {
  width: 100%;
  height: min(70vh, 720px);
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: contain;
  background: white;
}

.message-attachment {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 6px 10px 0 0;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.notice-thread + .notice-thread {
  margin-top: 14px;
}

.comments {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.inline-form {
  display: flex;
  gap: 10px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.span-2 {
  grid-column: 1 / -1;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.cda-alert {
  border: 1px solid #f4c391;
  border-radius: 8px;
  padding: 14px;
  color: #5d3109;
  background: #fff3e7;
  font-weight: 800;
  text-align: center;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-bottom: 12px;
}

.section-heading h3 {
  margin: 4px 0 0;
  color: var(--ink);
  font-size: 18px;
}

.referral-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fbfdff;
}

.referral-row {
  display: grid;
  grid-template-columns: 1.15fr 0.9fr 0.7fr 0.95fr 1fr 1.1fr auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.remove-btn {
  min-width: 42px;
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  color: white;
  background: #b92b2b;
  font-weight: 900;
}

.summary-card {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--mist);
}

.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.summary-row:last-child {
  border-bottom: 0;
}

.summary-row.total {
  margin: 6px -6px -6px;
  padding: 12px;
  border-radius: 8px;
  color: white;
  background: var(--navy);
}

.profile-photo-row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.agent-photo-preview {
  display: grid;
  width: 96px;
  height: 96px;
  place-items: center;
  overflow: hidden;
  border: 3px solid var(--sky);
  border-radius: 50%;
  color: white;
  background: var(--navy);
  font-size: 30px;
  font-weight: 900;
}

.agent-photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.status-pill {
  display: inline-flex;
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  color: #0c5132;
  background: #dff5e9;
  font-size: 12px;
  font-weight: 800;
}

.status-pill.warning {
  color: var(--amber);
  background: #fff1da;
}

.message-layout {
  grid-template-columns: 320px minmax(0, 1fr);
  align-items: stretch;
}

.message-list {
  display: grid;
  gap: 10px;
  align-content: start;
}

.message-list-header {
  display: grid;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.message-list-header h3 {
  margin: 0;
  color: var(--ink);
}

.message-person {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 104px;
  gap: 8px;
  align-items: center;
  width: 100%;
  padding: 14px;
  color: var(--text);
  text-align: left;
}

.message-thread-pick {
  display: grid;
  gap: 4px;
  min-width: 0;
  border: 0;
  padding: 0;
  color: inherit;
  background: transparent;
  text-align: left;
}

.thread-action-select {
  min-width: 0;
  padding: 8px;
  font-size: 12px;
}

.message-person.active {
  border-color: var(--blue);
  background: var(--sky);
}

.message-person span {
  color: var(--muted);
  font-size: 14px;
}

.message-thread {
  display: grid;
  grid-template-rows: auto minmax(260px, 1fr) auto;
  gap: 12px;
  min-height: 430px;
  max-height: calc(100vh - 190px);
}

#message-thread-list {
  display: grid;
  gap: 12px;
  align-content: start;
  min-height: 0;
  overflow: auto;
  padding-right: 6px;
}

#message-form {
  position: sticky;
  bottom: 0;
  z-index: 2;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  background: white;
}

.bubble {
  max-width: 76%;
  padding: 12px 14px;
}

.bubble.broker {
  background: var(--sky);
}

.bubble.agent {
  justify-self: end;
  color: white;
  background: var(--navy);
}

.agent-table {
  display: grid;
  gap: 8px;
}

.agent-table > div,
.agent-ledger > div {
  display: grid;
  grid-template-columns: 1.1fr 0.8fr 0.8fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
}

.agent-table .table-head,
.agent-ledger .table-head {
  color: var(--muted);
  background: var(--mist);
  font-size: 13px;
  font-weight: 800;
}

.cda-history > div {
  grid-template-columns: 1.3fr 1fr 0.8fr auto;
}

.button-pair {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.cda-queue-list {
  display: grid;
  gap: 10px;
}

.cda-review-row {
  align-items: flex-start;
}

.cda-review-row small,
.message-attachments {
  display: block;
  margin-top: 4px;
}

.cda-review-row a,
.message-attachments a {
  display: inline-block;
  margin: 4px 8px 0 0;
  color: var(--blue);
  font-weight: 800;
}

.queue-subhead {
  margin: 18px 0 10px;
  color: var(--ink);
  font-size: 16px;
}

.agent-ledger {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.agent-ledger > div {
  grid-template-columns: 1.3fr 0.8fr 0.8fr 0.8fr 0.8fr;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.notification-panel {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fbfdff;
}

.notification-panel h3 {
  margin: 0 0 4px;
  color: var(--ink);
}

.backend-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.backend-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfdff;
}

.backend-grid span,
.backend-grid strong {
  display: block;
}

.backend-grid span {
  color: var(--muted);
  font-size: 13px;
}

.backend-grid strong {
  margin-top: 4px;
  color: var(--ink);
  font-size: 24px;
}

.access-note,
.audit-note {
  border: 1px solid #f0d6a7;
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--amber);
  background: #fff8eb;
  font-weight: 700;
}

.locked-file {
  border-color: #f0d6a7;
  background: #fff8eb;
}

.signed-row {
  border-color: #bce7cf;
  background: #f0fbf5;
}

.tab-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.member-tabs {
  grid-column: 1 / -1;
}

.member-name-button {
  min-height: auto !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  color: var(--navy) !important;
  font: inherit;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.archive-content,
.archive-section {
  display: grid;
  gap: 12px;
}

.archive-section h3 {
  margin: 12px 0 0;
  color: var(--ink);
}

.archive-row {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfdff;
}

.archive-row p {
  margin: 0;
}

.resource-board {
  display: grid;
  gap: 18px;
}

.resource-section {
  display: grid;
  gap: 12px;
}

.resource-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.resource-section-header h3 {
  margin: 0;
  color: var(--ink);
}

.resource-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.resource-card {
  position: relative;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfdff;
}

.resource-logo {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  color: white;
  background: var(--blue);
  font-weight: 900;
}

.resource-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: white;
}

.resource-copy {
  display: grid;
  gap: 8px;
}

.resource-copy h4,
.resource-copy p {
  margin: 0;
}

.resource-copy p {
  color: var(--muted);
}

.resource-actions {
  grid-column: 1 / -1;
}

.resource-empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 14px;
  color: var(--muted);
  background: white;
}

.tab-strip button {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--ink);
  background: white;
  font-weight: 900;
}

.tab-strip button.active {
  color: white;
  border-color: var(--blue);
  background: var(--blue);
}

.cda-record-panel {
  display: none;
}

.cda-record-panel.active {
  display: grid;
  gap: 10px;
}

.cda-central-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.cda-dialog {
  width: min(1040px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  overflow: auto;
}

.signature-panel {
  margin-top: 18px;
}

.signature-workspace {
  display: grid;
  gap: 18px;
}

.signing-summary {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: #fbfdff;
  color: var(--ink);
  font-weight: 800;
}

.signature-doc-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.signature-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.signature-toolbar button {
  min-width: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--ink);
  background: white;
  font-weight: 900;
}

.signature-document {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  overflow: hidden;
}

.compact-header {
  padding: 12px;
}

.signature-page {
  position: relative;
  height: min(78vh, 860px);
  min-height: 640px;
  background: #eef4f8;
  overflow: auto;
}

.signature-page iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: white;
}

.signature-stamp {
  position: absolute;
  left: 34px;
  top: 74%;
  z-index: 4;
  width: 260px;
  min-width: 180px;
  min-height: 118px;
  border: 1px dashed rgba(7, 63, 102, 0.45);
  border-radius: 6px;
  padding: 10px 12px;
  color: #111;
  background: transparent;
  box-shadow: none;
  cursor: grab;
  font-size: 15px;
  resize: both;
  overflow: auto;
}

.signature-stamp:active {
  cursor: grabbing;
}

.signature-stamp small {
  font-family: inherit;
  font-size: 12px;
}

.signature-stamp img {
  display: block;
  width: 100%;
  max-height: 72px;
  object-fit: contain;
  object-position: left center;
  pointer-events: none;
}

.signature-stamp b,
.signature-stamp strong,
.signature-stamp small {
  display: block;
  pointer-events: none;
}

.escrow-stamp {
  top: 72%;
}

.signing-action-box {
  max-width: none;
}

.signature-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
}

.pdf-preview {
  min-height: 420px;
  padding: 18px;
  border-radius: 8px;
  background: #e6ebf2;
}

.pdf-page {
  max-width: 520px;
  min-height: 380px;
  margin: 0 auto;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: white;
  box-shadow: 0 18px 40px rgba(16, 35, 74, 0.14);
}

.pdf-page h3 {
  margin-top: 0;
  color: var(--ink);
}

.signature-line {
  margin-top: 78px;
  padding-top: 12px;
  border-top: 1px solid var(--ink);
  color: var(--muted);
}

.signature-line.compact-signature {
  margin-top: 44px;
}

.watercooler-hero {
  background:
    linear-gradient(90deg, rgba(126, 84, 45, 0.18) 1px, transparent 1px),
    linear-gradient(rgba(126, 84, 45, 0.18) 1px, transparent 1px),
    #b98252;
  background-size: 26px 26px;
}

.watercooler-hero .panel-header,
.watercooler-form {
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.86);
}

.watercooler-form {
  display: grid;
  grid-template-columns: minmax(260px, 420px) auto auto;
  align-items: end;
  width: fit-content;
  transform: rotate(-1deg);
}

.watercooler-form textarea {
  width: min(420px, 70vw);
  min-height: 190px;
  border: 0;
  border-radius: 3px;
  padding: 28px 22px 22px;
  color: #38250d;
  background: #fff2a8;
  box-shadow: 0 14px 24px rgba(42, 26, 9, 0.18);
  font-size: 22px;
  font-weight: 800;
}

.corkboard {
  position: relative;
  min-height: 72vh;
  padding: 24px;
  overflow: auto;
}

.pin-note {
  position: absolute;
  width: 230px;
  min-height: 150px;
  border: 0;
  border-radius: 3px;
  padding: 24px 18px 18px;
  color: #38250d;
  box-shadow: 0 14px 24px rgba(42, 26, 9, 0.24);
  text-align: left;
  transform: rotate(-2deg);
  user-select: none;
  touch-action: none;
  transition: box-shadow 160ms ease, transform 160ms ease;
}

.pin-note.note-small {
  width: 190px;
  min-height: 130px;
}

.pin-note.note-wide {
  width: 310px;
  min-height: 150px;
}

.pin-note.note-tall {
  width: 220px;
  min-height: 240px;
}

.pin-note.dragging {
  z-index: 20;
  box-shadow: 0 22px 32px rgba(42, 26, 9, 0.34);
  transform: rotate(0deg) scale(1.02);
}

.post-open-button {
  display: block;
  width: 100%;
  border: 0;
  padding: 0;
  color: inherit;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.watercooler-author {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.watercooler-author img,
.watercooler-author span {
  width: 28px;
  height: 28px;
  border-radius: 999px;
}

.watercooler-author img {
  object-fit: cover;
}

.watercooler-author span {
  display: inline-grid;
  place-items: center;
  color: white;
  background: var(--navy);
  font-weight: 900;
}

.watercooler-author b {
  font-size: 13px;
}

.post-menu-dot,
.post-action-menu,
.note-drag-handle {
  position: absolute;
  right: 10px;
  top: 8px;
  border-radius: 999px;
  padding: 2px 7px;
  color: var(--navy);
  background: rgba(255, 255, 255, 0.7);
  font-style: normal;
  font-weight: 900;
}

.post-action-menu {
  max-width: 96px;
  border: 1px solid rgba(7, 63, 102, 0.22);
  border-radius: 7px;
  padding: 4px 6px;
  font-size: 12px;
}

.note-drag-handle {
  right: auto;
  left: 10px;
  cursor: grab;
  font-size: 11px;
}

.pin-note:nth-child(even) {
  transform: rotate(2deg);
}

.pin-note.dragging {
  z-index: 20;
  box-shadow: 0 22px 32px rgba(42, 26, 9, 0.34);
  transform: rotate(0deg) scale(1.02);
}

.pin-note::before {
  content: "";
  position: absolute;
  top: 8px;
  left: 50%;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
}

.pin-note span,
.pin-note small {
  display: block;
}

.pin-thumb {
  width: 100%;
  max-height: 88px;
  border-radius: 6px;
  object-fit: cover;
  margin-bottom: 8px;
}

.pin-note span {
  font-size: 20px;
  font-weight: 900;
}

.pin-note small {
  margin-top: 16px;
  color: rgba(56, 37, 13, 0.7);
}

.pin-note em {
  display: inline-block;
  margin-top: 14px;
  color: var(--blue);
  font-style: normal;
  font-weight: 900;
}

.comment-row {
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.comment-row p {
  margin: 4px 0;
}

.pin-note.yellow {
  background: #fff2a8;
}

.pin-note.blue {
  background: #ccecff;
}

.pin-note.orange {
  background: #ffd1a4;
}

.watercooler-detail {
  margin-top: 18px;
}

.signed-pdf-sheet {
  position: relative;
  overflow: hidden;
  max-width: 840px;
  margin: 0 auto;
  padding: 34px;
  border: 1px solid #cfd9e3;
  border-radius: 4px;
  background: white;
  box-shadow: 0 20px 50px rgba(7, 63, 102, 0.14);
}

.signed-pdf-sheet > *:not(.pdf-watermark) {
  position: relative;
  z-index: 1;
}

.draft-watermark {
  position: absolute;
  inset: 50% auto auto 50%;
  z-index: 2;
  transform: translate(-50%, -50%) rotate(-22deg);
  color: rgba(188, 35, 35, 0.18);
  font-size: 156px;
  font-weight: 900;
  letter-spacing: 8px;
  pointer-events: none;
}

.signed-pdf-sheet.signed .draft-watermark {
  display: none;
}

.signed-pdf-sheet:not(.signed) .pdf-signatures {
  display: none;
}

.pdf-watermark {
  position: absolute;
  right: -20px;
  bottom: -24px;
  z-index: 0;
  width: 360px;
  opacity: 0.22;
  pointer-events: none;
}

.pdf-banner {
  color: var(--ink);
  font-size: 28px;
  font-weight: 900;
  text-align: center;
}

.pdf-subtitle {
  text-align: center;
}

.pdf-alert {
  margin: 18px 0;
  padding: 12px;
  border-radius: 4px;
  color: #111;
  background: #f5b400;
  font-weight: 900;
  text-align: center;
}

.pdf-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin: 12px 0;
}

.pdf-grid span {
  border: 1px solid var(--line);
  padding: 10px;
}

.pdf-grid b {
  display: block;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.pdf-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
}

.pdf-table th,
.pdf-table td {
  border: 1px solid var(--line);
  padding: 12px;
  text-align: left;
}

.pdf-table th {
  background: var(--mist);
}

.pdf-total {
  color: white;
  background: var(--navy);
  font-weight: 900;
}

.pdf-instruction-boxes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.instruction-box {
  border: 1px solid var(--line);
  border-left: 5px solid var(--gold);
  border-radius: 4px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.92);
}

.instruction-box h3 {
  margin: 0 0 8px;
  color: var(--ink);
}

.instruction-box b {
  display: block;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.instruction-box p {
  margin: 8px 0 0;
  line-height: 1.5;
}

.signed-pdf-sheet {
  aspect-ratio: 8.5 / 11;
  width: min(816px, 100%);
}

.admin-control-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.admin-control-grid button {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--navy);
  background: white;
  font-weight: 800;
}

.broker-wire {
  border-left-color: var(--navy);
}

.pdf-signatures {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 28px;
}

.pdf-signatures.single-signature {
  grid-template-columns: minmax(0, 320px);
  justify-content: start;
}

.pdf-signatures span {
  border-top: 1px solid var(--ink);
  padding-top: 12px;
}

.pdf-signatures b,
.pdf-signatures small {
  display: block;
}

.pdf-signatures em {
  display: block;
  margin: 8px 0;
  color: var(--ink);
  font-family: "Brush Script MT", "Segoe Script", cursive;
  font-size: 34px;
}

.signature-image {
  display: block;
  width: 210px;
  height: auto;
  margin: 8px 0;
}

.page-builder {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.builder-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.builder-toolbar button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--navy);
  background: white;
  font-weight: 800;
}

.builder-canvas {
  display: grid;
  gap: 10px;
  min-height: 220px;
  padding: 14px;
}

.builder-block {
  border: 1px dashed #adc3d4;
  border-radius: 8px;
  padding: 14px;
  color: var(--text);
  background: white;
  cursor: grab;
}

.sign-box {
  display: grid;
  align-content: start;
  gap: 14px;
}

.signature-input {
  color: var(--ink);
  font-family: "Brush Script MT", "Segoe Script", cursive;
  font-size: 30px;
}

.checkbox-label {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 10px;
  align-items: start;
}

.checkbox-label input {
  width: 18px;
  margin-top: 3px;
}

.toast {
  position: fixed;
  left: 50%;
  top: 42px;
  z-index: 5000;
  width: min(760px, calc(100vw - 28px));
  min-height: 86px;
  padding: 26px 30px;
  border-radius: 8px;
  color: white;
  background: var(--navy);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translate(-50%, -18px);
  transition: 180ms ease;
  pointer-events: none;
  text-align: center;
  font-size: 18px;
  font-weight: 900;
}

.toast strong {
  display: block;
  font-size: clamp(22px, 4vw, 34px);
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .nav-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

	  .metric-grid,
	  .content-grid,
	  .dashboard-card-grid,
	  .message-layout,
  .signature-layout,
  .backend-grid,
  .referral-row,
  .corkboard,
  .watercooler-form,
  .pdf-grid,
  .pdf-instruction-boxes,
  .pdf-signatures,
  .admin-control-grid {
    grid-template-columns: 1fr;
  }

  .main-content {
    padding: 20px;
  }
}

@media (max-width: 620px) {
  .topbar,
  .panel-header,
  .section-heading,
  .form-actions,
  .inline-form,
  .file-row {
    align-items: stretch;
    flex-direction: column;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .profile-photo-row {
    grid-template-columns: 1fr;
  }

  .agent-table > div {
    grid-template-columns: 1fr;
  }

  .agent-ledger > div {
    grid-template-columns: 1fr;
  }

  .nav-list {
    grid-template-columns: 1fr;
  }

  .metric-card strong {
    font-size: 26px;
  }
}
