/* App layout + components — buildless SPA, Sensr brand.
   Companion to brand.css (tokens). No build step required. */

/* ═══════════════════════════════════════════════════════════════════════════
   LAYOUT — sidebar + content column
   ═══════════════════════════════════════════════════════════════════════════ */

.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */

.app-sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--sidebar-bg);
  color: var(--color-text);
  border-right: 1px solid var(--color-border);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: var(--z-drawer);
  overflow: hidden; /* logo + footer pin; only .app-nav scrolls */
  transition: transform var(--duration-normal) var(--ease-out);
}

.sidebar-logo {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-5) var(--space-5) var(--space-6);
  text-decoration: none !important;
}

.sidebar-logo img {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.sidebar-logo-text {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  color: var(--color-text);
  letter-spacing: -0.02em;
}

.app-nav {
  flex: 1;
  min-height: 0; /* allow shrinking inside flex column */
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: 0 var(--space-3) var(--space-3);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  color: var(--sidebar-text);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  text-decoration: none;
  transition: background var(--duration-fast) var(--ease-out),
              color var(--duration-fast) var(--ease-out);
}

.nav-link:hover {
  background: var(--sidebar-hover);
  color: var(--color-text);
  text-decoration: none;
}

.nav-link.active {
  background: var(--sidebar-active);
  color: var(--sidebar-active-text);
}

/* Nav section label */
.nav-section {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  padding: var(--space-4) var(--space-3) var(--space-1);
}

/* Remove top gap from the first section so there's no dead space below the logo */
.nav-section.first {
  padding-top: var(--space-1);
}

/* Sidebar footer: user badge + sign-out */
.sidebar-footer {
  padding: var(--space-4) var(--space-4) var(--space-5);
  border-top: 1px solid var(--color-border);
  margin-top: var(--space-4);
}

.user-badge {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.user-badge-name {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-badge-role {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  text-transform: capitalize;
}

.logout-btn {
  margin-top: var(--space-2);
  background: var(--color-surface);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: var(--space-1) var(--space-3);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  font-family: var(--font-family);
  cursor: pointer;
  width: 100%;
  transition: background var(--duration-fast) var(--ease-out),
              color var(--duration-fast) var(--ease-out);
}

.logout-btn:hover {
  background: var(--color-surface-hover);
  color: var(--color-text);
}

/* Hamburger (mobile only) */
.sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--color-text);
  font-size: 1.4rem;
  flex-shrink: 0;
}

/* Sidebar overlay (mobile) */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(6, 6, 40, 0.5);
  z-index: calc(var(--z-drawer) - 1);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-normal) var(--ease-out);
}

.sidebar-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

/* ── Top bar (mobile) ───────────────────────────────────────────────────── */

.app-topbar {
  display: none;
  align-items: center;
  gap: var(--space-3);
  background: var(--sidebar-bg);
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-3) var(--space-4);
  position: sticky;
  top: 0;
  z-index: var(--z-raised);
}

.app-topbar img {
  height: 28px;
  width: auto;
}

.app-topbar > a {
  display: flex;
  align-items: center;
  line-height: 0;
}

.topbar-title {
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-bold);
  color: var(--color-text);
  letter-spacing: -0.02em;
}

.topbar-spacer {
  flex: 1;
}

/* ── Main content area ──────────────────────────────────────────────────── */

.app-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.page-header {
  padding: var(--space-6) var(--space-8) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg);
}

.page-header h1 {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  margin: 0;
  letter-spacing: -0.02em;
}

main {
  padding: var(--space-6) var(--space-8);
  width: 80%;
  max-width: 1200px;
  margin: 0 auto;
}

/* Schedule gets more horizontal space */
main.schedule-main {
  max-width: none;
  padding: var(--space-5) var(--space-6);
}

/* ═══════════════════════════════════════════════════════════════════════════
   PROGRESS BAR (top of page, driven by api.js in-flight counter)
   ═══════════════════════════════════════════════════════════════════════════ */

.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--sensr-gradient);
  z-index: var(--z-toast);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--duration-normal) var(--ease-out),
              opacity var(--duration-slow) var(--ease-out);
  opacity: 0;
}

.progress-bar.active {
  transform: scaleX(0.8);
  opacity: 1;
}

/* ═══════════════════════════════════════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════════════════════════════════════ */

.card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: var(--space-6);
}

.card + .card {
  margin-top: var(--space-5);
}

.accent-bar {
  height: 3px;
  border-radius: var(--radius-pill);
  background: var(--sensr-gradient);
  margin-bottom: var(--space-5);
}

.card-head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.card-head h2 {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  margin: 0;
  margin-right: auto;
  letter-spacing: -0.01em;
}

/* ═══════════════════════════════════════════════════════════════════════════
   TABLES
   ═══════════════════════════════════════════════════════════════════════════ */

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
}

