/* CAE Platform — estilos alineados con Next/Tailwind (globals.css), sin focus-ring
   para mejor compatibilidad con Edge. color-scheme evita inversiones raras del <select>. */

:root {
  color-scheme: light;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --emerald-400: #34d399;
  --emerald-500: #10b981;
  --emerald-600: #059669;
  --emerald-700: #047857;
  --emerald-800: #065f46;
  --emerald-900: #064e3b;
  --red-50: #fef2f2;
  --red-200: #fecaca;
  --red-600: #dc2626;
  --blue-100: #dbeafe;
  --blue-700: #1d4ed8;
  --green-50: #f0fdf4;
  --green-200: #bbf7d0;
  --green-600: #16a34a;
  --green-700: #15803d;
  --yellow-100: #fef9c3;
  --yellow-700: #a16207;
}

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

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--gray-900);
  background: var(--gray-50);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--emerald-600);
  font-weight: 500;
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* ——— Layout dashboard (sidebar) ——— */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--emerald-800);
  color: #fff;
  display: flex;
  flex-direction: column;
}

.sidebar__brand {
  padding: 1.25rem 1.1rem;
  border-bottom: 1px solid rgba(6, 78, 59, 0.45);
}

.sidebar__logo {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.sidebar__mark {
  width: 2rem;
  height: 2rem;
  background: var(--emerald-400);
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--emerald-900);
}

.sidebar__title {
  font-weight: 600;
  font-size: 0.9rem;
}

.sidebar__tagline {
  font-size: 0.7rem;
  color: #a7f3d0;
  margin: 0.35rem 0 0 2.55rem;
}

.sidebar__nav {
  flex: 1;
  padding: 0.75rem 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.sidebar__label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6ee7b7;
  padding: 0.35rem 0.75rem;
  margin-top: 0.35rem;
}

.sidebar__rule {
  border: 0;
  border-top: 1px solid rgba(6, 78, 59, 0.45);
  margin: 0.5rem 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #d1fae5;
  text-decoration: none;
}
.nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  text-decoration: none;
}

.nav-item--active {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-weight: 600;
}

.sidebar__user {
  padding: 1rem;
  border-top: 1px solid rgba(6, 78, 59, 0.45);
}

.sidebar__user-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.5rem;
}

.sidebar__avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: var(--emerald-500);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  flex-shrink: 0;
}

.sidebar__user-meta {
  min-width: 0;
}

.sidebar__user-name {
  font-size: 0.75rem;
  font-weight: 500;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar__user-email {
  font-size: 0.7rem;
  color: #a7f3d0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar__logout {
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  padding: 0;
  font-size: 0.7rem;
  color: #a7f3d0;
  cursor: pointer;
}
.sidebar__logout:hover {
  color: #fff;
}

.main-area {
  flex: 1;
  overflow: auto;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: #fff;
  border-bottom: 1px solid var(--gray-100);
  padding: 0.85rem 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar__status {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--gray-500);
}

.topbar__dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 999px;
  background: var(--emerald-500);
}

.topbar__rol {
  font-size: 0.75rem;
  color: var(--gray-400);
  text-transform: capitalize;
}

.content {
  padding: 1.75rem 2rem 2.5rem;
  max-width: 960px;
}

.content--wide {
  max-width: 1120px;
}

/* ——— Página pública (login / registro) ——— */
.public-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem;
  background: var(--gray-50);
}

.public-card {
  width: 100%;
  max-width: 28rem;
  background: #fff;
  border-radius: 1rem;
  border: 1px solid var(--gray-200);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  padding: 2rem;
}

.public-brand {
  text-align: center;
  margin-bottom: 1.75rem;
}

.public-brand__row {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.35rem;
}

.public-brand h1 {
  margin: 0.75rem 0 0.15rem;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gray-900);
}

.public-brand p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--gray-500);
}

/* ——— Componentes ——— */
.card {
  background: #fff;
  border-radius: 0.75rem;
  border: 1px solid var(--gray-100);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.card-pad {
  padding: 1.25rem 1.35rem;
}

.card-divide > * + * {
  border-top: 1px solid var(--gray-100);
}

.row-label {
  display: flex;
  gap: 1rem;
  padding: 0.65rem 1.1rem;
}

.row-label dt {
  width: 11rem;
  flex-shrink: 0;
  font-size: 0.875rem;
  color: var(--gray-500);
  margin: 0;
}

.row-label dd {
  margin: 0;
  font-size: 0.875rem;
  color: var(--gray-800);
}

.mono {
  font-family: ui-monospace, monospace;
  font-weight: 600;
}

.page-head {
  margin-bottom: 1.75rem;
}

.page-head h1,
.page-head h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gray-900);
}

.page-head p {
  margin: 0.25rem 0 0;
  font-size: 0.875rem;
  color: var(--gray-500);
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.875rem;
  color: var(--gray-400);
  margin-bottom: 1rem;
}
.breadcrumb a {
  color: var(--gray-400);
  font-weight: 400;
}
.breadcrumb a:hover {
  color: var(--gray-600);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.55rem 1.15rem;
  background: var(--emerald-600);
  color: #fff !important;
  border: 0;
  border-radius: 0.5rem;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  text-decoration: none !important;
}
.btn-primary:hover {
  background: var(--emerald-700);
  text-decoration: none !important;
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 1.15rem;
  border: 1px solid var(--emerald-600);
  color: var(--emerald-600) !important;
  background: #fff;
  border-radius: 0.5rem;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  text-decoration: none !important;
}
.btn-outline:hover {
  background: #ecfdf5;
  text-decoration: none !important;
}

