/* ==========================================================
   Portal Montironi — línea visual de repuestos.montironi.com
   Negro, blanco y grises, con el amarillo como acento puntual.
   ========================================================== */

:root {
  --bg: #000000;
  --bg-elevated: #0b0b0b;
  --surface: #111111;
  --surface-2: #171717;
  --surface-hover: #1c1c1c;
  --border: #262626;
  --border-strong: #3a3a3a;
  --text: #fafafa;
  --text-muted: #a3a3a3;
  --text-subtle: #737373;
  --accent: #facc15;
  --ok: #4ade80;

  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 16px;

  --font: 'Roboto', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --container: 1200px;
  --gutter: clamp(16px, 4vw, 40px);
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
p {
  margin: 0;
}

button {
  font: inherit;
}

svg {
  display: block;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.logo {
  display: block;
  height: 22px;
  width: auto;
}

.accent-bar {
  display: block;
  width: 70px;
  height: 4px;
  border-radius: 2px;
  background: var(--accent);
}

.lead {
  color: #d4d4d4;
  font-size: clamp(16px, 1.6vw, 19px);
  max-width: 34ch;
}

/* ==========================================================
   LOGIN
   ========================================================== */

.login-page {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
  overflow-x: hidden;
}

.login-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(1200px 700px at 15% 60%, rgba(255, 255, 255, 0.07), transparent 60%),
    radial-gradient(900px 600px at 90% 10%, rgba(255, 255, 255, 0.05), transparent 60%),
    linear-gradient(180deg, #050505 0%, #000 100%);
}

/* Trama sutil tipo plano técnico */
.login-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 80% 70% at 30% 50%, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 30% 50%, #000 30%, transparent 75%);
}

/*
  Para usar la misma foto de fondo que repuestos.montironi.com,
  copiala a public/img/login-bg.jpg y descomentá esto:

.login-bg {
  background:
    linear-gradient(90deg, rgba(0,0,0,.85) 0%, rgba(0,0,0,.55) 100%),
    url('/img/login-bg.jpg') center / cover no-repeat;
  filter: grayscale(1);
}
.login-bg::after { display: none; }
*/

.login-header {
  padding: 40px var(--gutter) 0;
}

.login-header .logo {
  height: 24px;
}

.login-main {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 480px);
  align-items: center;
  gap: clamp(32px, 6vw, 96px);
  width: 100%;
  max-width: 1440px;
  margin-inline: auto;
  padding: 48px var(--gutter);
}

.login-hero {
  display: grid;
  gap: 22px;
  padding-left: clamp(0px, 5vw, 100px);
}

.eyebrow {
  color: var(--text-subtle);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.login-hero h1 {
  font-size: clamp(34px, 4.4vw, 58px);
  font-weight: 700;
  line-height: 1.06;
  letter-spacing: -0.02em;
  max-width: 15ch;
}

.login-card {
  background: #ffffff;
  color: #0a0a0a;
  border-radius: var(--radius-lg);
  padding: clamp(28px, 3vw, 40px);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
}

.login-card h2 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.login-card-sub {
  margin-top: 6px;
  color: #525252;
  font-size: 15px;
}

.google-button-slot {
  display: flex;
  justify-content: center;
  min-height: 44px;
  margin-top: 28px;
  transition: opacity 0.2s;
}

.google-button-slot.is-loading {
  opacity: 0.4;
  pointer-events: none;
}

.google-button-placeholder {
  display: grid;
  place-items: center;
  width: 100%;
  height: 44px;
  border: 1px solid #e5e5e5;
  border-radius: var(--radius-sm);
  color: #a3a3a3;
  font-size: 14px;
}

.login-error {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: #fef2f2;
  color: #b91c1c;
  font-size: 14px;
}

.login-card-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid #ececec;
  color: #737373;
  font-size: 14px;
}

.login-card-foot strong {
  color: #0a0a0a;
  font-weight: 500;
}

.login-footer {
  padding: 24px var(--gutter) 32px;
  color: var(--text-subtle);
  font-size: 13px;
}

@media (max-width: 900px) {
  .login-header {
    padding-top: 28px;
  }

  .login-main {
    grid-template-columns: 1fr;
    align-content: center;
    padding-block: 32px;
  }

  .login-hero {
    padding-left: 0;
    gap: 16px;
  }

  .login-card h2 {
    font-size: 24px;
  }
}

/* ==========================================================
   PORTAL
   ========================================================== */

.portal-page {
  background:
    radial-gradient(1000px 500px at 50% -120px, rgba(255, 255, 255, 0.06), transparent 70%),
    var(--bg);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 68px;
}

.topbar-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  color: inherit;
  text-decoration: none;
  min-width: 0;
}

.topbar-logo .logo {
  height: 18px;
}

.topbar-divider {
  width: 1px;
  height: 20px;
  background: var(--border-strong);
}