th {
  text-align: center;
  padding: var(--space-2) var(--space-4);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

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

tbody tr {
  transition: background var(--duration-fast) var(--ease-out);
}

tbody tr:hover {
  background: var(--color-surface);
}

td a {
  color: var(--color-accent);
  text-decoration: none;
  font-weight: var(--font-weight-semibold);
}

td a:hover {
  text-decoration: underline;
}

/* ═══════════════════════════════════════════════════════════════════════════
   TAGS / STATUS PILLS
   ═══════════════════════════════════════════════════════════════════════════ */

.tag {
  display: inline-block;
  padding: 2px var(--space-2);
  border-radius: var(--radius-pill);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  background: var(--color-surface);
  color: var(--color-text);
  letter-spacing: 0.02em;
}

.tag-ok      { background: var(--sensr-light-green); color: var(--sensr-dark-blue); }
.tag-dim     { background: var(--color-surface); opacity: 0.65; }
.tag-active  { background: var(--sensr-light-green); color: var(--sensr-dark-blue); }
.tag-prospect { background: #fff3cd; color: #7a5300; }
.tag-closed  { background: var(--color-surface); opacity: 0.65; }
.tag-warn    { background: #fff3cd; color: #7a5300; }
.tag-danger  { background: #fde8e8; color: #9b1c1c; }

/* ═══════════════════════════════════════════════════════════════════════════
   COLOUR SWATCH
   ═══════════════════════════════════════════════════════════════════════════ */

.swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: var(--radius-sm);
  margin-right: var(--space-2);
  vertical-align: middle;
  border: 1px solid rgba(0, 0, 0, 0.12);
  flex-shrink: 0;
}

/* Swatch picker grid (Phase 3) */
.swatch-picker {
  display: grid;
  grid-template-columns: repeat(6, 28px);
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.swatch-option {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform var(--duration-fast) var(--ease-out),
              border-color var(--duration-fast) var(--ease-out);
}

.swatch-option:hover {
  transform: scale(1.15);
}

.swatch-option.selected {
  border-color: var(--color-text);
  transform: scale(1.15);
}

.color-preview-row {
  display: flex;
  align-items: center;
  min-height: 24px;
  font-size: var(--text-sm);
}

/* ═══════════════════════════════════════════════════════════════════════════
   FORMS
   ═══════════════════════════════════════════════════════════════════════════ */

.form {
  max-width: 540px;
}

.form-row {
  display: flex;
  flex-direction: column;
  margin-bottom: var(--space-5);
}

.form-row.inline {
  flex-direction: row;
  align-items: center;
  gap: var(--space-3);
}

.form-row label {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  margin-bottom: var(--space-1);
  color: var(--color-text);
}

/* Required asterisk */
.form-row label .req {
  color: var(--color-danger);
  margin-left: 2px;
}

/* Optional hint */
.form-row label .opt {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-normal);
  color: var(--color-text-muted);
  margin-left: var(--space-1);
}

/* Hint text below the input */
.field-hint {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  margin-top: var(--space-1);
}

/* Per-field error */
.field-error {
  font-size: var(--font-size-xs);
  color: var(--color-danger);
  margin-top: var(--space-1);
}

.form-row input,
.form-row select,
.form-row textarea {
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-base);
  font-family: var(--font-family);
  color: var(--color-text);
  background: var(--color-bg);
  transition: border-color var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out);
}

.form-row textarea {
  resize: vertical;
  min-height: 80px;
  line-height: var(--line-height-normal);
}

.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: var(--focus-ring);
}

.form-row input[aria-invalid="true"],
.form-row select[aria-invalid="true"],
.form-row textarea[aria-invalid="true"] {
  border-color: var(--color-danger);
}

.form-actions {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-2);
  align-items: center;
}

.form-error {
  color: var(--color-danger);
  font-size: var(--font-size-sm);
  margin-bottom: var(--space-3);
  min-height: 1em;
}

.form-success {
  color: var(--color-ok);
  font-size: var(--font-size-sm);
  margin-top: var(--space-3);
}

/* Date input — the custom dd/mm/yyyy component */
.date-field {
  position: relative;
}

.date-field input {
  padding-right: 2.2rem;
}

.date-field .date-icon {
  position: absolute;
  right: var(--space-2);
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  pointer-events: none;
  font-size: var(--font-size-md);
}

/* Combobox */
.combobox-wrap {
  position: relative;
}

.combobox-input {
  width: 100%;
}

.combobox-listbox {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  max-height: 220px;
  overflow-y: auto;
  z-index: var(--z-overlay);
  padding: var(--space-1) 0;
}

.combobox-option {
  padding: var(--space-2) var(--space-4);
  font-size: var(--font-size-sm);
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-out);
}

.combobox-option:hover,
.combobox-option[aria-selected="true"] {
  background: var(--color-surface);
}

.combobox-option[aria-selected="true"] {
  font-weight: var(--font-weight-semibold);
}

