/* =====================================================================
 * Caiman Interactive · Portal design system
 * Premium identity (mint accent, glass surfaces, soft orbs, sidebar layout)
 * ===================================================================== */

:root {
  --bg: #04060a;
  --bg-soft: #070b12;
  --bg-deep: #02040a;
  --surface: #0b0f17;
  --surface2: #121823;
  --surface3: #1a2231;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --mint: #5afca6;
  --mint-2: #28e489;
  --mint-soft: #88ffd4;
  --mint-dim: rgba(90, 252, 166, 0.12);
  --mint-glow: rgba(90, 252, 166, 0.32);
  --naranja: #ffb347;
  --rojo: #ff5c5c;
  --azul: #69a7ff;
  --pink: #ff5fd7;
  --muted: #8895ad;
  --muted-2: #6b7790;
  --text: #d6dfee;
  --heading: #f5f8ff;
  --shadow-mint: 0 18px 40px -22px rgba(90, 252, 166, 0.6);
  --shadow-card: 0 22px 60px -28px rgba(0, 0, 0, 0.85);
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 22px;
  --radius-pill: 999px;
  --sidebar-w: 256px;
  --header-h: 68px;
  --space-grotesk: "Space Grotesk", system-ui, sans-serif;
  --inter: "Inter", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

[data-theme="light"] {
  --bg: #f3f6fb;
  --bg-soft: #ffffff;
  --bg-deep: #e9eef6;
  --surface: #ffffff;
  --surface2: #eef2f8;
  --surface3: #e0e6f0;
  --border: rgba(8, 17, 31, 0.08);
  --border-strong: rgba(8, 17, 31, 0.16);
  --mint: #00a85a;
  --mint-2: #00c96b;
  --mint-soft: #5afca6;
  --mint-dim: rgba(0, 168, 90, 0.10);
  --mint-glow: rgba(0, 168, 90, 0.22);
  --naranja: #d97706;
  --rojo: #dc2626;
  --azul: #2563eb;
  --pink: #be185d;
  --muted: #5a6478;
  --muted-2: #7d8597;
  --text: #1c2536;
  --heading: #07101f;
  --shadow-mint: 0 14px 30px -16px rgba(0, 168, 90, 0.45);
  --shadow-card: 0 14px 40px -22px rgba(8, 17, 31, 0.18);
}

* { box-sizing: border-box; }
*::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--inter);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Subtle ambient orbs for the entire portal background */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(900px circle at 8% 6%, rgba(90, 252, 166, 0.10), transparent 55%),
    radial-gradient(800px circle at 92% 12%, rgba(40, 228, 137, 0.06), transparent 55%),
    radial-gradient(700px circle at 70% 95%, rgba(105, 167, 255, 0.05), transparent 55%);
}

[data-theme="light"] body::before {
  background:
    radial-gradient(900px circle at 8% 6%, rgba(0, 168, 90, 0.06), transparent 55%),
    radial-gradient(800px circle at 92% 12%, rgba(0, 200, 130, 0.05), transparent 55%),
    radial-gradient(700px circle at 70% 95%, rgba(37, 99, 235, 0.04), transparent 55%);
}

h1, h2, h3, h4, .display {
  font-family: var(--space-grotesk);
  color: var(--heading);
  font-weight: 700;
  letter-spacing: -0.022em;
  margin: 0;
}

.mono, .badge, code, .section-number, .stat-num {
  font-family: var(--mono);
}

a {
  color: var(--mint);
  text-decoration: none;
  transition: color 0.18s ease;
}
a:hover { text-decoration: underline; }

p { margin: 0 0 0.75rem; }

/* =====================================================================
 * APP SHELL  ─  sidebar + topbar + main + footer
 * ===================================================================== */

.layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: 1fr;
  min-height: 100vh;
}

/* Sidebar -------------------------------------------------------------- */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.25rem 1rem;
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg-soft) 100%);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 999px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 0.65rem 1.25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.85rem;
}

