/* SuiviSite - design tokens
   Anthracite + sage accent, flat surfaces, 1px rules, one soft shadow on hover. */
:root {
  --ink:      #1c1f21;
  --ink-soft: #3a4044;
  --muted:    #71787c;
  --bg:       #f4f4f1;
  --surface:  #ffffff;
  --line:     #e3e3de;
  --accent:   #4a8a78;
  --accent-d: #3b7264;
  --danger:   #a8443a;
  --amber:    #b0812f;
  --blue:     #46688f;

  --r-sm: 4px;
  --r-md: 8px;
  --shadow: 0 1px 3px rgba(28, 31, 33, .09);

  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;
  --s5: 24px; --s6: 32px; --s7: 48px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; letter-spacing: -.015em; }
.icon { flex: none; }
.muted { color: var(--muted); }
.num { text-align: right; font-variant-numeric: tabular-nums; }

.shell { max-width: 1180px; margin: 0 auto; padding: 0 var(--s5); }

/* ---------- Top bar ---------- */
.topbar { background: var(--ink); color: #f2f3f2; }
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 60px;
}
.brand { display: inline-flex; align-items: center; gap: var(--s3); }
.brand-mark { width: 28px; height: auto; display: block; }
.brand-name { font-weight: 600; letter-spacing: -.01em; font-size: 16px; }
.auth-logo { display: block; width: 56px; height: auto; }
.topbar-actions { display: flex; align-items: center; gap: var(--s2); }
.topbar .btn-ghost { color: #b9bdbd; border-color: #3a4044; }
.topbar .btn-ghost:hover { color: #fff; border-color: #5a6165; background: transparent; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: var(--s2);
  height: 36px; padding: 0 var(--s4);
  border: 1px solid transparent; border-radius: var(--r-sm);
  font: inherit; font-weight: 500; font-size: 14px;
  cursor: pointer; white-space: nowrap;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-d); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink-soft); }
.btn-ghost:hover { background: var(--surface); border-color: #cfcfc9; }
.btn-danger { background: transparent; border-color: var(--line); color: var(--danger); }
.btn-danger:hover { background: #fbf1f0; border-color: #e2c4c0; }
.btn-sm { height: 32px; padding: 0 var(--s3); font-size: 13px; }
.btn-block { width: 100%; justify-content: center; }
.btn[disabled] { opacity: .55; cursor: default; }

/* ---------- KPIs ---------- */
.kpis {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 1px; background: var(--line);
  border: 1px solid var(--line); border-radius: var(--r-md);
  overflow: hidden; margin: var(--s6) 0 var(--s5);
}
.kpi { background: var(--surface); padding: var(--s4) var(--s5); }
.kpi-label {
  display: block; font-size: 12px; font-weight: 500; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em;
}
.kpi-value {
  display: block; margin-top: var(--s1);
  font-size: 24px; font-weight: 600; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.kpi-sub { font-size: 15px; font-weight: 400; color: var(--muted); margin-left: 2px; }
.kpi-accent { color: var(--accent-d); }

/* ---------- Toolbar ---------- */
.toolbar {
  display: flex; align-items: center; gap: var(--s2);
  margin-bottom: var(--s5); flex-wrap: wrap;
}
.field-search {
  display: flex; align-items: center; gap: var(--s2);
  flex: 1 1 260px; height: 38px; padding: 0 var(--s3);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm);
  color: var(--muted);
}
.field-search input {
  flex: 1; border: 0; outline: none; background: transparent;
  font: inherit; color: var(--ink);
}
.field-search:focus-within { border-color: var(--accent); }

.select {
  height: 38px; padding: 0 var(--s3);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm);
  font: inherit; font-size: 14px; color: var(--ink-soft); cursor: pointer;
}
.select:focus { outline: none; border-color: var(--accent); }

.viewtoggle {
  display: flex; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden;
}
.viewtoggle-btn {
  display: grid; place-items: center; width: 38px; height: 38px; color: var(--muted);
}
.viewtoggle-btn + .viewtoggle-btn { border-left: 1px solid var(--line); }
.viewtoggle-btn.is-on { background: var(--ink); color: #fff; }

/* ---------- Status chips ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line);
  font-size: 12px; font-weight: 500; color: var(--ink-soft); white-space: nowrap;
}
.chip::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip-active   { color: var(--accent-d); }
.chip-paused   { color: var(--amber); }
.chip-dev      { color: var(--blue); }
.chip-archived { color: var(--muted); }

/* ---------- Cards ---------- */
.cards {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--s4); padding-bottom: var(--s7);
}
.card {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  overflow: hidden; transition: border-color .15s ease, box-shadow .15s ease;
}
.card:hover { border-color: #cfcfc9; box-shadow: var(--shadow); }

.card-shot {
  position: relative; display: block; aspect-ratio: 16 / 10;
  background: #edeeea; border-bottom: 1px solid var(--line); overflow: hidden;
}
.card-shot img { width: 100%; height: 100%; object-fit: cover; object-position: top center; display: block; }
.card-shot .chip { position: absolute; top: var(--s3); left: var(--s3); }

.shot-fallback {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s2);
  color: var(--muted); font-size: 13px;
}
.is-pending .shot-fallback { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .5; } }

.card-body { padding: var(--s4); flex: 1; }
.card-name { font-size: 16px; font-weight: 600; }
.card-name a:hover { color: var(--accent-d); }
.card-contact { margin: 2px 0 var(--s2); color: var(--muted); font-size: 14px; }
.card-url {
  display: inline-flex; align-items: center; gap: 5px;
  color: var(--accent-d); font-size: 13px; font-weight: 500;
}
.card-url:hover { text-decoration: underline; }