.combobox-empty {
  padding: var(--space-3) var(--space-4);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

/* ═══════════════════════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-5);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  font-family: var(--font-family);
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  line-height: var(--line-height-tight);
  transition: background var(--duration-fast) var(--ease-out),
              color var(--duration-fast) var(--ease-out),
              border-color var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out),
              opacity var(--duration-fast) var(--ease-out);
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.btn:hover {
  text-decoration: none;
}

.btn-primary {
  background: var(--color-accent);
  color: var(--color-text-inverse);
  border-color: var(--color-accent);
}

.btn-primary:hover {
  background: var(--color-accent-dark);
  border-color: var(--color-accent-dark);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-ghost {
  background: transparent;
  color: var(--color-text);
  border-color: var(--color-border);
}

.btn-ghost:hover {
  background: var(--color-surface);
}

.btn-sm {
  padding: var(--space-1) var(--space-3);
  font-size: var(--font-size-xs);
}

.btn-icon {
  padding: var(--space-1) var(--space-2);
  min-width: 32px;
}

.btn-danger {
  color: var(--color-danger);
  border-color: var(--color-danger);
  margin-left: auto;
}

.btn-danger:hover {
  background: var(--color-danger);
  color: var(--color-text-inverse);
}

/* Active/pressed state (e.g. zoom level on schedule toolbar) */
.btn-ghost.btn-active {
  background: var(--color-surface);
  border-color: var(--color-accent-soft);
  color: var(--color-accent);
}

/* ═══════════════════════════════════════════════════════════════════════════
   MISC HELPERS
   ═══════════════════════════════════════════════════════════════════════════ */

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

.error-text {
  color: var(--color-danger);
}

/* ── Skeleton shimmer ─────────────────────────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

.skeleton-line {
  height: 1em;
  border-radius: var(--radius-sm);
  background: linear-gradient(
    90deg,
    var(--color-surface) 25%,
    var(--color-surface-hover) 50%,
    var(--color-surface) 75%
  );
  background-size: 800px 100%;
  animation: shimmer 1.4s linear infinite;
}

.skeleton-row {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
}

.skeleton-row .skeleton-line:nth-child(1) { flex: 2; }
.skeleton-row .skeleton-line:nth-child(2) { flex: 3; }
.skeleton-row .skeleton-line:nth-child(3) { flex: 1; }

/* ── Toast notifications ───────────────────────────────────────────────── */
#toast-region {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: var(--sensr-dark-blue);
  color: var(--color-text-inverse);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  min-width: 200px;
  max-width: 360px;
  pointer-events: auto;
  animation: toast-in var(--duration-normal) var(--ease-out) both;
}

.toast.toast-error {
  background: var(--color-danger);
}

.toast.toast-ok {
  background: var(--sensr-medium-green);
  color: var(--sensr-dark-blue);
}

.toast.toast-out {
  animation: toast-out var(--duration-normal) var(--ease-in) both;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}

@keyframes toast-out {
  from { opacity: 1; transform: none; }
  to   { opacity: 0; transform: translateY(8px); }
}

/* ── Confirm dialog ────────────────────────────────────────────────────── */
.confirm-dialog {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: var(--space-6);
  max-width: 380px;
  width: 100%;
  font-family: var(--font-family);
  color: var(--color-text);
  animation: dialog-in var(--duration-normal) var(--ease-out) both;
}

.confirm-dialog::backdrop {
  background: rgba(6, 6, 40, 0.4);
  animation: backdrop-in var(--duration-normal) var(--ease-out) both;
}

.confirm-dialog p {
  margin: 0 0 var(--space-5);
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
}

.confirm-dialog .dialog-actions {
  display: flex;
  gap: var(--space-3);
  justify-content: flex-end;
}

/* ═══════════════════════════════════════════════════════════════════════════
   AUTH SCREENS
   ═══════════════════════════════════════════════════════════════════════════ */

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-surface);
  padding: var(--space-6);
}

.auth-page main {
  width: auto;
  max-width: none;
  margin: 0;
  padding: 0;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: var(--space-8) var(--space-8) var(--space-6);
}

.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-6);
}

.auth-logo img {
  height: 40px;
  width: auto;
}

.auth-card h2 {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  margin: 0 0 var(--space-6);
  text-align: center;
  letter-spacing: -0.02em;
}

.auth-card .form {
  max-width: none;
}

.auth-footer-link {
  text-align: center;
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  margin-top: var(--space-5);
}

/* ═══════════════════════════════════════════════════════════════════════════
   SCHEDULE / GANTT
   ═══════════════════════════════════════════════════════════════════════════ */

.schedule-wrap {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.schedule-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-5);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  box-shadow: var(--shadow-sm);
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.toolbar-sep {
  width: 1px;
  height: 20px;
  background: var(--color-border);
  margin: 0 var(--space-2);
}

.toolbar-label {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-left: var(--space-1);
}

.schedule-filter {
  padding: var(--space-1) var(--space-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  font-family: var(--font-family);
  background: var(--color-bg);
  color: var(--color-text);
  max-width: 180px;
  transition: border-color var(--duration-fast) var(--ease-out);
}

.schedule-filter:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: var(--focus-ring);
}

/* ── Custom Gantt timeline ───────────────────────────────────────────────── */

/* Outer container */
.gantt-container {
  width: 100%;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  background: var(--color-bg);
  overflow: hidden; /* clip the inner scroll el's radius */
}

/* The one scroll container — both axes scroll here */
.gantt-scroll {
  width: 100%;
  max-height: 65vh;
  overflow: auto;
  position: relative;
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
}

/* Inner wrapper — sets the real scrollable width */
.gantt-inner {
  position: relative;
  min-width: 100%;
}

/* ── Axis (sticky top) ────────────────────────────────────────────────────── */

.gantt-axis {
  position: sticky;
  top: 0;
  z-index: 10;
  height: 52px;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
}

/* Top-left cover so the name column header doesn't show content behind it */
.gantt-corner {
  position: sticky;
  left: 0;
  top: 0;
  z-index: 11;
  width: 200px;
  height: 100%;
  background: var(--color-bg);
  border-right: 1px solid var(--color-border);
  display: inline-block;
  flex-shrink: 0;
}