.sidebar-brand .brand-mark {
  position: relative;
  flex-shrink: 0;
}

.sidebar-brand .brand-mark::after {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 18px;
  background: radial-gradient(circle at center, var(--mint-glow), transparent 70%);
  filter: blur(14px);
  opacity: 0.7;
  z-index: -1;
}

.sidebar-brand img {
  display: block;
  height: 64px;
  width: auto;
  border-radius: 14px;
  border: 1px solid rgba(90, 252, 166, 0.22);
  background: var(--bg-deep);
  padding: 6px;
  box-shadow: 0 12px 28px -16px rgba(0, 0, 0, 0.6);
  transition: transform 0.4s ease;
}

[data-theme="light"] .sidebar-brand img {
  background: #ffffff;
  border-color: rgba(0, 168, 90, 0.28);
}

.sidebar-brand a:hover img { transform: rotate(-2deg) scale(1.02); }

.sidebar-brand .brand-words {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
  min-width: 0;
}

.sidebar-brand .brand-words .name {
  font-family: var(--space-grotesk);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--heading);
  letter-spacing: -0.02em;
}

.sidebar-brand .brand-words .role {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.28em;
  color: var(--mint);
  margin-top: 4px;
}

.sidebar-section-label {
  padding: 0.6rem 0.85rem 0.35rem;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--muted-2);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0.85rem;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid transparent;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.sidebar-link:hover {
  color: var(--heading);
  background: var(--surface2);
  text-decoration: none;
}

.sidebar-link.active {
  color: var(--heading);
  background: linear-gradient(135deg, var(--mint-dim), transparent 80%);
  border-color: rgba(90, 252, 166, 0.28);
  box-shadow: inset 2px 0 0 var(--mint);
}

[data-theme="light"] .sidebar-link.active {
  border-color: rgba(0, 168, 90, 0.32);
}

.sidebar-link .ico {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  color: currentColor;
}

.sidebar-link .ico svg {
  width: 18px;
  height: 18px;
}

.sidebar-spacer { flex: 1; }

/* Topbar (in client area) --------------------------------------------- */
.app-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1.5rem;
  min-height: var(--header-h);
  background: rgba(11, 15, 23, 0.78);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border-bottom: 1px solid var(--border);
}

[data-theme="light"] .topbar {
  background: rgba(255, 255, 255, 0.88);
}

.topbar-burger {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--heading);
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.topbar-page-info {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  min-width: 0;
}

.topbar-page-info .crumb {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.topbar-page-info .page-title-inline {
  font-family: var(--space-grotesk);
  font-weight: 700;
  color: var(--heading);
  font-size: 1.05rem;
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60vw;
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius-pill);
  background: var(--surface2);
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--heading);
  font-size: 0.85rem;
  font-weight: 600;
  max-width: 220px;
}

.user-chip .avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--space-grotesk);
  font-weight: 700;
  font-size: 0.75rem;
  color: var(--bg-deep);
  background: linear-gradient(135deg, var(--mint), var(--mint-soft));
  overflow: hidden;
  flex-shrink: 0;
}

.user-chip .avatar.has-img {
  background: var(--surface3);
  padding: 0;
}

.user-chip .avatar.has-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
  flex-shrink: 0;
}

.user-chip .meta {
  display: flex;
  flex-direction: column;
  line-height: 1;
  min-width: 0;
}

.user-chip .meta .who {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 130px;
}

.user-chip .meta .plan {
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--mint);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-top: 3px;
}

[data-theme="light"] .user-chip .avatar { color: #fff; }

.lang-picker {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-family: var(--mono);
}

.lang-picker a, .lang-picker button {
  padding: 5px 10px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  border-radius: var(--radius-pill);
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  text-transform: uppercase;
  transition: background 0.16s ease, color 0.16s ease;
}

.lang-picker a:hover, .lang-picker button:hover {
  color: var(--heading);
  text-decoration: none;
}

.lang-picker a.active, .lang-picker button.active {
  background: var(--mint);
  color: var(--bg-deep);
  box-shadow: 0 4px 14px -8px var(--mint-glow);
}

[data-theme="light"] .lang-picker a.active,
[data-theme="light"] .lang-picker button.active {
  color: #fff;
}

.theme-toggle-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--heading);
  cursor: pointer;
  font-size: 1.05rem;
  display: grid;
  place-items: center;
  transition: background 0.16s ease, transform 0.16s ease;
}

