/* ─── Milbby Reviews · sistema de diseño ─── */
:root {
  --purple:      #5400BD;
  --purple-dark: #3B0085;
  --purple-soft: #EDE4FB;
  --purple-tint: #F7F3FD;
  --ink:         #1C1330;
  --muted:       #6B6480;
  --line:        #E4DEF0;
  --white:       #FFFFFF;

  --sem-green:   #2E9E5B;
  --sem-amber:   #E7A400;
  --sem-red:     #D34141;
  --star:        #F5A623;

  --radius-card: 12px;
  --radius-btn:  8px;
  --shadow-sm:   0 1px 2px rgba(28,19,48,.06);
  --shadow-md:   0 4px 16px rgba(28,19,48,.08);

  --font-display: 'Raleway', system-ui, sans-serif;
  --font-body:    'Inter', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--purple-tint);
  font-size: 15px;
  line-height: 1.5;
}
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; margin: 0; }
a { color: var(--purple); }
button { font-family: inherit; cursor: pointer; }

.hidden { display: none !important; }

/* ── Cabecera ── */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--purple-dark);
  color: var(--white);
  display: flex; align-items: center; gap: 20px;
  padding: 0 20px; height: 60px;
}
.topbar .brand {
  font-family: var(--font-display); font-weight: 700; font-size: 20px;
  display: flex; align-items: center; gap: 10px;
}
.topbar .brand .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--white); }
.topbar nav { display: flex; gap: 4px; margin-left: 12px; }
.topbar nav button {
  background: transparent; border: 0; color: rgba(255,255,255,.75);
  padding: 8px 14px; border-radius: var(--radius-btn); font-size: 14px; font-weight: 500;
}
.topbar nav button:hover { color: var(--white); background: rgba(255,255,255,.1); }
.topbar nav button.active { color: var(--white); background: rgba(255,255,255,.18); }
.topbar .spacer { flex: 1; }
.topbar .user { font-size: 13px; color: rgba(255,255,255,.8); display: flex; align-items: center; gap: 12px; }
.topbar .user button {
  background: rgba(255,255,255,.12); border: 0; color: var(--white);
  padding: 6px 12px; border-radius: var(--radius-btn); font-size: 13px;
}

.container { max-width: 1080px; margin: 0 auto; padding: 24px 20px 80px; }

/* ── Botones ── */
.btn {
  border: 0; border-radius: var(--radius-btn); padding: 10px 16px;
  font-size: 14px; font-weight: 600; background: var(--purple); color: var(--white);
  transition: filter .15s ease;
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.secondary { background: var(--white); color: var(--purple); border: 1px solid var(--purple); }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--purple-soft); color: var(--purple); }
.btn.danger { background: var(--white); color: var(--sem-red); border: 1px solid var(--sem-red); }
.btn.small { padding: 6px 12px; font-size: 13px; }

/* ── Filtros ── */
.filters {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-card);
  padding: 12px 14px; margin-bottom: 18px; box-shadow: var(--shadow-sm);
}
.filters select, .filters input {
  font-family: inherit; font-size: 14px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: var(--radius-btn); background: var(--white); color: var(--ink);
}
.filters .grow { flex: 1; }

/* ── Tarjeta de reseña con columna de semáforo ── */
.review {
  display: flex; background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius-card); margin-bottom: 12px; overflow: hidden; box-shadow: var(--shadow-sm);
}
.review .semaphore { width: 6px; flex: none; }
.review .semaphore.green { background: var(--sem-green); }
.review .semaphore.amber { background: var(--sem-amber); }
.review .semaphore.red   { background: var(--sem-red); }
.review .body { padding: 14px 16px; flex: 1; min-width: 0; }
.review .head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.review .stars { color: var(--star); letter-spacing: 1px; font-size: 15px; }
.review .author { font-weight: 600; }
.review .meta { color: var(--muted); font-size: 13px; }
.review .store-tag {
  font-size: 12px; font-weight: 600; color: var(--purple);
  background: var(--purple-soft); padding: 2px 8px; border-radius: 20px;
}
.review .comment { margin: 6px 0; color: var(--ink); white-space: pre-wrap; word-wrap: break-word; }
.review .comment.empty { color: var(--muted); font-style: italic; }
.review .replied {
  margin-top: 8px; padding: 10px 12px; background: var(--purple-tint);
  border-left: 3px solid var(--sem-green); border-radius: 6px; font-size: 14px;
}
.review .replied .label { font-size: 12px; font-weight: 600; color: var(--sem-green); text-transform: uppercase; letter-spacing: .5px; }
.review .actions { display: flex; gap: 8px; margin-top: 10px; }