/* Month label band */
.gantt-month-band {
  position: absolute;
  top: 0;
  left: 200px; /* start after name column */
  right: 0;
  height: 24px;
  overflow: hidden;
}

.gantt-month-label {
  position: absolute;
  top: 0;
  height: 100%;
  display: flex;
  align-items: center;
  padding: 0 var(--space-2);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-muted);
  border-right: 1px solid var(--color-border);
  white-space: nowrap;
  overflow: hidden;
}

/* Day/week tick band */
.gantt-tick-band {
  position: absolute;
  top: 24px;
  left: 200px;
  right: 0;
  height: 28px;
  overflow: hidden;
}

.gantt-tick {
  position: absolute;
  top: 0;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--color-text-muted);
  border-right: 1px solid color-mix(in srgb, var(--color-border) 50%, transparent);
  user-select: none;
  box-sizing: border-box;
}

.gantt-tick-weekend {
  background: color-mix(in srgb, var(--color-border) 25%, transparent);
  color: color-mix(in srgb, var(--color-text-muted) 60%, transparent);
}

.gantt-tick-today {
  background: color-mix(in srgb, var(--color-accent) 15%, transparent);
  font-weight: var(--font-weight-bold);
  color: var(--color-accent);
}

/* Today vertical line */
.gantt-today-line {
  position: absolute;
  top: 52px; /* below the axis */
  bottom: 0;
  width: 2px;
  background: #ff7f6e;
  pointer-events: none;
  z-index: 5;
  display: none;
}

/* ── Rows ─────────────────────────────────────────────────────────────────── */

.gantt-rows {
  position: relative;
}

.gantt-row {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--color-border);
  min-height: 44px;
}

.gantt-row:last-child {
  border-bottom: none;
}

/* Sticky left name column */
.gantt-namecell {
  position: sticky;
  left: 0;
  z-index: 3;
  width: 200px;
  min-width: 200px;
  flex-shrink: 0;
  background: var(--color-bg);
  border-right: 1px solid var(--color-border);
  padding: var(--space-2) var(--space-3);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  overflow: hidden;
}

.gantt-name {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Utilisation mini-bar + percentage */
.gantt-util-summary {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.gantt-util-bar-wrap {
  display: flex;
  height: 4px;
  background: var(--color-border);
  border-radius: 2px;
  overflow: hidden;
}

.gantt-util-bar-confirmed {
  height: 100%;
  background: #4caf7d;
  transition: width 0.2s;
}

.gantt-util-bar-conditional {
  height: 100%;
  background: #d4863a;
  transition: width 0.2s;
}

.gantt-util-pct {
  font-size: 10px;
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-muted);
  line-height: 1;
}

.gantt-util-ok {
  color: #4caf7d;
}

.gantt-util-over {
  color: #e05252;
}

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

.gantt-util-cond {
  font-weight: normal;
  opacity: 0.75;
}

/* ── Lane (scrollable area per row) ──────────────────────────────────────── */

.gantt-lane {
  position: relative;
  flex: 1;
  min-height: 44px;
  overflow: visible;
}

/* Weekend background stripes inside the lane */
.gantt-weekend-stripe {
  position: absolute;
  top: 0;
  bottom: 0;
  background: color-mix(in srgb, var(--color-border) 20%, transparent);
  pointer-events: none;
}

/* ── Capacity fill layer ──────────────────────────────────────────────────── */

.gantt-fill-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.gantt-fill-confirmed {
  position: absolute;
  background: rgba(76, 175, 125, 0.18);
  border-radius: 2px 2px 0 0;
}

.gantt-fill-conditional {
  position: absolute;
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 3px,
    rgba(212, 134, 58, 0.25) 3px,
    rgba(212, 134, 58, 0.25) 6px
  );
  border-radius: 2px 2px 0 0;
}

/* Red cap for overbooked days */
.gantt-fill-overbooked {
  position: absolute;
  height: 3px;
  background: #e05252;
  border-radius: 2px 2px 0 0;
}

/* ── Bars layer ───────────────────────────────────────────────────────────── */

.gantt-bars-layer {
  position: absolute;
  inset: 0;
  overflow: visible;
}

.gantt-bar {
  position: absolute;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  padding: 0 6px;
  cursor: default;
  user-select: none;
  box-sizing: border-box;
  overflow: hidden;
  transition: box-shadow 0.1s;
}

.gantt-bar:hover {
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.25);
  z-index: 4;
}

.gantt-bar-label {
  font-size: 11px;
  font-weight: var(--font-weight-semibold);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

/* Prospect/tentative bar — hatch overlay applied via JS inline style */
.gantt-bar-prospect {
  border-style: dashed !important;
}

/* Drag handles on bar edges */
.gantt-bar-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 6px;
  cursor: ew-resize;
  z-index: 2;
  opacity: 0;
  transition: opacity 0.15s;
  background: rgba(255, 255, 255, 0.4);
}

.gantt-bar:hover .gantt-bar-handle {
  opacity: 1;
}

