/* ── Variables ── */
:root {
  --brand-900: #0C2856;
  --brand-800: #123f7f;
  --brand-700: #1f5fbf;
  --brand-500: #3498DB;
  --brand-50:  #eef4fd;
  --bg: #f6f8fc;
  --bg-2: #eef2f8;
  --surface: #ffffff;
  --line: #e4e9f2;
  --line-2: #d5dcea;
  --text: #0f172a;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --ok: #10b981;
  --ok-50: #ecfdf5;
  --bad: #ef4444;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .06);
  --shadow-md: 0 6px 18px rgba(12, 40, 86, .08);
  --shadow-lg: 0 20px 48px rgba(12, 40, 86, .18);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { overflow-x: hidden; }

body {
  background:
    radial-gradient(1200px 600px at -10% -20%, rgba(52,152,219,.10), transparent 60%),
    radial-gradient(900px 500px at 110% 10%, rgba(12,40,86,.08), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  width: 100%;
  min-height: 100vh;
}

/* ── Wrapper ── */
.wrap {
  max-width: 100%;
  margin: 0;
  padding: 16px 20px 56px;
  width: 100%;
}

/* ── Topbar ── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  padding: 14px 18px;
  background: rgba(255,255,255,.7);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 12px;
  z-index: 40;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.brand-logo {
  width: 40px; height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(12, 40, 86, .1);
  background: #fff;
  object-fit: contain;
  padding: 5px;
  box-shadow: var(--shadow-sm);
}

.brand-fallback {
  width: 40px; height: 40px;
  border-radius: 12px;
  display: none;
  place-items: center;
  background: linear-gradient(135deg, var(--brand-900), var(--brand-700));
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .5px;
}

.brand-text { line-height: 1.15; }
.brand-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--brand-900);
  letter-spacing: -.2px;
}
.brand-note {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.header-text .sub {
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

/* ── Topbar actions ── */
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  justify-content: flex-end;
  min-width: 0;
}
.search-box {
  position: relative;
  flex: 1;
  max-width: 440px;
  min-width: 0;
}
.search-box .search-icon {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  opacity: .55;
  pointer-events: none;
}
.search-box input {
  padding-left: 34px;
  border-radius: 999px;
  background: rgba(255,255,255,.85);
}
.btn-new {
  padding: 10px 18px;
  font-size: 13.5px;
  border-radius: 999px;
  white-space: nowrap;
}
.btn-new .btn-plus {
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
}


/* ── Feed wrap ── */
.feed-wrap { width: 100%; }

/* ── Drawer ── */
.drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.5);
  backdrop-filter: blur(4px);
  z-index: 70;
  animation: fadeIn .2s ease;
}
.drawer-overlay.open { display: block; }

.drawer {
  position: fixed;
  top: 0; right: 0;
  width: min(480px, 100vw);
  height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: -20px 0 50px rgba(12,40,86,.18);
  z-index: 71;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .28s cubic-bezier(.2,.7,.2,1);
}
.drawer.open { transform: translateX(0); }

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}
.drawer-head h3 {
  font-size: 17px;
  font-weight: 700;
  color: var(--brand-900);
  letter-spacing: -.2px;
}
.drawer-close {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--bg-2);
  border: 0;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  display: grid; place-items: center;
  transition: background .12s, color .12s;
}
.drawer-close:hover { background: #e2e8f0; color: var(--text); }

.drawer-body {
  padding: 18px 22px;
  overflow-y: auto;
  flex: 1;
}
.drawer-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  background: #fafbfd;
}

/* ── Layout ── */
.main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  width: 100%;
}

/* ── Sidebar form ── */
.sidebar { align-self: start; min-width: 0; }

.form-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: linear-gradient(135deg, var(--brand-700), var(--brand-900));
  color: #fff;
  border: 0;
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 10px;
  box-shadow: 0 8px 20px rgba(25, 95, 191, .28);
  transition: transform .15s ease, box-shadow .15s ease;
}
.form-toggle:hover { transform: translateY(-1px); box-shadow: 0 12px 26px rgba(25, 95, 191, .32); }
.form-toggle .arrow { transition: transform .2s; font-size: 11px; opacity: .9; }
.form-toggle.open .arrow { transform: rotate(180deg); }

.form-collapse { display: none; }
.form-collapse.open { display: block; }

/* ── Card ── */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}

.card-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--muted);
  margin-bottom: 14px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.section-head h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--brand-900);
  letter-spacing: -.2px;
}

