/* Axel Lite dashboard
 * Light theme: clean white + cobalt blue
 * Dark theme:  Spotify-style black + green
 * Auto-detects from prefers-color-scheme.
 */

:root {
  --bg:        #f8fafc;       /* off-white, lets cards float */
  --surface:   #ffffff;
  --surface-2: #f1f5f9;
  --border:    #e2e8f0;
  --text:      #0f172a;       /* near-black, slate-900 */
  --muted:     #64748b;       /* slate-500 */
  --muted-2:   #94a3b8;       /* slate-400 */
  --accent:    #2563eb;       /* cobalt blue (blue-600) */
  --accent-dk: #1d4ed8;       /* darker on hover (blue-700) */
  --gold:      #b45309;
  --red:       #dc2626;
  --topbar-bg: rgba(248,250,252,0.85);
  --pill-expire-bg: #fef3c7;
  --pill-expire-fg: #92400e;
  --pill-cancel-bg: #fee2e2;
  --pill-cancel-fg: #991b1b;
  --collab-bg:     #fef9c3;
  --collab-border: #fde047;
  --collab-fg:     #713f12;
  --shadow:    0 1px 2px rgba(15,23,42,0.04), 0 4px 12px rgba(15,23,42,0.05);
  --shadow-lg: 0 1px 2px rgba(15,23,42,0.06), 0 20px 40px -10px rgba(15,23,42,0.12);
  --radius:    14px;
  --radius-sm: 8px;
  --font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #121212;       /* Spotify primary background */
    --surface:   #181818;       /* Spotify card surface */
    --surface-2: #282828;       /* elevated section */
    --border:    #2a2a2a;
    --text:      #ffffff;
    --muted:     #b3b3b3;       /* Spotify text-secondary */
    --muted-2:   #6a6a6a;
    --accent:    #1db954;       /* Spotify green */
    --accent-dk: #1ed760;       /* brighter on hover (Spotify pattern) */
    --gold:      #f59e0b;
    --red:       #f87171;
    --topbar-bg: rgba(18,18,18,0.92);
    --pill-expire-bg: #422006;
    --pill-expire-fg: #fcd34d;
    --pill-cancel-bg: #450a0a;
    --pill-cancel-fg: #fca5a5;
    --collab-bg:     #2d1f06;
    --collab-border: #92400e;
    --collab-fg:     #fde047;
    --shadow:    0 1px 2px rgba(0,0,0,0.5), 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 1px 2px rgba(0,0,0,0.6), 0 20px 40px -10px rgba(0,0,0,0.6);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dk); }
button { font-family: inherit; cursor: pointer; }
input, textarea { font-family: inherit; font-size: inherit; }

.loading { padding: 40vh 0; text-align: center; color: var(--muted); }

/* ─── Top bar ──────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: var(--topbar-bg); backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top));
}
.topbar-row { display: flex; align-items: center; gap: 12px; max-width: 1100px; margin: 0 auto; }

/* Brand wordmark */
.brand {
  display: inline-flex; align-items: center; gap: 8px;
  text-decoration: none; color: var(--text);
  font-size: 17px; letter-spacing: -0.015em;
  line-height: 1;
  white-space: nowrap; flex-shrink: 0;
}
.brand-mark {
  width: 16px; height: 16px;
  color: var(--accent);
  flex-shrink: 0;
}
.brand-axel { font-weight: 700; white-space: nowrap; }
.brand-lite { font-weight: 400; color: var(--muted); margin-left: 3px; white-space: nowrap; }

@media (max-width: 480px) {
  .brand { font-size: 15px; gap: 6px; }
  .brand-mark { width: 14px; height: 14px; }
}

/* Today's actual date — sits between brand and actions on wide screens */
.topbar-today {
  color: var(--muted);
  font-size: 13px;
  margin-left: 12px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
@media (max-width: 700px) {
  .topbar-today { display: none; }
}
.topbar-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
  font-size: 14px; font-weight: 500;
  transition: background 0.12s, border-color 0.12s, transform 0.06s;
}
.btn:hover { background: var(--surface-2); border-color: #d6cebd; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: white; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-dk); border-color: var(--accent-dk); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); padding: 6px 10px; }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

/* ─── Container ───────────────────────────────────────────── */
.container { max-width: 1100px; margin: 0 auto; padding: 20px 16px 80px; }
.page-eyebrow {
  margin: 0 0 4px;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); font-weight: 600;
}
.page-title { margin: 0 0 4px; font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
.page-rel {
  margin-left: 8px;
  color: var(--muted); font-size: 14px; font-weight: 400; letter-spacing: 0;
  vertical-align: middle;
}
.page-sub   { margin: 0 0 24px; color: var(--muted); font-size: 14px; }

/* ─── Group header (city) ─────────────────────────────────── */
.group-header {
  margin: 32px 0 12px;
  display: flex; align-items: baseline; gap: 8px;
}
.group-header h2 {
  font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); font-weight: 600; margin: 0;
}
.group-header .count { color: var(--muted-2); font-size: 13px; }