.theme-toggle-btn:hover {
  background: var(--surface3);
  transform: translateY(-1px);
}

/* Main content -------------------------------------------------------- */
.main {
  width: 100%;
  max-width: 1300px;
  margin: 0 auto;
  padding: 1.75rem 1.75rem 3rem;
  flex: 1;
}

/* Footer -------------------------------------------------------------- */
.footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  text-align: center;
  padding: 1rem 1.25rem;
  font-size: 0.78rem;
  color: var(--muted);
}

/* =====================================================================
 * MOBILE  (sidebar becomes a slide-in drawer)
 * ===================================================================== */
@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .topbar-burger { display: inline-flex; }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 70;
    width: min(86vw, 320px);
    transform: translateX(-110%);
    transition: transform 0.28s ease;
    box-shadow: 0 30px 60px -10px rgba(0, 0, 0, 0.6);
  }

  body.has-sidebar-open .sidebar { transform: translateX(0); }

  body.has-sidebar-open::after {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 65;
  }
}

@media (max-width: 540px) {
  .topbar { padding: 0.75rem 1rem; }
  .main { padding: 1.25rem 1rem 2rem; }
  .user-chip .meta { display: none; }
  .topbar-page-info .page-title-inline { max-width: 40vw; }
}

/* =====================================================================
 * PAGE TITLE BLOCK
 * ===================================================================== */

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.page-head .lead {
  flex: 1 1 320px;
  min-width: 0;
}

.page-title {
  font-size: 2rem;
  margin-bottom: 0.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(180deg, var(--heading) 0%, var(--muted) 130%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.page-subtitle {
  color: var(--muted);
  margin-bottom: 0;
  font-size: 0.95rem;
  max-width: 60ch;
}

/* =====================================================================
 * CARDS
 * ===================================================================== */

.card {
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg-soft) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.4rem 1.45rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-card);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.card.hoverable:hover {
  border-color: rgba(90, 252, 166, 0.25);
  transform: translateY(-2px);
}

.card.ok {
  border-color: rgba(90, 252, 166, 0.35);
  background: linear-gradient(135deg, var(--surface) 0%, var(--mint-dim) 130%);
}

.card.warn {
  border-color: rgba(255, 179, 71, 0.32);
  background: linear-gradient(135deg, var(--surface) 0%, rgba(255, 179, 71, 0.08) 130%);
}

.card.bad {
  border-color: rgba(255, 92, 92, 0.32);
  background: linear-gradient(135deg, var(--surface) 0%, rgba(255, 92, 92, 0.06) 130%);
}

.card.glass {
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0));
  border-color: var(--border-strong);
}

.card-title {
  margin: 0 0 0.55rem 0;
  font-size: 1.05rem;
  font-weight: 700;
  font-family: var(--space-grotesk);
  letter-spacing: -0.01em;
}

