/* ═══════════════════════════════════════════════════════════════
   REUSE — Sistema de Design
   ───────────────────────────────────────────────────────────────
   Todas as cores, tipografia, espaçamentos e raios ficam aqui.
   Para mudar o visual do site, edite apenas as variáveis :root —
   o restante do CSS se ajusta automaticamente.
   ═══════════════════════════════════════════════════════════════ */

:root {
  /* ── Cores Primárias (verde-sustentabilidade) ─────────────── */
  --clr-primary:          #b45d7f;   /* botão principal, links, foco */
  --clr-primary-hover:    #944764;   /* hover do primário */
  --clr-primary-active:   #7a3650;   /* active/pressed */
  --clr-primary-light:    #fbf0f5;   /* fundo de elementos suaves */
  --clr-primary-soft:     #f0d1dd;   /* badges, highlights */

  /* ── Ações Confirmativas ──────────────────────────────────── */
  --clr-success:          #2f8d6a;   /* entregas confirmadas */
  --clr-success-light:    #dbf0e6;

  /* ── Ações Destrutivas / Perigo ───────────────────────────── */
  --clr-danger:           #c0392b;   /* cancelar, denunciar, excluir */
  --clr-danger-hover:     #a93226;
  --clr-danger-light:     #fde8e6;

  /* ── Avisos ───────────────────────────────────────────────── */
  --clr-warning:          #b45309;   /* bloqueios, lembretes */
  --clr-warning-light:    #fef3c7;

  /* ── Informativo ──────────────────────────────────────────── */
  --clr-info:             #1d4ed8;
  --clr-info-light:       #dbeafe;

  /* ── Superfícies ──────────────────────────────────────────── */
  --clr-bg:               #fbf6f8;   /* fundo geral da página */
  --clr-surface:          #ffffff;   /* cards, painéis, formulários */
  --clr-soft:             #f8eef2;   /* áreas de destaque suave */

  /* ── Texto ────────────────────────────────────────────────── */
  --clr-text:             #332430;   /* texto principal */
  --clr-muted:            #705a68;   /* texto secundário */
  --clr-subtle:           #a9909d;   /* placeholders, hints */
  --clr-on-primary:       #ffffff;   /* texto sobre fundo verde */

  /* ── Bordas e Divisores ───────────────────────────────────── */
  --clr-border:           #ead6df;
  --clr-border-focus:     var(--clr-primary);
  --clr-divider:          #f1e5eb;

  /* ── Sombras ──────────────────────────────────────────────── */
  --shadow-xs: 0 1px 2px rgba(111, 68, 89, 0.06);
  --shadow-sm: 0 2px 8px rgba(111, 68, 89, 0.09);
  --shadow-md: 0 6px 20px rgba(111, 68, 89, 0.13);
  --shadow-lg: 0 12px 36px rgba(111, 68, 89, 0.18);

  /* ── Tipografia ───────────────────────────────────────────── */
  --font-sans:   system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  --fz-xs:       0.75rem;     /*  12px */
  --fz-sm:       0.8125rem;   /*  13px */
  --fz-base:     0.9375rem;   /*  15px */
  --fz-md:       1rem;        /*  16px */
  --fz-lg:       1.125rem;    /*  18px */
  --fz-xl:       1.375rem;    /*  22px */
  --fz-2xl:      1.75rem;     /*  28px */
  --fz-3xl:      2.25rem;     /*  36px */

  /* ── Espaçamentos ─────────────────────────────────────────── */
  --sp-1:   4px;
  --sp-2:   8px;
  --sp-3:  12px;
  --sp-4:  16px;
  --sp-5:  20px;
  --sp-6:  24px;
  --sp-8:  32px;
  --sp-10: 40px;
  --sp-12: 48px;

  /* ── Raios de Borda ───────────────────────────────────────── */
  --r-sm:   6px;
  --r-md:   10px;
  --r-lg:   16px;
  --r-xl:   24px;
  --r-pill: 9999px;

  /* ── Transições ───────────────────────────────────────────── */
  --ease:       170ms ease;
  --ease-slow:  280ms ease;
}


/* ─────────────────────────────────────────────────────────────
   RESET & BASE
   ───────────────────────────────────────────────────────────── */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: var(--fz-base);
  line-height: 1.65;
  color: var(--clr-text);
  background: var(--clr-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; display: block; }

button { font: inherit; }


/* ─────────────────────────────────────────────────────────────
   TIPOGRAFIA
   ───────────────────────────────────────────────────────────── */

