@import url("https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700&family=Syne:wght@600;700;800&display=swap");

:root {
  --ink: #04191c;
  --ink-soft: #123a3e;
  --paper: #e8f3f1;
  --panel: #ffffff;
  --line: #c5d8d5;
  --line-strong: #7eaba6;
  --muted: #557275;
  --teal: #0d8f89;
  --teal-deep: #08706b;
  --teal-soft: #d5f1ef;
  --accent: #ff6f3c;
  --accent-soft: #ffe4d8;
  --good: #1a9a66;
  --warn: #d4a017;
  --shadow: 0 16px 40px rgba(4, 25, 28, 0.1);
  --radius: 20px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Outfit", sans-serif;
  color: var(--ink);
  background-color: #dceceb;
  background-image:
    radial-gradient(ellipse 80% 50% at 0% 0%, rgba(13, 143, 137, 0.35), transparent 55%),
    radial-gradient(ellipse 70% 45% at 100% 0%, rgba(255, 111, 60, 0.28), transparent 50%),
    radial-gradient(ellipse 50% 40% at 70% 100%, rgba(26, 154, 102, 0.18), transparent 55%),
    radial-gradient(ellipse 40% 30% at 20% 80%, rgba(61, 107, 140, 0.15), transparent 50%),
    linear-gradient(165deg, #f3fafa 0%, #e4f2ef 42%, #dff0eb 100%);
  background-attachment: fixed;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.4;
  background-image:
    linear-gradient(rgba(7, 70, 68, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(7, 70, 68, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
}

body::after {
  content: "";
  position: fixed;
  width: 320px;
  height: 320px;
  right: -80px;
  top: 20%;
  border-radius: 50%;
  border: 2px solid rgba(13, 143, 137, 0.2);
  box-shadow: inset 0 0 0 28px rgba(255, 111, 60, 0.06);
  pointer-events: none;
  z-index: 0;
  animation: floatOrb 12s ease-in-out infinite;
}

@keyframes floatOrb {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-18px) rotate(8deg); }
}

.app {
  position: relative;
  z-index: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 20px 70px;
}

/* ========== TOPBAR ========== */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.82);
  border: 2px solid var(--line-strong);
  border-radius: 22px;
  box-shadow: var(--shadow);
  animation: rise 0.55s var(--ease) both;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(145deg, var(--teal), #054f4c);
  border: 2px solid #063b39;
  box-shadow: 0 8px 20px rgba(13, 143, 137, 0.35);
  position: relative;
}
.brand-mark::after {
  content: "";
  position: absolute;
  inset: 10px;
  border: 2px solid rgba(255,255,255,0.75);
  border-radius: 8px;
  transform: rotate(12deg);
}
.brand h1 {
  margin: 0;
  font-family: "Syne", sans-serif;
  font-size: 1.55rem;
  letter-spacing: -0.03em;
}
.brand p { margin: 4px 0 0; color: var(--muted); font-size: 0.88rem; }

.nav { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.nav a, .btn, button {
  font: inherit;
  border: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 600;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), background 0.25s var(--ease);
}
.nav a, .btn.ghost {
  color: var(--ink-soft);
  background: #fff;
  border-color: var(--line);
}
.nav a.active, .btn.primary, button.primary {
  background: linear-gradient(135deg, var(--teal), var(--teal-deep));
  color: #fff;
  border-color: #065652;
  box-shadow: 0 8px 18px rgba(13, 143, 137, 0.3);
}
.nav a:hover, .btn:hover, button:hover { transform: translateY(-1px); }
.btn.accent, button.save {
  background: linear-gradient(135deg, var(--accent), #e45520);
  color: #fff;
  border-color: #c4471a;
}

/* ========== KPIs ========== */
.kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.kpi {
  background: var(--panel);
  border: 2px solid var(--line);
  border-left: 5px solid var(--teal);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  animation: rise 0.65s var(--ease) both;
}
.kpi:nth-child(2) { border-left-color: #3d7ea6; animation-delay: 0.04s; }
.kpi:nth-child(3) { border-left-color: var(--warn); animation-delay: 0.08s; }
.kpi:nth-child(4) { border-left-color: var(--good); animation-delay: 0.12s; }
.kpi:nth-child(5) { border-left-color: var(--accent); animation-delay: 0.16s; }
.kpi span { display: block; color: var(--muted); font-size: 0.8rem; margin-bottom: 6px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.kpi strong {
  font-family: "Syne", sans-serif;
  font-size: 1.95rem;
  letter-spacing: -0.04em;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 14px;
  margin-bottom: 16px;
}
.panel {
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  animation: rise 0.7s var(--ease) both;
  position: relative;
  overflow: hidden;
}
.panel::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--teal), var(--accent));
}
.panel h2 {
  margin: 0 0 14px;
  font-family: "Syne", sans-serif;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}
.chart-wrap { position: relative; height: 240px; }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px;
  margin-bottom: 14px;
  background: #fff;
  border: 2px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  position: sticky;
  top: 10px;
  z-index: 5;
  animation: rise 0.75s var(--ease) both;
}
.filters input, .filters select, .action-form input, .action-form select,
.config-form input, .config-form textarea, .config-form select {
  font: inherit;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 10px 12px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.filters input:focus, .filters select:focus,
.config-form input:focus, .config-form textarea:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(13, 143, 137, 0.18);
}
.filters input { flex: 1; min-width: 180px; }
.filters button {
  background: var(--ink);
  color: #fff;
  border-color: #021011;
}

