/* Plottier CMS — identidad visual del panel (ver docs/DESIGN-ADMIN.md) */
:root {
  --teal: #056d84;
  --teal-dark: #044f60;
  --naranja: #f39302;
  --magenta: #db2a54;
  --crema: #f1ece2;
  --bg: #f5f3ee;
  --card: #ffffff;
  --borde: #e3ddd1;
  --oscuro: #0d212f;
  --texto: #0d212f;
  --texto-suave: #5b6b76;
  --ok: #2e9e6b;
  --radio: 14px;
  --sombra: 0 2px 10px rgba(13, 33, 47, 0.08);
  --sombra-fuerte: 0 8px 30px rgba(13, 33, 47, 0.18);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Nunito', system-ui, sans-serif;
  background: var(--bg);
  color: var(--texto);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--teal); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: none;
  border-radius: var(--radio);
  padding: 0.8rem 1.4rem;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, transform 0.05s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-dark); }
.btn-naranja { background: var(--naranja); color: #fff; }
.btn-naranja:hover { background: #d97f02; }
.btn-ghost { background: transparent; color: var(--texto); }
.btn-ghost:hover { background: var(--crema); }

/* ===================== LANDING ===================== */
.hero {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--teal) 0%, var(--teal-dark) 100%);
  color: #fff;
  text-align: center;
  padding: 2rem;
}
.hero-card {
  max-width: 560px;
}
.hero .escudo {
  width: 92px;
  height: 92px;
  border-radius: 24px;
  background: #fff;
  display: grid;
  place-items: center;
  margin: 0 auto 1.5rem;
  font-size: 2.6rem;
  box-shadow: var(--sombra-fuerte);
}
.hero h1 { font-size: 2.4rem; margin: 0 0 0.4rem; font-weight: 800; }
.hero .sub { font-size: 1.15rem; opacity: 0.9; margin-bottom: 2rem; }
.hero .acciones { display: flex; gap: 0.8rem; justify-content: center; flex-wrap: wrap; }
.hero .btn-primary { background: #fff; color: var(--teal-dark); }
.hero .btn-primary:hover { background: var(--crema); }
.hero .btn-ghost { color: #fff; border: 1.5px solid rgba(255, 255, 255, 0.5); }
.hero .btn-ghost:hover { background: rgba(255, 255, 255, 0.12); }
.hero .pie { margin-top: 2.5rem; font-size: 0.85rem; opacity: 0.7; }

/* ===================== ADMIN ===================== */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.login-card {
  background: var(--card);
  border-radius: var(--radio);
  box-shadow: var(--sombra-fuerte);
  padding: 2.2rem;
  width: 100%;
  max-width: 380px;
}
.login-card .marca { text-align: center; margin-bottom: 1.6rem; }
.login-card .marca .escudo {
  width: 64px; height: 64px; border-radius: 18px; background: var(--teal);
  color: #fff; display: grid; place-items: center; font-size: 1.8rem; margin: 0 auto 0.8rem;
}
.login-card h2 { margin: 0; font-size: 1.3rem; }
.login-card .marca p { margin: 0.2rem 0 0; color: var(--texto-suave); font-size: 0.9rem; }

.campo { margin-bottom: 1rem; }
.campo label { display: block; font-size: 0.85rem; font-weight: 700; margin-bottom: 0.35rem; }
.campo input {
  width: 100%; padding: 0.7rem 0.85rem; border: 1.5px solid var(--borde);
  border-radius: 10px; font-family: inherit; font-size: 1rem; background: #fff;
}
.campo input:focus { outline: none; border-color: var(--teal); }
.btn-block { width: 100%; justify-content: center; }
.error-msg {
  background: #fde4ea; color: var(--magenta); border-radius: 10px;
  padding: 0.6rem 0.85rem; font-size: 0.9rem; margin-bottom: 1rem; display: none;
}
.error-msg.show { display: block; }

/* layout dashboard */
.app { display: none; min-height: 100vh; grid-template-columns: 256px 1fr; }
.app.show { display: grid; }
.sidebar {
  background: var(--oscuro); color: #cfd8de; padding: 1.4rem 1rem; display: flex; flex-direction: column;
}
.sidebar .brand { display: flex; align-items: center; gap: 0.6rem; padding: 0 0.4rem 1.4rem; }
.sidebar .brand .escudo {
  width: 38px; height: 38px; border-radius: 11px; background: var(--teal); color: #fff;
  display: grid; place-items: center; font-weight: 800;
}
.sidebar .brand b { color: #fff; font-size: 1.05rem; line-height: 1.1; }
.nav { list-style: none; padding: 0; margin: 0.5rem 0; flex: 1; }
.nav li {
  padding: 0.65rem 0.8rem; border-radius: 10px; cursor: pointer; font-weight: 600;
  display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.15rem; color: #aebac3;
}
.nav li:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.nav li.active { background: var(--teal); color: #fff; }
.nav li .ico { width: 1.2rem; text-align: center; }

.main { padding: 1.6rem 2rem; overflow: auto; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.6rem; }
.topbar h1 { margin: 0; font-size: 1.5rem; }
.user-chip { display: flex; align-items: center; gap: 0.7rem; color: var(--texto-suave); }
.user-chip .av {
  width: 36px; height: 36px; border-radius: 50%; background: var(--crema); color: var(--teal-dark);
  display: grid; place-items: center; font-weight: 800;
}

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
.stat {
  background: var(--card); border: 1px solid var(--borde); border-radius: var(--radio);
  padding: 1.2rem; box-shadow: var(--sombra);
}
.stat .label { color: var(--texto-suave); font-size: 0.85rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; }
.stat .num { font-size: 2.2rem; font-weight: 800; margin: 0.3rem 0 0; color: var(--teal-dark); }
.stat .hint { font-size: 0.85rem; color: var(--texto-suave); margin-top: 0.2rem; }
.stat.accent .num { color: var(--naranja); }
.stat.warn .num { color: var(--magenta); }

.panel {
  background: var(--card); border: 1px solid var(--borde); border-radius: var(--radio);
  padding: 1.4rem; box-shadow: var(--sombra); margin-top: 1.6rem;
}
.panel h3 { margin: 0 0 1rem; }
.placeholder { color: var(--texto-suave); padding: 2rem; text-align: center; }
.tag { display: inline-block; padding: 0.15rem 0.5rem; border-radius: 6px; font-size: 0.75rem; font-weight: 700; }
.tag.online { background: #e3f5ec; color: var(--ok); }
.tag.off { background: var(--crema); color: var(--texto-suave); }

.area-row { padding: 0.7rem 0; border-bottom: 1px solid var(--borde); }
.area-row:last-child { border-bottom: none; }
.area-row .area-name { font-weight: 700; }
.area-row .tramite { font-size: 0.9rem; color: var(--texto-suave); padding: 0.2rem 0 0.2rem 1rem; }

/* tablas */
.tabla { width: 100%; border-collapse: collapse; }
.tabla th, .tabla td { text-align: left; padding: 0.65rem 0.6rem; border-bottom: 1px solid var(--borde); font-size: 0.92rem; }
.tabla th { color: var(--texto-suave); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; }
.tabla tr:hover td { background: #faf9f6; }
.acciones-row { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.82rem; border-radius: 9px; }

/* badges de estado */
.badge { display: inline-block; padding: 0.18rem 0.55rem; border-radius: 999px; font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.02em; }
.b-DRAFT, .b-RECEIVED { background: #e4f1f5; color: var(--teal-dark); }
.b-REVIEW, .b-IN_PROGRESS { background: #fff3df; color: #b06a00; }
.b-PUBLISHED, .b-RESOLVED { background: #e3f5ec; color: var(--ok); }
.b-ARCHIVED, .b-REJECTED { background: var(--crema); color: var(--texto-suave); }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.toolbar select { padding: 0.5rem 0.7rem; border: 1.5px solid var(--borde); border-radius: 10px; font-family: inherit; background: #fff; }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(13,33,47,0.5); display: none; place-items: center; padding: 1rem; z-index: 50; }
.modal-bg.show { display: grid; }
.modal { background: var(--card); border-radius: var(--radio); box-shadow: var(--sombra-fuerte); width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; }
.modal header { display: flex; align-items: center; justify-content: space-between; padding: 1.1rem 1.4rem; border-bottom: 1px solid var(--borde); position: sticky; top: 0; background: #fff; }
.modal header h3 { margin: 0; }
.modal .body { padding: 1.4rem; }
.modal .footer { padding: 1rem 1.4rem; border-top: 1px solid var(--borde); display: flex; justify-content: flex-end; gap: 0.6rem; position: sticky; bottom: 0; background: #fff; }
.x { background: none; border: none; font-size: 1.4rem; cursor: pointer; color: var(--texto-suave); line-height: 1; }
.campo textarea { width: 100%; padding: 0.7rem 0.85rem; border: 1.5px solid var(--borde); border-radius: 10px; font-family: inherit; font-size: 0.95rem; min-height: 140px; resize: vertical; }
.campo select { width: 100%; padding: 0.7rem 0.85rem; border: 1.5px solid var(--borde); border-radius: 10px; font-family: inherit; font-size: 1rem; background: #fff; }
.fila { display: flex; gap: 0.8rem; }
.fila .campo { flex: 1; }
.check { display: flex; align-items: center; gap: 0.5rem; }
.check input { width: auto; }
.dl { margin: 0; }
.dl dt { font-size: 0.75rem; color: var(--texto-suave); text-transform: uppercase; font-weight: 800; margin-top: 0.7rem; }
.dl dd { margin: 0.15rem 0 0; }

/* editor WYSIWYG (Quill) */
.ql-toolbar.ql-snow { border-color: var(--borde); border-top-left-radius: 10px; border-top-right-radius: 10px; }
.ql-container.ql-snow { border-color: var(--borde); border-bottom-left-radius: 10px; border-bottom-right-radius: 10px; }
.ql-editor { min-height: 180px; font-family: inherit; font-size: 0.98rem; }

/* media grid */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.9rem; }
.media-item { border: 1px solid var(--borde); border-radius: 12px; overflow: hidden; background: #fff; }
.media-item .thumb { height: 110px; background: var(--crema); display: grid; place-items: center; overflow: hidden; }
.media-item .thumb img { width: 100%; height: 100%; object-fit: cover; }
.media-item .thumb .ext { font-size: 2rem; }
.media-item .meta { padding: 0.5rem 0.6rem; font-size: 0.78rem; color: var(--texto-suave); }
.media-item .meta b { color: var(--texto); display: block; font-size: 0.82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* bottom nav (móvil, estilo app) */
.bottomnav { display: none; }

@media (max-width: 820px) {
  .app.show { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main { padding: 1.1rem 1rem 5.5rem; }
  .fila { flex-direction: column; gap: 0; }
  .bottomnav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; height: 64px;
    background: #fff; border-top: 1px solid var(--borde); box-shadow: 0 -2px 12px rgba(13,33,47,0.08);
    z-index: 40; padding-bottom: env(safe-area-inset-bottom);
  }
  .bottomnav button {
    flex: 1; background: none; border: none; font-family: inherit; cursor: pointer;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.15rem;
    color: var(--texto-suave); font-size: 0.68rem; font-weight: 700;
  }
  .bottomnav button .ico { font-size: 1.25rem; }
  .bottomnav button.active { color: var(--teal); }
}