h1, h2, h3, h4, h5, h6 {
  line-height: 1.25;
  color: var(--clr-text);
  font-weight: 800;
}

h1 { font-size: var(--fz-2xl); }
h2 { font-size: var(--fz-xl);  font-weight: 700; }
h3 { font-size: var(--fz-lg);  font-weight: 700; }

p { margin: 0; }

a {
  color: var(--clr-primary);
  font-weight: 600;
  text-decoration: none;
  transition: color var(--ease);
}

a:hover {
  color: var(--clr-primary-hover);
  text-decoration: underline;
}

code {
  padding: 2px 8px;
  border-radius: var(--r-sm);
  background: var(--clr-soft);
  border: 1px solid var(--clr-primary-soft);
  color: var(--clr-primary-hover);
  font-size: var(--fz-sm);
  font-family: 'Courier New', ui-monospace, monospace;
  font-weight: 700;
  letter-spacing: 0.1em;
}

small { font-size: var(--fz-sm); }

strong { font-weight: 700; }


/* ─────────────────────────────────────────────────────────────
   FORMULÁRIOS
   ───────────────────────────────────────────────────────────── */

label {
  display: grid;
  gap: var(--sp-1);
  font-size: var(--fz-xs);
  font-weight: 700;
  color: var(--clr-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border: 1.5px solid var(--clr-border);
  border-radius: var(--r-md);
  background: var(--clr-surface);
  color: var(--clr-text);
  font: inherit;
  font-size: var(--fz-base);
  transition: border-color var(--ease), box-shadow var(--ease);
  appearance: none;
}

input::placeholder,
textarea::placeholder { color: var(--clr-subtle); }

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--clr-border-focus);
  box-shadow: 0 0 0 3px rgba(42, 125, 80, 0.18);
}

input[type="search"] {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238ba896' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 12px center;
  padding-left: 38px;
}

input[type="file"] {
  min-height: auto;
  padding: var(--sp-2) var(--sp-3);
  background: var(--clr-soft);
  border-style: dashed;
  cursor: pointer;
  font-size: var(--fz-sm);
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23506158' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

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


/* ─────────────────────────────────────────────────────────────
   LAYOUT
   ───────────────────────────────────────────────────────────── */

.container {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
  padding: var(--sp-6) 0 var(--sp-12);
}

.layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: var(--sp-5);
  align-items: start;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-4);
}


/* ─────────────────────────────────────────────────────────────
   TOPBAR
   ───────────────────────────────────────────────────────────── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: 0 max(var(--sp-5), calc((100% - 1160px) / 2));
  height: 62px;
  background: var(--clr-surface);
  border-bottom: 1px solid var(--clr-divider);
  box-shadow: var(--shadow-xs);
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--clr-primary) !important;
  text-decoration: none !important;
  flex-shrink: 0;
}

.logo::before {
  content: "♻";
  font-size: 1rem;
}

.logo:hover { color: var(--clr-primary-hover) !important; }

.topbar nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px var(--sp-1);
}

.topbar nav a {
  padding: var(--sp-1) var(--sp-2);
  border-radius: var(--r-sm);
  font-size: var(--fz-sm);
  font-weight: 600;
  color: var(--clr-muted);
  text-decoration: none;
  transition: color var(--ease), background var(--ease);
  white-space: nowrap;
}

.topbar nav a:hover {
  color: var(--clr-primary);
  background: var(--clr-primary-light);
  text-decoration: none;
}

/* Botão "Sair" dentro da nav */
.topbar nav a.btn {
  padding: 6px 14px;
}

.topbar .muted {
  font-size: var(--fz-sm);
  font-weight: 600;
  color: var(--clr-muted);
  padding: 0 var(--sp-1);
}

/* Badge de notificações não lidas */
.notif-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--r-pill);
  background: var(--clr-danger);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  margin-left: 3px;
  vertical-align: middle;
  line-height: 1;
}

/* Hamburger — mobile */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  padding: 6px;
  background: none;
  border: 1.5px solid var(--clr-border);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: border-color var(--ease);
}

.nav-toggle:hover { border-color: var(--clr-primary); }

.nav-toggle span {
  display: block;
  height: 2px;
  background: var(--clr-muted);
  border-radius: 2px;
  transition: var(--ease);
}


/* ─────────────────────────────────────────────────────────────
   PAINÉIS & STACKS
   ───────────────────────────────────────────────────────────── */

