:root {
  --ink: #0f172a;
  --muted: #475569;
  --line: #d7dee9;
  --bg: #f4f6fb;
  --panel: #ffffff;
  --brand: #2457df;
  --brand-strong: #14337a;
  --accent: #2563eb;
  --danger: #b42318;
  --sidebar: #1f2b3a;
  --sidebar-item: #293646;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
}

a {
  color: var(--brand-strong);
}

.shell {
  min-height: 100vh;
  padding-left: 165px;
}

.public-shell {
  padding-left: 0;
}

.sidebar {
  background: var(--sidebar);
  bottom: 0;
  color: #fff;
  left: 0;
  padding: 28px 15px;
  position: fixed;
  top: 0;
  width: 165px;
  overflow-y: auto;
}

.brand {
  align-items: center;
  display: flex;
  color: #fff;
  font-size: 19px;
  font-weight: 700;
  gap: 10px;
  line-height: 1.1;
  margin-bottom: 18px;
}

.brand img {
  height: 30px;
  width: 30px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav a,
.link-button {
  background: var(--sidebar-item);
  border: 0;
  border-radius: 6px;
  color: #fff;
  display: block;
  font-size: 12px;
  font-weight: 700;
  padding: 9px 10px;
  text-align: left;
  text-decoration: none;
}

.nav a:hover,
.link-button:hover {
  background: #344357;
}

.link-button {
  color: #ffebe9;
  cursor: pointer;
  width: 100%;
}

.nav-divider {
  border-top: 1px solid #435164;
  display: block;
  margin: 8px 0;
}

.main {
  margin: 0;
  max-width: none;
  padding: 16px 15px 42px;
}

.quick-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-start;
  margin-bottom: 10px;
}

.quick-actions button,
.quick-actions .button {
  padding: 10px 14px;
}

.public-shell .main {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.auth-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
  max-width: 460px;
  padding: 28px;
  width: 100%;
}

.auth-card h1 {
  margin-top: 18px;
}

.auth-brand {
  align-items: center;
  display: flex;
  gap: 10px;
}

.auth-brand img {
  height: 38px;
  width: 38px;
}

.register-access-button {
  animation: flashPulse 1s infinite;
  background: #fff7ed;
  border: 2px solid #f97316;
  border-radius: 8px;
  color: #9a3412;
  display: block;
  font-size: 15px;
  font-weight: 800;
  padding: 14px;
  text-align: center;
  text-decoration: none;
}

.register-access-wrap {
  display: flex;
  justify-content: center;
}

.muted {
  color: var(--muted);
}

.camera-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.camera-box {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.camera-box.field-missing {
  background: #fff7ed;
  border-color: #f97316;
  box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.16);
}

.camera-box h3 {
  font-size: 15px;
  margin: 0 0 6px;
}

.camera-file {
  height: 1px;
  opacity: 0;
  overflow: hidden;
  position: absolute;
  width: 1px;
}

.camera-box video,
.camera-box img {
  background: #0f172a;
  border-radius: 8px;
  display: block;
  margin: 10px 0;
  max-height: 320px;
  object-fit: contain;
  width: 100%;
}

.camera-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.camera-status {
  color: var(--muted);
  font-size: 12px;
  margin: 10px 0 0;
}

.chat-list {
  display: grid;
  gap: 16px;
}

.chat-window {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  max-width: 760px;
  overflow: hidden;
  width: 100%;
}

.main > .chat-window {
  margin-right: auto;
}

.chat-header {
  background: #eef6ff;
  border-bottom: 1px solid #bfdbfe;
  display: grid;
  gap: 4px;
  padding: 12px 14px;
}

.chat-header span {
  color: var(--muted);
  font-size: 12px;
}

.chat-thread {
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 520px;
  overflow-y: auto;
  padding: 14px;
}

.chat-bubble {
  border-radius: 8px;
  max-width: 78%;
  padding: 10px 12px;
}

.chat-bubble p {
  margin: 0 0 6px;
}

.chat-bubble small {
  color: #64748b;
  display: block;
  font-size: 11px;
}

.chat-in {
  align-self: flex-start;
  background: #ffffff;
  border: 1px solid var(--line);
}

.chat-out {
  align-self: flex-end;
  background: #dbeafe;
  border: 1px solid #93c5fd;
}

.chat-compose {
  align-items: end;
  background: #fff;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr auto;
  padding: 12px;
}

.chat-compose textarea {
  min-height: 48px;
}

.admin-message-panel {
  margin-bottom: 16px;
  max-width: 760px;
}

.admin-message-panel[open] {
  display: grid;
  gap: 14px;
}

.admin-message-panel summary {
  cursor: pointer;
  font-size: 16px;
  font-weight: 800;
  list-style: none;
}

.admin-message-panel summary::-webkit-details-marker {
  display: none;
}

.admin-message-panel summary::after {
  color: var(--brand);
  content: "Open";
  float: right;
  font-size: 12px;
}

.admin-message-panel[open] summary::after {
  content: "Close";
}

.message-broadcast-form {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px;
  padding-top: 12px;
}

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

.message-client-results {
  display: grid;
  gap: 10px;
}

