/*
 * Vehicle Deal Portal
 */

/* --------------------------------------------------
   Theme
-------------------------------------------------- */

:root {
  --bg-start: #f8fafc;
  --bg-end: #eef2f7;

  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-muted: #f1f5f9;

  --text: #111827;
  --text-soft: #475569;
  --text-muted: #64748b;

  --border: #e2e8f0;
  --border-strong: #cbd5e1;

  --navy: #020617;
  --navy-soft: #0f172a;
  --navy-hover: #1e293b;

  --blue: #2563eb;
  --blue-soft: #dbeafe;

  --green: #166534;
  --green-soft: #dcfce7;

  --amber: #92400e;
  --amber-soft: #fef3c7;

  --purple: #6d28d9;
  --purple-soft: #ede9fe;

  --red: #dc2626;
  --red-dark: #991b1b;
  --red-soft: #fff1f2;

  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-round: 999px;

  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 14px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 24px 70px rgba(15, 23, 42, 0.12);
}

/* --------------------------------------------------
   Reset and base
-------------------------------------------------- */

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family:
    Inter,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: var(--text);
  background:
    radial-gradient(
      circle at top left,
      rgba(37, 99, 235, 0.08),
      transparent 28rem
    ),
    linear-gradient(
      135deg,
      var(--bg-start) 0%,
      var(--bg-end) 100%
    );
}

h1,
h2,
h3 {
  color: var(--text);
}

h1 {
  margin-top: 0;
}

a {
  color: var(--blue);
  font-weight: 600;
}

img {
  max-width: 100%;
}

/* --------------------------------------------------
   Page layout
-------------------------------------------------- */

.page {
  width: 100%;
}

.page-dashboard {
  padding: 32px 40px 56px;
}

.page-content {
  width: 100%;
  max-width: 900px;
  margin: 40px auto;
  padding: 0 24px 56px;
}

/* --------------------------------------------------
   Header
-------------------------------------------------- */

.app-header {
  min-height: 64px;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: var(--navy);
  color: #fff;
}

.app-logo {
  color: #fff;
  text-decoration: none;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.app-logo:hover {
  opacity: 0.85;
}

.app-user {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}

.role-pill {
  padding: 4px 10px;
  border-radius: var(--radius-round);
  background: rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  text-transform: capitalize;
}

.admin-link {
  color: #fff;
  text-decoration: none;
  font-weight: 800;
}

.admin-link:hover {
  opacity: 0.85;
}

.tools-menu {
  position: relative;
}

.tools-menu > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
}

.tools-menu > summary::-webkit-details-marker {
  display: none;
}

.tools-menu-popover {
  position: absolute;
  z-index: 50;
  top: calc(100% + 14px);
  right: 0;
  width: 330px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  color: var(--text);
}

.tools-menu-popover::before {
  position: absolute;
  right: 20px;
  bottom: 100%;
  width: 12px;
  height: 12px;
  transform: translateY(6px) rotate(45deg);
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
  background: var(--surface);
  content: "";
}

.tools-menu-popover button,
.tools-menu-link {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.tools-menu-popover button:hover,
.tools-menu-link:hover {
  background: var(--surface-muted);
}

.tools-menu-icon {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: var(--radius-sm);
  background: var(--navy);
  color: #fff;
  font-size: 13px;
  font-weight: 900;
}

.tools-menu-popover strong,
.tools-menu-popover small {
  display: block;
}

.tools-menu-popover small {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 12px;
}

.logout-button {
  margin: 0;
  padding: 8px 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--navy);
  font-weight: 700;
  cursor: pointer;
}

/* --------------------------------------------------
   Dashboard
-------------------------------------------------- */

.dashboard {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin: 30px 0;
}

.card {
  width: 180px;
  min-height: 120px;
  padding: 24px;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);

  color: inherit;
  text-align: center;
  text-decoration: none;

  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.1);
}

.card h2 {
  margin: 0;
  font-size: 42px;
  line-height: 1;
}

.card p {
  margin: 10px 0 0;
  color: var(--text-soft);
  font-weight: 600;
}

.card-alert {
  border-left: 6px solid var(--red);
  background: var(--red-soft);
}

.card-alert h2,
.card-alert p {
  color: var(--red-dark);
}

/* --------------------------------------------------
   General actions and buttons
-------------------------------------------------- */

.page-actions,
.section-actions,
.show-actions,
.link-list {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.page-actions {
  justify-content: space-between;
  margin: 18px 0 28px;
}

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

.section-header h2 {
  margin: 0;
}

.primary-button,
.secondary-button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  min-height: 42px;
  padding: 11px 18px;

  border: 0;
  border-radius: var(--radius-md);

  text-decoration: none;
  font-weight: 800;
  cursor: pointer;

  transition:
    transform 0.15s ease,
    background 0.15s ease,
    box-shadow 0.15s ease;
}

.primary-button,
.button {
  background: var(--navy-soft);
  color: #fff;
}

.primary-button:hover,
.button:hover {
  background: var(--navy-hover);
  color: #fff;
  transform: translateY(-1px);
}

.secondary-button {
  background: var(--surface);
  color: var(--navy-soft);
  box-shadow: var(--shadow-sm);
}

.secondary-button:hover {
  transform: translateY(-1px);
}

.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  width: auto;
  min-height: 42px;
  margin: 0;
  padding: 11px 18px;

  border: 0;
  border-radius: var(--radius-md);

  background: var(--red);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

.danger-button:hover {
  background: #b91c1c;
  transform: translateY(-1px);
}

/* --------------------------------------------------
   Tables
-------------------------------------------------- */

.table-scroll {
  width: 100%;
  margin-bottom: 30px;
  overflow-x: auto;
  border-radius: var(--radius-lg);
}

.table-scroll table {
  min-width: 1100px;
}

table {
  width: 100%;
  overflow: hidden;
  border-collapse: collapse;

  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

th {
  padding: 14px;
  background: var(--navy-soft);
  color: #fff;
  font-size: 13px;
  text-align: left;
  white-space: nowrap;
}

td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  vertical-align: top;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.clickable-row {
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.clickable-row:hover {
  background: var(--surface-soft);
}

.clickable-row:active {
  background: #eef2ff;
}

/* --------------------------------------------------
   Forms
-------------------------------------------------- */

form {
  padding: 28px;
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
}

form h2 {
  margin-top: 28px;
}

form h2:first-child {
  margin-top: 0;
}

label {
  display: block;
  color: var(--text);
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  margin-top: 6px;
  margin-bottom: 18px;
  padding: 12px 14px;

  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);

  background: #fff;
  color: var(--text);
  font: inherit;
}

input[type="checkbox"],
input[type="radio"] {
  width: auto;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--navy-soft);
  box-shadow: 0 0 0 4px rgba(15, 23, 42, 0.08);
}

input[type="submit"],
button {
  width: auto;
  border: 0;
  border-radius: var(--radius-md);
  padding: 12px 18px;

  background: var(--navy-soft);
  color: #fff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;

  transition:
    transform 0.15s ease,
    background 0.15s ease;
}

input[type="submit"]:hover,
button:hover {
  transform: translateY(-1px);
}

/* --------------------------------------------------
   Choice and upload pages
-------------------------------------------------- */

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin: 28px 0;
}

.choice-card {
  display: block;
  padding: 28px;

  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);

  color: inherit;
  text-decoration: none;

  transition:
    transform 0.15s ease,
    border-color 0.15s ease;
}

.choice-card:hover {
  transform: translateY(-2px);
  border-color: var(--navy-soft);
}

.choice-card h2 {
  margin-top: 0;
}

.choice-card p {
  margin-bottom: 0;
  color: var(--text-soft);
}

.upload-placeholder {
  padding: 28px;
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
}

/* --------------------------------------------------
   Show pages and cards
-------------------------------------------------- */

.show-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 28px;
}

.show-actions {
  justify-content: flex-end;
}

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

.show-subtitle {
  margin-top: 8px;
  color: var(--text-soft);
  font-size: 18px;
}

.detail-card,
.danger-zone {
  margin-bottom: 24px;
  padding: 28px;

  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
}

.detail-card h2,
.danger-zone h2 {
  margin-top: 0;
}

.detail-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.detail-card-header h2 {
  margin: 0;
}

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

.detail-grid span,
.notes-box span {
  display: block;
  margin-bottom: 4px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 800;
}

.detail-grid strong {
  font-size: 16px;
}

.detail-grid a {
  text-decoration: none;
}

.detail-grid a:hover {
  text-decoration: underline;
}