.panel {
  padding: var(--sp-5) var(--sp-6);
  border: 1px solid var(--clr-border);
  border-radius: var(--r-lg);
  background: var(--clr-surface);
  box-shadow: var(--shadow-sm);
}

/* Painel dentro de painel: mais leve, sem sombra */
.panel .panel {
  background: var(--clr-bg);
  box-shadow: none;
  border-color: var(--clr-divider);
}

.stack {
  display: grid;
  gap: var(--sp-4);
}

.form-card {
  display: grid;
  gap: var(--sp-4);
  align-self: center;
  padding: var(--sp-10);
}


/* ─────────────────────────────────────────────────────────────
   PÁGINA DE AUTENTICAÇÃO
   ───────────────────────────────────────────────────────────── */

.auth-page {
  display: grid;
  place-items: center;
  min-height: 100svh;
  padding: var(--sp-6);
  background: var(--clr-bg);
}

.auth-card {
  width: min(940px, 100%);
  min-height: 560px;
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  overflow: hidden;
  border: 1px solid var(--clr-border);
  border-radius: var(--r-xl);
  background: var(--clr-surface);
  box-shadow: var(--shadow-lg);
}

.auth-brand {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: var(--sp-10);
  color: #fff;
  background:
    linear-gradient(
      160deg,
      rgba(15, 48, 27, 0.90) 0%,
      rgba(26, 80, 48, 0.80) 50%,
      rgba(42, 125, 80, 0.65) 100%
    ),
    url("https://images.unsplash.com/photo-1489987707025-afc232f7ea0f?auto=format&fit=crop&w=1000&q=80");
  background-size: cover;
  background-position: center;
}

.auth-brand h1 {
  font-size: var(--fz-3xl);
  font-weight: 800;
  letter-spacing: -0.04em;
  color: #fff;
  margin-bottom: var(--sp-3);
}

.auth-brand p {
  font-size: var(--fz-base);
  line-height: 1.65;
  opacity: 0.88;
}

.auth-brand::before {
  content: "♻ ReUse";
  font-size: var(--fz-sm);
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  opacity: 0.6;
  margin-bottom: auto;
}

.form-card h2 {
  font-size: var(--fz-xl);
  font-weight: 800;
}

.links {
  text-align: center;
  font-size: var(--fz-sm);
  color: var(--clr-muted);
}


/* ─────────────────────────────────────────────────────────────
   BOTÕES
   ───────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: 40px;
  padding: 8px 18px;
  border: 1.5px solid var(--clr-border);
  border-radius: var(--r-md);
  background: var(--clr-surface);
  color: var(--clr-muted);
  font: inherit;
  font-size: var(--fz-sm);
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition:
    background var(--ease),
    color var(--ease),
    border-color var(--ease),
    box-shadow var(--ease),
    transform 80ms ease;
  -webkit-user-select: none;
  user-select: none;
}

.btn:hover {
  background: var(--clr-soft);
  color: var(--clr-primary);
  border-color: var(--clr-primary-soft);
  text-decoration: none;
}

.btn:active { transform: scale(0.97); }

.btn:disabled,
.btn[disabled] {
  cursor: not-allowed;
  opacity: 0.58;
  transform: none;
  box-shadow: none;
}

/* ── Primário: verde cheio ── */
.btn.primary {
  background: var(--clr-primary);
  border-color: var(--clr-primary);
  color: var(--clr-on-primary);
  box-shadow: 0 2px 10px rgba(42, 125, 80, 0.28);
}

.btn.primary:hover {
  background: var(--clr-primary-hover);
  border-color: var(--clr-primary-hover);
  color: #fff;
  box-shadow: 0 4px 16px rgba(42, 125, 80, 0.38);
}

.btn.primary:active {
  background: var(--clr-primary-active);
  border-color: var(--clr-primary-active);
}

/* ── Secundário: contorno verde ── */
.btn.secondary {
  background: transparent;
  border-color: var(--clr-primary);
  color: var(--clr-primary);
}

.btn.secondary:hover {
  background: var(--clr-primary-light);
  color: var(--clr-primary-hover);
  border-color: var(--clr-primary-hover);
}

/* ── Perigo: vermelho — cancelar, denunciar, excluir ── */
.btn.danger {
  background: var(--clr-danger);
  border-color: var(--clr-danger);
  color: #fff;
  box-shadow: 0 2px 10px rgba(192, 57, 43, 0.22);
}

