:root {
  --bg: #ffffff;
  --bg-alt: #f5f5f7;
  --bg-tile: #f5f5f7;
  --panel: #ffffff;
  --panel-2: #f5f5f7;
  --border: #d2d2d7;
  --border-soft: #e8e8ed;
  --line: #d2d2d7;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --muted-2: #86868b;
  --link: #0d9f6e;
  --link-hover: #0a7a55;
  --accent: #0d9f6e;
  --ok: #0d9f6e;
  --ok-bg: #f0faf0;
  --danger: #b30000;
  --danger-bg: #fff5f5;
  --warn: #b35c00;
  --warn-bg: #fff8f0;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg-alt);
  color: var(--text);
  line-height: 1.47059;
  font-size: 15px;
  font-weight: 400;
  letter-spacing: -.015em;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }

.admin-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.admin-nav {
  background: rgba(255, 255, 255, 0.86);
  border-right: 1px solid var(--border-soft);
  padding: 1.35rem 1rem;
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

/* brand mark styles appended below */

.admin-nav .sub {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 1.4rem;
  letter-spacing: -.01em;
}

.admin-nav a {
  display: block;
  color: var(--text);
  padding: .55rem .75rem;
  border-radius: 10px;
  margin-bottom: .2rem;
  font-size: 13px;
  font-weight: 400;
  opacity: .88;
}

.admin-nav a:hover {
  background: var(--bg-alt);
  text-decoration: none;
  color: var(--text);
  opacity: 1;
}

.admin-nav a.active {
  background: var(--bg-alt);
  color: var(--text);
  font-weight: 600;
  opacity: 1;
  text-decoration: none;
}

.admin-main {
  padding: 1.5rem 1.75rem 2.5rem;
  max-width: 1200px;
}

.admin-top {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1.25rem;
}

.admin-top h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -.02em;
  color: var(--text);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  border: 1px solid transparent;
  border-radius: 980px;
  padding: .55rem 1rem;
  font-weight: 500;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  letter-spacing: -.01em;
  transition: background .15s ease, filter .15s ease, border-color .15s ease;
}

.btn-primary {
  background: var(--text);
  color: #fff;
  border-color: var(--text);
}

.btn-primary:hover {
  background: #000;
  color: #fff;
  text-decoration: none;
  filter: none;
}

.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--bg-alt);
  text-decoration: none;
  filter: none;
}

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: #f0c8c8;
}

.btn-danger:hover {
  filter: brightness(0.98);
  text-decoration: none;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
  box-shadow: var(--shadow-sm);
}

.stats {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: .75rem;
  margin-bottom: 1.15rem;
}

.stat {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 1rem;
  box-shadow: var(--shadow-sm);
}

.stat .label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.stat .value {
  font-size: 1.5rem;
  font-weight: 600;
  margin-top: .25rem;
  letter-spacing: -.02em;
  color: var(--text);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  text-align: left;
  padding: .75rem .55rem;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: top;
  font-size: 13px;
}

th {
  color: var(--muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

tr:last-child td { border-bottom: 0; }

.badge {
  display: inline-block;
  border-radius: 999px;
  padding: .18rem .55rem;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: -.01em;
}

.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-muted { background: var(--bg-alt); color: var(--muted); }

.flash {
  padding: .8rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  font-size: 13px;
}

.flash-ok {
  background: var(--ok-bg);
  border: 1px solid #c8e6c9;
  color: var(--ok);
}

.flash-error {
  background: var(--danger-bg);
  border: 1px solid #f0c8c8;
  color: var(--danger);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-grid .full { grid-column: 1 / -1; }

label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: .35rem;
  font-weight: 500;
}

input[type=text],
input[type=email],
input[type=number],
input[type=url],
input[type=password],
input[type=search],
textarea,
select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: .7rem .8rem;
  font: inherit;
  font-size: 14px;
  transition: border-color .15s ease, box-shadow .15s ease;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--link);
  box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.12);
}