/* ── Form elements ── */
label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin: 14px 0 6px;
}
label:first-of-type { margin-top: 0; }

input, textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(52, 152, 219, .18);
}
input::placeholder, textarea::placeholder { color: var(--muted-2); }
textarea { min-height: 96px; resize: vertical; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 0;
  border-radius: var(--radius);
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.03); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: linear-gradient(135deg, var(--brand-700), var(--brand-800));
  color: #fff;
  box-shadow: 0 6px 16px rgba(25, 95, 191, .28);
}
.btn-ghost {
  background: var(--brand-50);
  color: var(--brand-900);
  border: 1px solid #dce6f5;
}
.btn-ok { background: var(--ok); color: #fff; box-shadow: 0 4px 12px rgba(16,185,129,.25); }
.btn-bad { background: var(--bad); color: #fff; box-shadow: 0 4px 12px rgba(239,68,68,.2); }
.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn-full { width: 100%; margin-top: 14px; padding: 12px; font-size: 14px; }

/* ── Filter pills ── */
.filter-pills {
  display: inline-flex;
  padding: 4px;
  background: var(--bg-2);
  border-radius: 999px;
  border: 1px solid var(--line);
}
.filter-pills .btn {
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 12px;
  box-shadow: none;
  background: transparent;
  color: var(--muted);
  border: 0;
}
.filter-pills .btn:hover { transform: none; background: rgba(255,255,255,.6); }
.filter-pills .btn.btn-primary {
  background: var(--surface);
  color: var(--brand-900);
  box-shadow: 0 2px 6px rgba(12, 40, 86, .1);
}

/* ── Feed grid ── */
.feed {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
  width: 100%;
}

.empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
  font-size: 14px;
  background: var(--surface);
  border: 1px dashed var(--line-2);
  border-radius: var(--radius-lg);
}

/* ── Post card ── */
.post {
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--surface);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow .18s ease, border-color .18s ease;
  position: relative;
  box-shadow: var(--shadow-sm);
}
.post:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--line-2);
}
.post.accepted {
  border-color: var(--ok);
  box-shadow: 0 0 0 1px var(--ok), var(--shadow-sm);
}
.post.accepted::before {
  content: "✓ Aceptada";
  position: absolute;
  top: 10px; left: 10px;
  z-index: 2;
  background: var(--ok);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 999px;
  letter-spacing: .3px;
  box-shadow: 0 4px 12px rgba(16,185,129,.35);
}

.post-img-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 5;
  background: linear-gradient(135deg, #f1f5fb, #e6edf8);
  cursor: zoom-in;
  overflow: hidden;
}
.post-img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .35s ease;
}
.post-img-wrap:hover .post-img { transform: scale(1.03); }
.post-img-zoom {
  position: absolute;
  right: 10px; bottom: 10px;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  background: rgba(15, 23, 42, .62);
  color: #fff;
  border-radius: 50%;
  font-size: 14px;
  opacity: 0;
  transition: opacity .18s ease;
  backdrop-filter: blur(4px);
}
.post-img-wrap:hover .post-img-zoom { opacity: 1; }

.post-img-placeholder {
  width: 100%;
  aspect-ratio: 4 / 5;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #e8eef8, #dce6f5);
  color: var(--brand-700);
  font-size: 12px;
  font-weight: 600;
}

.post-body {
  padding: 14px 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 0;
}
.post-title {
  font-weight: 700;
  color: var(--brand-900);
  font-size: 15px;
  line-height: 1.3;
  letter-spacing: -.1px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-desc {
  color: #334155;
  font-size: 13px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.chips {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 2px;
}
.chip {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--brand-50);
  color: var(--brand-800);
  font-weight: 500;
  border: 1px solid #dbe6f7;
}

.post-footer {
  padding: 10px 14px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  position: relative;
  border-top: 1px solid var(--line);
  margin-top: 4px;
}
.post-date {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}
.btn-info {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--brand-700);
  cursor: pointer;
  transition: all .12s;
  white-space: nowrap;
}
.btn-info:hover {
  background: var(--brand-50);
  border-color: var(--brand-500);
  color: var(--brand-800);
}

/* ── Dropdown ── */
.dropdown-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .5);
  backdrop-filter: blur(4px);
  z-index: 49;
}
.dropdown-overlay.open { display: block; }