.message-client-card {
  align-items: end;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(220px, 1fr) minmax(260px, 1.4fr) auto;
  padding: 10px;
}

.message-client-card strong,
.message-client-card span,
.message-client-card small {
  display: block;
}

.message-client-card span,
.message-client-card small,
.muted {
  color: var(--muted);
  font-size: 12px;
}

.message-client-card textarea {
  min-height: 48px;
}

.terms-box {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}

.terms-box summary {
  cursor: pointer;
  font-weight: 800;
}

.terms-box p {
  color: var(--muted);
  white-space: pre-wrap;
}

.checkbox-row {
  align-items: center;
  display: flex;
  gap: 10px;
}

.checkbox-row input {
  width: auto;
}

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

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.register-card {
  max-width: 420px;
  width: 100%;
}

.register-card .form-grid,
.register-card .camera-grid {
  grid-template-columns: 1fr;
}

.page-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
  min-height: 84px;
}

h1 {
  font-size: 22px;
  margin: 0 0 18px;
}

.page-head h1 {
  margin: 0;
}

h2 {
  font-size: 18px;
}

.overview-band {
  background: linear-gradient(105deg, #14213f, #2457df);
  border-radius: 10px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.14);
  color: #fff;
  margin: 20px 0 12px;
  padding: 26px 14px;
}

.overview-band h2 {
  font-size: 19px;
  margin: 0 0 16px;
}

.overview-band p {
  font-size: 12px;
  font-weight: 700;
  margin: 0;
}

.flash-alert {
  animation: flashPulse 1s infinite;
  background: #fff7ed;
  border: 2px solid #f97316;
  border-radius: 8px;
  color: #9a3412;
  display: block;
  margin: 0 0 12px;
  padding: 14px;
  text-decoration: none;
}

.flash-alert strong {
  display: block;
  font-size: 16px;
  margin-bottom: 4px;
}

.flash-alert span {
  font-size: 13px;
  font-weight: 700;
}

@keyframes flashPulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.15);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(249, 115, 22, 0.28);
  }
}

.tile-grid {
  display: grid;
  gap: 12px 10px;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
}

.tile {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  min-height: 60px;
  padding: 13px 12px;
  position: relative;
  text-decoration: none;
}

.tile-blue {
  background: #eef6ff;
  border-color: #a9d0ff;
}

.tile strong {
  display: block;
  font-size: 12px;
  margin-bottom: 9px;
}

.tile span {
  color: #344054;
  display: block;
  font-size: 11px;
  line-height: 1.35;
  padding-right: 55px;
}

.tile em {
  color: var(--brand);
  font-size: 18px;
  font-style: normal;
  font-weight: 800;
  position: absolute;
  right: 12px;
  top: 15px;
}

.tile-flash {
  animation: flashPulse 1s infinite;
  border: 2px solid #f97316;
}

.settings-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
}

.settings-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px 12px;
}

.settings-wide {
  grid-column: span 2;
}

.settings-card header {
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 6px;
  margin: -2px 0 12px;
  padding-bottom: 10px;
}

.settings-card header strong {
  font-size: 13px;
}

.settings-card header span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.compact-form {
  gap: 10px;
}

.compact-form textarea {
  min-height: 76px;
}

.terms-editor-wrap {
  max-width: 1180px;
}

.terms-editor-card {
  padding: 18px;
}

.terms-editor-form {
  gap: 14px;
}

.terms-editor-textarea {
  min-height: 420px;
  resize: vertical;
}

.search-row {
  align-items: end;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(260px, 360px) auto;
  max-width: 460px;
}

.statement-filter {
  grid-template-columns: repeat(2, minmax(150px, 180px)) auto;
  max-width: 520px;
}

.search-row button {
  min-height: 39px;
}

.report-links {
  margin-bottom: 12px;
}

.action-stack {
  display: grid;
  gap: 6px;
  min-width: 170px;
}

.action-stack .button {
  padding: 9px 10px;
  text-align: center;
}

.template-box {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  padding: 12px;
}

.bank-details-banner {
  background: #fff;
  border: 3px solid #ef4444;
  border-radius: 8px;
  margin: 0 auto 16px;
  max-width: 620px;
  padding: 18px;
  text-align: center;
}

.bank-details-banner h2 {
  color: #ef4444;
  font-size: 24px;
  font-weight: 400;
  margin: 0 0 14px;
}

.bank-detail-grid {
  display: grid;
  align-items: start;
  column-gap: 32px;
  grid-template-columns: 1fr 1fr 1fr;
  text-align: left;
}

.bank-detail-col {
  display: grid;
  gap: 10px;
}

.bank-detail-middle {
  justify-items: center;
}

.bank-detail-middle > div:first-child {
  justify-self: center;
}

.bank-detail-right {
  justify-items: start;
  transform: translateX(-12px);
}

.bank-detail-grid span {
  color: var(--muted);
  display: block;
  font-size: 11px;
}

.bank-detail-grid strong {
  display: block;
  font-size: 14px;
}

.bank-details-banner p {
  color: var(--muted);
  margin: 12px 0;
}

