@import url("https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@500;600;700&family=DM+Sans:opsz,wght@9..40,400;9..40,500;9..40,600;9..40,700&display=swap");

:root {
  --ink: #1c1412;
  --ink-soft: #4a3f3a;
  --muted: #7a6e68;
  --paper: #f7f1eb;
  --panel: #fffdfb;
  --line: #e6d9cf;
  --blush: #c45c4a;
  --blush-soft: #f3e0db;
  --sage: #5f7a6c;
  --sage-soft: #e4eee8;
  --gold: #b08948;
  --shadow: 0 18px 50px rgba(28, 20, 18, 0.08);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: "DM Sans", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(ellipse 70% 45% at 10% -10%, rgba(196, 92, 74, 0.16), transparent 55%),
    radial-gradient(ellipse 55% 40% at 100% 0%, rgba(95, 122, 108, 0.14), transparent 50%),
    linear-gradient(180deg, #fbf7f3 0%, var(--paper) 100%);
}

a { color: inherit; }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
.error { color: #b42318; margin: 0 0 12px; }

/* Login */
.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-shell {
  width: min(920px, 100%);
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 28px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.login-hero {
  padding: 42px 36px;
  background:
    linear-gradient(160deg, rgba(28,20,18,0.88), rgba(28,20,18,0.72)),
    url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 460px;
}
.login-hero h2 {
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(2.2rem, 4vw, 3.2rem);
  line-height: 1.05;
  margin: 0 0 14px;
  font-weight: 600;
}
.login-hero p { margin: 0; opacity: 0.86; line-height: 1.5; max-width: 32ch; }
.login-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 28px; }
.login-pills span {
  border: 1px solid rgba(255,255,255,0.28);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
}
.login-card { padding: 42px 34px; display: flex; flex-direction: column; justify-content: center; }
.login-card h1 {
  font-family: "Cormorant Garamond", serif;
  font-size: 2.2rem;
  margin: 0 0 6px;
}
.login-card label { font-size: 0.78rem; color: var(--muted); margin: 14px 0 6px; }
.login-card input {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
  background: #fff;
}
.login-card button, .btn, button {
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #fff;
  border-radius: 999px;
  padding: 11px 18px;
}
.login-card button { margin-top: 18px; }
.btn.ghost, button.ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}
button.primary, .btn.primary {
  background: var(--blush);
  border-color: var(--blush);
}

/* App shell */
.app { max-width: 1240px; margin: 0 auto; padding: 28px 20px 80px; }
.topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 28px;
}
.brand h1 {
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(2rem, 3vw, 2.6rem);
  margin: 0;
  font-weight: 600;
}
.brand p { margin: 6px 0 0; color: var(--muted); }
.nav { display: flex; flex-wrap: wrap; gap: 8px; }
.nav a {
  text-decoration: none;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  color: var(--muted);
  font-size: 0.92rem;
}
.nav a.active, .nav a:hover {
  color: var(--ink);
  border-color: var(--line);
  background: rgba(255,255,255,0.7);
}

.kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.kpi {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 14px;
  box-shadow: var(--shadow);
}
.kpi span { display: block; color: var(--muted); font-size: 0.78rem; margin-bottom: 8px; }
.kpi strong { font-family: "Cormorant Garamond", serif; font-size: 2rem; font-weight: 600; }
.kpi.accent { background: linear-gradient(160deg, #fff, var(--blush-soft)); }

.section-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 16px;
}
.section-tabs a {
  text-decoration: none;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.65);
  color: var(--ink-soft);
  font-size: 0.9rem;
}
.section-tabs a.active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.country-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.country-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  text-decoration: none;
  transition: transform .2s ease, box-shadow .2s ease;
}
.country-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.country-card.active { outline: 2px solid var(--blush); }
.country-card .label { color: var(--muted); font-size: 0.78rem; }
.country-card .name { font-family: "Cormorant Garamond", serif; font-size: 1.45rem; margin: 4px 0 10px; }
.country-card .count { font-weight: 600; }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 18px;
  padding: 14px;
  background: rgba(255,255,255,0.7);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.filters select, .filters input {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
  background: #fff;
  min-width: 140px;
}
.filters input[name="q"] { flex: 1; min-width: 180px; }

.table-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
table { width: 100%; border-collapse: collapse; }
th, td {
  text-align: left;
  padding: 16px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th {
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  background: #faf6f2;
}
tr:last-child td { border-bottom: 0; }
.score {
  display: inline-flex;
  min-width: 42px;
  justify-content: center;
  padding: 6px 8px;
  border-radius: 999px;
  background: var(--sage-soft);
  color: var(--sage);
  font-weight: 600;
  font-size: 0.85rem;
}
.badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--blush-soft);
  color: #8a3d31;
  font-size: 0.78rem;
  font-weight: 600;
}
.badge.country { background: var(--sage-soft); color: #355246; }
.biz-name { font-weight: 600; margin-bottom: 4px; }
.contact-block { display: grid; gap: 4px; }
.contact-block a {
  color: var(--blush);
  text-decoration: none;
  font-weight: 500;
}
.contact-block a:hover { text-decoration: underline; }
.action-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.action-form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.action-form select, .action-form input {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  font: inherit;
}
.link { color: var(--blush); text-decoration: none; font-size: 0.86rem; }
.flash {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--sage-soft);
}

@media (max-width: 980px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-hero { min-height: auto; }
  .kpis, .country-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar { flex-direction: column; }
  table { display: block; overflow-x: auto; }
}
@media (max-width: 640px) {
  .kpis, .country-strip { grid-template-columns: 1fr 1fr; }
}