/* ─── Listing card ────────────────────────────────────────── */
.cards { display: grid; gap: 14px; grid-template-columns: 1fr; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  transition: box-shadow 0.18s, transform 0.06s;
}
@media (min-width: 880px) {
  .card { grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; padding: 18px; }
}
.card:hover { box-shadow: var(--shadow-lg); }

.card-main { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.card-aside {
  display: flex; flex-direction: column; gap: 10px; min-width: 0;
  border-top: 1px solid var(--border); padding-top: 14px;
}
@media (min-width: 880px) {
  .card-aside { border-top: 0; border-left: 1px solid var(--border); padding-top: 0; padding-left: 18px; }
}

.card-head { display: flex; align-items: flex-start; gap: 10px; }
.card-head .addr { flex: 1; min-width: 0; }
.card-head h3 { margin: 0 0 2px; font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.card-head .sub { color: var(--muted); font-size: 13px; }

.status-pill {
  display: inline-flex; align-items: center;
  padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
  flex-shrink: 0;
}
.status-Expiré { background: var(--pill-expire-bg); color: var(--pill-expire-fg); }
.status-Annulé { background: var(--pill-cancel-bg); color: var(--pill-cancel-fg); }

/* Tight horizontal label-value rows — one line each */
.kv-list { display: flex; flex-direction: column; gap: 5px; }
.kv-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  align-items: baseline;
  gap: 12px;
  font-size: 13.5px;
  line-height: 1.35;
}
.kv-row .k {
  color: var(--muted);
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em;
  font-weight: 600;
}
.kv-row .v { color: var(--text); font-weight: 500; }
.eval-small { color: var(--muted-2); font-size: 11px; font-weight: 400; margin-left: 4px; }

/* Compact footer line — property + broker, just below the numbers */
.card-meta {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  padding-top: 2px;
  border-top: 1px dashed var(--border);
}
.card-meta div { padding-top: 4px; }
.card-meta .meta-name { color: var(--text); font-weight: 500; }

.section-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted);
  font-weight: 600;
  margin: 0 0 6px;
}

