:root {
  --ink: #10224a;
  --muted: #5b6680;
  --paper: #f5f8ff;
  --white: #ffffff;
  --blue: #1f4fb2;
  --blue-dark: #163c91;
  --blue-soft: #eaf1ff;
  --orange: #ff7626;
  --orange-soft: #fff0e8;
  --line: #dce5f7;
  --green: #18875a;
  --shadow: 0 22px 70px rgba(16, 34, 74, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

body.admin-locked {
  min-height: 100vh;
  background:
    linear-gradient(115deg, rgba(245, 248, 255, 0.96), rgba(255, 240, 232, 0.9)),
    url("assets/hero-advisory-launch.jpg") center / cover;
}

body.admin-locked .admin-header,
body.admin-locked .admin-shell {
  display: none;
}

body:not(.admin-locked) .admin-login-screen {
  display: none;
}

.admin-login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 22px;
}

.admin-login-card {
  width: min(460px, 100%);
  display: grid;
  gap: 16px;
  padding: clamp(22px, 5vw, 34px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.admin-login-card img {
  width: 220px;
  max-height: 100px;
  object-fit: contain;
}

.admin-login-card h1 {
  margin-bottom: 0;
  font-size: clamp(34px, 6vw, 48px);
}

.admin-login-card p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

.admin-login-card a {
  color: var(--blue);
  font-weight: 800;
}

a {
  color: inherit;
  text-decoration: none;
}

.admin-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px clamp(18px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
}

.brand img {
  width: 190px;
  max-height: 84px;
  object-fit: contain;
}

.admin-header nav {
  display: flex;
  gap: 10px;
  color: var(--blue);
  font-weight: 800;
}

.admin-header nav a,
.admin-logout {
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: var(--blue-soft);
  color: var(--blue);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.admin-shell {
  padding: clamp(22px, 5vw, 56px);
}

.hero {
  max-width: 820px;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--orange);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 14px;
  font-size: clamp(42px, 7vw, 72px);
  line-height: 0.98;
}

h2 {
  margin-bottom: 12px;
  font-size: clamp(24px, 4vw, 34px);
  line-height: 1.05;
}

.hero p,
.helper {
  color: var(--muted);
  font-size: 17px;
  line-height: 1.6;
}

.option-grid,
.workspace {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.pin-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 340px) auto;
  gap: 16px;
  align-items: end;
  margin-bottom: 16px;
}

.sync-panel {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-bottom: 16px;
  border-color: rgba(255, 118, 38, 0.34);
  background: var(--orange-soft);
}

.sync-panel p {
  margin-bottom: 0;
  color: var(--muted);
}

.pin-panel p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

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

.option-grid article,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.option-grid article {
  min-height: 150px;
  padding: 20px;
}

.option-grid span,
.count-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  background: var(--orange-soft);
  color: var(--orange);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.option-grid h2 {
  margin-top: 18px;
  font-size: 22px;
}

.option-grid p {
  color: var(--muted);
  line-height: 1.55;
}

.panel {
  padding: clamp(18px, 4vw, 28px);
}

.panel + .panel {
  margin-top: 16px;
}

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

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

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding-top: 18px;
  margin-top: 18px;
  border-top: 1px solid var(--line);
}

.form-grid:first-of-type {
  border-top: 0;
  padding-top: 0;
  margin-top: 0;
}

label {
  display: grid;
  gap: 8px;
  color: var(--blue-dark);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

input,
select {
  width: 100%;
  min-height: 46px;
  border: 1px solid #c7d5ef;
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
  font: inherit;
  padding: 12px 14px;
}

.wide {
  grid-column: span 2;
}

.policy-pdf-reader {
  grid-column: 1 / -1;
  padding: 14px;
  border: 1px dashed #b9c9ea;
  border-radius: 8px;
  background: var(--blue-soft);
}

.policy-pdf-reader small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  text-transform: none;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.button.primary {
  align-self: end;
  background: var(--orange);
  color: var(--white);
  box-shadow: 0 12px 28px rgba(255, 118, 38, 0.22);
}

.button.secondary {
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--blue);
}

.upload-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.upload-box {
  min-height: 170px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 18px;
  border: 2px dashed #b9c9ea;
  border-radius: 8px;
  background: var(--blue-soft);
  text-align: center;
  cursor: pointer;
  text-transform: none;
}

.upload-box input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.upload-box strong {
  color: var(--blue);
  font-size: 19px;
}

.upload-box span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

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

.import-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.import-summary span {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  padding: 0 10px;
  border-radius: 8px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
}

.record-tools {
  margin-bottom: 14px;
}

.record-tools input {
  max-width: 520px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

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

th {
  color: var(--blue-dark);
  font-size: 12px;
  text-transform: uppercase;
}

td {
  color: var(--muted);
  line-height: 1.45;
}

.client-mobile {
  color: var(--ink);
  font-weight: 800;
}

.action-stack {
  display: grid;
  grid-template-columns: repeat(2, minmax(92px, 1fr));
  gap: 8px;
  min-width: 230px;
}

.inline-pdf-actions {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--blue-soft);
}

.inline-pdf-actions > strong {
  color: var(--blue);
  font-size: 13px;
}

td strong {
  color: var(--ink);
}

.view-client,
.edit-client,
.upload-client-doc {
  margin-top: 8px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  color: var(--blue);
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.edit-client {
  background: var(--blue);
  color: var(--white);
  border-color: var(--blue);
}

.upload-client-doc {
  background: var(--orange-soft);
  color: var(--orange);
  border-color: var(--orange-soft);
}

.client-dialog {
  width: min(860px, calc(100vw - 28px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  color: var(--ink);
  box-shadow: var(--shadow);
}

.client-dialog::backdrop {
  background: rgba(16, 34, 74, 0.42);
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.dialog-head h2 {
  margin-bottom: 0;
}

.client-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 18px;
}

.client-detail-grid div {
  padding: 12px;
  border-radius: 8px;
  background: var(--paper);
}

.client-detail-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.client-detail-grid strong {
  display: block;
  margin-top: 6px;
  overflow-wrap: anywhere;
}

.client-detail-grid label {
  text-transform: none;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  padding: 0 18px 18px;
}

.detail-upload-panel {
  padding: 0 18px 18px;
}

.detail-upload-panel h3 {
  margin: 8px 0 12px;
}

.detail-upload-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.attachment-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.attachment-list article {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.attachment-list strong,
.attachment-list small {
  display: block;
}

.attachment-list small {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.45;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: 340px;
  padding: 14px 16px;
  border-radius: 8px;
  background: var(--green);
  color: var(--white);
  font-weight: 800;
  box-shadow: var(--shadow);
  transform: translateY(130%);
  transition: transform 180ms ease;
}

.toast.is-visible {
  transform: translateY(0);
}

@media (max-width: 900px) {
  .option-grid,
  .form-grid,
  .upload-grid,
  .client-detail-grid,
  .detail-upload-actions {
    grid-template-columns: 1fr;
  }

  .wide {
    grid-column: auto;
  }

  .panel-head,
  .admin-header,
  .pin-panel {
    align-items: flex-start;
    flex-direction: column;
  }

  .pin-panel,
  .sync-panel {
    display: flex;
  }
}