.notes-box {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.notes-box p {
  margin-bottom: 0;
}

.danger-zone {
  border: 1px solid #fecaca;
  background: var(--red-soft);
}

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

.notice-message {
  margin-bottom: 24px;
  padding: 12px 16px;

  border-radius: var(--radius-md);
  background: var(--green-soft);
  color: var(--green);
  font-weight: 700;
}

.empty-state {
  margin: 0 0 24px;
  padding: 18px 20px;

  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);

  color: var(--text-muted);
}

/* --------------------------------------------------
   Status pills
-------------------------------------------------- */

.status-pill {
  display: inline-flex;
  align-items: center;

  padding: 5px 10px;
  border-radius: var(--radius-round);

  background: #e2e8f0;
  color: #334155;

  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status-pending {
  background: var(--amber-soft);
  color: var(--amber);
}

.status-contacted {
  background: var(--blue-soft);
  color: #1d4ed8;
}

.status-waiting {
  background: var(--purple-soft);
  color: var(--purple);
}

.status-bought {
  background: var(--green-soft);
  color: var(--green);
}

.status-lost {
  background: #fee2e2;
  color: var(--red-dark);
}

/* --------------------------------------------------
   Documents
-------------------------------------------------- */

.document-management-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.document-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;

  padding: 14px 16px;

  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.document-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.document-pill {
  display: inline-flex;
  align-items: center;

  max-width: 100%;
  padding: 9px 13px;

  border-radius: var(--radius-round);
  background: #eef2ff;
  color: #1e3a8a;

  text-decoration: none;
  font-weight: 800;

  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-pill:hover {
  background: #e0e7ff;
}

.document-size {
  color: var(--text-muted);
  font-size: 13px;
  white-space: nowrap;
}

.document-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.document-inline-form,
.document-remove-form {
  display: flex;
  align-items: center;
  gap: 8px;

  margin: 0;
  padding: 0;

  background: transparent;
  border-radius: 0;
  box-shadow: none;
}

.document-name-input {
  width: 220px;
  margin: 0;
  padding: 9px 11px;
}

.document-button {
  width: auto;
  margin: 0;
  white-space: nowrap;
}

.document-bulk-rename-form {
  display: flex;
  justify-content: flex-end;
  margin: 14px 0 0;
  padding: 0;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
}

.document-bulk-rename-form input[type="submit"] {
  width: auto;
  margin: 0;
}

.document-remove-form button {
  margin: 0;
}

.deal-overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(360px, 0.88fr);
  align-items: stretch;
  gap: 24px;
}

.deal-overview-grid > .detail-card {
  margin-bottom: 24px;
}

.deal-progress-card {
  position: sticky;
  top: 24px;
}

.document-section-header p {
  margin: 6px 0 0;
}

.document-dropzone {
  display: flex;
  min-height: 170px;
  padding: 28px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 7px;
  text-align: center;
  cursor: pointer;
  color: var(--text);
  background: var(--surface-soft);
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.document-dropzone:hover,
.document-dropzone.is-dragging {
  background: var(--navy-soft);
  border-color: var(--blue);
}

.document-dropzone.is-dragging {
  transform: scale(1.005);
}

.document-dropzone-icon {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  color: white;
  background: var(--blue);
  border-radius: 50%;
  font-size: 28px;
  line-height: 1;
}

.document-dropzone small {
  color: var(--text-muted);
}

.document-dropzone .document-paste-hint {
  margin-top: 4px;
  color: var(--blue);
  font-weight: 700;
}

.document-dropzone input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.document-selection {
  margin-top: 18px;
  padding: 18px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.document-selection-header,
.document-library-header,
.document-upload-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.document-preview-grid,
.document-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}

.document-preview-grid {
  margin-top: 14px;
}

.document-preview-card,
.document-card {
  min-width: 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.document-preview-media,
.document-thumbnail {
  display: grid;
  height: 168px;
  place-items: center;
  overflow: hidden;
  background: #e9eef6;
}

.document-preview-media img,
.document-preview-media iframe,
.document-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 0;
}

.document-preview-details,
.document-card-body {
  padding: 14px;
}

.document-preview-details strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-preview-details small {
  display: block;
  margin-top: 4px;
  color: var(--text-muted);
}

.document-preview-remove {
  margin: 10px 0 0;
  padding: 0;
  width: auto;
  color: var(--red-dark);
  background: transparent;
  border: 0;
  box-shadow: none;
  font-size: 13px;
}

.document-upload-actions {
  justify-content: flex-end;
  margin-top: 16px;
}

.document-upload-actions button,
.document-upload-actions input {
  width: auto;
  margin: 0;
}

.document-library-header {
  margin: 28px 0 14px;
}

.document-library-header h3 {
  margin: 0;
}

.document-thumbnail-link {
  display: block;
}

.document-thumbnail img {
  transition: transform 180ms ease;
}

.document-thumbnail-link:hover .document-thumbnail img {
  transform: scale(1.025);
}

.document-file-icon {
  display: grid;
  width: 74px;
  height: 88px;
  place-items: center;
  color: var(--navy);
  background: white;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  font-size: 12px;
}

.document-card-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 800;
}

.document-card .document-name-input {
  width: 100%;
}

.document-card-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: stretch;
  gap: 8px;
  margin-top: 10px;
}

.document-card-actions > a,
.document-card-actions > form,
.document-card-actions button {
  width: 100%;
}

.document-card-actions form {
  min-width: 74px;
}

.document-card-actions .document-autodoc-button {
  grid-column: 1 / -1;
}

.document-empty-state {
  display: flex;
  margin-top: 24px;
  padding: 28px;
  align-items: center;
  flex-direction: column;
  gap: 6px;
  background: var(--surface-soft);
  border-radius: var(--radius-lg);
  text-align: center;
}

/* --------------------------------------------------
   Raw lead dump
-------------------------------------------------- */

.raw-lead-card summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 800;
}

.raw-lead-card pre {
  margin: 18px 0 0;
  padding: 18px;

  border-radius: var(--radius-lg);
  background: var(--navy-soft);
  color: #e2e8f0;

  white-space: pre-wrap;
  overflow-wrap: anywhere;

  font-family:
    ui-monospace,
    SFMono-Regular,
    Menlo,
    Monaco,
    Consolas,
    monospace;
  font-size: 13px;
  line-height: 1.55;
}

/* --------------------------------------------------
   Authentication
-------------------------------------------------- */

.auth-page {
  min-height: calc(100vh - 72px);
  padding: 48px 18px;

  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-card {
  width: 100%;
  max-width: 460px;
  padding: 42px;

  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);

  text-align: center;
}

.auth-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 22px;

  display: grid;
  place-items: center;

  border-radius: 50%;
  background: linear-gradient(135deg, var(--navy), #1f2937);
  color: #fff;

  font-size: 32px;
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.28);
}

.auth-card h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.1;
  letter-spacing: -0.04em;
}

.auth-subtitle {
  margin: 12px 0 26px;
  color: var(--text-muted);
  font-size: 16px;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 16px;

  margin: 0 0 28px;

  color: #94a3b8;
  font-size: 12px;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--border);
}

.auth-form {
  padding: 0;
  background: none;
  border-radius: 0;
  box-shadow: none;
  text-align: left;
}

.auth-field {
  margin-bottom: 20px;
}

.auth-field label {
  margin-bottom: 8px;
}

.auth-field input {
  width: 100%;
  height: 52px;
  margin: 0;
}

.auth-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;

  margin: 4px 0 24px;

  font-size: 14px;
}

.remember-me {
  display: flex;
  align-items: center;
  gap: 8px;

  color: #334155;
  cursor: pointer;
}

.remember-me input {
  width: 18px;
  height: 18px;
  margin: 0;
}

.auth-link {
  color: var(--blue);
  text-decoration: none;
  font-weight: 600;
}

.auth-link:hover {
  text-decoration: underline;
}

.auth-button {
  width: 100%;
  height: 54px;

  border: 0;
  border-radius: var(--radius-lg);

  background: linear-gradient(135deg, var(--navy), var(--text));
  color: #fff;

  font-weight: 800;
  font-size: 17px;
  cursor: pointer;

  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.22);
}

.auth-footer {
  margin-top: 28px;
  padding-top: 22px;

  border-top: 1px solid var(--border);

  color: var(--text-muted);
  font-size: 14px;
}

.auth-footer span:last-child {
  color: var(--blue);
  font-weight: 700;
}

/* --------------------------------------------------
   Responsive
-------------------------------------------------- */