.gantt-bar-handle-left {
  left: 0;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.gantt-bar-handle-right {
  right: 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* ── Responsive: hide Gantt on small screens, show table only ─────────────── */

@media (max-width: 700px) {
  .gantt-container {
    display: none;
  }
}

/* Assignment create/edit dialog */
.assignment-dialog {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: var(--space-6);
  min-width: 320px;
  max-width: 480px;
  width: min(480px, calc(100vw - 2rem));
  font-family: var(--font-family);
  color: var(--color-text);
  animation: dialog-in var(--duration-normal) var(--ease-out) both;
}

.assignment-dialog::backdrop {
  background: rgba(6, 6, 40, 0.4);
  animation: backdrop-in var(--duration-normal) var(--ease-out) both;
}

.dialog-title {
  margin: 0 0 var(--space-5);
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-bold);
  color: var(--color-text);
}

.dialog-error {
  min-height: 1.2em;
  margin: var(--space-2) 0 0;
  font-size: var(--font-size-xs);
}

.dialog-actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-5);
  align-items: center;
}

/* Schedule: upcoming assignments table */
.schedule-table-section {
  margin-top: var(--space-4);
}

.schedule-table-section h3 {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-bold);
  margin: 0 0 var(--space-3);
  color: var(--color-text);
}

/* Floating action button (mobile) */
.fab {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--color-accent);
  color: var(--color-text-inverse);
  border: none;
  box-shadow: var(--shadow-lg);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: var(--z-raised);
  transition: background var(--duration-fast) var(--ease-out),
              transform var(--duration-fast) var(--ease-out);
}

.fab:hover {
  background: var(--color-accent-dark);
  transform: scale(1.08);
}

/* ═══════════════════════════════════════════════════════════════════════════
   CAPACITY REPORT
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Utilisation chart ──────────────────────────────────────────────────── */

.util-chart-wrap {
  margin-bottom: var(--space-5);
}

.util-chart-svg-wrap {
  position: relative;
}

.util-chart-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

/* Grid and reference lines */
.chart-grid-line {
  stroke: var(--color-border);
  stroke-width: 1;
}
.chart-ref-line {
  stroke: var(--color-danger);
  stroke-width: 1.2;
  stroke-dasharray: 5 4;
  opacity: 0.55;
}

/* Y-axis labels */
.chart-axis-label {
  font-size: 10px;
  font-family: var(--font-family);
  fill: var(--color-text-muted);
  text-anchor: end;
}

/* Column highlight for current month */
.chart-col-current {
  fill: var(--sensr-blue);
  fill-opacity: 0.05;
}

/* Bars */
.bar-confirmed {
  fill: var(--sensr-blue);
}
.bar-confirmed.bar-overbooked {
  fill: var(--color-danger);
}
.bar-conditional {
  /* fill is set inline to url(#util-prospect-hatch) */
  stroke: #d4863a;
  stroke-width: 0.5;
  stroke-opacity: 0.4;
}

/* Hit targets (transparent overlays for tooltip) */
.chart-hit-target {
  cursor: default;
}

/* Month / year labels */
.chart-month-label {
  font-size: 11px;
  font-family: var(--font-family);
  fill: var(--color-text-muted);
  text-anchor: middle;
}
.chart-month-current {
  fill: var(--color-accent);
  font-weight: 600;
}
.chart-year-label {
  font-size: 10px;
  font-family: var(--font-family);
  fill: var(--color-text-muted);
  text-anchor: middle;
  opacity: 0.65;
}

/* Current month indicator dot */
.chart-current-dot {
  fill: var(--color-accent);
}

/* Tooltip */
.util-chart-tooltip {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  background: var(--color-text);
  color: var(--sensr-white);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  font-size: var(--font-size-xs);
  line-height: 1.6;
  white-space: nowrap;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 1px;
  z-index: var(--z-raised);
}
.util-chart-tooltip[hidden] { display: none; }
.util-chart-tooltip strong { font-weight: var(--font-weight-semibold); }
.util-chart-tooltip .tooltip-conditional { opacity: 0.75; }

/* Legend */
.util-chart-legend {
  display: flex;
  gap: var(--space-5);
  margin-top: var(--space-2);
  justify-content: center;
}
.util-chart-legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}
.legend-swatch {
  display: inline-block;
  width: 14px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}
.legend-swatch-confirmed {
  background: var(--sensr-blue);
}
.legend-swatch-conditional {
  background: repeating-linear-gradient(
    45deg,
    #d4863a 0px,
    #d4863a 3px,
    rgba(212, 134, 58, 0.2) 3px,
    rgba(212, 134, 58, 0.2) 6px
  );
  border: 1px solid rgba(212, 134, 58, 0.4);
}

/* ── Month navigator ─────────────────────────────────────────────────────── */

.capacity-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.capacity-month-label {
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-base);
  min-width: 160px;
  text-align: center;
}

/* ── Report table ────────────────────────────────────────────────────────── */

.cap-delta-pos { color: var(--sensr-medium-green); font-weight: var(--font-weight-semibold); }
.cap-delta-neg { color: var(--color-danger); font-weight: var(--font-weight-semibold); }

.cell-center { text-align: center; }

.cap-total,
.cap-total-label {
  font-weight: var(--font-weight-bold);
  border-top: 2px solid var(--color-border);
}