/* =====================================================================
 * BADGES & PILLS
 * ===================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.22rem 0.55rem;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: 1px solid var(--border);
  color: var(--muted);
  background: var(--surface2);
}

.badge.ok {
  color: var(--mint);
  border-color: rgba(90, 252, 166, 0.35);
  background: var(--mint-dim);
}

[data-theme="light"] .badge.ok {
  background: rgba(0, 168, 90, 0.10);
  border-color: rgba(0, 168, 90, 0.28);
}

.badge.warn {
  color: var(--naranja);
  border-color: rgba(255, 179, 71, 0.32);
  background: rgba(255, 179, 71, 0.10);
}

.badge.bad {
  color: var(--rojo);
  border-color: rgba(255, 92, 92, 0.32);
  background: rgba(255, 92, 92, 0.08);
}

.pill-soft {
  display: inline-block;
  padding: 0.18rem 0.6rem;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
}

.plan-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  font-family: var(--mono);
  font-weight: 600;
  background: var(--mint-dim);
  color: var(--mint);
  border: 1px solid rgba(90, 252, 166, 0.28);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* =====================================================================
 * BUTTONS
 * ===================================================================== */

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.25rem;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  background: linear-gradient(135deg, var(--mint) 0%, var(--mint-2) 100%);
  color: #04060a;
  box-shadow: var(--shadow-mint);
  transition: transform 0.18s ease, box-shadow 0.2s ease, filter 0.18s ease;
  text-decoration: none;
}

.btn-primary:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
  text-decoration: none;
  box-shadow: 0 22px 50px -22px var(--mint-glow);
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  filter: none;
  transform: none;
}

[data-theme="light"] .btn-primary { color: #fff; }

.btn-secondary, .btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  background: var(--surface2);
  color: var(--heading);
  border: 1px solid var(--border);
  text-decoration: none;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease, transform 0.18s ease;
}

.btn-secondary:hover, .btn-ghost:hover {
  background: var(--surface3);
  border-color: var(--border-strong);
  text-decoration: none;
  transform: translateY(-1px);
}

.btn-ghost { background: transparent; }

.btn-danger {
  border-color: rgba(255, 92, 92, 0.32);
  color: var(--rojo);
}

.btn-danger:hover {
  background: rgba(255, 92, 92, 0.08);
  border-color: rgba(255, 92, 92, 0.5);
}

.btn-row { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }

/* =====================================================================
 * FORMS  (unified input style)
 * ===================================================================== */

label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.35rem;
  letter-spacing: 0.02em;
}

input:not([type]),
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="url"],
input[type="date"],
input[type="datetime-local"],
input[type="month"],
input[type="time"],
input[type="week"],
input[type="search"],
select,
textarea {
  width: 100%;
  max-width: 100%;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--heading);
  font-family: inherit;
  font-size: 0.92rem;
  line-height: 1.4;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
  appearance: none;
  -webkit-appearance: none;
}

input::placeholder, textarea::placeholder {
  color: var(--muted-2);
  opacity: 1;
}

input:hover, select:hover, textarea:hover {
  border-color: var(--border-strong);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--mint);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--mint-dim);
}

/* Browser autofill — neutralise the white WebKit background */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active,
textarea:-webkit-autofill,
select:-webkit-autofill {
  -webkit-text-fill-color: var(--heading) !important;
  -webkit-box-shadow: 0 0 0 1000px var(--surface) inset !important;
  box-shadow: 0 0 0 1000px var(--surface) inset !important;
  caret-color: var(--mint);
  transition: background-color 5000s ease-in-out 0s;
  background-clip: content-box !important;
  border-color: var(--border) !important;
}

input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px var(--surface) inset, 0 0 0 3px var(--mint-dim) !important;
  box-shadow: 0 0 0 1000px var(--surface) inset, 0 0 0 3px var(--mint-dim) !important;
  border-color: var(--mint) !important;
}

textarea {
  min-height: 110px;
  resize: vertical;
  font-family: inherit;
}

/* Custom select arrow */
select {
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 50%,
    calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 2.2rem;
}