.btn.danger:hover {
  background: var(--clr-danger-hover);
  border-color: var(--clr-danger-hover);
  color: #fff;
  box-shadow: 0 4px 16px rgba(192, 57, 43, 0.32);
}


/* ─────────────────────────────────────────────────────────────
   ALERTAS
   ───────────────────────────────────────────────────────────── */

.alert {
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  border-left: 4px solid var(--clr-info);
  background: var(--clr-info-light);
  color: var(--clr-info);
  font-weight: 600;
  font-size: var(--fz-base);
  line-height: 1.55;
}

.alert.success {
  border-left-color: var(--clr-success);
  background: var(--clr-success-light);
  color: var(--clr-success);
}

.alert.error {
  border-left-color: var(--clr-danger);
  background: var(--clr-danger-light);
  color: var(--clr-danger);
}

.alert.warning {
  border-left-color: var(--clr-warning);
  background: var(--clr-warning-light);
  color: var(--clr-warning);
}


/* ─────────────────────────────────────────────────────────────
   GRID DE ITENS & CARDS
   ───────────────────────────────────────────────────────────── */

.items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: var(--sp-4);
  align-items: start;
}

.item-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--clr-border);
  border-radius: var(--r-lg);
  background: var(--clr-surface);
  box-shadow: var(--shadow-xs);
  transition: transform var(--ease-slow), box-shadow var(--ease-slow);
}

.item-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.item-photo {
  position: relative;
  height: 176px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--clr-soft);
  color: var(--clr-subtle);
  font-size: var(--fz-sm);
}

.item-photo::before {
  content: "Carregando foto";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #a88495;
  font-size: var(--fz-sm);
  font-weight: 700;
}

.item-photo img {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--ease-slow);
}

.item-photo.is-loaded::before,
.item-photo.is-missing::before {
  content: "";
}

.item-photo img.image-fallback {
  object-fit: cover;
}

.item-card:hover .item-photo img {
  transform: scale(1.05);
}

.item-body {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: var(--sp-4);
  flex: 1;
}

.item-body h2 {
  font-size: var(--fz-base);
  font-weight: 700;
  line-height: 1.4;
}

.item-body > a:last-child {
  margin-top: auto;
  padding-top: var(--sp-2);
  font-size: var(--fz-sm);
}


