/* Altus CRM
   Brand tokens from locked Altus materials (2026) */

:root {
  --navy: #141758;
  --navy-deep: #1a2f9e;
  --blue: #2456d6;
  --purple: #5C4ACA;
  --cyan: #16BDDA;
  --soft-blue: #eaf2fb;
  --grey: #5a5f7a;
  --border: #d8dee8;
  --white: #ffffff;
  --bg: #f7f9fc;
  --danger: #9b1c3a;
  --danger-bg: #fdecef;
  --success: #0b6b4a;
  --success-bg: #e8f7f1;
  --radius: 16px;
  --radius-sm: 12px;
  --shadow: 0 10px 28px rgba(20, 23, 88, 0.08);
  --shadow-lg: 0 18px 50px rgba(20, 23, 88, 0.16);
  --font: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;
  --header-h: 72px;
  --max: 1120px;
  --hero: linear-gradient(105deg, #1a2f9e 0%, #2456d6 48%, #16BDDA 100%);
  --ombre: linear-gradient(90deg, #c5eef8 0%, #d8cdf8 55%, #e0d4fb 100%);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--navy);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--purple);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:hover {
  color: var(--navy);
}

:focus-visible {
  outline: 3px solid var(--cyan);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 200;
  background: var(--white);
  color: var(--navy);
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 8px;
}

.skip-link:focus {
  top: 12px;
}

.wrap {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--navy);
  color: var(--white);
  min-height: var(--header-h);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: var(--header-h);
}

.logo {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  text-decoration: none;
}

.logo img {
  width: 150px;
  height: auto;
}

.nav-toggle {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 10px;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.nav-toggle-bar {
  display: block;
  height: 2px;
  width: 22px;
  background: var(--white);
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.site-nav {
  display: none;
  flex-direction: column;
  gap: 4px;
  position: absolute;
  top: var(--header-h);
  left: 0;
  right: 0;
  background: var(--navy);
  padding: 8px 20px 20px;
  box-shadow: var(--shadow-lg);
}

.site-nav.is-open {
  display: flex;
}

.site-nav a {
  color: var(--white);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 12px 4px;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  color: var(--cyan);
}

.site-nav .nav-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 8px;
  background: var(--white);
  color: var(--navy-deep);
  font-weight: 700;
  font-size: 14px;
  padding: 12px 20px;
  border-radius: 999px;
  text-decoration: none;
}

.site-nav .nav-cta:hover,
.site-nav .nav-cta:focus-visible {
  color: var(--navy-deep);
  filter: brightness(1.04);
}

.logo { gap: 10px; }
.logo-tag {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--navy);
  background: var(--cyan);
  border-radius: 6px;
  padding: 2px 7px;
}

.site-nav a[aria-current="page"] {
  color: var(--cyan);
}

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

body { background: var(--bg); min-height: 100vh; display: flex; flex-direction: column; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
  font-weight: 700;
  font-size: 14px;
  line-height: 1.2;
  padding: 11px 18px;
  border-radius: 999px;
  border: 1.5px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--purple); color: var(--white); }
.btn-primary:hover { background: #4b3bb0; color: var(--white); }
.btn-ghost { background: var(--white); color: var(--navy); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--purple); color: var(--purple); }
.btn-danger-ghost { background: transparent; color: var(--danger); border-color: #f0c5cf; }
.btn-danger-ghost:hover { background: var(--danger-bg); color: var(--danger); }
.btn-sm { padding: 7px 13px; font-size: 13px; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border-radius: 10px; border: 1px solid var(--border);
  background: var(--white); color: var(--navy);
  font-size: 22px; line-height: 1; cursor: pointer; font-family: inherit;
}
.icon-btn:hover { border-color: var(--purple); color: var(--purple); }
.file-btn { position: relative; }

/* Layout */
.app-main { flex: 1; padding-top: 28px; padding-bottom: 40px; max-width: 1360px; }
.app-main:focus { outline: none; }
.view-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 20px;
}
.view-head h1 { margin: 0; font-size: 1.75rem; font-weight: 800; letter-spacing: -0.01em; }
.view-sub { margin: 2px 0 0; color: var(--grey); font-size: 0.95rem; }
.card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}