[data-theme="light"] select {
  background-image:
    linear-gradient(45deg, transparent 50%, #5a6478 50%),
    linear-gradient(135deg, #5a6478 50%, transparent 50%);
}

/* File inputs (unified) */
input[type="file"] {
  width: 100%;
  border: 1px dashed var(--border-strong);
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.75rem;
  color: var(--muted);
  font-size: 0.85rem;
  cursor: pointer;
}

input[type="file"]::-webkit-file-upload-button {
  background: var(--surface2);
  color: var(--heading);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.4rem 0.85rem;
  margin-right: 0.75rem;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.82rem;
  transition: background 0.16s ease;
}

input[type="file"]::-webkit-file-upload-button:hover {
  background: var(--surface3);
}

input[type="file"]::file-selector-button {
  background: var(--surface2);
  color: var(--heading);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.4rem 0.85rem;
  margin-right: 0.75rem;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.82rem;
}

input[type="file"]:hover { border-color: var(--mint); color: var(--heading); }

/* Checkbox & radio refresh */
input[type="checkbox"], input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 1px solid var(--border-strong);
  background: var(--surface2);
  border-radius: 5px;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  margin-right: 6px;
  vertical-align: middle;
  transition: all 0.16s ease;
}

input[type="radio"] { border-radius: 50%; }

input[type="checkbox"]:checked, input[type="radio"]:checked {
  background: var(--mint);
  border-color: var(--mint);
}

input[type="checkbox"]:checked::after {
  content: "";
  width: 5px;
  height: 9px;
  border: solid var(--bg-deep);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-1px, -1px);
}

input[type="radio"]:checked::after {
  content: "";
  width: 7px;
  height: 7px;
  background: var(--bg-deep);
  border-radius: 50%;
}

[data-theme="light"] input[type="checkbox"]:checked::after { border-color: #fff; }
[data-theme="light"] input[type="radio"]:checked::after { background: #fff; }

.form-grid {
  display: grid;
  gap: 1rem;
}

.form-grid.cols-2 { grid-template-columns: 1fr 1fr; }
.form-grid.auto { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

@media (max-width: 640px) {
  .form-grid.cols-2, .form-grid.auto { grid-template-columns: 1fr; }
}

/* Disable native ugly OS form widgets */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] { -moz-appearance: textfield; }

/* =====================================================================
 * TABLES
 * ===================================================================== */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

table.wide {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

table.wide th, table.wide td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

table.wide th {
  font-family: var(--space-grotesk);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  background: var(--surface2);
  font-weight: 600;
}

table.wide tr:last-child td { border-bottom: none; }
table.wide tbody tr:hover td { background: var(--surface2); }

/* =====================================================================
 * FLASH messages
 * ===================================================================== */

.flash {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  background: var(--surface2);
  font-size: 0.9rem;
  line-height: 1.45;
}

.flash::before {
  content: "i";
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface3);
  color: var(--muted);
  font-family: var(--space-grotesk);
  font-weight: 700;
  font-size: 0.78rem;
}

.flash.bad {
  border-color: rgba(255, 92, 92, 0.32);
  color: var(--rojo);
  background: rgba(255, 92, 92, 0.08);
}

.flash.bad::before { background: rgba(255, 92, 92, 0.18); color: var(--rojo); content: "!"; }

.flash.ok {
  border-color: rgba(90, 252, 166, 0.32);
  color: var(--mint);
  background: var(--mint-dim);
}

.flash.ok::before { background: rgba(90, 252, 166, 0.22); color: var(--mint); content: "✓"; }

/* =====================================================================
 * DASHBOARD
 * ===================================================================== */

.section-number {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: inline-grid;
  place-items: center;
  font-size: 1.1rem;
  background: var(--mint-dim);
  border: 1px solid rgba(90, 252, 166, 0.22);
  color: var(--mint);
  margin-bottom: 0.7rem;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.grid-4 .card { margin-bottom: 0; }

.activity-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.activity-list li {
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
  color: var(--muted);
}

.activity-list li:last-child { border-bottom: none; }

.activity-list strong { color: var(--heading); }

/* =====================================================================
 * PROGRESS BAR
 * ===================================================================== */

.progress-bar {
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--surface2);
  overflow: hidden;
  margin-top: 0.6rem;
  border: 1px solid var(--border);
}

.progress-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--mint), var(--mint-soft));
  transition: width 0.4s ease;
}