.badge { font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 20px; color: var(--white); }
.badge.green { background: var(--sem-green); }
.badge.amber { background: var(--sem-amber); }
.badge.red   { background: var(--sem-red); }
.badge.gray  { background: var(--muted); }

/* ── Panel lateral de respuesta ── */
.drawer-backdrop {
  position: fixed; inset: 0; background: rgba(28,19,48,.45); z-index: 100;
  display: flex; justify-content: flex-end;
}
.drawer {
  width: min(520px, 100%); height: 100%; background: var(--white);
  padding: 22px; overflow-y: auto; box-shadow: var(--shadow-md);
  animation: slidein .2s ease;
}
@keyframes slidein { from { transform: translateX(30px); opacity: .6; } to { transform: none; opacity: 1; } }
.drawer h2 { font-size: 20px; margin-bottom: 4px; }
.drawer .close { position: absolute; top: 16px; right: 20px; background: 0; border: 0; font-size: 22px; color: var(--muted); }
.drawer .review-quote {
  background: var(--purple-tint); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; margin: 14px 0;
}
.drawer textarea {
  width: 100%; min-height: 150px; font-family: inherit; font-size: 14px; line-height: 1.5;
  padding: 12px; border: 1px solid var(--line); border-radius: 10px; resize: vertical; color: var(--ink);
}
.drawer .drawer-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.drawer .note { font-size: 12px; color: var(--muted); margin-top: 10px; }

/* ── KPIs ── */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 24px; }
.kpi-card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-card); padding: 18px; box-shadow: var(--shadow-sm); }
.kpi-card .num { font-family: var(--font-display); font-size: 34px; font-weight: 700; line-height: 1; }
.kpi-card .lbl { color: var(--muted); font-size: 13px; margin-top: 6px; }

table.kpi { width: 100%; border-collapse: collapse; background: var(--white); border-radius: var(--radius-card); overflow: hidden; box-shadow: var(--shadow-sm); }
table.kpi th, table.kpi td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); font-size: 14px; }
table.kpi th { background: var(--purple-soft); color: var(--purple-dark); font-weight: 600; font-size: 13px; }
table.kpi tr:last-child td { border-bottom: 0; }
.bar { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; min-width: 90px; }
.bar > span { display: block; height: 100%; background: var(--sem-green); }
.pct { font-weight: 600; font-variant-numeric: tabular-nums; }

.section-title { font-size: 18px; margin: 22px 0 12px; }

/* ── Login ── */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card {
  background: var(--white); border: 1px solid var(--line); border-radius: 16px;
  padding: 32px; width: 100%; max-width: 380px; box-shadow: var(--shadow-md);
}
.login-card .brand { font-family: var(--font-display); font-weight: 700; font-size: 24px; color: var(--purple-dark); text-align: center; margin-bottom: 6px; }
.login-card .sub { text-align: center; color: var(--muted); font-size: 14px; margin-bottom: 22px; }
.login-card label { display: block; font-size: 13px; font-weight: 600; margin: 12px 0 5px; }
.login-card input {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: var(--radius-btn);
  font-family: inherit; font-size: 15px;
}
.login-card .btn { width: 100%; margin-top: 20px; padding: 12px; }

/* ── Admin ── */
.admin-block { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-card); padding: 20px; margin-bottom: 18px; box-shadow: var(--shadow-sm); }
.admin-block h3 { font-size: 16px; margin-bottom: 12px; }
.status-line { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 14px; }
.form-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.form-row input, .form-row select { padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-btn); font-family: inherit; font-size: 14px; }

.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty .big { font-size: 40px; margin-bottom: 8px; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--white); padding: 12px 20px; border-radius: 10px;
  box-shadow: var(--shadow-md); z-index: 200; font-size: 14px; max-width: 90%;
}
.toast.err { background: var(--sem-red); }
.spinner { display: inline-block; width: 15px; height: 15px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .6s linear infinite; vertical-align: -2px; }
.btn.secondary .spinner, .btn.ghost .spinner { border-color: rgba(84,0,189,.3); border-top-color: var(--purple); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive ── */
@media (max-width: 640px) {
  .topbar { gap: 8px; padding: 0 12px; }
  .topbar .brand { font-size: 17px; }
  .topbar nav button { padding: 8px 10px; font-size: 13px; }
  .container { padding: 16px 12px 80px; }
  .drawer { width: 100%; }
}

*:focus-visible { outline: 2px solid var(--purple); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