/* ─────────────────────────────────────────────────────────────
   BADGES
   ───────────────────────────────────────────────────────────── */

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  background: var(--clr-primary-light);
  color: var(--clr-primary-hover);
  font-size: var(--fz-xs);
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* Status de item */
.badge.status-disponivel  { background: #d4eddf; color: #155c2e; }
.badge.status-reservado   { background: #fef3c7; color: #92400e; }
.badge.status-entregue    { background: #dbeafe; color: #1e3a8a; }
.badge.status-pausado     { background: #f0f0f0; color: #555555; }
.badge.status-cancelado,
.badge.status-cancelada   { background: #f0f0f0; color: #666666; }
.badge.status-expirada    { background: #f0f0f0; color: #666666; }
.badge.status-no_show     { background: #fde8e6; color: #9b1c1c; }
.badge.status-pendente    { background: #fef3c7; color: #92400e; }
.badge.status-aceita      { background: #d4eddf; color: #155c2e; }


/* ─────────────────────────────────────────────────────────────
   CHAT
   ───────────────────────────────────────────────────────────── */

.chat-messages {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  max-height: 420px;
  overflow-y: auto;
  padding: var(--sp-2) 0 var(--sp-3);
  scroll-behavior: smooth;
}

.msg {
  max-width: 76%;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-lg);
  line-height: 1.5;
}

.msg-own {
  align-self: flex-end;
  background: var(--clr-primary-soft);
  border-bottom-right-radius: var(--r-sm);
}

.msg-other {
  align-self: flex-start;
  background: var(--clr-bg);
  border: 1px solid var(--clr-divider);
  border-bottom-left-radius: var(--r-sm);
}

.msg-sender {
  display: block;
  font-size: var(--fz-xs);
  font-weight: 700;
  color: var(--clr-primary-hover);
  margin-bottom: 2px;
}

.msg-other .msg-sender { color: var(--clr-muted); }

.msg-text {
  display: block;
  font-size: var(--fz-base);
  color: var(--clr-text);
  word-break: break-word;
}

.msg-time {
  display: block;
  font-size: var(--fz-xs);
  color: var(--clr-subtle);
  margin-top: 3px;
  text-align: right;
}


/* ─────────────────────────────────────────────────────────────
   CARTEIRA DE PONTOS
   ───────────────────────────────────────────────────────────── */

.saldo-destaque {
  font-size: var(--fz-3xl);
  font-weight: 800;
  color: var(--clr-primary);
  line-height: 1;
}

.saldo-destaque small {
  font-size: var(--fz-md);
  font-weight: 600;
  color: var(--clr-muted);
}

.transacao {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
}

.transacao-icone {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: var(--r-pill);
  display: grid;
  place-items: center;
  font-size: var(--fz-md);
  font-weight: 800;
}

.transacao.credito .transacao-icone {
  background: var(--clr-success-light);
  color: var(--clr-success);
}

.transacao.debito .transacao-icone {
  background: var(--clr-danger-light);
  color: var(--clr-danger);
}

.transacao-info { flex: 1; }

.transacao-valor {
  font-size: var(--fz-lg);
  font-weight: 800;
}

.transacao.credito .transacao-valor { color: var(--clr-success); }
.transacao.debito  .transacao-valor { color: var(--clr-danger);  }


/* ─────────────────────────────────────────────────────────────
   UTILITÁRIOS
   ───────────────────────────────────────────────────────────── */

.muted, .meta {
  color: var(--clr-muted);
  font-size: var(--fz-sm);
}

.text-center { text-align: center; }
.w-full { width: 100%; }

/* Divider decorativo */
.divider {
  height: 1px;
  background: var(--clr-divider);
  border: none;
  margin: var(--sp-2) 0;
}


/* ─────────────────────────────────────────────────────────────
   RESPONSIVO
   ───────────────────────────────────────────────────────────── */

@media (max-width: 820px) {
  /* Auth */
  .auth-page { padding: 0; }

  .auth-card {
    grid-template-columns: 1fr;
    min-height: 100svh;
    border: none;
    border-radius: 0;
    box-shadow: none;
  }

  .auth-brand {
    min-height: 200px;
    padding: var(--sp-6);
  }

  .auth-brand h1 { font-size: var(--fz-2xl); }

  .auth-brand::before { display: none; }

  .form-card { padding: var(--sp-6); }

  /* Layout */
  .layout,
  .grid-2 { grid-template-columns: 1fr; }

  /* Topbar mobile */
  .topbar {
    position: relative;
    height: auto;
    flex-wrap: wrap;
    padding: var(--sp-3) var(--sp-4);
    gap: var(--sp-2);
  }

  .topbar nav {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    padding: var(--sp-2) 0 var(--sp-1);
    border-top: 1px solid var(--clr-divider);
    gap: 2px;
  }

  .topbar nav.open { display: flex; }

  .topbar nav a {
    padding: var(--sp-2) var(--sp-3);
    border-radius: var(--r-md);
    font-size: var(--fz-base);
  }

  .nav-toggle { display: flex; }

  /* Container */
  .container { padding: var(--sp-4) 0 var(--sp-8); }

  /* Botões em blocos menores: full width */
  .stack .btn,
  .form-card .btn { width: 100%; }

  /* Items */
  .items-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: var(--sp-3);
  }
}

.inline-form {
  display: inline-flex;
  align-items: center;
  margin: 0;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--sp-3);
  padding: var(--sp-3) 0;
}

.pagination-status {
  color: var(--clr-muted);
  font-weight: 800;
  font-size: var(--fz-sm);
}

.install-app-card {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 500;
  width: min(420px, calc(100vw - 32px));
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: var(--sp-3);
  align-items: center;
  padding: var(--sp-4);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(234, 214, 223, 0.94);
  box-shadow: var(--shadow-lg);
}

.install-app-card div {
  display: grid;
  gap: 4px;
}

.install-app-card span {
  color: var(--clr-muted);
  line-height: 1.5;
  font-size: var(--fz-sm);
}

.install-dismiss {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: var(--r-pill);
  background: var(--clr-primary-light);
  color: var(--clr-primary-hover);
  font-size: 1.2rem;
  font-weight: 800;
  cursor: pointer;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--sp-3);
}

.page-header h1,
.page-header h2 {
  margin-bottom: 0.35rem;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}

.summary-card {
  background: var(--clr-surface);
  border: 1px solid var(--clr-divider);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  display: grid;
  gap: 0.35rem;
}

.summary-label {
  color: var(--clr-muted);
  font-size: var(--fz-sm);
}

.status-callout,
.code-callout,
.chat-toolbar {
  padding: var(--sp-3);
  border-radius: var(--r-md);
  background: rgba(42, 111, 151, 0.08);
  border: 1px solid rgba(42, 111, 151, 0.16);
}

.code-callout {
  display: grid;
  gap: 0.4rem;
}

.code-callout code {
  display: inline-block;
  font-size: var(--fz-lg);
  font-weight: 800;
  letter-spacing: 0.12em;
}

.empty-state {
  text-align: center;
  padding: var(--sp-5);
}

.item-photo-large {
  height: 320px;
}

.impact-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) 0;
  border-top: 1px solid var(--clr-divider);
}

.impact-row:first-of-type {
  border-top: none;
}

.image-preview {
  border: 1px dashed var(--clr-divider);
  border-radius: var(--r-md);
  padding: var(--sp-3);
  min-height: 120px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: var(--sp-3);
  background: rgba(255, 255, 255, 0.45);
}

.image-preview img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--r-md);
}

@media (max-width: 820px) {
  .page-header,
  .action-row {
    flex-direction: column;
    align-items: stretch;
  }

  .inline-form,
  .inline-form .btn,
  .action-row .btn {
    width: 100%;
  }
}

/* Design refresh */
:root {
  --clr-primary: #b45d7f;
  --clr-primary-hover: #944764;
  --clr-primary-active: #7a3650;
  --clr-primary-light: #fbf0f5;
  --clr-primary-soft: #f0d1dd;
  --clr-accent: #e4a574;
  --clr-navy: #432a3a;
  --clr-success: #2f8d6a;
  --clr-success-light: #dbf0e6;
  --clr-bg: #fbf6f8;
  --clr-surface: #ffffff;
  --clr-soft: #f9f0f4;
  --clr-surface-alt: #fff8fb;
  --clr-text: #332430;
  --clr-muted: #705a68;
  --clr-subtle: #ab90a0;
  --clr-border: #ead6df;
  --clr-divider: #f1e5eb;
  --shadow-xs: 0 1px 2px rgba(111, 68, 89, 0.04);
  --shadow-sm: 0 8px 24px rgba(111, 68, 89, 0.07);
  --shadow-md: 0 18px 44px rgba(111, 68, 89, 0.11);
  --shadow-lg: 0 30px 70px rgba(111, 68, 89, 0.17);
}

body {
  background:
    radial-gradient(circle at top left, rgba(228, 165, 116, 0.16), transparent 26%),
    radial-gradient(circle at top right, rgba(180, 93, 127, 0.12), transparent 24%),
    linear-gradient(180deg, #fffafc 0%, var(--clr-bg) 38%, #f8eff4 100%);
}

.container {
  padding-top: var(--sp-8);
}

.topbar {
  min-height: 72px;
  padding-top: 10px;
  padding-bottom: 10px;
  background: rgba(255, 255, 255, 0.82);
  border-bottom: 1px solid rgba(234, 214, 223, 0.78);
  box-shadow: 0 10px 30px rgba(111, 68, 89, 0.06);
  backdrop-filter: blur(14px);
}

.logo {
  font-size: 1.28rem;
  letter-spacing: -0.04em;
  color: var(--clr-navy) !important;
}

.logo::before {
  content: "";
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--clr-primary), var(--clr-accent));
  box-shadow: 0 0 0 7px rgba(180, 93, 127, 0.10);
}