.payment-reference {
  background: #fff7ed;
  border: 1px solid #f97316;
  border-radius: 8px;
  min-width: 170px;
  padding: 8px;
}

.payment-reference strong {
  color: #b42318;
  font-size: 18px;
}

.bank-copy-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.stat {
  color: var(--muted);
  font-size: 13px;
}

.stat strong {
  color: var(--ink);
  display: block;
  font-size: 26px;
  margin-top: 6px;
}

.form {
  display: grid;
  gap: 14px;
}

.form-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

label {
  color: var(--muted);
  display: grid;
  font-size: 13px;
  gap: 6px;
}

input,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  font: inherit;
  padding: 10px 12px;
  width: 100%;
}

label.field-missing input,
label.field-missing textarea,
label.field-missing select {
  background: #fff7ed;
  border-color: #f97316;
  box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.16);
}

label.field-missing::after,
.camera-box.field-missing::after {
  color: #b42318;
  content: "Required";
  display: block;
  font-size: 12px;
  font-weight: 700;
  margin-top: 4px;
}

textarea {
  min-height: 90px;
}

button,
.button {
  background: var(--brand);
  border: 0;
  border-radius: 7px;
  color: white;
  cursor: pointer;
  display: inline-block;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  padding: 16px 18px;
  text-decoration: none;
}

.button.secondary,
button.secondary {
  background: #475467;
}

.button.danger,
button.danger {
  background: var(--danger);
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 18px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  background: var(--panel);
  border-collapse: collapse;
  min-width: 760px;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 13px;
}

.bulk-payment-table {
  min-width: 1180px;
}

.bulk-payment-table input,
.bulk-payment-table select {
  min-width: 120px;
}

.bulk-payment-table td:first-child input {
  min-width: 145px;
}

.bulk-payment-table td:nth-child(2) input,
.bulk-payment-table td:nth-child(6) input {
  min-width: 110px;
}

.alert {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  color: #9a3412;
  padding: 12px;
}

.success {
  background: #ecfdf3;
  border: 1px solid #abefc6;
  border-radius: 8px;
  color: #067647;
  font-weight: 700;
  padding: 10px 12px;
}

.review-list {
  display: grid;
  gap: 18px;
}

.applicant-review {
  display: grid;
  gap: 18px;
}

.review-head {
  align-items: start;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding-bottom: 14px;
}

.review-head h2,
.document-review h3,
.approval-actions h3 {
  margin: 0;
}

.status-pill {
  background: #eef4ff;
  border: 1px solid #b2ccff;
  border-radius: 999px;
  color: #1d4ed8;
  padding: 7px 12px;
  text-transform: capitalize;
  white-space: nowrap;
}

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

.review-grid section,
.document-review {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.detail-list {
  display: grid;
  gap: 8px 14px;
  grid-template-columns: 130px 1fr;
  margin: 12px 0 0;
}

.detail-list dt {
  color: var(--muted);
  font-size: 12px;
}

.detail-list dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.document-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  margin-top: 12px;
}

.document-tile {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  padding: 12px;
}

.document-tile strong {
  text-transform: capitalize;
}

.document-tile span {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.document-tile img {
  aspect-ratio: 4 / 3;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 6px;
  object-fit: contain;
  width: 100%;
}

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

.approval-actions form {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.movement-card {
  display: grid;
  gap: 16px;
  margin-bottom: 18px;
}

.movement-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
}

.movement-legend span {
  align-items: center;
  color: var(--muted);
  display: inline-flex;
  font-size: 13px;
  gap: 7px;
}

.movement-legend i {
  border-radius: 999px;
  display: inline-block;
  height: 10px;
  width: 10px;
}

.legend-loaned,
.bar-loaned {
  background: #2563eb;
}

.legend-received,
.bar-received {
  background: #16a34a;
}

.legend-interest,
.bar-interest {
  background: #06b6d4;
}

.legend-cash,
.bar-cash {
  background: #eab308;
}

.legend-personal,
.bar-personal {
  background: #8b5cf6;
}

.legend-debts,
.bar-debts {
  background: #64748b;
}

.legend-carried,
.bar-carried {
  background: #f97316;
}

.movement-chart {
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  min-height: 250px;
  overflow-x: auto;
  padding: 22px;
}

.movement-month {
  align-items: center;
  display: grid;
  gap: 8px;
  min-width: 240px;
}

.movement-bars {
  align-items: end;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(7, 1fr);
  height: 180px;
  width: 100%;
}

.movement-bar {
  border-radius: 5px 5px 0 0;
  display: block;
  min-height: 3px;
}

.movement-month strong {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
  min-height: 28px;
  text-align: center;
}

.compact-table table {
  min-width: 680px;
}

@media (max-width: 720px) {
  .shell {
    padding-left: 0;
  }

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

  .main {
    padding: 16px;
  }

  .review-head,
  .approval-actions,
  .review-grid {
    display: grid;
    grid-template-columns: 1fr;
  }

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

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

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

  .settings-wide {
    grid-column: auto;
  }

  .search-row,
  .message-client-card {
    grid-template-columns: 1fr;
    max-width: none;
  }
}
