/* Theme 3 — Architectural Minimalist. Plain CSS, no build step. */

:root {
  --color-background: #FFFFFF;
  --color-panel: #F5F5F4;
  --color-border: #E2E2E0;
  --color-accent: #1D3557;
  --color-accent-active: #2A4A7F;
  --color-text: #1F2320;
  --color-text-muted: #6B6F6D;
  --font-sans: 'Poppins', 'Lato', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--color-background);
  color: var(--color-text);
  line-height: 1.5;
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  border-bottom: 1px solid var(--color-border);
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.topbar__brand {
  font-weight: 600;
  color: var(--color-accent);
  text-decoration: none;
  font-size: 1.125rem;
}

.main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.card {
  background: var(--color-background);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 2rem;
  width: 100%;
  max-width: 420px;
}

.card--wide { max-width: 480px; }

.card h1 {
  margin: 0 0 1.5rem;
  font-size: 1.25rem;
  font-weight: 600;
}

.field { margin-bottom: 1rem; }

.field label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.375rem;
}

.field input {
  width: 100%;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.9375rem;
  background: var(--color-background);
  color: var(--color-text);
}

.field input:focus {
  outline: none;
  border-color: var(--color-accent);
}

.field-row {
  display: flex;
  gap: 0.75rem;
}
.field-row .field { flex: 1; }

.field-error {
  color: #B3261E;
  font-size: 0.8125rem;
  margin-top: 0.375rem;
}

.btn {
  display: inline-block;
  width: 100%;
  padding: 0.625rem 1rem;
  background: var(--color-accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
}

.btn:hover { background: var(--color-accent-active); }

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

.form-footer {
  margin-top: 1.25rem;
  font-size: 0.875rem;
  color: var(--color-text-muted);
  text-align: center;
}

.form-footer a { color: var(--color-accent); }

.status-message {
  background: var(--color-panel);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  margin-bottom: 1.25rem;
}

.panel {
  background: var(--color-panel);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 1.5rem;
}

/* ---------------------------------------------------------------------
   Mobile — construction-site usage means phones, not just desks.
   --------------------------------------------------------------------- */
@media (max-width: 640px) {
  .topbar { padding: 0.875rem 1rem; }

  .card, .card--wide {
    padding: 1.5rem;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  /* Side-by-side fields (e.g. First/Last name) get cramped below ~400px
     — stack them instead of shrinking them. */
  .field-row {
    flex-direction: column;
    gap: 0;
  }

  /* 44px is the standard minimum comfortable touch-target size — the
     stage dropdown on lead cards was sized for a mouse, not a thumb. */
  .field input,
  select {
    min-height: 44px;
    font-size: 16px; /* also prevents iOS Safari auto-zooming in on focus */
  }

  .btn { min-height: 44px; }
}

/* ---------------------------------------------------------------------
   Authenticated app shell — sidebar navigation, mobile-toggleable with
   no JavaScript (checkbox + CSS sibling selector).
   --------------------------------------------------------------------- */

.nav-toggle-checkbox { display: none; }

.shell { min-height: 100vh; }

.shell__mobile-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--color-border);
}

.nav-toggle-label {
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--color-accent);
}

.sidebar {
  display: none;
  flex-direction: column;
  background: var(--color-panel);
  border-right: 1px solid var(--color-border);
  padding: 1.5rem 1rem;
}

.nav-toggle-checkbox:checked ~ .sidebar { display: flex; }

.sidebar__brand {
  font-weight: 600;
  color: var(--color-accent);
  font-size: 1.125rem;
  margin-bottom: 1.5rem;
  padding: 0 0.5rem;
}

.sidebar__links {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}

.sidebar__link {
  padding: 0.625rem 0.75rem;
  border-radius: 6px;
  color: var(--color-text);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
}

.sidebar__link:hover { background: var(--color-border); }

.sidebar__link--active {
  background: var(--color-accent);
  color: #fff;
}

.sidebar__footer {
  border-top: 1px solid var(--color-border);
  padding-top: 1rem;
  margin-top: 1rem;
}

.sidebar__user {
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0 0.5rem;
  margin-bottom: 0.5rem;
}

.sidebar__tenant {
  display: block;
  font-weight: 400;
  color: var(--color-text-muted);
  font-size: 0.8125rem;
}

.sidebar__logout {
  width: 100%;
  text-align: left;
  padding: 0.5rem 0.5rem;
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-family: inherit;
  font-size: 0.8125rem;
  cursor: pointer;
}

.sidebar__logout:hover { color: var(--color-text); }

.shell__content {
  padding: 1.5rem 1rem;
  display: flex;
  justify-content: center;
}