.topbar-label {
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.user-info {
  display: grid;
  text-align: right;
  line-height: 1.25;
  min-width: 0;
}

.user-name {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-email {
  color: var(--text-subtle);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.icon-button {
  display: grid;
  place-items: center;
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.icon-button:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
  color: var(--text);
}

.portal-main {
  padding-top: clamp(40px, 6vw, 72px);
  padding-bottom: 64px;
}

.portal-hero {
  display: grid;
  gap: 18px;
  margin-bottom: 40px;
}

.portal-hero h1 {
  font-size: clamp(34px, 4.5vw, 52px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.05;
}

.portal-hero .lead {
  color: var(--text-muted);
  max-width: none;
}

/* ---------- Toolbar ---------- */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  margin-bottom: 36px;
}

.search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 280px;
  max-width: 380px;
}

.search-icon {
  position: absolute;
  left: 14px;
  color: var(--text-subtle);
  pointer-events: none;
}

.search input {
  width: 100%;
  height: 44px;
  padding: 0 44px 0 42px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  transition: border-color 0.15s, background 0.15s;
}

.search input::placeholder {
  color: var(--text-subtle);
}

.search input:focus {
  outline: none;
  border-color: var(--text-muted);
  background: var(--surface-2);
}

.search input::-webkit-search-cancel-button {
  display: none;
}

.search-kbd {
  position: absolute;
  right: 12px;
  display: grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  color: var(--text-subtle);
  font-family: inherit;
  font-size: 12px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  height: 36px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.chip:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.chip.is-active {
  background: var(--text);
  border-color: var(--text);
  color: #000;
}

/* ---------- Secciones ---------- */

.section-title {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.count {
  color: var(--text-subtle);
  letter-spacing: 0;
}

.section-note {
  color: var(--text-subtle);
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}

/* ---------- Tarjetas ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 16px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 220px;
  padding: 24px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg-elevated) 100%);
  color: inherit;
  text-decoration: none;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

a.card:hover {
  transform: translateY(-3px);
  border-color: #525252;
  background: linear-gradient(180deg, var(--surface-hover) 0%, var(--surface) 100%);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.6);
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.card-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

a.card:hover .card-icon {
  background: var(--text);
  border-color: var(--text);
  color: #000;
}

.badge {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.badge-testing {
  background: rgba(250, 204, 21, 0.1);
  border: 1px solid rgba(250, 204, 21, 0.35);
  color: var(--accent);
}

.badge-pending {
  border: 1px dashed var(--border-strong);
  color: var(--text-subtle);
}

.card-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.card-desc {
  color: var(--text-muted);
  font-size: 14.5px;
  line-height: 1.55;
}

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  font-size: 13px;
}

.card-area {
  color: var(--text-subtle);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 11.5px;
}

.card-link {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--text-muted);
}

.card-arrow {
  flex: none;
  transition: transform 0.2s ease, color 0.2s ease;
}

a.card:hover .card-link {
  color: var(--text);
}

a.card:hover .card-arrow {
  transform: translate(2px, -2px);
  color: var(--accent);
}

.card-disabled {
  border-style: dashed;
  background: transparent;
}

.card-disabled .card-icon,
.card-disabled .card-title {
  color: var(--text-subtle);
}

.card-disabled .card-desc {
  color: #5c5c5c;
}

.empty {
  padding: 48px 0;
  color: var(--text-subtle);
  text-align: center;
}

/* ---------- Automatizaciones ---------- */

.services {
  margin-top: 64px;
}

.services-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 460px), 1fr));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--border);
  gap: 1px;
}

.service {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 20px;
  background: var(--bg-elevated);
}

.service-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.service-body {
  flex: 1;
  min-width: 0;
}

.service-body h3 {
  font-size: 15px;
  font-weight: 500;
}

.service-body p {
  margin-top: 2px;
  color: var(--text-subtle);
  font-size: 13.5px;
}

.service-status {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
  color: var(--text-subtle);
  font-size: 12px;
  white-space: nowrap;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.15);
}

.portal-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-top: 24px;
  padding-bottom: 32px;
  border-top: 1px solid var(--border);
  color: var(--text-subtle);
  font-size: 13px;
}

@media (max-width: 640px) {
  .topbar-inner {
    height: 60px;
  }

  .topbar-label,
  .topbar-divider,
  .user-info {
    display: none;
  }

  .search {
    max-width: none;
    flex-basis: 100%;
  }

  .search-kbd {
    display: none;
  }

  .chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    margin-inline: calc(var(--gutter) * -1);
    padding-inline: var(--gutter);
    scrollbar-width: none;
  }

  .chips::-webkit-scrollbar {
    display: none;
  }

  .chip {
    flex: none;
  }

  .card {
    min-height: 0;
    padding: 20px;
  }

  .service-status {
    display: none;
  }

  .portal-footer {
    flex-direction: column;
    gap: 4px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
  }
}