.cap-total-label {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

/* Conditional (prospect) hours column */
.cap-conditional {
  color: #7a5300;
  font-size: var(--font-size-sm);
}
.cap-conditional-pct {
  opacity: 0.7;
  font-size: var(--font-size-xs);
}

/* ═══════════════════════════════════════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════════════════════════════════════ */

@keyframes dialog-in {
  from { opacity: 0; transform: translateY(-8px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}

@keyframes backdrop-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── < 900px: collapse sidebar to drawer ──────────────────────────────── */
@media (max-width: 899px) {
  .app-sidebar {
    transform: translateX(-100%);
  }

  .app-sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay {
    display: block;
  }

  .app-topbar {
    display: flex;
  }

  .app-content {
    margin-left: 0;
  }

  .sidebar-toggle {
    display: flex;
  }

  /* Schedule table is primary on mobile; Gantt hidden */
  .vis-timeline-container {
    display: none;
  }

  .fab {
    display: flex;
  }

  main {
    padding: var(--space-4);
  }

  main.schedule-main {
    padding: var(--space-3) var(--space-4);
  }

  #toast-region {
    bottom: var(--space-4);
    right: var(--space-4);
    left: var(--space-4);
  }

  .toast {
    max-width: none;
  }
}

/* ── < 640px: stacked tables, narrow dialogs ─────────────────────────── */
@media (max-width: 639px) {
  .card {
    padding: var(--space-4);
    border-radius: var(--radius);
  }

  .auth-card {
    padding: var(--space-6) var(--space-5);
  }

  .assignment-dialog {
    min-width: 0;
    width: min(480px, calc(100vw - 1.5rem));
  }

  .confirm-dialog {
    max-width: none;
    width: calc(100vw - 2rem);
  }

  /* Stacked table rows on very narrow screens */
  .table-responsive table,
  .table-responsive thead,
  .table-responsive tbody,
  .table-responsive th,
  .table-responsive td,
  .table-responsive tr {
    display: block;
  }

  .table-responsive thead {
    display: none;
  }

  .table-responsive td {
    border-bottom: none;
    padding: var(--space-1) var(--space-3);
  }

  .table-responsive td::before {
    content: attr(data-label);
    font-weight: var(--font-weight-bold);
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-muted);
    display: block;
    margin-bottom: 2px;
  }

  .table-responsive tr {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    margin-bottom: var(--space-3);
    padding: var(--space-3) var(--space-1);
  }

  .table-responsive tr:hover {
    background: var(--color-surface);
  }

  .table-wrap {
    border: none;
    border-radius: 0;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   UTILITY
   ═══════════════════════════════════════════════════════════════════════════ */

/* Screen-reader only — visually hidden but accessible */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Input with inline prefix/suffix (e.g. currency symbol) ─────────────── */

.input-affix-wrap {
  display: flex;
  align-items: stretch;
}

.input-affix {
  display: flex;
  align-items: center;
  padding: 0 var(--space-3);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  white-space: nowrap;
  flex-shrink: 0;
}

.input-affix-left {
  border-right: none;
  border-radius: var(--radius) 0 0 var(--radius);
}

.input-affix-right {
  border-left: none;
  border-radius: 0 var(--radius) var(--radius) 0;
}

.input-affix-input {
  flex: 1;
  min-width: 0;
  border-radius: 0 var(--radius) var(--radius) 0;
}

/* When inside a .form-row, .form-row input (0-1-1) beats .input-affix-input
   (0-1-0) and adds a full border + wrong border-radius. Override both here. */
.form-row .input-affix-input {
  border-radius: 0 var(--radius) var(--radius) 0;
  border-left: none;
}

/* ═══════════════════════════════════════════════════════════════════════════
   BOARD — kanban pipeline (sales + future chapters)
   ═══════════════════════════════════════════════════════════════════════════ */

/* Board view removes the content max-width so the 6-column grid can breathe */
main.board-main {
  max-width: none;
  padding: var(--space-5) var(--space-6);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.board-wrap {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-height: 0;
  flex: 1;
}

/* ── Board toolbar ───────────────────────────────────────────────────────── */

.board-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3) var(--space-6);
}

.board-toolbar-title {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  letter-spacing: -0.02em;
  margin: 0;
}

.board-toolbar-filters {
  display: flex;
  align-items: center;
  gap: var(--space-5);
}

.board-filter-label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  cursor: pointer;
}

.board-filter-check {
  gap: var(--space-2);
}

.board-filter-checkbox {
  cursor: pointer;
}

/* Small select used in the toolbar */
.select-sm {
  appearance: none;
  -webkit-appearance: none;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: var(--space-1) var(--space-5) var(--space-1) var(--space-3);
  font-size: var(--font-size-sm);
  font-family: var(--font-family);
  color: var(--color-text);
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23888' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-2) center;
}

.select-sm:focus {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* ── Board slot (board engine renders here) ──────────────────────────────── */

.board-slot {
  flex: 1;
  min-height: 0;
  display: flex;
}

/* ── Board root ──────────────────────────────────────────────────────────── */

.board {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

/* ── Board scroll container ──────────────────────────────────────────────── */

.board-scroll {
  display: flex;
  gap: var(--space-3);
  overflow-x: auto;
  overflow-y: hidden;
  flex: 1;
  padding-bottom: var(--space-4);    /* room for horizontal scrollbar */
  scroll-padding: var(--space-3);
}

.board-scroll::-webkit-scrollbar {
  height: 6px;
}

.board-scroll::-webkit-scrollbar-track {
  background: var(--color-surface);
  border-radius: 3px;
}

.board-scroll::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 3px;
}

/* ── Column ──────────────────────────────────────────────────────────────── */

.board-col {
  display: flex;
  flex-direction: column;
  width: 264px;
  min-width: 264px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.board-col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg);
  flex-shrink: 0;
}

.board-col-title {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
}

.board-col-count {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-muted);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  min-width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 var(--space-2);
}