/* Empty states */
.empty {
  text-align: center; color: var(--grey);
  padding: 36px 20px; border: 2px dashed var(--border);
  border-radius: var(--radius); background: var(--white);
}
.empty h2, .empty h3 { color: var(--navy); margin: 0 0 6px; font-size: 1.1rem; }
.empty p { margin: 0 0 14px; }
.empty-sm { padding: 16px 10px; font-size: 0.85rem; border-width: 1.5px; }
.empty-sm p { margin: 0; }

/* Boards */
.board {
  display: grid; gap: 14px;
  grid-auto-flow: column;
  grid-auto-columns: minmax(250px, 82vw);
  overflow-x: auto; padding-bottom: 10px;
  scroll-snap-type: x mandatory;
}
.column {
  background: var(--soft-blue); border-radius: var(--radius);
  padding: 12px; display: flex; flex-direction: column; gap: 10px;
  min-height: 220px; scroll-snap-align: start;
  border: 2px solid transparent; transition: border-color 0.15s, background 0.15s;
}
.column.drag-over { border-color: var(--purple); background: #e3e0fa; }
.column-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 2px 4px; }
.column-head h2 { margin: 0; font-size: 0.85rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; }
.column-meta { font-size: 0.78rem; color: var(--grey); font-weight: 600; text-align: right; }
.column-total { display: block; color: var(--navy); font-weight: 800; font-size: 0.9rem; }
.column-cards { display: flex; flex-direction: column; gap: 10px; flex: 1; }
.col-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.stage-Lead .col-dot, .stage-todo .col-dot { background: #8a90b0; }
.stage-Contacted .col-dot, .stage-progress .col-dot { background: var(--cyan); }
.stage-Proposal .col-dot, .stage-review .col-dot { background: var(--purple); }
.stage-Negotiation .col-dot { background: #e09a1a; }
.stage-Won .col-dot, .stage-done .col-dot { background: var(--success); }
.stage-Lost .col-dot { background: var(--danger); }

.item {
  background: var(--white); border-radius: var(--radius-sm);
  border: 1px solid var(--border); padding: 12px;
  box-shadow: 0 2px 6px rgba(20, 23, 88, 0.05);
  cursor: grab; display: flex; flex-direction: column; gap: 6px;
}
.item:hover { border-color: #b9b0ee; }
.item.dragging { opacity: 0.45; }
.item-title {
  font-weight: 700; font-size: 0.95rem; line-height: 1.3;
  background: none; border: 0; padding: 0; text-align: left;
  color: var(--navy); font-family: inherit; cursor: pointer;
}
.item-title:hover { color: var(--purple); text-decoration: underline; }
.item-sub { font-size: 0.82rem; color: var(--grey); }
.item-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.item-value { font-weight: 800; font-size: 0.95rem; }
.item-next { font-size: 0.82rem; background: var(--bg); border-radius: 8px; padding: 6px 8px; }
.item select {
  font: inherit; font-size: 0.78rem; font-weight: 600;
  border: 1px solid var(--border); border-radius: 8px;
  padding: 4px 6px; background: var(--white); color: var(--navy); max-width: 100%;
}
.item a.item-link { font-size: 0.8rem; font-weight: 600; word-break: break-all; }

.pill {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.02em;
  padding: 3px 9px; border-radius: 999px;
  background: var(--soft-blue); color: var(--navy);
}
.pill-high { background: var(--danger-bg); color: var(--danger); }
.pill-medium { background: #fff4de; color: #8a5a00; }
.pill-low { background: var(--success-bg); color: var(--success); }
.pill-overdue { background: var(--danger-bg); color: var(--danger); }
.pill-type { background: #ece9fb; color: var(--purple); }
.pill-sample { background: #fff4de; color: #8a5a00; }

/* Toolbar */
.toolbar { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.search { flex: 1 1 260px; }
.search input, .inline-select select,
.field input, .field select, .field textarea {
  width: 100%; font: inherit; font-size: 15px; color: var(--navy);
  background: var(--white); border: 1.5px solid var(--border);
  border-radius: 10px; padding: 10px 12px;
}
.search input:focus, .inline-select select:focus,
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--purple); box-shadow: 0 0 0 3px rgba(92, 74, 202, 0.18);
}
.inline-select { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; font-weight: 600; color: var(--grey); }
.inline-select select { width: auto; padding: 9px 10px; }

/* Clients */
.clients-layout { display: grid; gap: 18px; }
.client-list { display: grid; gap: 10px; align-content: start; }
.client-card {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 12px;
  text-align: left; width: 100%;
  background: var(--white); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px 16px;
  font: inherit; color: var(--navy); cursor: pointer;
}
.client-card:hover { border-color: #b9b0ee; }
.client-card[aria-current="true"] { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(92, 74, 202, 0.15); }
.client-name { font-weight: 700; }
.client-meta { grid-column: 1 / -1; font-size: 0.83rem; color: var(--grey); overflow-wrap: anywhere; }
.status-Lead { background: #eef0f7; color: #4b5170; }
.status-Active { background: var(--success-bg); color: var(--success); }
.status-Prospect { background: #e3f7fb; color: #0b6f82; }
.status-Paused { background: #fff4de; color: #8a5a00; }
.status-Former { background: var(--danger-bg); color: var(--danger); }

.client-detail { padding: 20px; }
.client-detail:empty { display: none; }
.client-detail h2 { margin: 0; font-size: 1.3rem; }
.client-detail h3 { margin: 20px 0 8px; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--grey); }
.detail-grid { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 0.92rem; margin-top: 12px; }
.detail-grid dt { color: var(--grey); font-weight: 600; }
.detail-grid dd { margin: 0; overflow-wrap: anywhere; }
.detail-notes { white-space: pre-wrap; background: var(--bg); border-radius: 10px; padding: 10px 12px; font-size: 0.9rem; }
.related { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.related li {
  display: flex; justify-content: space-between; gap: 10px; align-items: center;
  background: var(--bg); border-radius: 10px; padding: 8px 12px; font-size: 0.88rem;
}
.related button { background: none; border: 0; font: inherit; font-weight: 600; color: var(--navy); cursor: pointer; text-align: left; padding: 0; }
.related button:hover { color: var(--purple); text-decoration: underline; }
.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

/* Schedule */
.schedule-layout { display: grid; gap: 20px; align-items: start; }
.agenda { display: grid; gap: 20px; }
.agenda-group h2 { margin: 0 0 8px; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--grey); }
.agenda-day { font-size: 0.82rem; font-weight: 700; color: var(--purple); margin: 10px 0 6px; }
.agenda-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.event {
  display: grid; grid-template-columns: 74px 1fr auto; gap: 12px; align-items: center;
  background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 14px;
}
.event-time { font-weight: 800; font-size: 0.88rem; }
.event-body { min-width: 0; }
.event-sub { font-size: 0.8rem; color: var(--grey); }
.event.past { opacity: 0.6; }

.calendar { padding: 16px; display: grid; gap: 12px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; }
.cal-head h2 { margin: 0; font-size: 1.05rem; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow { font-size: 0.7rem; font-weight: 700; color: var(--grey); text-align: center; text-transform: uppercase; padding: 4px 0; }
.cal-cell {
  aspect-ratio: 1 / 1; min-height: 38px;
  border: 1px solid transparent; border-radius: 10px;
  background: var(--bg); font: inherit; font-size: 0.82rem; font-weight: 600; color: var(--navy);
  cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  padding: 2px;
}
.cal-cell:hover { border-color: var(--purple); }
.cal-cell.other { color: #a6abc4; background: transparent; }
.cal-cell.today { background: var(--navy); color: var(--white); }
.cal-cell.selected { border-color: var(--purple); box-shadow: 0 0 0 2px rgba(92, 74, 202, 0.25); }
.cal-dots { display: flex; gap: 2px; height: 6px; }
.cal-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--cyan); }
.cal-cell.today .cal-dots i { background: var(--cyan); }
.cal-day-list { border-top: 1px solid var(--border); padding-top: 10px; }
.cal-day-list h3 { margin: 0 0 8px; font-size: 0.9rem; }

/* Footer */
.app-footer { border-top: 1px solid var(--border); background: var(--white); padding: 16px 0; }
.footer-inner { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; max-width: 1360px; }
.footer-note { margin: 0; font-size: 0.82rem; color: var(--grey); }
.footer-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Modal */
.modal {
  border: 0; padding: 0; border-radius: var(--radius);
  width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 32px);
  box-shadow: var(--shadow-lg); color: var(--navy);
}
.modal::backdrop { background: rgba(20, 23, 88, 0.45); }
.modal-form { display: flex; flex-direction: column; max-height: calc(100vh - 32px); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px 8px; }
.modal-head h2 { margin: 0; font-size: 1.2rem; }
.modal-body { padding: 8px 20px 4px; overflow-y: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.modal-foot { display: flex; gap: 8px; align-items: center; padding: 14px 20px 18px; border-top: 1px solid var(--border); margin-top: 10px; flex-wrap: wrap; }
.spacer { flex: 1; }
.field { display: flex; flex-direction: column; gap: 5px; grid-column: span 2; }
.field.half { grid-column: span 1; }
.field label { font-size: 0.82rem; font-weight: 700; }
.field textarea { min-height: 90px; resize: vertical; }
.field-error { color: var(--danger); font-size: 0.8rem; font-weight: 600; }
.field input[aria-invalid="true"] { border-color: var(--danger); }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  background: var(--navy); color: var(--white); font-weight: 600; font-size: 0.9rem;
  padding: 10px 18px; border-radius: 999px; box-shadow: var(--shadow-lg); z-index: 300;
}

/* Desktop */
@media (min-width: 760px) {
  .wrap { padding: 0 24px; }
  .nav-toggle { display: none; }
  .site-nav {
    display: flex; flex-direction: row; align-items: center;
    gap: 6px; position: static; padding: 0; box-shadow: none; background: transparent;
  }
  .site-nav a { padding: 8px 14px; border-radius: 999px; }
  .site-nav a[aria-current="page"] { background: rgba(255, 255, 255, 0.12); color: var(--white); box-shadow: inset 0 -2px 0 var(--cyan); }
  .logo img { width: 168px; }
  .board { grid-auto-columns: minmax(250px, 1fr); }
  .board-6 { grid-auto-columns: minmax(230px, 1fr); }
  .clients-layout { grid-template-columns: minmax(0, 1fr) minmax(320px, 420px); align-items: start; }
  .client-detail { position: sticky; top: calc(var(--header-h) + 16px); }
}
@media (min-width: 1000px) {
  .schedule-layout { grid-template-columns: minmax(0, 1fr) 360px; }
  .calendar { position: sticky; top: calc(var(--header-h) + 16px); }
}
@media (max-width: 520px) {
  .modal-body { grid-template-columns: 1fr; }
  .field.half { grid-column: span 2; }
  .event { grid-template-columns: 60px 1fr; }
  .event > :last-child { grid-column: 1 / -1; justify-self: start; }
  .view-head h1 { font-size: 1.45rem; }
}

.site-header .wrap { max-width: 1360px; }
.board.is-empty { display: block; }
@media (min-width: 1200px) {
  .board-6 { grid-auto-columns: minmax(180px, 1fr); }
}