.btn-sm {
  padding: 0.4rem 0.85rem;
  font-size: 0.8rem;
}

.btn-danger {
  background: #b91c1c;
  color: #fff !important;
  border: 0;
  border-radius: 0.5rem;
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  cursor: pointer;
}

.link-muted {
  color: var(--gray-400) !important;
  font-weight: 400;
  font-size: 0.875rem;
}

.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  font-size: 0.875rem;
  background: #fff;
  border: 1px solid var(--gray-100);
  border-radius: 0.75rem;
  overflow: hidden;
  border-collapse: collapse;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.data-table th {
  text-align: left;
  padding: 0.65rem 0.85rem;
  background: var(--gray-50);
  color: var(--gray-600);
  font-weight: 500;
}

.data-table td {
  padding: 0.65rem 0.85rem;
  border-top: 1px solid var(--gray-100);
  vertical-align: middle;
}

.data-table tr:hover td {
  background: #fafafa;
}

.truncate {
  max-width: 14rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Estados (píldoras) */
.estado {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.estado--borrador {
  background: var(--gray-100);
  color: var(--gray-600);
}
.estado--solicitado {
  background: var(--blue-100);
  color: var(--blue-700);
}
.estado--revision {
  background: var(--yellow-100);
  color: var(--yellow-700);
}
.estado--aprobado {
  background: var(--green-200);
  color: var(--green-700);
}
.estado--rechazado {
  background: var(--red-200);
  color: #991b1b;
}

/* Formularios — sin box-shadow ring (Edge) */
.field {
  margin-bottom: 1.1rem;
}

.field label,
.field .label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: 0.35rem;
}

.input,
select.select,
textarea.textarea {
  width: 100%;
  max-width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--gray-300);
  border-radius: 0.5rem;
  font-size: 0.875rem;
  background-color: #fff;
  color: var(--gray-900);
}

select.select {
  /* Nativo, colores explícitos para Edge / modo oscuro del SO */
  appearance: auto;
  -webkit-appearance: menulist;
  min-height: 2.65rem;
}

.input:focus-visible,
select.select:focus-visible,
textarea.textarea:focus-visible {
  outline: 2px solid var(--emerald-500);
  outline-offset: 1px;
  border-color: var(--emerald-500);
}

input[type="file"] {
  padding: 0.35rem 0;
  border: 0;
  font-size: 0.85rem;
}


.field-hint {
  font-size: 0.75rem;
  color: var(--gray-500);
  margin-top: 0.25rem;
}

.sector-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
}

@media (min-width: 520px) {
  .sector-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

.sector-pill {
  display: block;
  text-align: center;
  padding: 0.45rem 0.35rem;
  border-radius: 0.5rem;
  border: 1px solid var(--gray-300);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--gray-600) !important;
  text-decoration: none !important;
  background: #fff;
}
.sector-pill:hover {
  border-color: var(--emerald-400);
  background: #ecfdf5;
  text-decoration: none !important;
}

.sector-pill--active {
  background: var(--emerald-600);
  border-color: var(--emerald-600);
  color: #fff !important;
}

/* ——— Marketplace header (público) ——— */
.mercado-header {
  background: var(--emerald-800);
  color: #fff;
  padding: 1rem 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.mercado-header a {
  color: #a7f3d0 !important;
  font-size: 0.875rem;
}
.mercado-header a:hover {
  color: #fff !important;
}

/* Flash */
.flash {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
}

.flash li {
  padding: 0.55rem 0.85rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
}

.flash .ok {
  background: var(--green-50);
  border: 1px solid var(--green-200);
  color: var(--green-700);
}

.flash .error {
  background: var(--red-50);
  border: 1px solid var(--red-200);
  color: var(--red-600);
}

/* Dashboard home shortcuts */
.shortcut-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
}

@media (min-width: 720px) {
  .shortcut-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.shortcut {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 1.1rem;
  border-radius: 0.75rem;
  border: 1px solid var(--gray-100);
  background: #fff;
  text-decoration: none !important;
  color: inherit;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: border-color 0.15s, background 0.15s;
}
.shortcut:hover {
  border-color: #6ee7b7;
  background: rgba(236, 253, 245, 0.35);
}

.shortcut__icon {
  width: 2.65rem;
  height: 2.65rem;
  border-radius: 0.65rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.shortcut h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--gray-800);
}

.shortcut p {
  margin: 0.2rem 0 0;
  font-size: 0.8rem;
  color: var(--gray-500);
}

.shortcut__arrow {
  margin-left: auto;
  color: var(--gray-300);
  font-size: 1.1rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
  margin-bottom: 1.75rem;
}

@media (min-width: 720px) {
  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1.1rem;
}

.stat-card__icon {
  width: 2.65rem;
  height: 2.65rem;
  border-radius: 0.65rem;
  background: #ecfdf5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.stat-card__val {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
}

.stat-card__lbl {
  margin: 0.1rem 0 0;
  font-size: 0.7rem;
  color: var(--gray-500);
}

.section-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gray-700);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 0.65rem;
}

.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
}

.empty-state p {
  margin: 0.25rem 0;
  color: var(--gray-500);
}

.empty-state .sub {
  font-size: 0.875rem;
  color: var(--gray-400);
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: flex-end;
}

.admin-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: flex-start;
}

.muted {
  color: var(--gray-500);
  font-size: 0.875rem;
}