@media (max-width: 900px) {
  .deal-overview-grid {
    grid-template-columns: 1fr;
  }

  .deal-progress-card {
    position: static;
  }

  .document-row {
    align-items: stretch;
    flex-direction: column;
  }

  .document-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .document-inline-form {
    align-items: stretch;
  }

  .document-name-input {
    width: 100%;
    flex: 1;
  }
}
.follow-up-outcome-form { border-top: 1px solid #e2e8f0; margin-top: 1.25rem; padding-top: 1.25rem; }
.follow-up-outcome-actions,
.customer-journey-links { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 0.75rem; }

@media (max-width: 720px) {
  .document-preview-grid,
  .document-gallery {
    grid-template-columns: 1fr;
  }

  .document-upload-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .document-upload-actions button,
  .document-upload-actions input {
    width: 100%;
  }

  .page-dashboard {
    padding: 24px 18px 48px;
  }

  .page-content {
    margin-top: 24px;
    padding: 0 18px 48px;
  }

  .app-header {
    padding: 0 16px;
  }

  .app-user {
    gap: 8px;
  }

  .app-user > span:first-child {
    display: none;
  }

  .dashboard {
    gap: 12px;
  }

  .card {
    width: calc(50% - 6px);
    min-width: 0;
  }

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

  .show-header {
    flex-direction: column;
  }

  .show-actions {
    width: 100%;
    justify-content: flex-start;
  }

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

  .detail-card-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .section-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .document-inline-form {
    flex-direction: column;
  }

  .document-button {
    width: 100%;
  }
}

@media (max-width: 520px) {
  .auth-card {
    padding: 30px 22px;
    border-radius: 18px;
  }

  .auth-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .auth-card h1 {
    font-size: 28px;
  }

  .card {
    width: 100%;
  }

  .role-pill {
    display: none;
  }
}

/* Responsive, scannable 2FA enrolment */
.two-factor-card { overflow: visible; }
.two-factor-account-label { margin: 5px 0 0; color: var(--muted); font-size: 14px; }
.two-factor-setup { display: grid; grid-template-columns: minmax(280px, 380px) minmax(280px, 1fr); gap: clamp(24px, 4vw, 48px); align-items: start; margin-top: 28px; }
.two-factor-enrolment, .two-factor-confirm { min-width: 0; }
.two-factor-enrolment h3, .two-factor-confirm h3 { margin-top: 0; }
.two-factor-qr-wrap { display: block; width: 100%; margin-top: 20px; }
.two-factor-qr { display: block; width: min(100%, 360px); min-height: 0; margin: 0; padding: clamp(12px, 3vw, 20px); overflow: visible; line-height: 0; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-xl); box-sizing: border-box; }
.two-factor-qr svg { display: block; width: 100%; max-width: none; height: auto; overflow: visible; shape-rendering: crispEdges; }
.two-factor-confirm { padding-top: 2px; }
.two-factor-form { margin-top: 20px; }
.two-factor-manual { width: min(100%, 480px); margin-top: 18px; padding: 15px 17px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface-soft); }
.two-factor-manual summary { cursor: pointer; font-weight: 800; }
.two-factor-manual p { margin: 14px 0 10px; }
.two-factor-manual code { display: block; width: 100%; padding: 13px; overflow-wrap: anywhere; user-select: all; color: var(--ink); background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: clamp(13px, 2vw, 16px); line-height: 1.6; letter-spacing: .08em; }
.two-factor-secret-warning { color: var(--muted); font-size: 13px; }
.two-factor-enabled-state, .two-factor-start-state { margin-top: 22px; }

@media (max-width: 800px) {
  .two-factor-setup { grid-template-columns: minmax(0, 1fr); }
  .two-factor-qr { width: min(100%, 340px); margin-inline: auto; }
}

@media (max-width: 440px) {
  .two-factor-card { padding: 20px; }
  .two-factor-qr { width: 100%; border-radius: var(--radius-lg); }
}

/* --------------------------------------------------
   AutoDoc deal-pack export
-------------------------------------------------- */
.autodoc-export-form { display: grid; gap: 18px; }
.autodoc-export-section { margin: 0; }
.autodoc-export-section > label { display: block; margin: 14px 0 7px; font-weight: 800; }
.autodoc-export-section > input[type="url"] { width: 100%; }
.autodoc-export-section > small { display: block; margin-top: 6px; color: var(--text-soft); }
.autodoc-export-section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.autodoc-export-section-heading > div { display: flex; align-items: flex-start; gap: 12px; }
.autodoc-export-section-heading > div > span { display: grid; width: 30px; height: 30px; flex: 0 0 auto; place-items: center; border-radius: 50%; background: var(--navy); color: #fff; font-weight: 900; }
.autodoc-export-section-heading h2 { margin: 1px 0 3px; }
.autodoc-export-section-heading p { margin: 0; color: var(--text-soft); }
.autodoc-ready-badge { padding: 6px 10px; border-radius: var(--radius-round); background: var(--green-soft); color: var(--green); font-size: 12px; }
.autodoc-document-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.autodoc-document-field { display: grid; gap: 7px; padding: 15px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface-muted); }
.autodoc-document-field label { font-size: 12px; font-weight: 800; color: var(--text-soft); }
.autodoc-document-field input[type="file"] { width: 100%; }
.autodoc-document-heading { display: flex; justify-content: space-between; gap: 10px; }
.autodoc-document-heading span { color: var(--text-soft); font-size: 12px; }
.autodoc-document-or { color: var(--text-muted); font-size: 11px; font-weight: 900; text-align: center; text-transform: uppercase; }
.autodoc-info-note { margin: 14px 0 0; padding: 12px 14px; border-radius: var(--radius-md); background: #eff6ff; color: #1e3a8a; }
.autodoc-toggle { display: flex; align-items: center; gap: 8px; font-weight: 800; }
.autodoc-toggle input { width: 18px; height: 18px; accent-color: var(--green); }
.autodoc-finish-grid { display: grid; grid-template-columns: 1fr 1fr; align-items: end; gap: 14px; }
.autodoc-finish-grid label { display: block; margin-bottom: 7px; font-weight: 800; }
.autodoc-approved-summary { display: flex; justify-content: space-between; padding: 13px 15px; border: 1px solid #bbf7d0; border-radius: var(--radius-md); background: #f0fdf4; }
.autodoc-approved-summary strong { color: var(--green); }
.autodoc-export-actions { display: flex; justify-content: flex-end; gap: 10px; }
@media (max-width: 720px) {
  .autodoc-document-grid, .autodoc-finish-grid { grid-template-columns: 1fr; }
  .autodoc-export-section-heading { flex-direction: column; }
  .autodoc-export-actions { flex-direction: column-reverse; }
  .autodoc-export-actions a, .autodoc-export-actions input { width: 100%; text-align: center; }
}

.error-message {
  margin-bottom: 24px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--red-soft);
  color: var(--red-dark);
  font-weight: 700;
}

.two-factor-setup {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 32px;
  align-items: start;
  margin-top: 24px;
}

.two-factor-qr-wrap {
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.two-factor-qr {
  display: flex;
  justify-content: center;
  align-items: center;

  width: 320px;
  min-height: 320px;

  padding: 20px;

  background: #fff;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
}

.two-factor-qr svg {
  display: block;

  width: 100%;
  height: auto;

  max-width: 280px;
}

.two-factor-instructions {
  min-width: 0;
}

@media (max-width: 800px) {
  .two-factor-setup {
    grid-template-columns: 1fr;
  }

  .two-factor-qr {
    margin: 0 auto;
  }
}

/* Prospect working page */

.prospect-action-card {
  border-top: 5px solid var(--blue);
}

.prospect-action-card .detail-card-header p {
  margin: 6px 0 0;
}

.prospect-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 24px 0;
}

.quick-update-form {
  margin: 0;
  padding: 24px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: none;
}

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

.follow-up-date-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 11px;
  border-radius: var(--radius-round);
  background: var(--blue-soft);
  color: #1d4ed8;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

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

.resolved-actions form {
  margin: 0;
  padding: 0;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
}

@media (max-width: 720px) {
  .quick-update-grid {
    grid-template-columns: 1fr;
  }

  .prospect-quick-actions,
  .resolved-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .prospect-quick-actions a,
  .resolved-actions a,
  .resolved-actions button {
    width: 100%;
  }
}

.progress-form,
.document-upload-form {
  margin: 0;
}

.recall-report-form { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.recall-report-form input[type="text"] { min-width: 230px; text-transform: uppercase; }

.document-upload-form input[type="file"] {
  padding: 10px;
  background: var(--surface-soft);
  border: 1px dashed var(--border-strong);
}

.scope-switch {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 16px 0 24px;
}

.scope-active {
  background: var(--navy-soft);
  color: #fff;
}

.delivery-follow-up-options {
  margin: 4px 0 22px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-soft);
}

.delivery-follow-up-options legend {
  padding: 0 8px;
  color: var(--text);
  font-weight: 800;
}

.delivery-follow-up-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.delivery-follow-up-choice {
  position: relative;
  display: block;
  padding: 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    transform 0.15s ease;
}

.delivery-follow-up-choice:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
}