/* Collapsible section — uses native <details>/<summary> */
details.collapsible { margin: 0; padding: 0; }
details.collapsible > summary {
  cursor: pointer; user-select: none; list-style: none;
  display: flex; align-items: center; gap: 6px;
  padding: 4px 0;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); font-weight: 600;
  transition: color 0.12s;
}
details.collapsible > summary:hover { color: var(--text); }
details.collapsible > summary::-webkit-details-marker { display: none; }
details.collapsible > summary::after {
  content: ""; display: inline-block;
  width: 0; height: 0; margin-left: auto;
  border-left: 4px solid currentColor;
  border-top: 3px solid transparent;
  border-bottom: 3px solid transparent;
  opacity: 0.55;
  transition: transform 0.18s ease;
}
details.collapsible[open] > summary::after { transform: rotate(90deg); }
details.collapsible > summary .toggle-count {
  color: var(--muted-2); font-size: 11px; font-weight: 500;
  text-transform: none; letter-spacing: 0;
  margin-left: 4px;
}
details.collapsible > .reveal {
  margin-top: 10px;
  animation: reveal-down 0.18s ease-out;
}
@keyframes reveal-down {
  from { opacity: 0; transform: translateY(-3px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Owner block — moved to the top of the card; compact, 1–2 lines per owner */
.owners {
  display: flex; flex-direction: column; gap: 8px;
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}
.owner { font-size: 13px; }
.owner-line { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.owner-name { font-size: 15.5px; font-weight: 600; color: var(--text); letter-spacing: -0.005em; }
.owner-tag  { color: var(--muted-2); font-size: 12px; font-weight: 400; }
.owner-detail { font-size: 12px; margin-top: 2px; }
.owner-origin { color: var(--muted); }
.owner-pron { color: var(--accent); font-style: italic; }
.owner-detail-sep { color: var(--muted-2); margin: 0 4px; }
.owner-off { color: var(--red); font-size: 11px; margin-top: 4px; font-weight: 600; }

.nuggets { display: flex; flex-direction: column; gap: 10px; }
.nugget {
  background: var(--surface-2);
  border-left: 3px solid var(--accent);
  padding: 10px 12px;
  border-radius: 4px;
  font-size: 13px;
}
.nugget .fact { font-weight: 600; color: var(--text); }
.nugget .angle { color: var(--muted); margin-top: 4px; font-size: 12.5px; line-height: 1.45; }

.history {
  background: var(--surface-2); border-radius: var(--radius-sm); padding: 8px 10px;
  font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 4px;
}
.history .row { display: flex; gap: 8px; align-items: baseline; }
.history .row .no { font-family: var(--mono); color: var(--muted-2); }
.history .row .price { margin-left: auto; color: var(--text); font-weight: 500; }
.history-notes { color: var(--text); font-size: 12.5px; white-space: pre-wrap; padding-top: 4px; border-top: 1px dashed var(--border); margin-top: 4px; }

.collab-note {
  background: var(--collab-bg); border: 1px solid var(--collab-border);
  border-radius: var(--radius-sm); padding: 8px 10px;
  font-size: 12px; color: var(--collab-fg);
}

/* Notes — chat-style log with Enter-to-submit */
.notes-header {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted);
  font-weight: 600;
  margin-bottom: 4px;
}
.notes-header .count { color: var(--muted-2); }

.note-input { display: flex; flex-direction: column; gap: 4px; }
.note-input textarea {
  width: 100%; min-height: 56px; resize: vertical;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 12px; background: var(--bg); color: var(--text);
  outline: none; transition: border-color 0.12s;
  font-size: 13px; line-height: 1.4;
}
.note-input textarea:focus { border-color: var(--accent); }
.note-input .hint {
  display: flex; justify-content: space-between;
  color: var(--muted-2); font-size: 11px; padding: 0 2px;
}
.note-input .hint .saving { color: var(--accent); opacity: 0; transition: opacity 0.18s; }
.note-input .hint .saving.on { opacity: 1; }

.notes-log {
  display: flex; flex-direction: column; gap: 6px;
  max-height: 360px; overflow-y: auto;
  padding-right: 2px;
}
.notes-log:empty::after {
  content: "No notes yet. Type and press ↵ to log your first.";
  display: block; color: var(--muted-2); font-size: 12px; padding: 8px 2px;
  font-style: italic;
}
.note-entry {
  background: var(--surface-2); border-radius: var(--radius-sm);
  padding: 8px 10px; font-size: 13px;
  position: relative;
  border-left: 2px solid var(--border);
  transition: border-color 0.12s;
}
.note-entry:hover { border-left-color: var(--accent); }
.note-entry:hover .note-del { opacity: 1; }
.note-entry .note-ts {
  display: flex; justify-content: space-between; align-items: center;
  color: var(--muted); font-size: 11px; margin-bottom: 3px;
  font-variant-numeric: tabular-nums;
}
.note-entry .note-body { white-space: pre-wrap; color: var(--text); line-height: 1.4; }
.note-del {
  background: transparent; border: 0; cursor: pointer;
  color: var(--muted-2); padding: 0 4px;
  opacity: 0; transition: opacity 0.12s, color 0.12s;
  font-size: 14px; line-height: 1;
}
.note-del:hover { color: var(--red); }

/* ─── Login ───────────────────────────────────────────────── */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card {
  width: 100%; max-width: 360px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 32px 28px; box-shadow: var(--shadow-lg);
}
.login-card .brand { font-size: 22px; margin-bottom: 4px; }
.login-card .brand-mark { width: 20px; height: 20px; }
.login-card p { color: var(--muted); font-size: 13px; margin: 6px 0 22px; }
.login-card input[type=password] {
  width: 100%; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); outline: none; transition: border-color 0.12s;
  margin-bottom: 12px;
}
.login-card input:focus { border-color: var(--accent); }
.login-card button { width: 100%; padding: 12px; }
.login-card .err { color: var(--red); font-size: 12px; margin-top: 8px; min-height: 16px; }

/* ─── History list ───────────────────────────────────────── */
.history-list { display: flex; flex-direction: column; gap: 8px; }
.history-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 14px; font-size: 14px;
  transition: background 0.12s;
}
.history-item:hover { background: var(--surface-2); }
.history-item .date { font-weight: 600; min-width: 140px; }
.history-item .count { color: var(--muted); margin-left: auto; font-size: 13px; }

/* ─── Empty / utility ─────────────────────────────────────── */
.empty { text-align: center; color: var(--muted); padding: 40px 20px; font-size: 14px; }
.divider { height: 1px; background: var(--border); margin: 4px 0; }
.error-banner {
  background: var(--pill-cancel-bg); border: 1px solid var(--pill-cancel-fg); color: var(--pill-cancel-fg);
  padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13px;
  margin-bottom: 16px;
}
