@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600&family=IBM+Plex+Mono:wght@500;600&display=swap');

:root {
  --bg: #F4F7F6;
  --surface: #FFFFFF;
  --ink: #16231F;
  --muted: #5B6B66;
  --border: #DCE3E0;
  --primary: #0E6E5D;
  --primary-dark: #0A4F43;
  --primary-tint: #E4F1EC;
  --amber: #C97A1A;
  --amber-tint: #FBEEDD;
  --danger: #B3261E;
  --danger-tint: #FBEAE9;
  --success: #2E7D5B;
  --radius: 10px;
  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .brand {
  font-family: var(--font-display);
  letter-spacing: -0.01em;
}

a { color: inherit; }

button {
  font-family: var(--font-body);
  cursor: pointer;
}

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

/* ---------- Layout de autenticación ---------- */

.auth-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
}

/* Panel de marca (izquierda) */

.auth-brand-panel {
  position: relative;
  background: var(--primary-dark);
  background-image:
    radial-gradient(circle at 15% 15%, rgba(255,255,255,0.06) 0, transparent 45%),
    repeating-linear-gradient(-45deg, rgba(255,255,255,0.035) 0 1px, transparent 1px 26px);
  color: #EAF4EF;
  display: flex;
  align-items: center;
  overflow: hidden;
}

.brand-panel-inner {
  padding: 64px 64px;
  max-width: 480px;
}

.auth-brand-panel .auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 56px;
}

.auth-brand-panel .mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #EAF4EF;
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
}

.auth-brand-panel .auth-brand span {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand-headline {
  font-family: var(--font-display);
  font-size: 40px;
  line-height: 1.12;
  font-weight: 700;
  margin: 0 0 18px;
  color: #FFFFFF;
}

.brand-sub {
  font-size: 15px;
  line-height: 1.55;
  color: #BFDCD0;
  margin: 0 0 32px;
  max-width: 380px;
}

.brand-stamp-row {
  display: flex;
  gap: 10px;
  margin-bottom: 36px;
}

.brand-stamp-row .stamp {
  background: rgba(255,255,255,0.06);
}
.brand-stamp-row .stamp.ok { color: #7FDCB1; }
.brand-stamp-row .stamp.ko { color: #F0A39C; }

.brand-features {
  list-style: none;
  margin: 0;
  padding: 22px 0 0;
  border-top: 1px solid rgba(255,255,255,0.14);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.brand-features li {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13.5px;
  color: #D6ECE3;
}

.brand-features .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #7FDCB1;
  flex-shrink: 0;
}

/* Panel del formulario (derecha) */

.auth-form-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px 36px;
}

.auth-card h1 {
  font-size: 22px;
  margin: 0 0 4px;
}

.auth-card p.subtitle {
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 24px;
}

@media (max-width: 860px) {
  .auth-screen { grid-template-columns: 1fr; }
  .auth-brand-panel { display: none; }
  .auth-form-panel { padding: 24px; }
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--ink);
}

.field input, .field select, .field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 14px;
  background: var(--surface);
  color: var(--ink);
}

.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--primary);
}

.btn-primary {
  width: 100%;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 11px 16px;
  font-size: 14px;
  font-weight: 600;
  margin-top: 4px;
}

.btn-primary:hover { background: var(--primary-dark); }

.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 600;
}

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

.auth-switch {
  text-align: center;
  margin-top: 18px;
  font-size: 13px;
  color: var(--muted);
}

.auth-switch button {
  background: none;
  border: none;
  color: var(--primary);
  font-weight: 600;
  font-size: 13px;
  padding: 0;
}

.error-msg {
  background: var(--danger-tint);
  color: var(--danger);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 16px;
}

/* ---------- Layout de la app ---------- */

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

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
}

.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px;
  margin-bottom: 28px;
}

.sidebar .brand .mark {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 14px;
}

.sidebar .brand span { font-size: 16px; font-weight: 700; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  background: none;
  border: none;
  text-align: left;
  width: 100%;
  margin-bottom: 2px;
}

.nav-item:hover { background: var(--bg); color: var(--ink); }
.nav-item.active { background: var(--primary-tint); color: var(--primary-dark); font-weight: 600; }

.sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.org-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.org-role {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}

.main {
  padding: 32px 40px;
  max-width: 1100px;
}

.main-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.main-header h1 { font-size: 24px; margin: 0; }
.main-header p { color: var(--muted); font-size: 14px; margin: 4px 0 0; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}

.card h2 {
  font-size: 15px;
  margin: 0 0 16px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.checkbox-row input { width: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  text-align: left;
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 10px 10px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 12.5px;
}

td.no-mono { font-family: var(--font-body); }

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

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
  font-size: 14px;
}

/* ---------- Sello de conformidad (elemento distintivo) ---------- */

.stamp {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 92px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1.5px dashed currentColor;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transform: rotate(-2deg);
}

.stamp.ok { color: var(--success); background: #EFF7F2; }
.stamp.ko { color: var(--danger); background: var(--danger-tint); }

.top-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.icon-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--muted);
}

.icon-btn:hover { color: var(--danger); border-color: var(--danger); }

.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}

.kpi .value {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
}

.kpi .label {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 2px;
}

.hidden { display: none !important; }

@media (max-width: 800px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    flex-direction: row;
    justify-content: space-around;
    padding: 8px;
    border-right: none;
    border-top: 1px solid var(--border);
    z-index: 10;
  }
  .sidebar .brand, .sidebar-footer { display: none; }
  .nav-item { flex-direction: column; font-size: 10px; gap: 3px; padding: 6px; }
  .main { padding: 20px; padding-bottom: 90px; }
}