.board-col-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-height: 80px;
}

.board-col-foot {
  border-top: 1px solid var(--color-border);
  padding: var(--space-3) var(--space-4);
  flex-shrink: 0;
}

.board-foot-inner {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.board-foot-total {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
}

.board-foot-weighted {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

/* ── Card ────────────────────────────────────────────────────────────────── */

.board-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: var(--space-3);
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  transition: box-shadow var(--duration-fast) var(--ease-out),
              border-color var(--duration-fast) var(--ease-out);
}

.board-card:hover {
  box-shadow: var(--shadow-sm);
  border-color: var(--color-text-muted);
}

.board-card:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.board-card--placeholder {
  opacity: 0;
  pointer-events: none;
}

.board-card--ghost {
  box-shadow: var(--shadow-lg);
  cursor: grabbing;
  opacity: 0.92;
}

/* ── Card inner layout ───────────────────────────────────────────────────── */

.board-card-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.board-card-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--color-border);
}

.board-card-company {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.board-card-title {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
  text-decoration: none;
  margin-bottom: var(--space-2);
  line-height: var(--line-height-tight);
}

.board-card-title:hover {
  color: var(--sensr-blue);
  text-decoration: underline;
}

.board-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-1);
}

.board-card-amount {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
}

.board-card-prob {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 1px var(--space-2);
}

.board-card-date {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  margin-top: var(--space-1);
}

.board-card-owner {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  margin-top: 2px;
}

/* ── Stage tag colours ───────────────────────────────────────────────────── */

.stage-identified  { background: rgba(104, 117, 217, 0.12); color: #5256c8; }
.stage-in-contact  { background: rgba(59, 130, 246, 0.12);  color: #1d4ed8; }
.stage-preparing   { background: rgba(245, 158, 11, 0.12);  color: #b45309; }
.stage-awaiting    { background: rgba(249, 115, 22, 0.12);  color: #c2410c; }
.stage-won         { background: rgba(34, 197, 94, 0.12);   color: #15803d; }
.stage-lost        { background: rgba(239, 68, 68, 0.12);   color: #b91c1c; }
.stage-no-bid      { background: rgba(100, 116, 139, 0.12); color: #475569; }

/* ── Responsive — stack columns below 900px ──────────────────────────────── */

@media (max-width: 900px) {
  main.board-main {
    overflow: visible;
    padding: var(--space-4);
  }

  .board-scroll {
    flex-direction: column;
    overflow-x: visible;
    overflow-y: visible;
    flex: none;
  }

  .board-col {
    width: 100%;
    min-width: 0;
  }

  .board-col-body {
    max-height: 480px;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   DEAL DETAIL — two-column layout + activity feed + reminders + timeline
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Header ──────────────────────────────────────────────────────────────── */

.deal-detail-wrap {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.deal-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.deal-detail-title-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex: 1;
  min-width: 0;
}

.deal-detail-name {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  margin: 0;
  letter-spacing: -0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.deal-detail-actions {
  display: flex;
  gap: var(--space-2);
  flex-shrink: 0;
  flex-wrap: wrap;
}

/* ── Two-column body ─────────────────────────────────────────────────────── */

.deal-detail-body {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: var(--space-5);
  align-items: start;
}

.deal-detail-left,
.deal-detail-right {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

/* ── Company colour swatch (small inline circle) ────────────────────────── */

.company-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

/* ── Deal summary ────────────────────────────────────────────────────────── */

.deal-summary h3 {
  margin: 0 0 var(--space-4);
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
}

.summary-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-1) var(--space-5);
  margin: 0 0 var(--space-3);
}

.summary-list dt {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-muted);
  white-space: nowrap;
  padding: var(--space-1) 0;
}

.summary-list dd {
  font-size: var(--font-size-sm);
  color: var(--color-text);
  margin: 0;
  padding: var(--space-1) 0;
}

.deal-description {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  margin-top: var(--space-3);
  white-space: pre-wrap;
}

/* ── Section headings inside cards ───────────────────────────────────────── */

.deal-detail-left .card h3,
.deal-detail-right .card h3 {
  margin: 0 0 var(--space-4);
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
}

/* ── Activity composer ────────────────────────────────────────────────────── */

.activity-composer {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
  align-items: flex-start;
}

.activity-composer input,
.activity-composer select,
.activity-composer textarea {
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-base);
  font-family: var(--font-family);
  color: var(--color-text);
  background: var(--color-bg);
  transition: border-color var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out);
}

.activity-composer input:focus,
.activity-composer select:focus,
.activity-composer textarea:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: var(--focus-ring);
}

.activity-composer-type {
  width: 110px;
  flex-shrink: 0;
}

.activity-composer-subject {
  flex: 1;
  min-width: 140px;
}

.activity-composer-body {
  width: 100%;
  resize: vertical;
  min-height: 60px;
  flex-shrink: 0;
}

/* ── Activity feed ────────────────────────────────────────────────────────── */

.activity-feed {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.activity-item {
  border-left: 2px solid var(--color-border);
  padding-left: var(--space-3);
}

.activity-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-bottom: var(--space-1);
}

.activity-type-tag {
  font-size: var(--font-size-xs);
  text-transform: capitalize;
}

.activity-time {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

.activity-by {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

.activity-by::before {
  content: "·";
  margin-right: var(--space-2);
}

.activity-subject {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  margin: 0 0 var(--space-1);
}

.activity-body {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  margin: 0;
  white-space: pre-wrap;
}

.activity-delete {
  margin-left: auto;
  color: var(--color-text-muted);
  opacity: 0;
  transition: opacity var(--duration-fast) var(--ease-out);
}

.activity-item:hover .activity-delete {
  opacity: 1;
}

/* ── Reminders ────────────────────────────────────────────────────────────── */

.reminder-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.reminder-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-border);
}

.reminder-item:last-child {
  border-bottom: none;
}

.reminder-item.reminder-done .reminder-subject {
  text-decoration: line-through;
  color: var(--color-text-muted);
}

.reminder-done-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--color-border);
  background: transparent;
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color var(--duration-fast) var(--ease-out),
              color var(--duration-fast) var(--ease-out);
}

.reminder-done-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.reminder-item.reminder-done .reminder-done-btn {
  border-color: var(--color-success);
  color: var(--color-success);
}

.reminder-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.reminder-subject {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
}

.reminder-meta {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

.reminder-delete {
  color: var(--color-text-muted);
  opacity: 0;
  margin-left: auto;
  transition: opacity var(--duration-fast) var(--ease-out);
}

.reminder-item:hover .reminder-delete {
  opacity: 1;
}

/* ── Deal contacts ────────────────────────────────────────────────────────── */

.deal-contacts-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.deal-contact-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-sm);
  flex-wrap: wrap;
}

.deal-contact-name {
  font-weight: var(--font-weight-medium);
}

.deal-contact-role,
.deal-contact-email {
  font-size: var(--font-size-xs);
}

.deal-contact-item .btn-icon {
  margin-left: auto;
  opacity: 0;
  transition: opacity var(--duration-fast) var(--ease-out);
}

.deal-contact-item:hover .btn-icon {
  opacity: 1;
}

/* ── Stage history timeline ───────────────────────────────────────────────── */

.stage-history {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.stage-history-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-3) 0;
  padding-left: var(--space-4);
  border-left: 2px solid var(--color-border);
  position: relative;
}

.stage-history-item::before {
  content: "";
  position: absolute;
  left: -5px;
  top: var(--space-4);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-border);
}