.progress-bar.bar-warn > span {
  background: linear-gradient(90deg, var(--naranja), #ffd088);
}

.progress-bar.bar-danger > span {
  background: linear-gradient(90deg, var(--rojo), #ff9696);
}

/* =====================================================================
 * MODAL
 * ===================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
  backdrop-filter: blur(6px);
}

.modal-backdrop.show { display: flex; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  width: min(540px, 100%);
  max-height: 90vh;
  overflow: auto;
  padding: 1.6rem;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
}

/* =====================================================================
 * LOGIN PAGE
 * ===================================================================== */

.login-page {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
  overflow: hidden;
}

.login-page::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(700px circle at 12% 10%, rgba(90, 252, 166, 0.18), transparent 55%),
    radial-gradient(800px circle at 85% 90%, rgba(40, 228, 137, 0.12), transparent 55%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
}

.login-page::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse at center, black 10%, transparent 70%);
}

.login-card {
  position: relative;
  z-index: 1;
  width: min(440px, 100%);
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg-soft) 100%);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-strong);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  padding: 0;
}

.login-accent {
  height: 5px;
  width: 100%;
  background: linear-gradient(90deg, var(--mint), var(--mint-soft), var(--mint));
}

.login-body { padding: 2rem 2rem 2.25rem; }

.login-brand {
  text-align: center;
  margin-bottom: 1.4rem;
}

.login-brand .login-logo-wrap {
  position: relative;
  display: inline-block;
}

.login-brand .login-logo-wrap::after {
  content: "";
  position: absolute;
  inset: -16px;
  border-radius: 30px;
  background: radial-gradient(circle, var(--mint-glow), transparent 70%);
  filter: blur(20px);
  opacity: 0.85;
  z-index: -1;
}

.login-brand img {
  display: block;
  height: 100px;
  width: auto;
  margin: 0 auto;
  border-radius: 22px;
  border: 1px solid rgba(90, 252, 166, 0.28);
  background: var(--bg-deep);
  padding: 12px;
  box-shadow: 0 18px 40px -16px rgba(0, 0, 0, 0.7);
}

[data-theme="light"] .login-brand img {
  background: #fff;
  border-color: rgba(0, 168, 90, 0.32);
}

.login-brand .login-words {
  margin-top: 0.95rem;
}

.login-brand .login-words .name {
  font-family: var(--space-grotesk);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--heading);
  letter-spacing: -0.02em;
}

.login-brand .login-words .role {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.32em;
  color: var(--mint);
  margin-top: 4px;
}

.login-tagline {
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0.85rem 0 0;
  max-width: 32ch;
  margin-left: auto;
  margin-right: auto;
}

.login-langs {
  display: flex;
  justify-content: center;
  margin-top: 1.1rem;
  gap: 6px;
}

.login-langs a {
  padding: 5px 12px;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  border: 1px solid var(--border);
  background: var(--surface2);
  border-radius: var(--radius-pill);
  text-decoration: none;
  transition: all 0.16s ease;
}

.login-langs a:hover {
  color: var(--heading);
  border-color: var(--border-strong);
  text-decoration: none;
}

.login-langs a.active {
  color: var(--bg-deep);
  background: var(--mint);
  border-color: var(--mint);
}

[data-theme="light"] .login-langs a.active { color: #fff; }

/* =====================================================================
 * SPINNER
 * ===================================================================== */

.spinner {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--mint);
  animation: ci-spin 0.9s linear infinite;
  margin: 1rem auto;
}

@keyframes ci-spin {
  to { transform: rotate(360deg); }
}

/* =====================================================================
 * MISC
 * ===================================================================== */

.feedback-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.75rem;
}

.feedback-btns button {
  flex: 1 1 160px;
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--heading);
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.feedback-btns button:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.feedback-btns button.selected {
  border-color: var(--mint);
  background: var(--mint-dim);
  box-shadow: 0 0 0 1px var(--mint);
}

.metric-grid-inline {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.65rem;
  margin-top: 0.75rem;
}