.delivery-follow-up-choice input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.delivery-follow-up-choice:has(input[type="radio"]:checked) {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.delivery-follow-up-choice span {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.delivery-follow-up-choice strong {
  color: var(--text);
}

.delivery-follow-up-choice small {
  color: var(--text-muted);
  font-size: 12px;
}

.delivery-follow-up-skip:has(input[type="radio"]:checked) {
  border-color: var(--red);
  background: var(--red-soft);
}

@media (max-width: 800px) {
  .delivery-follow-up-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .delivery-follow-up-grid {
    grid-template-columns: 1fr;
  }
}

.form-select{
    width:100%;
    padding:14px 16px;
    border:1px solid #d6dbe7;
    border-radius:12px;
    background:#fff;
    font-size:15px;
    font-weight:500;
    color:#1f2937;
    appearance:none;
    transition:.2s;
}

.form-select:focus{
    border-color:#356dff;
    box-shadow:0 0 0 3px rgba(53,109,255,.15);
    outline:none;
}

.delivery-follow-up-options[hidden] {
  display: none;
}

/* Deal search */

.deal-search-panel {
  margin: 28px 0;
}

.deal-search-form {
  margin: 0;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
}

.deal-search-field {
  width: 100%;
}

.deal-search-label {
  margin-bottom: 8px;
}

.deal-search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.deal-search-icon {
  position: absolute;
  left: 15px;
  z-index: 1;
  color: var(--text-muted);
  font-size: 22px;
  pointer-events: none;
}

.deal-search-input {
  width: 100%;
  height: 52px;
  margin: 0;
  padding: 12px 82px 12px 46px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface-soft);
  font-size: 16px;
}

.deal-search-input:focus {
  background: var(--surface);
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.deal-search-clear {
  position: absolute;
  right: 14px;
  padding: 6px 8px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 800;
}

.deal-search-clear:hover {
  color: var(--red);
}

.search-summary {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 14px;
}

.deal-search-empty {
  text-align: center;
}

.deal-search-empty h3 {
  margin-top: 0;
}

@media (max-width: 720px) {
  .deal-search-form {
    padding: 16px;
  }

  .deal-search-input {
    font-size: 16px;
  }
}

/* --------------------------------------------------
   Delivered / paid reconciliation
-------------------------------------------------- */

.payment-summary {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.payment-summary-card {
  min-width: 180px;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.payment-summary-card span {
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 700;
}

.payment-summary-card strong {
  font-size: 28px;
}

.delivered-table {
  margin-bottom: 30px;
}

.paid-deals-dialog {
  width: min(760px, calc(100vw - 32px));
  max-height: min(780px, calc(100vh - 48px));
  padding: 0;
  overflow: hidden;

  border: 0;
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 30px 90px rgba(15, 23, 42, 0.28);
}

.paid-deals-dialog::backdrop {
  background: rgba(2, 6, 23, 0.68);
  backdrop-filter: blur(3px);
}

.paid-dialog-header {
  padding: 24px 26px 18px;

  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;

  border-bottom: 1px solid var(--border);
}

.paid-dialog-header h2 {
  margin: 0;
}

.paid-dialog-header .muted {
  margin-bottom: 0;
}

.dialog-close-button {
  width: 38px;
  height: 38px;
  padding: 0;

  display: grid;
  place-items: center;

  border-radius: 50%;
  background: var(--surface-muted);
  color: var(--text-soft);

  font-size: 24px;
  line-height: 1;
}

.dialog-close-button:hover {
  background: #e2e8f0;
  color: var(--text);
}

.bulk-paid-form {
  margin: 0;
  padding: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.paid-dialog-toolbar {
  padding: 14px 26px;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;

  background: var(--surface-soft);
  border-bottom: 1px solid var(--border);

  color: var(--text-soft);
  font-size: 14px;
  font-weight: 800;
}

.paid-dialog-toolbar > div {
  display: flex;
  gap: 12px;
}

.text-button {
  padding: 0;
  background: transparent;
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
}

.text-button:hover {
  transform: none;
  text-decoration: underline;
}

.paid-deal-selection-list {
  max-height: 480px;
  padding: 16px 20px;
  overflow-y: auto;

  display: flex;
  flex-direction: column;
  gap: 10px;
}

.paid-deal-option {
  position: relative;

  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 12px;

  padding: 15px 16px;

  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);

  cursor: pointer;
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    transform 0.15s ease;
}

.paid-deal-option:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
}

.paid-deal-option.is-selected {
  border-color: #16a34a;
  background: #f0fdf4;
}

.paid-deal-checkbox {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.paid-deal-checkmark {
  width: 26px;
  height: 26px;

  display: grid;
  place-items: center;

  border: 2px solid var(--border-strong);
  border-radius: 7px;

  background: var(--surface);
  color: transparent;
  font-size: 16px;
  font-weight: 900;
}

.paid-deal-option.is-selected .paid-deal-checkmark {
  border-color: #16a34a;
  background: #16a34a;
  color: #fff;
}

.paid-deal-details {
  min-width: 0;

  display: flex;
  flex-direction: column;
  gap: 3px;

  color: var(--text-soft);
  font-size: 13px;
}

.paid-deal-details strong {
  color: var(--text);
  font-size: 15px;
}

.paid-deal-details small {
  margin-top: 3px;
  color: var(--text-muted);
}

.paid-dialog-actions {
  padding: 18px 26px;

  display: flex;
  justify-content: flex-end;
  gap: 10px;

  border-top: 1px solid var(--border);
  background: var(--surface-soft);
}

#submit-paid-deals:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

@media (max-width: 720px) {
  .paid-deals-dialog {
    width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
  }

  .paid-dialog-header,
  .paid-dialog-toolbar,
  .paid-dialog-actions {
    padding-left: 18px;
    padding-right: 18px;
  }

  .paid-dialog-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .paid-dialog-actions {
    flex-direction: column-reverse;
  }

  .paid-dialog-actions .primary-button,
  .paid-dialog-actions .secondary-button {
    width: 100%;
  }

  .payment-summary-card {
    width: 100%;
  }
}

/* --------------------------------------------------
   Main dashboard
-------------------------------------------------- */

.dashboard-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 24px;
}

.dashboard-hero h1 {
  margin-bottom: 8px;
  font-size: clamp(32px, 4vw, 48px);
  letter-spacing: -0.04em;
}

.dashboard-intro {
  margin: 0;
  color: var(--text-muted);
  font-size: 17px;
}

.dashboard-scope-switch {
  margin: 0;
}

.dashboard-search {
  margin-bottom: 22px;
}

.dashboard-search-form {
  position: relative;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;

  margin: 0;
  padding: 10px;

  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-md);
}

.dashboard-search-icon {
  position: absolute;
  top: 37px;
  left: 27px;
  z-index: 1;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 24px;
  line-height: 1;
  pointer-events: none;
}

.dashboard-search-input {
  min-width: 0;
  width: 100%;
  height: 54px;
  margin: 0;
  padding-left: 52px;
  border: 0;
  background: var(--surface-soft);
  font-size: 16px;
}

.dashboard-search-input:focus {
  border: 0;
  box-shadow: none;
}

.dashboard-search-button {
  min-height: 54px;
  margin: 0;
}

.dashboard-quick-actions {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 30px;
}

.quick-action-card {
  min-height: 76px;
  padding: 14px;

  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;

  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);

  color: var(--text);
  text-align: center;
  text-decoration: none;
  font-weight: 800;

  transition:
    transform 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.quick-action-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.quick-action-symbol {
  width: 30px;
  height: 30px;

  display: grid;
  place-items: center;

  border-radius: 9px;
  background: var(--navy-soft);
  color: #fff;

  font-size: 18px;
  line-height: 1;
}

.dashboard-section {
  margin-bottom: 30px;
}

.dashboard-section-heading,
.dashboard-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 18px;
  margin-bottom: 16px;
}

.dashboard-section-heading h2,
.dashboard-panel-header h2 {
  margin: 0;
}

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

.dashboard-metric-card {
  padding: 22px;

  display: flex;
  flex-direction: column;
  gap: 7px;

  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
}

.dashboard-metric-card span {
  color: var(--text-soft);
  font-weight: 800;
}

.dashboard-metric-card strong {
  font-size: 38px;
  line-height: 1;
}

.dashboard-metric-card small {
  color: var(--text-muted);
}

.dashboard-metric-muted strong {
  color: var(--red-dark);
}

.dashboard-metric-carryover strong {
  color: var(--amber);
}

.dashboard-metric-total {
  border-color: #bfdbfe;
  background: #eff6ff;
}

.dashboard-metric-total strong {
  color: var(--blue);
}

.attention-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.attention-card {
  min-height: 132px;
  padding: 18px;

  display: flex;
  flex-direction: column;
  justify-content: space-between;

  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 4px solid var(--border-strong);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);

  color: var(--text);
  text-decoration: none;

  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease;
}