.table-wrap {
  background: #fff;
  border: 2px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: rise 0.8s var(--ease) both;
}
table { width: 100%; border-collapse: collapse; }
th, td {
  text-align: left;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  background: linear-gradient(180deg, var(--teal-soft), #eef8f7);
  border-bottom: 2px solid var(--line-strong);
}
tr { transition: background 0.2s var(--ease); }
tr:hover { background: rgba(13, 143, 137, 0.06); }

.score {
  display: inline-grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  border: 2px solid rgba(13, 143, 137, 0.35);
  background: linear-gradient(160deg, #dff5f3, #fff);
  color: var(--teal-deep);
  font-family: "Syne", sans-serif;
  font-weight: 700;
}
.badge {
  display: inline-block;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(13, 143, 137, 0.3);
  background: var(--teal-soft);
  color: var(--teal-deep);
  font-size: 0.75rem;
  font-weight: 600;
}
.pain { font-weight: 600; margin-bottom: 4px; }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
.link { color: var(--teal-deep); font-weight: 600; text-decoration: none; }
.link:hover { color: var(--accent); }
.action-form { display: grid; gap: 6px; min-width: 170px; }
.action-form button {
  background: var(--ink);
  color: #fff;
  border-radius: 10px;
  padding: 8px 10px;
  border-color: #021011;
}

/* ========== LOGIN ========== */
.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
  background-color: #073936;
  background-image:
    radial-gradient(ellipse 90% 70% at 10% 20%, rgba(13, 143, 137, 0.55), transparent 55%),
    radial-gradient(ellipse 80% 60% at 90% 10%, rgba(255, 111, 60, 0.4), transparent 50%),
    radial-gradient(ellipse 60% 50% at 50% 100%, rgba(212, 160, 23, 0.25), transparent 55%),
    linear-gradient(160deg, #042826 0%, #0a4a46 45%, #0d5c57 100%);
}
.login-body::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.05) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(circle at center, black 30%, transparent 80%);
  pointer-events: none;
}
.login-shell {
  width: min(920px, 96vw);
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 0;
  border-radius: 28px;
  overflow: hidden;
  border: 2px solid rgba(255,255,255,0.28);
  box-shadow: 0 30px 80px rgba(0,0,0,0.35);
  animation: rise 0.65s var(--ease) both;
  position: relative;
  z-index: 1;
}
.login-hero {
  padding: 42px 36px;
  background:
    linear-gradient(160deg, rgba(7, 57, 54, 0.2), rgba(4, 40, 38, 0.55)),
    linear-gradient(135deg, #0f8f8a, #0a5c58 55%, #ff6f3c);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 460px;
  border-right: 2px solid rgba(255,255,255,0.2);
}
.login-hero h2 {
  margin: 0 0 12px;
  font-family: "Syne", sans-serif;
  font-size: 2rem;
  letter-spacing: -0.03em;
  line-height: 1.15;
}
.login-hero p { margin: 0; opacity: 0.92; line-height: 1.5; max-width: 28ch; }
.login-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 28px; }
.login-pills span {
  border: 1.5px solid rgba(255,255,255,0.45);
  background: rgba(255,255,255,0.12);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 600;
}
.login-card {
  margin: 0;
  width: auto;
  background: #f7fffe;
  border: none;
  border-radius: 0;
  padding: 42px 34px;
  box-shadow: none;
  display: grid;
  gap: 10px;
  animation: none;
}
.login-card h1 {
  margin: 0;
  font-family: "Syne", sans-serif;
  letter-spacing: -0.03em;
  font-size: 1.7rem;
  color: var(--ink);
}
.login-card .muted { color: var(--muted); margin: 0 0 8px; }
.login-card label { font-size: 0.84rem; color: var(--muted); font-weight: 600; }
.login-card input {
  font: inherit;
  border-radius: 14px;
  border: 2px solid var(--line);
  padding: 12px 14px;
  background: #fff;
}
.login-card input:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(13, 143, 137, 0.18);
}
.login-card button {
  margin-top: 10px;
  background: linear-gradient(135deg, var(--teal), var(--teal-deep));
  color: #fff;
  border: 2px solid #065652;
  border-radius: 14px;
  padding: 12px 16px;
}
.error { color: #c4432a; font-weight: 600; }

/* ========== CONFIG ========== */
.section-title {
  font-family: "Syne", sans-serif;
  margin: 26px 0 12px;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-title::before {
  content: "";
  width: 10px;
  height: 28px;
  border-radius: 6px;
  background: linear-gradient(180deg, var(--teal), var(--accent));
  border: 1px solid #065652;
}
.config-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.config-card {
  background: #fff;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  animation: rise 0.65s var(--ease) both;
  position: relative;
  overflow: hidden;
}
.config-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 6px;
  background: linear-gradient(180deg, var(--teal), var(--accent));
}
.config-card.product-card::before {
  background: linear-gradient(180deg, var(--accent), var(--warn));
}
.config-card h3 {
  margin: 0 0 8px;
  font-family: "Syne", sans-serif;
  font-size: 1.15rem;
}
.config-card p.help { margin: 0 0 14px; color: var(--muted); font-size: 0.9rem; line-height: 1.45; }
.config-form { display: grid; gap: 10px; }
.config-form label { font-size: 0.82rem; color: var(--muted); font-weight: 600; }
.config-form textarea { min-height: 90px; resize: vertical; font-family: inherit; }
.config-form code, .help code {
  background: var(--teal-soft);
  border: 1px solid rgba(13,143,137,0.25);
  border-radius: 6px;
  padding: 1px 6px;
  font-size: 0.85em;
}
.flash {
  padding: 12px 14px;
  border-radius: 14px;
  border: 2px solid rgba(26, 154, 102, 0.35);
  background: rgba(26, 154, 102, 0.12);
  color: var(--good);
  margin-bottom: 14px;
  font-weight: 600;
  animation: rise 0.35s var(--ease) both;
}
.flash.err {
  border-color: rgba(196,67,42,0.35);
  background: rgba(196,67,42,0.12);
  color: #c4432a;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 980px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .config-grid, .login-shell { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; align-items: flex-start; }
  .login-hero { min-height: auto; border-right: 0; border-bottom: 2px solid rgba(255,255,255,0.2); }
}
@media (max-width: 640px) {
  .kpis { grid-template-columns: 1fr 1fr; }
  th:nth-child(5), td:nth-child(5) { display: none; }
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.45rem;
}
.action-form.inline {
  display: inline-flex;
  gap: 0.25rem;
  margin: 0;
}
.action-form.inline button.primary {
  background: var(--accent, #0d9488);
  color: #fff;
  border: 0;
}