.topbar nav {
  gap: 6px;
}

.topbar nav a {
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 650;
  transition: color var(--ease), background var(--ease), box-shadow var(--ease);
}

.topbar nav a:hover {
  background: rgba(180, 93, 127, 0.10);
  box-shadow: inset 0 0 0 1px rgba(180, 93, 127, 0.08);
}

.topbar .muted {
  font-weight: 700;
  padding: 0 var(--sp-2);
}

.panel {
  padding: var(--sp-6);
  border: 1px solid rgba(234, 214, 223, 0.88);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(12px);
}

.auth-page {
  background:
    radial-gradient(circle at top left, rgba(180, 93, 127, 0.14), transparent 30%),
    radial-gradient(circle at bottom right, rgba(228, 165, 116, 0.16), transparent 30%),
    linear-gradient(180deg, #fffafd 0%, #f9eff4 100%);
}

.auth-card {
  border: 1px solid rgba(234, 214, 223, 0.88);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
}

.auth-brand {
  background:
    linear-gradient(160deg, rgba(74, 42, 58, 0.94) 0%, rgba(180, 93, 127, 0.82) 54%, rgba(228, 165, 116, 0.62) 100%),
    url("https://images.unsplash.com/photo-1489987707025-afc232f7ea0f?auto=format&fit=crop&w=1000&q=80");
}

.btn {
  min-height: 42px;
  padding: 9px 18px;
  border: 1px solid rgba(212, 225, 218, 0.95);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--clr-text);
  box-shadow: 0 4px 14px rgba(23, 50, 44, 0.05);
}