.attention-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.attention-card span {
  color: var(--text-soft);
  font-weight: 800;
}

.attention-card strong {
  font-size: 34px;
}

.attention-card small {
  color: var(--text-muted);
}

.attention-card-alert {
  border-top-color: var(--red);
  background: var(--red-soft);
}

.attention-card-warning {
  border-top-color: #f59e0b;
  background: #fffbeb;
}

.attention-card-info {
  border-top-color: var(--blue);
  background: #eff6ff;
}

.dashboard-content-grid {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.dashboard-panel {
  min-width: 0;
  max-width: 100%;
  padding: 24px;

  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-md);
}

.dashboard-panel-link {
  color: var(--blue);
  text-decoration: none;
  font-size: 14px;
  font-weight: 800;
}

.dashboard-item-list {
  display: flex;
  flex-direction: column;
}

.dashboard-list-item {
  padding: 15px 0;

  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;

  border-bottom: 1px solid var(--border);

  color: inherit;
  text-decoration: none;
}

.dashboard-list-item:first-child {
  padding-top: 0;
}

.dashboard-list-item:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.dashboard-list-main,
.dashboard-list-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.dashboard-list-main {
  flex: 1;
}

.dashboard-list-main strong,
.dashboard-list-main span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-list-main span {
  color: var(--text-soft);
  font-size: 14px;
}

.dashboard-list-meta {
  align-items: flex-end;
  text-align: right;
}

.dashboard-list-meta small {
  color: var(--text-muted);
  white-space: nowrap;
}

.dashboard-panel-empty {
  padding: 20px 0;
  color: var(--text-muted);
}

.dashboard-delivery-panel {
  margin-bottom: 30px;
}

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

.delivery-preview-card {
  min-width: 0;
  max-width: 100%;
  padding: 16px;

  display: flex;
  align-items: center;
  gap: 14px;

  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);

  color: inherit;
  text-decoration: none;
}

.delivery-preview-date {
  width: 58px;
  min-width: 58px;
  height: 58px;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  border-radius: var(--radius-lg);
  background: var(--navy-soft);
  color: #fff;
}

.delivery-preview-date small {
  color: #cbd5e1;
  font-size: 11px;
}

