/* ProptechOS design system — https://proptechos.com/design-system
   Tokens first, then the few components this app actually uses. */

:root {
  /* Brand */
  --loulou:  #59124C;   /* primary purple */
  --canary:  #D8FF54;   /* neon green    */
  --fog:     #E0EBE9;   /* light blue-green */
  --mystic:  #300D2E;   /* deep dark purple */
  --swirl:   #D6CCC4;   /* soft beige    */

  /* UI */
  --bg:            #FFFFFF;
  --bg-secondary:  #E0EBE9;
  --text:          #1A1A1A;
  --text-secondary:#666666;
  --border:        #E0E0E0;

  /* Status */
  --info:    #B4D0CB;
  --ok:      #94C4A4;
  --warning: #FFE879;
  --error:   #FC4F5C;

  /* Data visualisation */
  --cold: #B9DBD5;  --neutral: #7FB195;  --warm: #D44E5A;  --power: #E6D45E;

  /* Spacing */
  --xs: 4px; --sm: 8px; --md: 16px; --lg: 24px; --xl: 32px;
  --xxl: 48px; --xxxl: 64px;

  /* Radius */
  --r-sm: 6px; --r-md: 16px; --r-lg: 24px; --r-full: 9999px;
  --r-control: 8px;          /* buttons and inputs */

  /* Shadow */
  --shadow-sm: 0px 1px 2px rgba(0, 0, 0, .05);
  --shadow-md: 0px 4px 6px rgba(0, 0, 0, .1);
  --shadow-lg: 0px 4px 20px rgba(0, 0, 0, .2);

  /* Motion */
  --fast: 150ms; --normal: 300ms; --slow: 500ms;

  --font: Avenir, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;         /* Body */
  font-weight: 400;        /* Book */
  line-height: 1.4;        /* 140% */
}

h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 var(--md); }
h1 { font-size: 72px; font-weight: 400; }
h2 { font-size: 48px; font-weight: 400; }
h3 { font-size: 32px; font-weight: 600; }
h4 { font-size: 24px; font-weight: 600; }
small, .small { font-size: 14px; }

/* Header ------------------------------------------------------------------ */
header {
  /* Loulou, with the white/green logotype -- the purple logomark on mystic was
     nearly invisible. */
  background: var(--loulou);
  color: #fff;
  padding: var(--md) var(--xl);
  display: flex;
  align-items: center;
  gap: var(--md);
}
header img { height: 28px; }
header .spacer { flex: 1; }

/* Card -------------------------------------------------------------------- */
.card {
  padding: var(--lg);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  background: var(--bg);
}
.panel {
  padding: var(--lg);
  border-radius: var(--r-md);
  background: var(--bg-secondary);
}

/* Controls ---------------------------------------------------------------- */
button {
  padding: 12px var(--lg);
  border-radius: var(--r-control);
  border: 0;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  background: var(--loulou);
  color: #fff;
  cursor: pointer;
  transition: opacity var(--fast) ease;
}
button:hover:not(:disabled) { opacity: .88; }
button:disabled { opacity: .45; cursor: default; }
button.secondary {
  background: var(--canary);
  color: var(--mystic);
}

select, input {
  height: 48px;
  padding: 12px var(--md);
  border-radius: var(--r-control);
  border: 1px solid var(--border);
  font-family: inherit;
  font-size: 16px;
  background: var(--bg);
  color: var(--text);
  width: 100%;
}

label {
  display: block;
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: var(--xs);
}

/* Layout ------------------------------------------------------------------ */
main { padding: var(--xl); max-width: 1400px; margin: 0 auto; }
.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--md);
  margin-bottom: var(--lg);
}
.row { display: flex; gap: var(--md); align-items: center; flex-wrap: wrap; }

/* Table ------------------------------------------------------------------- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td {
  text-align: left;
  padding: var(--sm) var(--md);
  border-bottom: 1px solid var(--border);
}
th { font-weight: 600; color: var(--text-secondary); white-space: nowrap; }
tbody tr:hover { background: var(--fog); }

/* Status ------------------------------------------------------------------ */
.badge {
  display: inline-block;
  padding: var(--xs) 12px;
  border-radius: var(--r-full);
  font-size: 14px;
  font-weight: 600;
}
.badge.ok      { background: var(--ok); }
.badge.info    { background: var(--info); }
.badge.warning { background: var(--warning); }
.badge.error   { background: var(--error); color: #fff; }

/* Freshness is load-bearing here: a stale snapshot must never be mistaken for
   current data, because the whole point of the tool is comparing counts. */
.freshness { color: var(--text-secondary); font-size: 14px; }

/* Export modal ------------------------------------------------------------ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(48, 13, 46, .55);   /* mystic, translucent */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--md);
  z-index: 10;
}
.modal-backdrop[hidden] { display: none; }

.modal {
  max-width: 520px;
  text-align: center;
}
.modal h4 { margin-bottom: var(--sm); }
.modal p {
  color: var(--text-secondary);
  margin: 0 0 var(--md);
}
.modal button { margin-top: var(--sm); }

.spinner {
  width: 48px;
  height: 48px;
  margin: 0 auto var(--md);
  border: 4px solid var(--fog);
  border-top-color: var(--loulou);
  border-radius: var(--r-full);
  animation: spin 900ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 3s; }
}