.dropdown {
  display: none;
  position: fixed;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: min(320px, 92vw);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 50;
  padding: 10px 0;
  animation: dropIn .18s ease;
}
.dropdown.open { display: block; }

@keyframes dropIn {
  from { opacity: 0; transform: translate(-50%, -48%); }
  to   { opacity: 1; transform: translate(-50%, -50%); }
}

.dd-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  font-size: 13px;
  gap: 10px;
}
.dd-item a { color: var(--brand-700); text-decoration: none; }
.dd-item a:hover { text-decoration: underline; }

.dd-label {
  color: var(--text);
  font-weight: 600;
  text-transform: capitalize;
}
.dd-sep { height: 1px; background: var(--line); margin: 6px 14px; }
.dd-id {
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  padding: 6px 14px 2px;
}

/* ── Dropzone ── */
.dropzone {
  border: 2px dashed var(--line-2);
  border-radius: var(--radius);
  padding: 28px 14px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  background: #fafcff;
}
.dropzone:hover, .dropzone.drag-over {
  border-color: var(--brand-500);
  background: rgba(52, 152, 219, .06);
}
.drop-text { font-size: 12px; color: var(--muted); font-weight: 500; }
.drop-preview {
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  border-radius: 8px;
}
.dropzone.uploading { opacity: .6; pointer-events: none; }

/* ── Lightbox ── */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(5, 10, 22, .88);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  cursor: zoom-out;
  animation: fadeIn .2s ease;
}
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 24px 60px rgba(0,0,0,.5);
}
.lightbox-close {
  position: absolute;
  top: 18px; right: 18px;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,.12);
  color: #fff;
  border: 1px solid rgba(255,255,255,.22);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background .15s;
}
.lightbox-close:hover { background: rgba(255,255,255,.22); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ════════════════════════════════════════════════════
   RESPONSIVE — Tablet (≥640px)
   ════════════════════════════════════════════════════ */
@media (min-width: 640px) {
  .wrap { padding: 22px 22px 56px; }
  .feed { gap: 22px; }
  .header-text .sub { font-size: 13px; }
}

/* ════════════════════════════════════════════════════
   RESPONSIVE — Desktop (≥1100px)
   ════════════════════════════════════════════════════ */
@media (min-width: 1100px) {
  .wrap { padding: 18px 28px 64px; }
  .feed { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 22px; }
}

/* ════════════════════════════════════════════════════
   RESPONSIVE — Tablet (≤860px)
   ════════════════════════════════════════════════════ */
@media (max-width: 860px) {
  .topbar {
    flex-wrap: wrap;
    gap: 10px;
  }
  .topbar-actions { width: 100%; }
  .search-box { max-width: none; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ════════════════════════════════════════════════════
   RESPONSIVE — Small phones (≤480px)
   ════════════════════════════════════════════════════ */
@media (max-width: 480px) {
  .wrap { padding: 12px 12px 40px; }
  .topbar { padding: 12px 14px; border-radius: 18px; }
  .feed { grid-template-columns: 1fr; gap: 14px; }
  .brand-name { font-size: 14px; }
  .btn-new { padding: 9px 14px; font-size: 13px; }
  .stat-value { font-size: 22px; }
  .filter-pills { width: 100%; overflow-x: auto; }
  .section-head { flex-wrap: wrap; }
}

/* Loading state */
.btn[disabled]{ opacity:.7; cursor:not-allowed; transform:none; filter:none; }
.btn.is-loading::before{
  content:''; width:12px; height:12px;
  border:2px solid rgba(255,255,255,.45);
  border-top-color:#fff;
  border-radius:50%;
  display:inline-block;
  margin-right:6px;
  animation: spin .75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Edit modal */
.ay-modal { position:fixed; inset:0; z-index:80; animation: fadeIn .2s ease; }
.ay-modal-backdrop { position:absolute; inset:0; background:rgba(15,23,42,.55); backdrop-filter: blur(4px); }
.ay-modal-card {
  position:relative;
  max-width:640px; width:92vw;
  margin: 8vh auto 0;
  background:#fff;
  border-radius: var(--radius-lg);
  padding: 22px;
  border:1px solid var(--line);
  box-shadow: var(--shadow-lg);
  display:grid;
  gap:8px;
}
.ay-modal-card h3 {
  margin:0 0 6px;
  color:var(--brand-900);
  font-size:18px;
  font-weight:700;
  letter-spacing:-.2px;
}
.ay-modal-actions { display:flex; justify-content:flex-end; gap:10px; margin-top:14px; }