@media (min-width: 768px) {
  .shell { display: flex; }
  .shell__mobile-bar { display: none; }
  .sidebar { display: flex !important; width: 220px; flex-shrink: 0; min-height: 100vh; }
  .shell__content { flex: 1; padding: 2.5rem 2rem; justify-content: flex-start; }
}

/* ---------------------------------------------------------------------
   Signature pad — canvas drawing surface for signing change orders.
   --------------------------------------------------------------------- */
.signature-pad {
  width: 100%;
  aspect-ratio: 3 / 1;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: #fff;
  touch-action: none; /* stop the browser from panning/scrolling while drawing */
  cursor: crosshair;
  display: block;
}

.signature-hint {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin: 0.375rem 0 0.75rem;
}

/* ---------------------------------------------------------------------
   Design refresh — shadows, refined states, transitions. Applied to
   the shared classes, so every page that already uses .panel/.card/.btn
   picks this up automatically, not just newly-built views.
   --------------------------------------------------------------------- */
:root {
  --shadow-sm: 0 1px 2px rgba(15, 23, 32, 0.05), 0 1px 3px rgba(15, 23, 32, 0.06);
  --shadow-md: 0 2px 6px rgba(15, 23, 32, 0.06), 0 6px 16px rgba(15, 23, 32, 0.08);
  --shadow-lg: 0 12px 32px rgba(15, 23, 32, 0.16);
  --color-success: #2E7D32;
  --color-success-bg: #EAF4EC;
  --color-success-border: #BEE0C4;
  --color-danger: #B3261E;
  --color-danger-bg: #FBEAEA;
  --color-danger-border: #F1C4C1;
  --radius: 10px;
  --radius-sm: 7px;
  --transition: all 0.15s ease;
}

.panel {
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.card {
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

.btn {
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.btn:hover {
  background: var(--color-accent-active);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

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

.field input,
.field textarea,
select {
  transition: var(--transition);
}

.field input:focus,
.field textarea:focus,
select:focus {
  box-shadow: 0 0 0 3px rgba(29, 53, 87, 0.12);
}

/* Formalizes the inline background/border colors several views were
   repeating ad hoc for success/error banners. */
.status-message--success {
  background: var(--color-success-bg);
  border-color: var(--color-success-border);
}

.status-message--error {
  background: var(--color-danger-bg);
  border-color: var(--color-danger-border);
}

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

/* ---------------------------------------------------------------------
   Sidebar refinement — accent bar instead of a hard block fill, icons
   inherit color via currentColor so active/hover states apply to both
   text and icon together.
   --------------------------------------------------------------------- */
.shell__mobile-bar,
.sidebar { box-shadow: var(--shadow-sm); }

.sidebar__link {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  transition: var(--transition);
}

.sidebar__link svg { flex-shrink: 0; opacity: 0.75; }

.sidebar__link--active svg { opacity: 1; }

.sidebar__link:not(.sidebar__link--active):hover {
  background: #fff;
  box-shadow: var(--shadow-sm);
}

/* ---------------------------------------------------------------------
   Footer
   --------------------------------------------------------------------- */
.app-footer {
  margin-top: auto;
  padding: 1.5rem 1rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

/* ---------------------------------------------------------------------
   Kanban board — drag-and-drop lead pipeline.
   --------------------------------------------------------------------- */
.kanban-board {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding-bottom: 1rem;
  align-items: flex-start;
}

.kanban-column {
  flex: 0 0 260px;
  background: var(--color-panel);
  border-radius: var(--radius);
  padding: 0.875rem;
  transition: var(--transition);
}

.kanban-column--over {
  background: #E4EBF4;
  outline: 2px dashed var(--color-accent);
  outline-offset: -2px;
}

.kanban-column__header {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  margin-bottom: 0.75rem;
  padding: 0 0.25rem;
}

.kanban-column__cards {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  min-height: 48px; /* keeps empty columns droppable, not just a sliver */
}

.kanban-card {
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 0.875rem;
  box-shadow: var(--shadow-sm);
  cursor: grab;
  touch-action: none; /* this card owns touch gestures, not page scroll */
  transition: box-shadow 0.15s ease;
  user-select: none;
}

.kanban-card:hover { box-shadow: var(--shadow-md); }

.kanban-card--dragging {
  cursor: grabbing;
  box-shadow: var(--shadow-lg);
  opacity: 0.97;
}

.kanban-card__name { font-weight: 600; font-size: 0.9375rem; }
.kanban-card__meta { font-size: 0.8125rem; color: var(--color-text-muted); margin-top: 0.125rem; }