.metric-box {
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 0.7rem 0.95rem;
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: 0.82rem;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.metric-box:hover {
  border-color: var(--border-strong);
  background: var(--surface3);
}

.admin-toggle {
  appearance: none;
  width: 44px;
  height: 26px;
  border-radius: var(--radius-pill);
  background: var(--surface2);
  border: 1px solid var(--border);
  position: relative;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.admin-toggle::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--heading);
  transition: transform 0.2s ease, background 0.18s ease;
}

.admin-toggle:checked {
  background: var(--mint-dim);
  border-color: var(--mint);
}

.admin-toggle:checked::after {
  transform: translateX(18px);
  background: var(--mint);
}

/* Helpful utility */
.muted { color: var(--muted); }
.row { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.spacer { flex: 1; }
.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }

/* Buttons cluster on tables */
table.wide td .btn-secondary,
table.wide td .btn-primary { padding: 0.45rem 0.85rem; font-size: 0.82rem; }

/* =====================================================================
 * AVATAR EDITOR (profile + admin client edit)
 * ===================================================================== */

.avatar-editor {
  display: grid;
  grid-template-columns: 116px 1fr;
  gap: 1.25rem;
  align-items: center;
}

.avatar-preview {
  width: 116px;
  height: 116px;
  border-radius: 50%;
  background: var(--surface2);
  border: 2px solid var(--border-strong);
  overflow: hidden;
  position: relative;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-card);
}

.avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.avatar-preview .initials {
  font-family: var(--space-grotesk);
  font-weight: 800;
  font-size: 2.4rem;
  letter-spacing: -0.01em;
  background: linear-gradient(135deg, var(--mint), var(--mint-soft));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.avatar-controls .btn-secondary[for] {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

@media (max-width: 560px) {
  .avatar-editor { grid-template-columns: 1fr; text-align: center; }
  .avatar-preview { margin: 0 auto; }
}

/* =====================================================================
 * GENERIC PORTAL MODAL (send-to-production, etc.)
 * ===================================================================== */

.ci-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(2, 4, 10, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.ci-modal.open {
  display: flex;
  animation: ci-modal-in 0.18s ease-out;
}

@keyframes ci-modal-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.ci-modal-box {
  width: 100%;
  max-width: 540px;
  max-height: calc(100vh - 2rem);
  overflow: auto;
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg-soft) 100%);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: 0 30px 90px -30px rgba(0, 0, 0, 0.85);
  padding: 1.5rem;
  position: relative;
}

.ci-modal-box .close {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--heading);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.ci-modal-box .close:hover {
  border-color: var(--mint);
  background: var(--surface3);
}

.ci-modal-box h3 {
  margin: 0 0 0.4rem;
  font-family: var(--space-grotesk);
  color: var(--heading);
  font-size: 1.2rem;
}

.ci-modal-box .subtitle {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.ci-modal-box .body {
  display: grid;
  gap: 0.85rem;
}

.ci-modal-box .actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 1.1rem;
}

.ci-modal-box .actions .btn-primary,
.ci-modal-box .actions .btn-secondary { flex: 1 1 0; min-width: 140px; justify-content: center; }

.ci-modal-box .selection-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.6rem;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface2);
  max-height: 130px;
  overflow: auto;
}

.ci-modal-box .selection-pills .pill {
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-pill);
  background: var(--mint-dim);
  border: 1px solid var(--mint);
  color: var(--mint);
  font-size: 0.78rem;
  font-family: var(--mono);
}

.ci-modal-box .count-line {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.ci-modal-box .count-line strong { color: var(--mint); }

/* Catalog "send to production" floating button */
.cat-send-bar {
  position: sticky;
  bottom: 1rem;
  z-index: 30;
  display: flex;
  justify-content: flex-end;
  pointer-events: none;
  margin-top: 1rem;
}

.cat-send-bar .btn-primary {
  pointer-events: auto;
  box-shadow: 0 18px 40px -18px var(--mint-glow);
}

.cat-send-bar .btn-primary[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}