.delivery-preview-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.delivery-preview-info strong,
.delivery-preview-info span {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.delivery-preview-info span {
  color: var(--text-soft);
  font-size: 13px;
}

.delivery-preview-info small {
  color: var(--text-muted);
}

/* Dashboard tablet */

@media (max-width: 1050px) {
  .dashboard-quick-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

  .attention-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

/* Dashboard mobile */

@media (max-width: 720px) {
  .dashboard-hero {
    flex-direction: column;
  }

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

  .dashboard-search-button {
    width: 100%;
  }

  .dashboard-quick-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-content-grid {
    min-width: 0;
    grid-template-columns: 1fr;
  }

  .dashboard-content-grid > *,
  .dashboard-item-list,
  .dashboard-list-item,
  .dashboard-list-main,
  .dashboard-list-meta,
  .dashboard-delivery-panel,
  .delivery-preview-grid,
  .delivery-preview-card,
  .delivery-preview-info {
    min-width: 0;
    max-width: 100%;
  }

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

  .delivery-preview-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-list-item {
    width: 100%;
    align-items: flex-start;
    flex-direction: column;
  }

  .dashboard-list-main,
  .dashboard-list-meta {
    width: 100%;
  }

  .dashboard-list-meta {
    align-items: flex-start;
    text-align: left;
  }
}

@media (max-width: 480px) {
  .dashboard-metric-grid,
  .attention-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-panel {
    padding: 20px 18px;
  }

  .dashboard-quick-actions {
    gap: 10px;
  }

  .quick-action-card {
    min-height: 84px;
    flex-direction: column;
  }
}

.dashboard-list-item-overdue,
.dashboard-list-item-today {
  margin-inline: -10px;
  padding-inline: 10px;
  border-radius: var(--radius-md);
}

.dashboard-list-item-overdue {
  background: var(--red-soft);
}

.dashboard-list-item-overdue .dashboard-list-meta small {
  color: var(--red-dark);
  font-weight: 800;
}

.dashboard-list-item-today {
  background: var(--amber-soft);
}

.dashboard-list-item-today .dashboard-list-meta small {
  color: var(--amber);
  font-weight: 800;
}

/* --------------------------------------------------
   Deal imports
-------------------------------------------------- */

.deal-import-form {
  margin: 0;
}

.deal-import-form input[type="file"] {
  padding: 12px;
  background: var(--surface-soft);
  border: 1px dashed var(--border-strong);
}

.import-column-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* --------------------------------------------------
   Deals workspace
-------------------------------------------------- */

.deal-workspace-header {
  align-items: center;
  margin-bottom: 24px;
}

.deal-heading-block {
  flex: 0 0 auto;
}

.deal-workspace-header .deal-view-tabs {
  min-width: 0;
  flex: 1 1 auto;
  margin: 0;
}

.deal-header-scope {
  justify-content: flex-end;
  margin: 0;
}

.deal-view-tabs {
  display: flex;
  align-items: center;
  gap: 8px;

  margin: 0 0 28px;
  padding: 6px;

  overflow-x: auto;

  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
}

.deal-view-tab {
  min-height: 42px;
  padding: 10px 16px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  flex: 1 0 auto;

  border-radius: var(--radius-md);

  color: var(--text-soft);
  text-decoration: none;
  white-space: nowrap;
}

.deal-view-tab:hover {
  color: var(--text);
  background: var(--surface-soft);
}

.deal-view-tab-active {
  background: var(--navy-soft);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.deal-view-tab-active:hover {
  background: var(--navy-hover);
  color: #fff;
}

.deal-insights-section {
  margin-bottom: 32px;
}

.deal-insights-summary {
  margin: 7px 0 0;
  color: var(--text-muted);
  font-size: 14px;
}

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

.deal-mix-overview {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr);
  gap: 16px;
}

.deal-mix-panel {
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
}

.deal-mix-panel-header {
  min-height: 70px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.deal-mix-panel-header h3 {
  margin: 0;
  font-size: 19px;
}

.deal-deliverable-summary {
  min-width: 430px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.deal-deliverable-summary > div {
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 10px;
  padding: 9px 11px;
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}

.deal-deliverable-summary span {
  color: var(--text-soft);
  font-weight: 800;
  white-space: nowrap;
}

.deal-deliverable-summary strong {
  grid-row: span 2;
  font-size: 27px;
  line-height: 1;
}

.deal-deliverable-summary small,
.deal-mix-metric small {
  color: var(--text-muted);
}

.deal-deliverable-total {
  background: var(--navy-soft) !important;
}

.deal-deliverable-total span,
.deal-deliverable-total strong,
.deal-deliverable-total small {
  color: #fff;
}

.deal-mix-metrics {
  display: grid;
  gap: 12px;
  padding-top: 16px;
}

.deal-mix-metrics-four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.deal-mix-metrics-two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.deal-mix-metric {
  min-width: 0;
  padding: 14px;
  border-radius: var(--radius-lg);
  background: var(--surface-soft);
}

.deal-mix-metric .deal-insight-heading strong {
  font-size: 24px;
}

.deal-mix-metric .deal-insight-progress {
  margin: 14px 0 8px;
}

.deal-insight-card {
  padding: 20px;

  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
}

.deal-insight-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.deal-insight-heading span {
  color: var(--text-soft);
  font-weight: 800;
}

.deal-insight-heading strong {
  font-size: 30px;
  line-height: 1;
}

.deal-insight-progress {
  height: 8px;
  margin: 18px 0 10px;
  overflow: hidden;

  border-radius: var(--radius-round);
  background: var(--surface-muted);
}

.deal-insight-progress span {
  display: block;
  height: 100%;

  border-radius: inherit;
  background: var(--blue);

  transition: width 0.25s ease;
}

.deal-insight-card small {
  color: var(--text-muted);
}

.deal-data-completeness {
  margin: 14px 0 0;
  padding: 12px 14px;

  border-radius: var(--radius-md);
  background: var(--amber-soft);
  color: var(--amber);

  font-size: 13px;
}

.deal-list-header {
  margin-top: 0;
}

.deal-list-header .search-summary {
  margin-top: 6px;
}

.deal-workspace-table {
  margin-bottom: 30px;
}

.deal-workspace-table table {
  min-width: 1250px;
}

.deal-workspace-table td strong {
  white-space: nowrap;
}

.active-deal-sections {
  display: grid;
  gap: 18px;
}

.active-deal-section {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
}

.active-deal-section-header {
  min-height: 66px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--border);
}

.active-deal-section-header > div {
  display: flex;
  align-items: center;
  gap: 12px;
}

.active-deal-section-header p,
.active-deal-section-header small {
  margin: 0;
  color: var(--text-muted);
}

.active-deal-section .deal-workspace-table {
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.current-month-deliveries {
  margin-top: 8px;
  border-color: #bfd3ff;
}

.current-month-deliveries .active-deal-section-header {
  background: var(--blue-soft);
}

.current-month-deliveries-title {
  color: #1d4ed8;
  font-weight: 900;
}

.active-deal-section-empty {
  margin: 0;
  padding: 24px 18px;
  color: var(--text-muted);
}

.status-bank-transfer,
.status-pending-finance,
.status-finance-approved,
.status-finance-settled,
.status-edd-set {
  background: var(--amber-soft);
  color: var(--amber);
}

.status-paper-delivered,
.status-delivered {
  background: var(--blue-soft);
  color: #1d4ed8;
}

.status-paid {
  background: var(--green-soft);
  color: var(--green);
}

.status-fallover {
  background: #fee2e2;
  color: var(--red-dark);
}

@media (max-width: 1050px) {
  .deal-workspace-header {
    flex-wrap: wrap;
  }

  .deal-workspace-header .deal-view-tabs {
    flex-basis: 100%;
    order: 3;
  }

  .deal-mix-overview {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 720px) {
  .deal-workspace-header {
    align-items: flex-start;
  }

  .deal-header-scope {
    justify-content: flex-start;
  }

  .deal-workspace-header .deal-view-tabs {
    order: initial;
  }

  .deal-view-tabs {
    margin-inline: -4px;
  }

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

  .deal-mix-metrics-four,
  .deal-mix-metrics-two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .deal-insight-card {
    padding: 17px;
  }

  .deal-workspace-table table {
    min-width: 760px;
  }

  .deal-column-secondary {
    display: none;
  }

  .deal-workspace-table th,
  .deal-workspace-table td {
    padding: 11px 10px;
  }
}

@media (max-width: 480px) {
  .deal-insights-grid {
    grid-template-columns: 1fr;
  }

  .deal-mix-panel-header {
    display: grid;
  }

  .deal-deliverable-summary {
    min-width: 0;
    grid-template-columns: 1fr;
  }

  .deal-view-tab {
    flex: 0 0 auto;
  }

  .deal-workspace-table table {
    min-width: 690px;
  }
}

/* --------------------------------------------------
   Follow-up workspace
-------------------------------------------------- */

.prospect-workspace-header {
  margin-bottom: 20px;
}

.prospect-view-tab {
  gap: 8px;
}

.prospect-view-tab small {
  min-width: 24px;
  padding: 3px 7px;
  border-radius: var(--radius-round);
  background: var(--surface-muted);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 900;
  text-align: center;
}

.prospect-view-tab.deal-view-tab-active small {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.prospect-workload-section {
  margin-bottom: 28px;
}

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

.prospect-workload-card {
  min-height: 135px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid var(--border);
  border-top: 4px solid var(--border-strong);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  color: var(--text);
  text-decoration: none;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease;
}

.prospect-workload-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.prospect-workload-card span {
  color: var(--text-soft);
  font-weight: 800;
}

.prospect-workload-card strong {
  font-size: 36px;
  line-height: 1;
}

.prospect-workload-card small {
  color: var(--text-muted);
}

.prospect-workload-overdue {
  border-top-color: var(--red);
  background: var(--red-soft);
}

.prospect-workload-overdue strong {
  color: var(--red-dark);
}

.prospect-workload-today {
  border-top-color: #f59e0b;
  background: #fffbeb;
}

.prospect-workload-today strong {
  color: var(--amber);
}

.prospect-workload-week {
  border-top-color: var(--blue);
  background: #eff6ff;
}

.prospect-workload-week strong {
  color: var(--blue);
}

.prospect-list-header {
  margin-bottom: 16px;
}

.prospect-workspace-table table {
  min-width: 1250px;
}

.prospect-workspace-row {
  cursor: pointer;
}

.prospect-workspace-row.prospect-overdue td {
  background: #fff7f7;
}

.prospect-workspace-row.prospect-due-today td {
  background: #fffbeb;
}

.prospect-workspace-row.prospect-due-tomorrow td {
  background: #eff6ff;
}

.prospect-workspace-row:hover td {
  filter: brightness(0.985);
}

.prospect-due-label,
.prospect-due-date,
.prospect-source {
  display: block;
}

.prospect-due-label {
  font-weight: 900;
  white-space: nowrap;
}

.prospect-due-date,
.prospect-source {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 12px;
}

.prospect-overdue .prospect-due-label {
  color: var(--red-dark);
}

.prospect-due-today .prospect-due-label {
  color: var(--amber);
}

.prospect-due-tomorrow .prospect-due-label {
  color: #1d4ed8;
}

.prospect-phone-link {
  white-space: nowrap;
  text-decoration: none;
}

.prospect-notes-cell {
  min-width: 230px;
  max-width: 330px;
  color: var(--text-soft);
}

.prospect-actions-cell {
  min-width: 390px;
}

.prospect-row-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.prospect-inline-action-form {
  margin: 0;
  padding: 0;
  display: inline-flex;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.prospect-small-action {
  min-height: 32px;
  margin: 0;
  padding: 7px 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

button.prospect-small-action {
  background: var(--surface);
  color: var(--text-soft);
}

.prospect-small-action:hover,
button.prospect-small-action:hover {
  transform: translateY(-1px);
  background: var(--surface-muted);
  color: var(--text);
}

.prospect-call-action {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}

.prospect-bought-action,
button.prospect-bought-action {
  border-color: #bbf7d0;
  background: var(--green-soft);
  color: var(--green);
}

.prospect-lost-action,
button.prospect-lost-action {
  border-color: #fecaca;
  background: var(--red-soft);
  color: var(--red-dark);
}

.prospect-open-action {
  border-color: var(--navy-soft);
  background: var(--navy-soft);
  color: #fff;
}

.prospect-open-action:hover {
  background: var(--navy-hover);
  color: #fff;
}

.status-delivered-follow-up {
  background: var(--blue-soft);
  color: #1d4ed8;
}

.prospect-mobile-list {
  display: none;
}

@media (max-width: 1050px) {
  .prospect-workload-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .prospect-workspace-header .show-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .prospect-workspace-header .show-actions a {
    width: 100%;
  }

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

  .prospect-desktop-table {
    display: none;
  }

  .prospect-mobile-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
  }

  .prospect-mobile-card {
    padding: 18px;
    border: 1px solid var(--border);
    border-left: 5px solid var(--border-strong);
    border-radius: var(--radius-xl);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
  }

  .prospect-mobile-card.prospect-overdue {
    border-left-color: var(--red);
    background: var(--red-soft);
  }

  .prospect-mobile-card.prospect-due-today {
    border-left-color: #f59e0b;
    background: #fffbeb;
  }

  .prospect-mobile-card.prospect-due-tomorrow {
    border-left-color: var(--blue);
    background: #eff6ff;
  }

  .prospect-mobile-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
  }

  .prospect-mobile-card-header > div {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  .prospect-mobile-card-header > div > strong {
    font-size: 17px;
  }

  .prospect-mobile-card-header > div > span {
    color: var(--text-soft);
    font-size: 14px;
  }

  .prospect-mobile-due {
    margin: 16px 0 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
  }

  .prospect-mobile-due span {
    color: var(--text-muted);
    font-size: 13px;
  }

  .prospect-overdue .prospect-mobile-due strong {
    color: var(--red-dark);
  }

  .prospect-due-today .prospect-mobile-due strong {
    color: var(--amber);
  }

  .prospect-due-tomorrow .prospect-mobile-due strong {
    color: #1d4ed8;
  }

  .prospect-mobile-notes {
    margin: 0 0 14px;
    color: var(--text-soft);
    font-size: 14px;
    line-height: 1.45;
  }

  .prospect-mobile-phone {
    display: inline-block;
    margin-bottom: 14px;
    text-decoration: none;
  }

  .prospect-mobile-card .prospect-row-actions {
    padding-top: 14px;
    border-top: 1px solid rgba(148, 163, 184, 0.3);
  }

  .prospect-mobile-card .prospect-small-action {
    flex: 1 1 auto;
  }
}

@media (max-width: 480px) {
  .prospect-workspace-header .show-actions {
    grid-template-columns: 1fr;
  }

  .prospect-workload-grid {
    grid-template-columns: 1fr;
  }

  .prospect-mobile-card-header {
    flex-direction: column;
  }

  .prospect-mobile-card .prospect-row-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .prospect-mobile-card .prospect-inline-action-form {
    width: 100%;
  }

  .prospect-mobile-card .prospect-small-action {
    width: 100%;
  }
}

/* --------------------------------------------------
   Chrome extension download page
-------------------------------------------------- */

.extension-download-card {
  margin-bottom: 22px;
}

.extension-download-heading {
  margin-bottom: 18px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.extension-download-heading h2 {
  margin-bottom: 4px;
}

.extension-download-card .primary-button {
  margin-top: 14px;
}

.extension-install-steps {
  margin: 18px 0 0;
  padding-left: 24px;
}

.extension-install-steps li {
  margin-bottom: 14px;
  padding-left: 6px;
  color: var(--text-soft);
  line-height: 1.55;
}

.extension-install-steps li::marker {
  color: var(--navy);
  font-weight: 900;
}

.extension-install-steps code,
.extension-help-list code {
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-muted);
  color: var(--text);
}

.extension-help-list {
  margin: 18px 0 0;
}

.extension-help-list > div {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.extension-help-list > div:first-child {
  padding-top: 0;
}

.extension-help-list > div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.extension-help-list dt {
  margin-bottom: 5px;
  color: var(--text);
  font-weight: 900;
}

.extension-help-list dd {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.5;
}

@media (max-width: 600px) {
  .extension-download-heading {
    flex-direction: column;
  }

  .extension-download-card .primary-button {
    width: 100%;
  }
}

/* --------------------------------------------------
   Monthly bulletins
-------------------------------------------------- */

.bulletin-list { display: grid; }
.bulletin-list-row { display: flex; justify-content: space-between; gap: 18px; padding: 18px 4px; border-bottom: 1px solid var(--border); color: inherit; text-decoration: none; }
.bulletin-list-row:last-child { border-bottom: 0; }
.bulletin-list-row > div:first-child { display: grid; gap: 5px; }
.bulletin-list-row span { color: var(--text-soft); }
.bulletin-list-meta { display: flex; align-items: center; gap: 14px; }
.bulletin-status { padding: 5px 10px; border-radius: var(--radius-round); font-size: .78rem; font-weight: 800; }
.bulletin-status-active { color: var(--green); background: var(--green-soft); }
.bulletin-status-draft { color: var(--amber); background: var(--amber-soft); }
.bulletin-status-archived { color: var(--text-soft); background: var(--surface-muted); }
.bulletin-status-warning { color: var(--amber); background: var(--amber-soft); }
.bulletin-upload-card { max-width: 720px; }
.form-stack { display: grid; gap: 16px; }
.form-stack > div { display: grid; gap: 7px; }
.form-stack small { display: block; margin-top: 5px; }
.bulletin-date-grid, .bulletin-settings-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.bulletin-settings-form { grid-template-columns: 2fr 1fr 1fr 1fr auto; align-items: end; }
.bulletin-settings-form > div { display: grid; gap: 7px; }
.bulletin-page-heading { margin: 28px 0 16px; }
.bulletin-page-heading h2 { margin-bottom: 4px; }
.bulletin-page-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.bulletin-page-card { padding: 0; overflow: hidden; }
.bulletin-page-preview { aspect-ratio: 16 / 10; overflow: hidden; background: var(--surface-muted); border-bottom: 1px solid var(--border); }
.bulletin-page-preview img, .bulletin-choice-card img { width: 100%; height: 100%; object-fit: contain; display: block; }
.bulletin-page-content { padding: 18px; }
.bulletin-page-title { display: flex; justify-content: space-between; margin-bottom: 16px; }
.compact-form { gap: 12px; }
.bulletin-page-options { grid-template-columns: 1fr auto; align-items: end; }
.checkbox-label { display: flex; align-items: center; gap: 7px; min-height: 42px; }
.deal-bulletin-summary { display: grid; gap: 3px; margin: 0 0 18px; padding: 13px 15px; border: 1px solid #bbf7d0; border-radius: var(--radius-md); background: #f0fdf4; }
.deal-bulletin-summary span { color: var(--text-soft); }
.deal-bulletin-missing { border-color: #fde68a; background: #fffbeb; }

.deal-details-card { display: flex; flex-direction: column; }
.deal-document-statuses { display: grid; flex: 1; grid-template-columns: repeat(3, minmax(0, 1fr)); align-content: center; gap: 14px; min-height: 150px; margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--border); }
.deal-document-status { display: flex; min-width: 0; flex-direction: column; justify-content: center; gap: 5px; padding: 16px 17px; border: 1px solid var(--border); border-radius: var(--radius-md); background: linear-gradient(145deg, #fff, var(--surface-muted)); box-shadow: 0 6px 18px rgba(15, 39, 71, .05); }
.deal-document-status > span { color: var(--text-soft); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.deal-document-status > strong { font-size: 16px; }
.deal-document-status small { overflow-wrap: anywhere; color: var(--text-soft); line-height: 1.45; }
.deal-export-failure { display: grid; gap: 3px; margin-top: 12px; padding: 12px 14px; border: 1px solid #fecaca; border-radius: var(--radius-md); background: #fef2f2; color: #991b1b; }
.deal-documents-card .document-section-header { align-items: center; margin-bottom: 20px; padding-bottom: 18px; border-bottom: 1px solid var(--border); }
.deal-document-checklist { display: grid; gap: 12px; margin-bottom: 20px; }
.deal-checklist-step { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto minmax(150px, auto); align-items: center; gap: 14px; padding: 15px 16px; border: 1px solid var(--border); border-radius: var(--radius-md); background: #fff; box-shadow: 0 5px 16px rgba(15, 39, 71, .045); }
.deal-checklist-step.is-complete { border-color: #bbf7d0; background: linear-gradient(90deg, #f0fdf4, #fff 72%); }
.deal-checklist-number { display: grid; width: 30px; height: 30px; place-items: center; border-radius: 50%; background: var(--navy); color: #fff; font-weight: 900; }
.deal-checklist-step > div { display: grid; gap: 3px; }
.deal-checklist-step > div > strong { font-size: 15px; }
.deal-checklist-step small { overflow-wrap: anywhere; color: var(--text-soft); line-height: 1.4; }
.deal-checklist-state { min-width: 76px; padding: 5px 9px; border-radius: var(--radius-round); background: #f1f5f9; color: var(--text-soft); font-size: 11px; font-weight: 900; text-align: center; text-transform: uppercase; letter-spacing: .035em; }
.deal-checklist-step.is-complete .deal-checklist-state { background: var(--green-soft); color: var(--green); }
.deal-checklist-step > .secondary-button, .deal-checklist-step > .recall-report-form > input[type="submit"] { min-width: 150px; justify-self: end; text-align: center; }
.deal-checklist-step .recall-report-form { display: flex; justify-content: flex-end; gap: 8px; }
.deal-checklist-step .recall-report-form input[type="text"] { width: 190px; }
.prepared-document-upload-form { display: none; }
.prepared-file-fields { display: grid; min-width: 260px; gap: 8px; }
.prepared-file-fields label { display: grid; gap: 4px; }
.prepared-file-fields label > span { color: var(--text-soft); font-size: 11px; font-weight: 850; text-transform: uppercase; letter-spacing: .035em; }
.prepared-file-fields label em { font-weight: 600; text-transform: none; }
.prepared-file-fields input[type="file"] { width: 260px; max-width: 100%; padding: 7px; border: 1px dashed #b8c7db; border-radius: 9px; background: #f8fafc; color: var(--text-soft); font-size: 12px; }
.prepared-file-fields-single { align-self: center; }
.prepared-document-actions { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: 4px 0 20px; padding: 15px 17px; border: 1px solid #bfdbfe; border-radius: var(--radius-md); background: #eff6ff; }
.prepared-document-actions p { display: grid; gap: 3px; margin: 0; }
.prepared-document-actions small { color: var(--text-soft); }
.other-documents-heading { margin: 4px 0 12px; }
.other-documents-heading h3 { margin-bottom: 3px; }
.autodoc-readiness-note { margin: 0 0 18px; padding: 12px 14px; border-radius: var(--radius-md); background: #fffbeb; color: #92400e; }

@media (max-width: 820px) {
  .deal-document-statuses { grid-template-columns: 1fr; align-content: start; min-height: 0; }
  .deal-checklist-step { grid-template-columns: 34px minmax(0, 1fr); }
  .deal-checklist-state { text-align: left; }
  .deal-checklist-step > .secondary-button, .deal-checklist-step > .recall-report-form, .deal-checklist-step > .muted { grid-column: 2; }
  .deal-checklist-step > .secondary-button, .deal-checklist-step > .recall-report-form > input[type="submit"] { width: 100%; justify-self: stretch; }
  .deal-checklist-step .recall-report-form { justify-content: flex-start; flex-wrap: wrap; }
  .deal-checklist-step .recall-report-form input[type="text"] { width: 100%; }
  .prepared-file-fields { grid-column: 2; min-width: 0; width: 100%; }
  .prepared-file-fields input[type="file"] { width: 100%; }
  .prepared-document-actions { align-items: stretch; flex-direction: column; }
  .prepared-document-actions input[type="submit"] { width: 100%; }
}
.bulletin-choice-section { margin-bottom: 20px; }
.bulletin-choice-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.bulletin-choice-card { overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); }
.bulletin-choice-card img { aspect-ratio: 16 / 10; background: var(--surface-muted); border-bottom: 1px solid var(--border); }
.bulletin-choice-card > div { display: grid; gap: 3px; padding: 12px; }
.bulletin-choice-card span { color: var(--text-soft); }
.bulletin-choice-card form { padding: 0 12px 12px; }
.bulletin-choice-card button { width: 100%; }

.bulletin-library-grid { display: grid; gap: 16px; }
.bulletin-library-card { display: flex; justify-content: space-between; align-items: center; gap: 24px; margin: 0; padding: 22px; border: 1px solid transparent; }
.bulletin-library-card-active { border-color: #bbf7d0; }
.bulletin-library-card-main { display: flex; min-width: 0; align-items: center; gap: 16px; }
.bulletin-brand { display: grid; width: 48px; height: 48px; flex: 0 0 auto; place-items: center; border-radius: 13px; background: var(--navy); color: #fff; font-size: 20px; font-weight: 900; }
.bulletin-library-copy { display: grid; min-width: 0; gap: 4px; color: var(--text-soft); }
.bulletin-library-title-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.bulletin-library-title { overflow: hidden; color: var(--text); font-size: 17px; font-weight: 900; text-decoration: none; text-overflow: ellipsis; }
.bulletin-library-title:hover { text-decoration: underline; }
.bulletin-manufacturer { color: var(--text); font-size: 13px; }
.bulletin-library-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 14px; }
.bulletin-active-toggle { display: flex; align-items: center; gap: 8px; font-weight: 800; cursor: pointer; }
.bulletin-active-toggle input { width: 18px; height: 18px; accent-color: var(--green); }
.bulletin-warning { display: flex; gap: 13px; margin-bottom: 14px; padding: 14px 16px; border: 1px solid #fde68a; border-radius: var(--radius-lg); background: #fffbeb; color: var(--amber); }
.bulletin-warning > span { display: grid; width: 25px; height: 25px; flex: 0 0 auto; place-items: center; border-radius: 50%; background: var(--amber); color: #fff; font-weight: 900; }
.bulletin-warning p { margin: 3px 0 0; color: #78350f; }
.bulletin-library-help { display: flex; gap: 8px; margin-top: 20px; padding: 0 4px; color: var(--text-soft); }
.bulletin-selector-layout { display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); gap: 20px; align-items: start; }
.bulletin-selector-controls { position: sticky; top: 20px; }
.bulletin-recommendation { display: flex; gap: 12px; margin-bottom: 20px; padding: 14px; border: 1px solid #bbf7d0; border-radius: var(--radius-md); background: #f0fdf4; color: var(--green); }
.bulletin-recommendation > span { display: grid; width: 25px; height: 25px; flex: 0 0 auto; place-items: center; border-radius: 50%; background: var(--green); color: #fff; font-weight: 900; }
.bulletin-recommendation p { margin: 4px 0 0; color: var(--text-soft); font-size: 13px; line-height: 1.45; }
.bulletin-recommendation-neutral { border-color: var(--border); background: var(--surface-muted); color: var(--text); }
.bulletin-recommendation-neutral > span { background: var(--text-soft); }
.bulletin-confirm-form select { width: 100%; }
.bulletin-selected-summary { padding: 14px; border-radius: var(--radius-md); background: var(--surface-muted); }
.bulletin-selected-summary span, .bulletin-selected-summary strong, .bulletin-selected-summary small { display: block; }
.bulletin-selected-summary span { margin-bottom: 4px; color: var(--text-muted); font-size: 12px; font-weight: 800; text-transform: uppercase; }
.bulletin-selected-summary small { margin-top: 3px; color: var(--text-soft); }
.bulletin-confirm-form .primary-button { width: 100%; }
.bulletin-pdf-panel { padding: 18px; }
.bulletin-preview-heading h2 { margin-bottom: 14px; }
.bulletin-pdf-panel iframe { width: 100%; height: min(72vh, 760px); border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface-muted); }

@media (max-width: 800px) {
  .bulletin-page-grid, .bulletin-choice-grid { grid-template-columns: 1fr; }
  .bulletin-settings-form { grid-template-columns: 1fr; }
  .bulletin-selector-layout { grid-template-columns: 1fr; }
  .bulletin-selector-controls { position: static; }
  .bulletin-library-card { align-items: flex-start; flex-direction: column; }
  .bulletin-library-actions { width: 100%; justify-content: space-between; }
}

@media (max-width: 520px) {
  .bulletin-list-row { flex-direction: column; }
  .bulletin-list-meta { justify-content: space-between; }
  .bulletin-date-grid { grid-template-columns: 1fr; }
  .bulletin-library-help { flex-direction: column; }
  .bulletin-pdf-panel iframe { height: 58vh; }
}
.prepared-paste-zone {
  border: 1px dashed #94a3b8;
  border-radius: 10px;
  cursor: pointer;
  display: grid;
  gap: 0.2rem;
  min-width: 11rem;
  padding: 0.7rem 0.85rem;
}

.prepared-paste-zone:focus,
.prepared-paste-zone:hover {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgb(37 99 235 / 12%);
  outline: none;
}

.prepared-paste-zone.has-pasted-file {
  background: #ecfdf5;
  border-color: #16a34a;
}

.prepared-paste-zone small { color: #64748b; }
.existing-licence-assignments { display: grid; gap: 0.55rem; grid-column: 1 / -1; }
.existing-document-form,
.document-category-form { display: flex; gap: 0.5rem; align-items: center; }
.existing-document-form select,
.document-category-form select { min-width: 0; flex: 1; }
.document-category-form { align-items: stretch; flex-direction: column; margin-top: 0.75rem; width: 100%; }
.document-category-form input[type="submit"] { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; width: 100%; }
.document-card-body { min-width: 0; }
.prepared-document-missing,
.prepared-document-replacement { display: grid; gap: 8px; }
.prepared-document-complete { border: 1px solid #bbf7d0; border-radius: 10px; background: #f0fdf4; min-width: 0; }
.prepared-document-complete summary { align-items: center; cursor: pointer; display: flex; gap: 0.75rem; justify-content: space-between; list-style: none; padding: 0.75rem 0.85rem; }
.prepared-document-complete summary::-webkit-details-marker { display: none; }
.prepared-document-complete summary span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prepared-document-complete summary strong { color: #2563eb; flex: none; font-size: 0.85rem; }
.prepared-document-replacement { border-top: 1px solid #bbf7d0; padding: 0.85rem; }

.deal-command-centre {
  align-items: center;
  background: linear-gradient(135deg, #0f172a, #1e3a5f);
  border-radius: 18px;
  color: #fff;
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 1.6fr) minmax(14rem, 0.8fr) auto;
  margin-bottom: 1.25rem;
  padding: 1.25rem;
}
.deal-command-primary h2 { color: #fff; margin: 0.2rem 0; }
.deal-command-primary p { color: #cbd5e1; margin: 0; }
.deal-command-readiness { background: rgb(255 255 255 / 9%); border-radius: 12px; display: grid; gap: 0.2rem; padding: 0.8rem; }
.deal-command-readiness.is-ready { background: rgb(22 163 74 / 24%); }
.deal-command-readiness span,
.deal-command-readiness small { color: #cbd5e1; }
.deal-command-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: flex-end; }
.deal-activity-timeline { list-style: none; margin: 0; padding: 0; }
.deal-activity-timeline li { display: grid; gap: 0.75rem; grid-template-columns: 12px 1fr; padding: 0.7rem 0; }
.deal-activity-marker { background: #2563eb; border-radius: 999px; height: 10px; margin-top: 0.35rem; width: 10px; }
.deal-activity-timeline li:not(:last-child) .deal-activity-marker { box-shadow: 0 18px 0 -4px #cbd5e1; }
.deal-activity-timeline li div { display: grid; gap: 0.15rem; }
.deal-activity-timeline time,
.deal-activity-timeline small { color: #64748b; font-size: 0.82rem; }
@media (max-width: 900px) {
  .deal-command-centre { grid-template-columns: 1fr; }
  .deal-command-actions { justify-content: flex-start; }
  .prepared-file-fields { grid-template-columns: 1fr; }
}
@media (min-width: 560px) {
  .document-category-form { display: grid; grid-template-columns: minmax(0, 1fr); }
}