.stage-history-item:first-child::before {
  background: var(--color-primary);
}

.stage-history-arrow {
  font-size: var(--font-size-sm);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.stage-history-meta {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

/* ── Small button variant ─────────────────────────────────────────────────── */

.btn-sm {
  padding: var(--space-1) var(--space-3);
  font-size: var(--font-size-xs);
}

/* ── Icon-only button (×, ✓ without a border) ─────────────────────────────── */

.btn-icon {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--color-text-muted);
  font-size: var(--font-size-md);
  padding: 0 var(--space-1);
  line-height: 1;
  font-family: var(--font-family);
}

.btn-icon:hover {
  color: var(--color-danger);
}

/* ── Responsive deal detail ───────────────────────────────────────────────── */

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

/* ── Combobox inline variant (contact linker) ─────────────────────────────── */

.combobox-listbox-inline {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: var(--z-raised);
}

/* ═══════════════════════════════════════════════════════════════════════════
   OVERVIEW — dashboard page
   ═══════════════════════════════════════════════════════════════════════════ */

.overview-wrap {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.overview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  align-items: start;
}

.overview-col {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.overview-section-heading {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--color-text-muted);
  margin: 0;
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--color-border);
}

/* ── Cards (no gradient bar — plain bordered box) ─────────────────────────── */

.overview-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: var(--space-4);
}

.overview-card-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  margin: 0 0 var(--space-3);
  color: var(--color-text);
}

.overview-card-icon {
  display: flex;
  align-items: center;
  color: var(--color-text-muted);
  flex-shrink: 0;
}

/* ── List items ───────────────────────────────────────────────────────────── */

.overview-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.overview-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-sm);
}

.overview-item a {
  color: var(--color-accent);
  text-decoration: none;
  font-weight: var(--font-weight-semibold);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.overview-item a:hover {
  text-decoration: underline;
}

.overview-item span:first-child {
  flex-shrink: 0;
}

.overview-item-meta {
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
  flex-shrink: 0;
  white-space: nowrap;
  margin-left: auto;
}

.overview-pct {
  margin-left: auto;
  flex-shrink: 0;
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-xs);
  padding: 1px var(--space-2);
  border-radius: var(--radius-pill);
}

.overview-pct-low {
  background: var(--color-surface);
  color: var(--color-text-muted);
}

.overview-pct-high {
  background: #fde8e8;
  color: #9b1c1c;
}

.overview-empty {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  margin: 0;
}

.overview-see-all {
  display: block;
  margin-top: var(--space-3);
  font-size: var(--font-size-xs);
  color: var(--color-accent);
  text-decoration: none;
}

.overview-see-all:hover {
  text-decoration: underline;
}

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