.card-money {
  display: flex; border-top: 1px solid var(--line);
}
.card-money span {
  flex: 1; padding: var(--s3) var(--s4);
  font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.card-money span + span { border-left: 1px solid var(--line); }
.card-money em {
  display: block; font-style: normal; font-size: 11px; font-weight: 500;
  color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 2px;
}

/* ---------- List view ---------- */
.table-wrap {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  overflow-x: auto; margin-bottom: var(--s7);
}
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; padding: var(--s3) var(--s4);
  font-size: 11px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: var(--s2) var(--s4); border-bottom: 1px solid var(--line); }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafaf8; }
.cell-shot { width: 72px; padding-right: 0; }
.thumb {
  display: grid; place-items: center; width: 56px; height: 36px;
  background: #edeeea; border: 1px solid var(--line); border-radius: 3px;
  overflow: hidden; color: var(--muted);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.link-strong { font-weight: 600; }
.link-strong:hover { color: var(--accent-d); }

/* ---------- Empty state ---------- */
.empty {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: var(--s7) var(--s5); text-align: center;
}
.empty-title { margin: 0; font-size: 17px; font-weight: 600; }
.empty-text { margin: var(--s2) auto var(--s5); max-width: 420px; color: var(--muted); }

/* ---------- Detail ---------- */
.backlink {
  display: inline-flex; align-items: center; gap: 6px;
  margin: var(--s5) 0 var(--s4); color: var(--muted); font-size: 14px; font-weight: 500;
}
.backlink:hover { color: var(--ink); }

.detail-grid {
  display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, 1fr);
  gap: var(--s6); padding-bottom: var(--s7); align-items: start;
}
.shot-frame {
  position: relative; aspect-ratio: 16 / 10; overflow: hidden;
  background: #edeeea; border: 1px solid var(--line); border-radius: var(--r-md);
}
.shot-frame img { width: 100%; height: 100%; object-fit: cover; object-position: top center; display: block; }
.shot-actions { display: flex; gap: var(--s2); margin-top: var(--s3); flex-wrap: wrap; }

.detail-name { margin: var(--s3) 0 var(--s1); font-size: 27px; font-weight: 600; }
.detail-contact { margin: 0 0 var(--s3); color: var(--muted); }
.detail-url {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--accent-d); font-weight: 500; word-break: break-all;
}
.detail-url:hover { text-decoration: underline; }

.amounts {
  margin: var(--s5) 0 0; padding: 0;
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface);
}
.amounts > div {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: var(--s3) var(--s4); border-bottom: 1px solid var(--line);
}
.amounts > div:last-child { border-bottom: 0; }
.amounts dt { color: var(--muted); font-size: 14px; }
.amounts dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.amounts-total { background: #fafaf8; }
.amounts-total dt { color: var(--ink); font-weight: 500; }
.amounts-total dd { color: var(--accent-d); font-size: 17px; }

.notes { margin-top: var(--s5); }
.notes h2 {
  font-size: 11px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em; margin-bottom: var(--s2);
}
.notes p { margin: 0; color: var(--ink-soft); }

.detail-actions { display: flex; gap: var(--s2); margin-top: var(--s5); }
.meta { margin-top: var(--s4); font-size: 12px; color: var(--muted); }

/* ---------- Forms ---------- */
.form-page { padding-bottom: var(--s7); }
.page-title { font-size: 24px; font-weight: 600; margin-bottom: var(--s5); }
.form {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: var(--s5); max-width: 760px;
  display: flex; flex-direction: column; gap: var(--s4);
}
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--s4); }
.field { display: flex; flex-direction: column; gap: 6px; }
.label { font-size: 13px; font-weight: 500; color: var(--ink-soft); }
.label em { color: var(--accent-d); font-style: normal; }
.field input[type=text], .field input[type=password], .field textarea {
  height: 38px; padding: 0 var(--s3);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm);
  font: inherit; color: var(--ink);
}
.field textarea { height: auto; padding: var(--s2) var(--s3); resize: vertical; line-height: 1.5; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); }
.field-money { position: relative; display: block; }
.field-money em {
  position: absolute; left: var(--s3); top: 50%; transform: translateY(-50%);
  font-style: normal; font-size: 13px; color: var(--muted); pointer-events: none;
}
.field-money input { width: 100%; padding-left: 46px !important; font-variant-numeric: tabular-nums; }
.field input[type=file] { font-size: 13px; color: var(--muted); }
.hint { font-size: 12px; color: var(--muted); }
.error { font-size: 13px; color: var(--danger); }
.form-actions { display: flex; gap: var(--s2); padding-top: var(--s2); }

/* ---------- Login ---------- */
.auth-page { background: var(--ink); }
.auth { min-height: 100vh; display: grid; place-items: center; padding: var(--s5); }
.auth-card {
  width: 100%; max-width: 340px; background: var(--surface);
  border-radius: var(--r-md); padding: var(--s6);
}
.auth-title { font-size: 21px; font-weight: 600; margin: var(--s4) 0 var(--s1); }
.auth-text { margin: 0 0 var(--s5); color: var(--muted); font-size: 14px; }
.auth-card .field { margin-bottom: var(--s4); }

/* ---------- Tablet ---------- */
@media (max-width: 900px) {
  .detail-grid { grid-template-columns: 1fr; gap: var(--s5); }
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpis .kpi:first-child { grid-column: span 2; }
}
@media (max-width: 640px) {
  .shell { padding: 0 var(--s4); }
  .kpis { grid-template-columns: 1fr; }
  .kpis .kpi:first-child { grid-column: auto; }
  .toolbar .select { flex: 1 1 140px; }
}