.btn:hover {
  background: #ffffff;
  border-color: rgba(31, 122, 89, 0.24);
  box-shadow: 0 10px 24px rgba(23, 50, 44, 0.08);
}

.btn.primary {
  background: linear-gradient(135deg, var(--clr-primary) 0%, #cf7396 100%);
  border-color: transparent;
  box-shadow: 0 12px 22px rgba(180, 93, 127, 0.24);
}

.btn.primary:hover {
  background: linear-gradient(135deg, var(--clr-primary-hover) 0%, #b45d7f 100%);
  border-color: transparent;
  box-shadow: 0 16px 28px rgba(180, 93, 127, 0.30);
}

.btn.secondary {
  background: rgba(180, 93, 127, 0.08);
  border-color: rgba(180, 93, 127, 0.16);
  color: var(--clr-primary-hover);
}

.btn.secondary:hover {
  background: rgba(180, 93, 127, 0.12);
  border-color: rgba(180, 93, 127, 0.22);
}

.btn.danger {
  background: linear-gradient(135deg, var(--clr-danger) 0%, #d45546 100%);
  border-color: transparent;
  box-shadow: 0 12px 22px rgba(192, 57, 43, 0.20);
}

.alert {
  border-radius: 14px;
}

.items-grid {
  gap: var(--sp-5);
}

.item-card {
  border: 1px solid rgba(234, 214, 223, 0.88);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-sm);
}

.item-card:hover {
  transform: translateY(-6px);
}

.item-photo {
  background: linear-gradient(180deg, #eef5f1 0%, #e3ede7 100%);
}

.badge {
  background: rgba(180, 93, 127, 0.10);
  letter-spacing: 0.04em;
}

.dashboard-shell {
  display: grid;
  gap: var(--sp-5);
}

.dashboard-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(260px, 0.8fr);
  gap: var(--sp-5);
  padding: var(--sp-8);
  border-radius: 28px;
  background: linear-gradient(135deg, rgba(67, 42, 58, 0.97) 0%, rgba(180, 93, 127, 0.92) 56%, rgba(228, 165, 116, 0.78) 100%);
  color: #fff;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

.dashboard-hero::after {
  content: "";
  position: absolute;
  inset: auto -80px -80px auto;
  width: 240px;
  height: 240px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.dashboard-hero-copy,
.hero-aside {
  position: relative;
  z-index: 1;
}

.dashboard-hero-copy {
  display: grid;
  gap: var(--sp-3);
}

.dashboard-hero-copy h1 {
  font-size: clamp(2rem, 4vw, 3.4rem);
  color: #fff;
  letter-spacing: -0.05em;
}

.dashboard-hero-copy p {
  max-width: 60ch;
  color: rgba(255, 255, 255, 0.84);
  font-size: var(--fz-lg);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: rgba(255, 255, 255, 0.74);
}

.eyebrow::before {
  content: "";
  width: 18px;
  height: 1px;
  background: currentColor;
}

.hero-aside {
  display: grid;
  align-content: end;
  gap: var(--sp-3);
}

.hero-chip {
  padding: var(--sp-4);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(14px);
}

.hero-chip-label {
  display: block;
  font-size: var(--fz-xs);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.66);
  margin-bottom: 8px;
}

.hero-chip strong {
  color: #fff;
  font-size: var(--fz-lg);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--sp-4);
}

.metric-card {
  display: grid;
  gap: 10px;
  padding: var(--sp-6);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(247, 250, 248, 0.96) 100%);
  border: 1px solid rgba(212, 225, 218, 0.92);
  box-shadow: var(--shadow-sm);
}

.metric-card-accent {
  background: linear-gradient(135deg, rgba(31, 122, 89, 0.95) 0%, rgba(24, 85, 64, 0.95) 100%);
  border-color: rgba(31, 122, 89, 0.25);
  color: #fff;
}

.metric-card-accent .metric-kicker,
.metric-card-accent .metric-unit,
.metric-card-accent .metric-note {
  color: rgba(255, 255, 255, 0.78);
}

.metric-kicker {
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 800;
  color: var(--clr-muted);
}

.metric-value {
  font-size: clamp(2rem, 3vw, 3rem);
  line-height: 1;
  letter-spacing: -0.05em;
  color: var(--clr-navy);
}

.metric-card-accent .metric-value {
  color: #fff;
}

.metric-unit {
  color: var(--clr-muted);
  font-weight: 700;
}

.metric-note {
  color: var(--clr-muted);
  max-width: 34ch;
}

.profile-layout,
.impact-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) 360px;
  gap: var(--sp-5);
  align-items: start;
}