textarea { min-height: 110px; resize: vertical; }

.checks {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
}

.checks label {
  display: flex;
  gap: .4rem;
  align-items: center;
  color: var(--text);
  margin: 0;
  font-size: 13px;
}

.actions {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  margin-top: 1.15rem;
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  background: var(--bg-alt);
}

.login-card {
  width: min(100%, 420px);
  box-shadow: var(--shadow);
}

.login-card h1 {
  margin: 0 0 .35rem;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -.02em;
}

.login-card p {
  color: var(--muted);
  margin: 0 0 1.15rem;
  font-size: 14px;
}

.error-list {
  color: var(--danger);
  font-size: 13px;
  margin: 0 0 .8rem;
  padding-left: 1.1rem;
}

.toolbar {
  display: flex;
  gap: .6rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  align-items: center;
}

.toolbar input,
.toolbar select {
  width: auto;
  min-width: 180px;
}

.muted { color: var(--muted); }

.row-actions {
  display: flex;
  gap: .35rem;
  flex-wrap: wrap;
  align-items: center;
}

.field-gap { margin-bottom: .85rem; }

@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 860px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-nav {
    position: relative;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border-soft);
  }
  .form-grid, .stats { grid-template-columns: 1fr; }
  .admin-top h1 { font-size: 22px; }
}

/* Affiliate charts */
.chart-card .chart-empty {
  margin: 0.35rem 0 0.5rem;
  font-size: 13px;
}

.chart-wrap {
  position: relative;
  width: 100%;
}

.chart-wrap--daily {
  height: 260px;
}

.chart-wrap--daily-sm {
  height: 180px;
  margin-top: 0.75rem;
}

.chart-wrap--bars {
  height: 280px;
}

.chart-wrap--hour {
  height: 280px;
}

@media (max-width: 860px) {
  .chart-wrap--daily { height: 220px; }
  .chart-wrap--bars,
  .chart-wrap--hour { height: 240px; }
}

.admin-nav .brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 500; font-size: 18px; letter-spacing: -.02em;
  color: var(--text); margin-bottom: .15rem; text-decoration: none; line-height: 1;
}
.admin-nav .brand:hover { text-decoration: none; color: var(--text); opacity: .92; }
.admin-nav .brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--bg-alt, #f5f5f7); color: var(--link, #0066cc);
  font-weight: 600; font-size: 11px; letter-spacing: -.04em; flex-shrink: 0;
}
.admin-nav .brand-name { font-weight: 500; font-size: 17px; color: var(--text); }
.admin-nav .brand-accent { color: var(--link, #0066cc); font-weight: 500; }
.login-brand {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  margin: 0 auto .85rem; text-decoration: none; color: var(--text); line-height: 1;
}
.login-brand:hover { text-decoration: none; color: var(--text); opacity: .92; }
.login-brand .brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%;
  background: #f5f5f7; color: #0066cc;
  font-weight: 600; font-size: 12px; letter-spacing: -.04em;
}
.login-brand .brand-name { font-weight: 500; font-size: 18px; color: #1d1d1f; }
.login-brand .brand-accent { color: #0066cc; font-weight: 500; }


/* MascotaUtil brand accents */
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: #0d9f6e;
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  margin-right: .55rem;
}
.brand {
  display: flex;
  align-items: center;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  margin-bottom: .35rem;
}
.brand:hover { text-decoration: none; color: var(--text); }
.brand-name { font-size: 15px; letter-spacing: -.02em; }
.brand-accent { color: #0d9f6e; }
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: linear-gradient(160deg, #f0faf6 0%, #e8f4fb 100%);
}
.login-card { width: 100%; max-width: 400px; }
.login-card h1 { margin: .75rem 0 .35rem; font-size: 1.35rem; }
.login-card p { color: var(--muted); margin: 0 0 1rem; font-size: 14px; }
.footer-admin { opacity: .55; font-size: 12px; }