.profile-side-panel,
.impact-side-panel {
  display: grid;
  gap: var(--sp-5);
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--sp-3);
}

.section-heading .eyebrow {
  color: var(--clr-primary);
}

.section-heading .eyebrow::before {
  background: currentColor;
}

.section-heading h2 {
  font-size: 1.35rem;
  letter-spacing: -0.03em;
}

.info-list,
.impact-list {
  display: grid;
  gap: var(--sp-3);
}

.info-row {
  display: grid;
  gap: 4px;
  padding: var(--sp-4);
  border-radius: 16px;
  background: var(--clr-surface-alt);
  border: 1px solid var(--clr-divider);
}

.info-row span {
  font-size: var(--fz-xs);
  color: var(--clr-muted);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-weight: 800;
}

.insight-list {
  display: grid;
  gap: var(--sp-3);
  padding-left: 1.1rem;
  color: var(--clr-muted);
}

.impact-row {
  padding: var(--sp-4) 0;
}

.impact-value {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(31, 122, 89, 0.10);
  color: var(--clr-primary-hover);
  font-size: var(--fz-sm);
  font-weight: 800;
}

.dashboard-alert {
  margin-top: calc(var(--sp-3) * -1);
}

@media (max-width: 820px) {
  .dashboard-hero,
  .metric-grid,
  .profile-layout,
  .impact-layout {
    grid-template-columns: 1fr;
  }

  .dashboard-hero {
    padding: var(--sp-6);
  }
}

/* Final polish */
.topbar {
  min-height: 64px;
}

.topbar nav {
  row-gap: 6px;
  flex-wrap: nowrap;
  justify-content: flex-end;
  margin-left: auto;
}

.topbar nav a {
  line-height: 1.35;
}

.topbar .topbar-logout {
  display: inline-flex;
  flex: 0 0 auto;
  width: auto;
}

.topbar .topbar-logout .btn {
  min-height: 38px;
  padding: 7px 14px;
  border-radius: 10px;
  line-height: 1;
  white-space: nowrap;
}

.alert {
  line-height: 1.65;
}

.btn {
  min-height: 42px;
  white-space: normal;
  text-align: center;
}

input,
select,
textarea,
button {
  font: inherit;
}

textarea {
  min-height: 132px;
}

@media (max-width: 1120px) {
  .topbar {
    height: auto;
    flex-wrap: wrap;
    padding: var(--sp-3) var(--sp-4);
    gap: var(--sp-2);
  }

  .topbar nav {
    display: none;
    width: 100%;
    margin-left: 0;
    flex-direction: column;
    align-items: stretch;
    padding: var(--sp-2) 0 var(--sp-1);
    border-top: 1px solid var(--clr-divider);
    gap: 2px;
  }

  .topbar nav.open {
    display: flex;
  }

  .topbar nav a {
    padding: var(--sp-2) var(--sp-3);
    border-radius: var(--r-md);
    font-size: var(--fz-base);
  }

  .nav-toggle {
    display: flex;
  }

  .topbar nav .topbar-logout,
  .topbar nav .topbar-logout .btn {
    width: 100%;
  }

  .topbar nav .topbar-logout {
    margin-top: var(--sp-1);
  }
}

@media (max-width: 820px) {
  .topbar {
    position: sticky;
    top: 0;
  }

  .topbar .muted {
    width: 100%;
    padding: 6px 10px;
    border-radius: 12px;
    background: var(--clr-primary-light);
  }

  .topbar nav .inline-form {
    display: block;
  }

  .topbar nav .inline-form .btn {
    justify-content: center;
  }

  .container {
    width: min(100% - 24px, 1160px);
  }
}

@media (max-width: 520px) {
  .btn,
  .action-row .btn,
  .list-card-actions .btn {
    width: 100%;
  }

  .alert,
  .soft-note,
  .empty-card {
    border-radius: 16px;
  }
}
